Old 16th April 2008, 10:37   #121
grobigou
Junior Member
 
Join Date: Nov 2007
Posts: 3
Hello

I don't if you also have the same problem, but with the version 3.4 of the registry plugin, the program I have made does not work anymore. It's craching every time I try to launch it.
If I put the version 3.3 of the plugin back, my program works fine.
Does anyone have the same issue ?

Antoine.
grobigou is offline   Reply With Quote
Old 16th April 2008, 13:27   #122
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
What code cause crashing?
Instructor is offline   Reply With Quote
Old 17th April 2008, 09:21   #123
grobigou
Junior Member
 
Join Date: Nov 2007
Posts: 3
Hello !

Here is the code.
It is like a cleaner for the registry
It is looking for some value and delete them.

; Un nettoyeur de Registre pour la HLU
; C'est le BON
; 4 itérations pour Safenet, une seule pour les autres
; V1.0 : safenet, ireike, cosine, ipsecdrv et ipsecmon
; V1.1 : safenet, ireike, cosine, ipsecdrv, ipsecmon et ipsec dial client
; V1.2 : Av ec le nouvel environnement
;--------------------------------

; Ne fonctionne pas avec la V3.4 de Registry
; Donc c'est la v3.3 qu'il faut mettre pour le moment

!include "UMUI.nsh"
!include "Registry.nsh"
!include "Sections.nsh"
VAR Reg
VAR Chemin
VAR Motclef
VAR Iteration
VAR Go

XPStyle on

; The name of the installer
Name "Registry Cleaner v1.2"

; The file to write
OutFile "Registry.Cleaner.v1.2.exe"
BrandingText "NSIS - Créé par Antoine SOUBIGOU"

;--------------------------------
; Show details
ShowInstDetails show

;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
; !define MUI_HEADERIMAGE
;!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp" ; optional


;--------------------------------
;--------------------------------
;--------------------------------
; Pages
;--------------------------------
;--------------------------------
;--------------------------------

; D:\Program Files\NSIS\Contrib\Modern UI\ioSpecial.ini
; Fichier modifié pour voir tout le titre
; ligne 1235 pour espacer les lignes

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH


;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "French"
; !insertmacro MUI_LANGUAGE "English"

;--------------------------------
;--------------------------------
; Installation de drivers cartes 3G
;--------------------------------
;--------------------------------

Section "Suppression des répertoires" Info1

; Cette option permet de griser une case pour obliger l'installation
SectionIn RO
ReadRegStr $9 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\" "ProgramFilesDir"
DetailPrint "Suppression des répertoires sous $9"
RMDir /r "$9\Cosine Communication"
RMDir /r "$9\Safenet"

SectionEnd

Section "Recherche des mots clef dans le Registre" Info2

StrCpy $Go "1"
; Cette option permet de griser une case pour obliger l'installation
SectionIn RO

GetTempFileName $R0
FileOpen $R1 $R0 w

; On Commencera avec le mot Safenet
StrCpy $Motclef "safenet"
; On fera la vérification sur Safenet QUATRE fois ! ... On l'initialise Ã_ 1
StrCpy $Iteration "1"

Depart:
FileWrite $R1 'Liste des clés de registre incluant la chaîne $Motclef$\r$\n'
; Si on est sur safenet, Alors on a une chaine de caractères différente
StrCmp $Motclef "safenet" +1 +3
DetailPrint "Lancement du nettoyage de $Motclef dans la base de Registre..... Itération $Iteration sur 4....."
Goto Suite
DetailPrint "Lancement du nettoyage de $Motclef dans la base de Registre....."

Suite:
FileWrite $R1 '$\r$\nHKEY_CLASSES_ROOT$\r$\n$\r$\n'
StrCpy $Chemin "HKCR"
StrCpy $Reg "1"
${registry::Open} "HKEY_CLASSES_ROOT" "/K=1 /V=1 /S=1 /B=1 /NI='$Motclef'" $0
; Si c'est bon, on commence la loop, sinon on arrete tout
StrCmp $0 0 +1 loop
MessageBox MB_OK "Error" IDOK close

Coin2:
FileWrite $R1 '$\r$\nHKEY_CURRENT_USER$\r$\n$\r$\n'
StrCpy $Chemin "HKCU"
StrCpy $Reg "2"
${registry::Open} "HKEY_CURRENT_USER" "/K=1 /V=1 /S=1 /B=1 /NI='$Motclef'" $0
StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close

