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.
Registry plugin
229 posts
What code cause crashing?
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.
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.
Fixed: search with /NI option.
"Registry" plugin v3.5
"Registry" plugin v3.5
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]"
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]"
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?
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?
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\pt-BR]
"en-US"=hex(7):00,00,00,00
mrdamm
${registry::Write} "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\pt-BR" "en-US" "" "REG_MULTI_SZ" $0${registry::SaveKey} /D=2
The documentation for Registry Export (save to the file in REGEDIT4 format) includes:
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.
The documentation for Registry Export (save to the file in REGEDIT4 format) includes:
I understand option /D=0 in the context of ${registry::SaveKey}, but what does /D=2 mean in this context?
/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
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.
REG_MULTI_SZ
In fact, all codes that I use in the script, regarded to registry entries are like the following:
Originally posted by InstructorHey, 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.
${registry::Write} "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\pt-BR" "en-US" "" "REG_MULTI_SZ" $0
In fact, all codes that I use in the script, regarded to registry entries are like the following:
Any clues?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
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
Best Regards,
Gustavo Guerra
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!
!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!
... Obviously, there has to be a !define REGISTRY_LIB in there, too.
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:
Here is the code fragment using the registry find (it is scanning the registry for USB 2.0 high speed controllers):
- Chris
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):
Any suggestions?
${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}
- Chris
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.
Try "RegistryTest.nsi" and "Search and write founded in text file" with "HKEY_LOCAL_MACHINE". It may help to find where is the problem.
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!
Is there a way to do this???
Please.
Thanks.
The plugin is great by the way!
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."
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."
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???
Any other ideas???
I already said, try the large string build, if the plugin can't handle that, you must use a external tool
Guess I will be using an external tool then.
so you tested, and the large string build does not work? if so, its a bug in the registry plugin...
mguenette
See ${registry::ReadExtra} and ${registry::WriteExtra}.
See ${registry::ReadExtra} and ${registry::WriteExtra}.
I am trying to build the registry plugin (v3.5) using VC2005 on XP and I get the following link errors:
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!
Creating library .\Release/registry.lib and object .\Release/registry.expIf 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.
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
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!
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."
"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."
Originally posted by AndersSorry, I failed to mention that I already verified that "Basic Runtime Checks" is set to "Default".
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."
With "Buffer Security Check" disabled (/GS-), I still receive the following errors (yes, DllMain is set as the entry point):
registry.obj : error LNK2019: unresolved external symbol _memset referenced in function _xitoaAOther ideas?
registry.obj : error LNK2019: unresolved external symbol _memcpy referenced in function __WriteExtra
Thanks!
Originally posted by nsnbI solved the problem. 🙂
With "Buffer Security Check" disabled (/GS-), I still receive the following errors (yes, DllMain is set as the entry point):
Other ideas?
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. 🙂
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?
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?
Originally posted by Niko49I 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.
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?
BTW, I have added one function to the plugin, named registry::SaveValue. You can find it in the following thread:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
It would be nice if Instructor could add it officially to his plugin. 🙂
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!
Yes please Instructor, add it officially to his plugin!!!!
I prefer use the plugin official.
Thank you a lot!
Originally posted by InstructorFinally found time for some more testing, I was able to narrow down the problem (tested with latest versiion of the NSIS registry plugin).
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.
This is my test program - scans the HKLM path for entries containing the string "enhanced":
Works fine on my development machine and on a couple of other machines.
!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
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:
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.
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
(test program and registry file attached as a zip file)
Any suggestions?
Best regards
Chris
Added: ${SaveKey} "/N=[name]" option to save only specified value.
Fixed: processing 260 characters path.
"Registry" plugin v3.6
Fixed: processing 260 characters path.
"Registry" plugin v3.6