Coin3:
FileWrite $R1 '$\r$\nHKEY_LOCAL_MACHINE$\r$\n$\r$\n'
StrCpy $Chemin "HKLM"
StrCpy $Reg "3"
${registry::Open} "HKEY_LOCAL_MACHINE" "/K=1 /V=1 /S=1 /B=1 /NI='$Motclef'" $0
StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close

Coin4:
FileWrite $R1 '$\r$\nHKEY_USERS$\r$\n$\r$\n'
StrCpy $Chemin "HKU"
StrCpy $Reg "4"
${registry::Open} "HKEY_USERS" "/K=1 /V=1 /S=1 /B=1 /NI='$Motclef'" $0
StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close

Coin5:
FileWrite $R1 '$\r$\nHKEY_CURRENT_CONFIG$\r$\n$\r$\n'
StrCpy $Chemin "HKCC"
StrCpy $Reg "5"
${registry::Open} "HKEY_CURRENT_CONFIG" "/K=1 /V=1 /S=1 /B=1 /NI='$Motclef'" $0
StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close

loop:
${registry::Find} "$0" $1 $2 $3 $4
StrCmp $4 '' check
StrCmp $Chemin 'HKCR' HKCRloop +1
StrCmp $Chemin 'HKCU' HKCUloop +1
StrCmp $Chemin 'HKLM' HKLMloop +1
StrCmp $Chemin 'HKU' HKUloop +1
StrCmp $Chemin 'HKCC' HKCCloop

HKCRloop:
StrCmp $4 'REG_KEY' 0 Value1
StrCmp $Go "0" +4
DeleteRegKey HKCR "$1\$2"
DetailPrint "Key HKCR\$1\$2 detected"
FileWrite $R1 'Delete Key : "$Chemin - $1\$2" $\r$\n'
goto loop
Value1:
StrCmp $Go "0" +4
DeleteRegValue HKCR "$1" "$2"
DetailPrint "Value HKCR\$1 '$2' detected"
FileWrite $R1 'Delete Value. Chemin : "$Chemin\$1" et la valeur : "$2" $\r$\n'
goto loop

HKCUloop:
StrCmp $4 'REG_KEY' 0 Value2
StrCmp $Go "0" +4
DeleteRegKey HKCU "$1\$2"
DetailPrint "Key HKCU\$1\$2 detected"
FileWrite $R1 'Delete Key : "$Chemin - $1\$2" $\r$\n'
goto loop
Value2:
StrCmp $Go "0" +4
DeleteRegValue HKCU "$1" "$2"
DetailPrint "Value HKCU\$1 '$2' detected"
FileWrite $R1 'Delete Value. Chemin : "$Chemin\$1" et la valeur : "$2" $\r$\n'
goto loop

HKLMloop:
StrCmp $4 'REG_KEY' 0 Value3
StrCmp $Go "0" +4
DeleteRegKey HKLM "$1\$2"
DetailPrint "Key HKLM\$1\$2 detected"
FileWrite $R1 'Delete Key : "$Chemin - $1\$2" $\r$\n'
goto loop
Value3:
StrCmp $Go "0" +4
DeleteRegValue HKLM "$1" "$2"
DetailPrint "Value HKLM\$1 '$2' detected"
FileWrite $R1 'Delete Value. Chemin : "$Chemin\$1" et la valeur : "$2" $\r$\n'
goto loop

HKUloop:
StrCmp $4 'REG_KEY' 0 Value4
StrCmp $Go "0" +4
DeleteRegKey HKU "$1\$2"
DetailPrint "Key HKU\$1\$2 detected"
FileWrite $R1 'Delete Key : "$Chemin - $1\$2" $\r$\n'
goto loop
Value4:
StrCmp $Go "0" +4
DeleteRegValue HKU "$1" "$2"
DetailPrint "Value HKU\$1 '$2' detected"
FileWrite $R1 'Delete Value. Chemin : "$Chemin\$1" et la valeur : "$2" $\r$\n'
goto loop

HKCCloop:
StrCmp $4 'REG_KEY' 0 Value5
StrCmp $Go "0" +4
DeleteRegKey HKCC "$1\$2"
DetailPrint "Key HKCC\$1\$2 detected"
FileWrite $R1 'Delete Key : "$Chemin - $1\$2" $\r$\n'
goto loop
Value5:
StrCmp $Go "0" +4
DeleteRegValue HKCC "$1" "$2"
DetailPrint "Value HKCC\$1 '$2' detected"
FileWrite $R1 'Delete Value. Chemin : "$Chemin\$1" et la valeur : "$2" $\r$\n'
goto loop

Check:
StrCmp $Reg "1" +5
StrCmp $Reg "2" +5
StrCmp $Reg "3" +5
StrCmp $Reg "4" +5
StrCmp $Reg "5" check2
goto Coin2
goto Coin3
goto Coin4
goto Coin5

Check2:
StrCmp $Motclef "safenet" Safenetiteration
StrCmp $Motclef "ireike" Ireikechange
StrCmp $Motclef "cosine" Cosinechange
StrCmp $Motclef "ipsecdrv" Ipsecdrvchange
StrCmp $Motclef "ipsecmon" Ipsecmonchange
StrCmp $Motclef "ipsec dial client" Iteration
Safenetiteration:
StrCmp $Iteration "2" Iteration
StrCmp $Iteration "3" Iteration
StrCmp $Iteration "4" close
StrCpy $Motclef "ireike"
Goto Depart
Ireikechange:
StrCpy $Motclef "cosine"
Goto Depart
Cosinechange:
StrCpy $Motclef "ipsecdrv"
Goto Depart
Ipsecdrvchange:
StrCpy $Motclef "ipsecmon"
Goto Depart
Ipsecmonchange:
StrCpy $Motclef "ipsec dial client"
Goto Depart
Iteration:
IntOp $Iteration $Iteration + 1
StrCpy $Motclef "safenet"
Goto Depart

close:
${registry::Close} "$0"
${registry::Unload}

FileClose $R1
DetailPrint "Le fichier de LOG se trouve Ã_ $R0"

;Exec '"notepad.exe" "$R0"'

MessageBox MB_YESNO "Pour finaliser le nettoyage, voulez vous redémarrer votre Ordinateur ?\
$\n$\nSi OUI, fermer toutes vos applications et cliquez sur OUI .\
$\nSi NON, vous pourrez redémarrer votre ordinateur manuellement"\
IDNO Fin IDYES Redemarre
Redemarre:
Reboot
Fin:
SectionEnd


;Descriptions
;Language strings
LangString DESC_Info1 ${LANG_FRENCH} "Cette section supprime les répertoires 'SafeNet' et 'Cosine Communication' du répertoire 'Program Files'"
; LangString DESC_efface ${LANG_ENGLISH} "This mandatory section erase all the mobile card drivers saved under the temp folder"
LangString DESC_Info2 ${LANG_FRENCH} "Cette section supprime, de la base de registre, toutes clefs ou valeurs comprenant les mots Safenet, ipsecdrv, ipsecmon, cosine et ireike"
; LangString DESC_copie ${LANG_ENGLISH} "This mandatory section save all the mobile card drivers under a temp folder"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Info1} $(DESC_Info1)
!insertmacro MUI_DESCRIPTION_TEXT ${Info2} $(DESC_Info2)
!insertmacro MUI_FUNCTION_DESCRIPTION_END


Function .onInit
Call admin
MessageBox MB_YESNO "Vous êtes sur le point de lancer un nettoyage de votre base de registre. $\nVeuillez SVP vous assurer que tout kit de connexion et SafeNet sont effectivement fermés ou désinstallés\
$\n$\nYou are about to clean you registry data base. $\nPlease ensure that any connection kit or SafeNet is completely closed or uninstalled" IDYES gogogo
Abort
gogogo:
FunctionEnd

; Une fonction Admin pour empecher l'installation en Single User
Function admin
ClearErrors
UserInfo::GetName
ifErrors Win9x
Pop $0
UserInfo::GetAccountType
Pop $1
UserInfo::GetOriginalAccountType
Pop $2
StrCmp $1 "Admin" 0 +3
Goto done
StrCmp $1 "User" 0 +3
MessageBox MB_OK 'Administrator Rights requiered'
Abort
StrCmp $1 "Guest" 0 +3
MessageBox MB_OK 'Administrator Rights requiered'
Abort
MessageBox MB_OK "Unknown error"
Abort

Win9x:
MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
done:
FunctionEnd

I hope it can help you !

Antoine.
grobigou is offline   Reply With Quote
Old 17th April 2008, 20:36   #124
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Fixed: search with /NI option.


"Registry" plugin v3.5
Attached Files
File Type: zip registry.zip (93.4 KB, 559 views)
Instructor is offline   Reply With Quote
Old 5th May 2008, 20:07   #125
rixor
Junior Member
 
Join Date: Mar 2008
Posts: 17
Hello Instructor,

Forgive me if this was answered somewhere, but I never saw it explicitly detailed in this thread: Does your plugin work for the Unicode branch of NSIS (after converting the NSH to Unicode format)?

The reason I ask is because I am having trouble using the CopyValue function. It doesn't seem to be working, and when I check the error code with a message box (just like you do in the example), I get a square instead of a number (check the attachment).

The lines that use the function are as follows:

${registry::CopyValue} "HKEY_LOCAL_MACHINE\SOFTWARE\Texas Instruments\CCS_C:|CCStudio_v3.3|" "CC_APP" "HKEY_LOCAL_MACHINE\SOFTWARE\FireSync5\CCS_Backup\CCS_C:|CCStudio_v3.3|" "CC_APP" $R0
MessageBox MB_OK "registry::CopyValue$\n$\n\
Errorlevel: [$R0]"
Attached Images
File Type: jpg error.jpg (5.1 KB, 453 views)
rixor is offline   Reply With Quote
Old 28th June 2008, 01:22   #126
mrdamm
Junior Member
 
Join Date: Jun 2008
Posts: 2
WriteRegMultiStr

Hello folks.

Can anyone explain how to use WriteRegMultiStr to write a registry value of data type REG_MULTI_SZ?

For example, I have these registry entries taken from a .REG file. How can I use the values using WriteRegMultiStr?

Quote:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\pt-BR]
"en-US"=hex(7):00,00,00,00
mrdamm is offline   Reply With Quote
Old 30th June 2008, 05:46   #127
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
mrdamm
code:
${registry::Write} "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\pt-BR" "en-US" "" "REG_MULTI_SZ" $0
Instructor is offline   Reply With Quote
Old 1st July 2008, 18:34   #128
vc6
Junior Member
 
Join Date: Feb 2007
Posts: 48
Question ${registry::SaveKey} /D=2

The documentation for Registry Export (save to the file in REGEDIT4 format) includes:
Quote:

/D=[0|1|2]
/D=0 - Don't delete any keys (default)
/D=1 - Delete only root key before restoring
/D=2 - Delete keys before restoring
I understand option /D=0 in the context of ${registry::SaveKey}, but what does /D=2 mean in this context?

AFAIK ${registry::SaveKey} does not have any restore side effect, so what does "Delete keys before restoring" mean?

Thanks,
Victor

P.S. BTW, ${registry::RestoreKey} doesn't work for me for some reason.
ExecWait 'regedit /s "$INSTDIR\${regedit4file}"' works very well.

Last edited by vc6; 1st July 2008 at 20:07.
vc6 is offline   Reply With Quote
Old 9th July 2008, 22:56   #129
mrdamm
Junior Member
 
Join Date: Jun 2008
Posts: 2
Unhappy REG_MULTI_SZ

Quote:
Originally posted by Instructor
code:
${registry::Write} "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\pt-BR" "en-US" "" "REG_MULTI_SZ" $0
Hey, wait. Am I doing something wrong or what? I tried to compile the program with MakeNSISW and it stops compiling when the compiler reaches the code provided by you.
In fact, all codes that I use in the script, regarded to registry entries are like the following:

code:
WriteRegDWORD HKEY_LOCAL_MACHINE SYSTEM\CurrentControlSet\Control\MUI\UILanguages\pt-BR LCID 1046
WriteRegStr HKEY_LOCAL_MACHINE SYSTEM\CurrentControlSet\Control\MUI\UILanguages\pt-BR DefaultFallback en-US
WriteRegDWORD HKEY_LOCAL_MACHINE SYSTEM\CurrentControlSet\Control\MUI\UILanguages\pt-BR Type 274
WriteRegStr HKLM "${REGKEY}\Components" "Registry Section" 1



Any clues?
mrdamm is offline   Reply With Quote
Old 29th August 2008, 18:41   #130
ovatsus
Junior Member
 
Join Date: Apr 2007
Posts: 14
Unfortunately the plugin doesn't work correctly when reading REG_MULTI_SZ values on 64-bit. It always goes to the Wow6432 node, even after SetRegView 64. Can you please help?

Best Regards,
Gustavo Guerra
ovatsus is offline   Reply With Quote
Old 12th November 2008, 10:58   #131
mtconleyuk
Junior Member
 
Join Date: Nov 2005
Posts: 38
You might consider adding a

!ifndef REGISTRY_LIB
[...]
!endif ; REGISTRY_LIB

around the contents of registry.nsh to allow scripts to include it more than once (e.g., in two different .nsi files, one of which is included in the other). See LogicLib.nsh for an example.

Otherwise, great library!
mtconleyuk is offline   Reply With Quote
Old 12th November 2008, 11:01   #132
mtconleyuk
Junior Member
 
Join Date: Nov 2005
Posts: 38
... Obviously, there has to be a !define REGISTRY_LIB in there, too.
mtconleyuk is offline   Reply With Quote
Old 15th January 2009, 16:45   #133
groove1963
Junior Member
 
Join Date: Jan 2009
Posts: 6
Hi,

I have a strange problem with a "registry::find" in an installer which at the moment only seems to occur when the installer is used on an iMac (running Windows XP).

The "registry::find" is using 100% CPU, memory consumption is going up to 1 GB, then back down to about 15 MB, but the call never returns to the main code.

The parameters of the failing call to "registry::find" are:
  • 2190896
  • SOFTWARE\Microsoft\Cryptography\Defaults\Provider Types\Type 024 Name microsoft enhanced rsa and aes cryptographic provider (prototype)
  • REG_SZ

Here is the code fragment using the registry find (it is scanning the registry for USB 2.0 high speed controllers):
code:

${registry::Open} "HKEY_LOCAL_MACHINE" "/K=0 /V=1 /S=1 /NI='enhanced' /T=REG_SZ" $0
${registry::Find} $0 $1 $2 $3 $4
${While} $4 != ""
${StrCase} $3 "$3" "L"
${StrLoc} $5 $3 "controller" ">"
${If} $5 != ""
${StrLoc} $5 $3 "usb" ">"
${If} $5 != ""
StrCpy $UsbEnhancedController $3
${ExitWhile}
${EndIf}
${EndIf}
${registry::Find} $0 $1 $2 $3 $4
${EndWhile}

${registry::Close} $0
${registry::Unload}



Any suggestions?

- Chris
groove1963 is offline   Reply With Quote
Old 16th January 2009, 13:24   #134
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
groove1963
Try "RegistryTest.nsi" and "Search and write founded in text file" with "HKEY_LOCAL_MACHINE". It may help to find where is the problem.
Instructor is offline   Reply With Quote
Old 6th February 2009, 13:18   #135
mguenette
Junior Member
 
Join Date: Feb 2009
Posts: 3
I have a situation where I have to read and write a binary registry value a more than 1024 caracters.
Is there a way to do this???
Please.

Thanks.

The plugin is great by the way!
mguenette is offline   Reply With Quote
Old 6th February 2009, 14:04   #136
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,888
If the plugin is coded correctly, you could use the large nsis string build ( http://nsis.sourceforge.net/Special_Builds ) if not, you might have to use some external tool, regedit.exe or reg.exe or something custom.

NOTE: you are NOT really supposed to store large things in the registry ( > 1024b )

from MSDN:
"Generally, data consisting of more than one or two kilobytes (K) should be stored as a file and referred to by using a key in the registry rather than being stored as a value. Instead of duplicating large pieces of data in the registry, an application should save the data as a file and refer to the file. Executable binary code should never be stored in the registry."

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 6th February 2009, 14:24   #137
mguenette
Junior Member
 
Join Date: Feb 2009
Posts: 3
I Know I'm not supposed to do that, but a software that we use does that and I'm want to implement an automation to configure that application.

Any other ideas???
mguenette is offline   Reply With Quote
Old 6th February 2009, 14:36   #138
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,888
I already said, try the large string build, if the plugin can't handle that, you must use a external tool

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 6th February 2009, 14:43   #139
mguenette
Junior Member
 
Join Date: Feb 2009
Posts: 3
Guess I will be using an external tool then.
mguenette is offline   Reply With Quote
Old 7th February 2009, 13:23   #140
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,888
so you tested, and the large string build does not work? if so, its a bug in the registry plugin...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 8th February 2009, 13:07   #141
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
mguenette
See ${registry::ReadExtra} and ${registry::WriteExtra}.
Instructor is offline   Reply With Quote
Old 8th February 2009, 16:01   #142
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
I am trying to build the registry plugin (v3.5) using VC2005 on XP and I get the following link errors:
Quote:
Creating library .\Release/registry.lib and object .\Release/registry.exp
registry.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function _xitoaA
registry.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function _xitoaA
registry.obj : error LNK2019: unresolved external symbol _memset referenced in function _xitoaA
registry.obj : error LNK2019: unresolved external symbol _memcpy referenced in function __WriteExtra
If I change the default project setting (as came with the plugin) to *not* ignore all default libraries (i.e. remove /NODEFAULTLIB), then it builds OK.

However, it seems to me that removing /NODEFAULTLIB will create problems down the road (see http://forums.winamp.com/showthread.php?threadid=302413 ).

What is the proper way to build Registry Plugin v3.5? What am I missing?

Thanks!
nsnb is offline   Reply With Quote
Old 8th February 2009, 16:05   #143
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,888
The post you are already linking to tells you what to do:

"So I manually defined the entry point and disabled "Buffer Security Check" (/GS-)."

"Got rid of the last errors by setting "Basic Runtime Checks" to "Default" in the project properties."

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 8th February 2009, 16:29   #144
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Quote:
Originally posted by Anders
The post you are already linking to tells you what to do:

"So I manually defined the entry point and disabled "Buffer Security Check" (/GS-)."

"Got rid of the last errors by setting "Basic Runtime Checks" to "Default" in the project properties."
Sorry, I failed to mention that I already verified that "Basic Runtime Checks" is set to "Default".

With "Buffer Security Check" disabled (/GS-), I still receive the following errors (yes, DllMain is set as the entry point):
Quote:
registry.obj : error LNK2019: unresolved external symbol _memset referenced in function _xitoaA
registry.obj : error LNK2019: unresolved external symbol _memcpy referenced in function __WriteExtra
Other ideas?

Thanks!
nsnb is offline   Reply With Quote
Old 8th February 2009, 20:03   #145
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Quote:
Originally posted by nsnb

With "Buffer Security Check" disabled (/GS-), I still receive the following errors (yes, DllMain is set as the entry point):

Other ideas?
I solved the problem.

I simply downloaded the NSIS source code and copied memset.c and memcpy.c from the SCons\Config directory. The plugin now builds perfectly. I can now proceed to modifying it.
nsnb is offline   Reply With Quote
Old 9th February 2009, 09:54   #146
Niko49
Junior Member
 
Join Date: Feb 2009
Posts: 2
Hello everybody,

I tested the plugin's with WIN CE 5.0.

It can read and open key register but not write.

Has you seen this problem on this OS?
Niko49 is offline   Reply With Quote
Old 10th February 2009, 18:31   #147
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Quote:
Originally posted by Niko49
I tested the plugin's with WIN CE 5.0.

It can read and open key register but not write.

Has you seen this problem on this OS?
I haven't tried NSIS on WinCE but you may want to look at the numerous #ifdef POCKETPC in registry.c - some code is compiled conditionally and registry::RestoreKey, for example, is disabled for POCKETPC.

BTW, I have added one function to the plugin, named registry::SaveValue. You can find it in the following thread:

http://forums.winamp.com/showthread....04#post2484404

It would be nice if Instructor could add it officially to his plugin.
nsnb is offline   Reply With Quote
Old 12th February 2009, 11:24   #148
Niko49
Junior Member
 
Join Date: Feb 2009
Posts: 2
I use "Registry NSIS plugin v3.5 for Pocket PC"

Yes please Instructor, add it officially to his plugin!!!!

I prefer use the plugin official.

Thank you a lot!
Niko49 is offline   Reply With Quote
Old 3rd March 2009, 18:09   #149
groove1963
Junior Member
 
Join Date: Jan 2009
Posts: 6
Quote:
Originally posted by Instructor
groove1963
Try "RegistryTest.nsi" and "Search and write founded in text file" with "HKEY_LOCAL_MACHINE". It may help to find where is the problem.
Finally found time for some more testing, I was able to narrow down the problem (tested with latest versiion of the NSIS registry plugin).

This is my test program - scans the HKLM path for entries containing the string "enhanced":

code:

!include Library.nsh
!include "Registry.nsh"

Name "MyRegistryTest"
OutFile "MyRegistryTest.exe"
InstallDir $PROGRAMFILES\MyRegistryTest

RequestExecutionLevel admin
AllowRootDirInstall false

ShowInstDetails show

Section MySection

${registry::Open} "HKEY_LOCAL_MACHINE" "/B=1 /K=0 /V=1 /S=1 /NI='enhanced' /T=REG_SZ" $0

StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close

loop:
${registry::Find} "$0" $1 $2 $3 $4

StrCmp $4 '' close
DetailPrint "$1 $2 $3 $4"
goto loop

close:
${registry::Close} "$0"
${registry::Unload}

SectionEnd



Works fine on my development machine and on a couple of other machines.

If I add the key below to the registry (taken from the registry of a machine where my installer gets stuck), then registry::Find will go to an infinite internal loop using 100% CPU:

code:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{6994AD04-93EF-11D0-A3CC-00A0C9223196}]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{6994AD04-93EF-11D0-A3CC-00A0C9223196}\##?#HDAUDIO#FUNC_01&VEN_10EC&DEV_0885&SUBSYS_106B3E00&REV_1001#4&1D21CA73&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\#DigitalInputWave\Device Parameters\Mixer\0\Controls\0]
"Control Type"=dword:70010001
"Multiple Items"=dword:00000001
"Item0"=dword:00000001



I suspect that it is the length or depth of the registry path, because if I shorten some parts of the registry entry, the registry::Find works again.

(test program and registry file attached as a zip file)

Any suggestions?

Best regards
Chris
Attached Files
File Type: zip error.zip (996 Bytes, 310 views)
groove1963 is offline   Reply With Quote
Old 4th March 2009, 07:10   #150
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Added: ${SaveKey} "/N=[name]" option to save only specified value.

Fixed: processing 260 characters path.


"Registry" plugin v3.6
Attached Files
File Type: zip registry.zip (93.8 KB, 407 views)
Instructor is offline   Reply With Quote
Old 9th March 2009, 04:47   #151
groove1963
Junior Member
 
Join Date: Jan 2009
Posts: 6
Hello "Instructor",

I just tested the 3.6 version you posted a couple of days ago.

Quote:
Fixed: processing 260 characters path.
"Registry" plugin v3.6
Unfortunately, the problem described in my posting is not fixed - although the errors are now a bit different:

When I now search with the example code and registry entry posted above, I get an access violation "... encountered a problem and needs to close", error description is:

code:
AppName: myregistrytest.exe AppVer: 0.0.0.0 ModName: user32.dll
ModVer: 5.1.2600.5512 Offset: 00008d4e



By the way, when testing this, I made one test run with /N instead of /NI to make a case sensitive search. In this test run, the code did not crash but now again got stuck in the infinite loop on the long registry key described above.

Any suggestions?

Regards
Chris

Last edited by groove1963; 9th March 2009 at 05:26.
groove1963 is offline   Reply With Quote
Old 9th March 2009, 18:18   #152
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
groove1963
Problem isn't reproduced.
Instructor is offline   Reply With Quote
Old 17th March 2009, 09:18   #153
groove1963
Junior Member
 
Join Date: Jan 2009
Posts: 6
Quote:
Problem isn't reproduced
Well, the test program I posted which does nothing except the registry search crashes when I build it with the 3.6 version. When build with the 3.5 version it gets stuck in an infinite loop as described before when, so there seems to be some problem related to the registry plugin.

Can you give me any hint how I could help to narrow down the problem if you cannot reproduce it?

Regards
Chris
groove1963 is offline   Reply With Quote
Old 23rd March 2009, 07:28   #154
groove1963
Junior Member
 
Join Date: Jan 2009
Posts: 6
Did some more testing today, same behaviour with the 3.6 DLL after upgrading to NSIS 2.44 (I was using 2.37 before):
  • Access violation with the /NI search
  • Infinite loop on the {6994AD04-93EF-11D0-A3CC-00A0C9223196} registry key quoted above with the /N or /NS search

Then I did another test with the large string build of NSIS 2.44, same behaviour, no difference.

Then I coded a test scan of HKLM without using the search option:

code:

${registry::Open} "HKEY_LOCAL_MACHINE" "/B=1 /T=REG_SZ" $0

StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close

loop:
${registry::Find} "$0" $1 $2 $3 $4
StrCmp $4 '' close
goto loop

close:
${registry::Close} "$0"
${registry::Unload}



This got stuck again in an infinite loop on the {6994AD04-93EF-11D0-A3CC-00A0C9223196} registry key (like the /N or /NS searches).

I have downloaded the 3.6 version another time to make sure I was really using the right version, same results.

Unfortunately no version is visible in the DLL attributes and the 3.5 and 3.6 versions DLL size is 16.384. However the source comment in the header of the registry.c file included in the 3.6 version says "v3.4" ...

Any suggestions? If I don't find a solution for this quickly, I'll have to hand-code a plugin to search for this specific registry string

Regards
Chris
groove1963 is offline   Reply With Quote
Old 23rd March 2009, 11:21   #155
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
See "registry.zip\Desktop\Readme.txt" version it must be 3.6.
Instructor is offline   Reply With Quote
Old 23rd March 2009, 12:54   #156
groove1963
Junior Member
 
Join Date: Jan 2009
Posts: 6
Quote:
See "registry.zip\Desktop\Readme.txt" version it must be 3.6.
OK, just checked this, the text in the readme.txt was 3.4.

I checked the download date of the file, was after the 3.6 fix, so I cleared the browser cache, re-downloaded the 3.6 version, now the readme.txt is 3.6 ...

... and the bug is fixed! Thanks a lot!

Best regards
Chris
groove1963 is offline   Reply With Quote
Old 8th September 2009, 18:23   #157
RajaW
Junior Member
 
Join Date: Sep 2009
Location: Atlanta, GA
Posts: 1
Send a message via AIM to RajaW Send a message via Yahoo to RajaW
Windows 7 - registry read not working on Uninstall section

Thank you for writing this plugin. I have found it very useful. I seem so have found a small bug. The registry::Read function does not appear to work on Windows 7 (RTM) for GUID keys under the Uninstall section.

Example:

code:

${registry::Read} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B7643B11-A60E-4A33-A465-263FEB32113A}" "UninstallString" $R0 $R1
MessageBox MB_OK 'registry::Read$\n$\n\
$$R0 "string" =[$R0]$\n\
$$R1 "type" =[$R1]$\n'



I used the code from your example provided. The above code does work properly on Windows Server 2003. The above code pulls blank values on Windows 7. The data retrieved on Windows Server 2003 is:

string = MsiExec.exe /X{B7643B11-A60E-4A33-A465-263FEB32113A}
type = REG_EXPAND_SZ

I hope this helps.

Kind regards,
-=Raj=-
RajaW is offline   Reply With Quote
Old 14th September 2009, 22:40   #158
glab
Junior Member
 
Join Date: Sep 2009
Posts: 1
I also have an issue with Windows 7 (64 bit).

The following operation results in an unsuccessful open.

code:

;Open registry for search
${registry::Open} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData" "/K=0 /V=0 /S=1 /N='Application X' /T=REG_SZ" $0

;If open successful, find the entry we are interested in.
StrCmp $0 0 0 find

;If open unsuccessful, abort with error
Goto error



Through RegEdit I have checked the registry entry I am attempting to open and confirmed its existence. The issue only appears with the 64 bit version of windows 7, this works for the 32 bit version of Windows 7.

Having 'Application X' installed under C:\Program Files\ instead of C:\Program Files (x86)\ doesn't solve the problem in opening its registry entry.

Thoughts?

Thanks and regards.
glab is offline   Reply With Quote
Old 26th October 2009, 11:28   #159
ChocJunkie
Senior Member
 
Join Date: Oct 2009
Location: Germany
Posts: 120
Hi

I'm kind of struggeling using the RestoreKey functionality. I'm using:
code:
${registry::RestoreKey} "$PLUGINSDIR\myReg.reg" $0
The variable $0 contains '0' after the execution, but the registry key doesn't show up in the registry editor.
If I'm executing the file by hand, the registry value shows up.

Any ideas?

Thanks

CJ
ChocJunkie is offline   Reply With Quote
Old 26th October 2009, 14:47   #160
Brewster333
Junior Member
 
Join Date: Jul 2008
Location: Ivanovo, Russia
Posts: 16
Hello! I need to delete keys from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB key. Standard NSIS function can't do this. May be this plugin helps me?
Brewster333 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Tags
plug-in, registry

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump