The Version 4 always need elevation?, The gringoloco modified version allow make changes in hkcu root key without elevation, the new version 4.x not allow make changes in any key without elevation.
Registry plugin
229 posts
vicokoby
gringoloco023 wrote own "registry::RestoreKey" implementation without regedit execution.Originally Posted by Readme.txtNote:
${registry::RestoreKey} simply exec regedit: regedit /s "[file]"
${registry::RestoreKey}
In the ANSI days we never used ${registry::RestoreKey} cause it doesn't wait for regedit to finish it's job and somehow (I can't remember now) it was preferable to use Reg.exe.
Like this:
Still, I'm not really certain that vicokoby was refering to the ${registry::RestoreKey} function.
Ps. : Do not be to impressed by the code, it was basically my first C project 😉.
Edit: another bug we found was, when trying to MoveKey from HKLM to HKCU without the needed privileges, MoveKey returned an error, but copied the whole key to HKCU anyway while not being able to delete the HKLM key.
We made a quick fix for it in our launcher code. see: http://portableapps.hg.sourceforge.n...f2d5a0f#l1.130
regards
gringoloco023 wrote own "registry::RestoreKey" implementation without regedit execution.We had a few reasons for that.
In the ANSI days we never used ${registry::RestoreKey} cause it doesn't wait for regedit to finish it's job and somehow (I can't remember now) it was preferable to use Reg.exe.
Like this:
nsExec::ExecToStack `"$SYSDIR\reg.exe" import "${_FILE}"` The main reason I rewrote the ${registry::RestoreKey} was that Wine has a bug in regedit / Reg.exe with Windows Registry Editor Version 5.00 files. It crashes Wine.Still, I'm not really certain that vicokoby was refering to the ${registry::RestoreKey} function.
Ps. : Do not be to impressed by the code, it was basically my first C project 😉.
Edit: another bug we found was, when trying to MoveKey from HKLM to HKCU without the needed privileges, MoveKey returned an error, but copied the whole key to HKCU anyway while not being able to delete the HKLM key.
We made a quick fix for it in our launcher code. see: http://portableapps.hg.sourceforge.n...f2d5a0f#l1.130
regards
Hello !
This script is amazing for registry manipulation.
But on the research I can not process the results.
I would find keys "Desktop Integration" in many places (in the hive Key Users), and then modify a String value that can be found here "\Desktop Integration \ 1 \ URL"
How can I get the result of "Desktop Integration" and then add the key "1" to finally fulfill my pre-field "URL"?
Is it possible?
Thank you ... I'm lost!
This script is amazing for registry manipulation.
But on the research I can not process the results.
I would find keys "Desktop Integration" in many places (in the hive Key Users), and then modify a String value that can be found here "\Desktop Integration \ 1 \ URL"
How can I get the result of "Desktop Integration" and then add the key "1" to finally fulfill my pre-field "URL"?
Is it possible?
Thank you ... I'm lost!
@gringoloco023
So your modified version of the registry plugin automatically waits until a command (savekey, restorekey, etc.) is fully executed (and I don't have to use sleep commands after such a command)?
Apart from that, thanks for providing it, I just stumbled upon the issue (with the original plugin) that I can't use restorekey with RequestExecutionLevel user. It won't import a .reg file even if it contains only hkcu entries and because I use NSIS to make portable setups this is a big showstopper...
So your modified version of the registry plugin automatically waits until a command (savekey, restorekey, etc.) is fully executed (and I don't have to use sleep commands after such a command)?
Apart from that, thanks for providing it, I just stumbled upon the issue (with the original plugin) that I can't use restorekey with RequestExecutionLevel user. It won't import a .reg file even if it contains only hkcu entries and because I use NSIS to make portable setups this is a big showstopper...
Delete
Can't read MachineGuid
I'm attempting the following but just getting blank strings for the value and type:
${registry::Read} "HKLM\SOFTWARE\Microsoft\Cryptography" "MachineGuid" $MACHGUID $1
However the following returns 0, indicating the key exists:
${registry::KeyExists} "HKLM\SOFTWARE\Microsoft\Cryptography" $2
Is this key not readable for some reason?
TIA.
I'm attempting the following but just getting blank strings for the value and type:
${registry::Read} "HKLM\SOFTWARE\Microsoft\Cryptography" "MachineGuid" $MACHGUID $1
However the following returns 0, indicating the key exists:
${registry::KeyExists} "HKLM\SOFTWARE\Microsoft\Cryptography" $2
Is this key not readable for some reason?
TIA.
Hi Instructor! I love your plugin! Would you add support of 64-bit keys? 'SetRegView 64' don't work. I need to use ${registry::movekey} on some 64-bit keys.
Thanks!
Regards,
David Pi
Add: I've just download the version 4.1. And found it works perfect with 'SetRegView 64'. I've been using an old version before. Sorry for this post!
Thanks!
Regards,
David Pi
Add: I've just download the version 4.1. And found it works perfect with 'SetRegView 64'. I've been using an old version before. Sorry for this post!
solved
Originally Posted by David Pi View PostHi Instructor! I love your plugin! Would you add support of 64-bit keys? 'SetRegView 64' don't work. I need to use ${registry::movekey} on some 64-bit keys.
Thanks!
Regards,
David Pi
Add: I've just download the version 4.1. And found it works perfect with 'SetRegView 64'. I've been using an old version before. Sorry for this post!
thank you.. i hadn't noticed there was a newer version...
works great under 64-bit..
however.. now it's incompatible with XP?
i have to make two separate launchers for my portableapps 🙁
What have you found that suggests that it isn't compatible with XP? The flag that is set by SetRegView 64 is ignored on non 64-bit OS's.
Stu
Stu
i was just logging in to edit my comment..Originally Posted by Afrow UK View PostWhat have you found that suggests that it isn't compatible with XP? The flag that is set by SetRegView 64 is ignored on non 64-bit OS's.
Stu
it's not the registry plugin..
it was my fault..
the portableapp was already installed on the host machine i was testing and didn't realize.
Sorry about that..
Setregview 64 works great with 4.1.. 🙂
no complaints here.
Something wrong with Hex?
anyone know why i can't save hex from the registry?
but there is more in the registry..
no matter what i try. .. it refuses to save the rest..?
is this a glitch or am i missing something?
What's werid.. is if i import first.. it saves correctly..
By the way.. here's my code:
anyone know why i can't save hex from the registry?
[HKEY_CURRENT_USER\Software\App\Preferences]
"Language"="en_US"
"Preferences"=hex:01
"Version"=hex:03,00,00,00
"Window"=hex(7):62,00,72,00,69,00,64,00,67,00,65,00,3a,00,6c,00,69,00,62,00,\
72,00,61,00,72,00,79,00,3a,00,2f,00,00,00,62,00,72,00,69,00,64,00,67,00,65,\
00,3a,00,66,00,73,00,3a,00,66,00,69,00,6c,00,65,00,3a,00,2f,00,2f,00,2f,00,\
3a,00,3a,00,7b,00,32,00,30,00,44,00,30,00,34,00,46,00,45,00,30,00,2d,00,33,\
00,41,00,45,00,41,00,2d,00,31,00,30,00,36,00,39,00,2d,00,41,00,32,00,44,00,\
38,00,2d,00,30,00,38,00,30,00,30,00,32,00,42,00,33,00,30,00,33,00,30,00,39,\
00,44,00,7d,00,00,00,62,00,72,00,69,00,64,00,67,00,65,00,3a,00,66,00,73,00,\
3a,00,66,00,69,00,6c,00,65,00,3a,00,2f,00,2f,00,2f,00,43,00,3a,00,2f,00,55,\
00,73,00,65,00,72,00,73,00,2f,00,44,00,4a,00,25,00,32,00,30,00,52,00,55,00,\
44,00,45,00,42,00,4f,00,59,00,53,00,45,00,53,00,00,00,62,00,72,00,69,00,64,\
00,67,00,65,00,3a,00,73,00,70,00,65,00,63,00,69,00,61,00,6c,00,3a,00,64,00,\
65,00,73,00,6b,00,74,00,6f,00,70,00,00,00,62,00,72,00,69,00,64,00,67,00,65,\
00,3a,00,66,00,73,00,3a,00,66,00,69,00,6c,00,65,00,3a,00,2f,00,2f,00,2f,00,\
43,00,3a,00,2f,00,55,00,73,00,65,00,72,00,73,00,2f,00,44,00,4a,00,25,00,32,\
00,30,00,52,00,55,00,44,00,45,00,42,00,4f,00,59,00,53,00,45,00,53,00,2f,00,\
44,00,6f,00,63,00,75,00,6d,00,65,00,6e,00,74,00,73,00,00,00,62,00,72,00,69,\
00,64,00,67,00,65,00,3a,00,66,00,73,00,3a,00,66,00,69,00,6c,00,65,00,3a,00,\
2f,00,2f,00,2f,00,43,00,3a,00,2f,00,55,00,73,00,65,00,72,00,73,00,2f,00,44,\
00,4a,00,25,00,32,00,30,00,52,00,55,00,44,00,45,00,42,00,4f,00,59,00,53,00,\
45,00,53,00,2f,00,50,00,69,00,63,00,74,00,75,00,72,00,65,00,73,00,00,00,00,\
00 but there is more in the registry..
no matter what i try. .. it refuses to save the rest..?
is this a glitch or am i missing something?
What's werid.. is if i import first.. it saves correctly..
By the way.. here's my code:
StrCpy $R0 0
${Do}
EnumRegKey $R1 `${_ROOT}` `${_KEY}` $R0
;MessageBox MB_OK `DEBUG: $R1`
${If} $R1 != ""
registry::_SaveKey /NOUNLOAD `${_ROOT}\${_KEY}\$R1` `$SETTINGSDIRECTORY\${APPNAME}.reg` `/A=1`
Pop $0
IntOp $R0 $R0 + 1
${EndIf}
${LoopWhile} $R1 != "" Maybe related to NSIS_MAX_STRLEN?
thank you.. im starting to believe this is the case.Originally Posted by MSG View PostMaybe related to NSIS_MAX_STRLEN?
i believe it's due to "null terminating strings".
As you can see in the example above..
Each Value has multiple "null terminating strings".
NSIS stops at the first "null".
is it possible to bypass this restriction ?
RegOpen Error
just tried RegOpen:

the first value is read correctly..
but the rest are shown as [] for value, string, and type.
from my research.. MULTI_SZ seems to be very hard for NSIS to handle.
I've found reading & writing MULTI_SZ routines..
but those are for specific keys.
just tried RegOpen:
${registry::Open} "HKCU\SOFTWARE\App\Preferences" "/K=0 /V=1 /S=1" $0
StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close
loop:
${registry::Find} "$0" $1 $2 $3 $4
MessageBox MB_OKCANCEL '$$1 "path" =[$1]$\n\
$$2 "value" =[$2]$\n\
$$3 "string" =[$3]$\n\
$$4 "type" =[$4]$\n\
$\n\
Find next?' IDOK loop
close: 
the first value is read correctly..
but the rest are shown as [] for value, string, and type.
from my research.. MULTI_SZ seems to be very hard for NSIS to handle.
I've found reading & writing MULTI_SZ routines..
but those are for specific keys.
Found Solution
unbelievably.. using MS-DOS is the solution for MULTI_SZ that exceed MaxLengthStr
To export/save:
unbelievably.. using MS-DOS is the solution for MULTI_SZ that exceed MaxLengthStr
To export/save:
ExpandEnvStrings `$0` %COMSPEC%
nsExec::Exec `"$0" /c reg export "HKCU\Software\App\Preferences" "$SETTINGSDIRECTORY\settings.reg"` To import file:ExpandEnvStrings `$0` %COMSPEC%
nsExec::Exec `"$0" /c reg import "$SETTINGSDIRECTORY\settings.reg"` To import specific values:@reg.exe add "HKCU\Software\App\Preferences" /v "MySoftware" /d "Software1"\0"Software2"\0"Software3"\0 /t REG_MULTI_SZ /f Is there any chance that the bug (at least I call it a bug...) that it's unable to import .reg files to HKEY_CURRENT_USER without elevation will get fixed?
Apart from that it's a perfect addon!
Apart from that it's a perfect addon!
Hi Instructor,
Does this plugin support unicode or it is for ANSI only?
Does this plugin support unicode or it is for ANSI only?
If there is only one .dll in the .zip file then it is most likely ANSI only...Originally Posted by rvintonyak View Post
Does this plugin support unicode or it is for ANSI only?
Hi!
I had the following problem. In my script I delete a registry key (with NSIS commands), then later in my script I check if the key exists, using registry::_KeyExists. Normally the check comes very near after the deletion. The problem is that the result from _KeyExists is 0 that means the key exists, but it doesn't exist anymore (I can see this with Regedit). But if I put "sleep 5000" before the check the results is correct, the plug-in returns -1. What is the explanation about this?
[edit #1]
I see that the information from me is not good enough. Actually I delete the registry key in separate installer, called in silent mode. I call it with ExecWait command and when it exists, I check if the registry key exists. Only in this situation I have a problem.
[edit #2]
Some additional information. I call the integrated installer (this one that I call in silent mode) several times. I saw that once (probably, because it opens some cmd-windows for short time) that the script runs after ExecWait, but my integrated installer is still working... This can explain the behavior that I mentioned before, but how I can be sure that the installer, called in silent mode (also compiled with NSIS) is finished? I thought that it is enough to call it with ExecWait...
I had the following problem. In my script I delete a registry key (with NSIS commands), then later in my script I check if the key exists, using registry::_KeyExists. Normally the check comes very near after the deletion. The problem is that the result from _KeyExists is 0 that means the key exists, but it doesn't exist anymore (I can see this with Regedit). But if I put "sleep 5000" before the check the results is correct, the plug-in returns -1. What is the explanation about this?
[edit #1]
I see that the information from me is not good enough. Actually I delete the registry key in separate installer, called in silent mode. I call it with ExecWait command and when it exists, I check if the registry key exists. Only in this situation I have a problem.
[edit #2]
Some additional information. I call the integrated installer (this one that I call in silent mode) several times. I saw that once (probably, because it opens some cmd-windows for short time) that the script runs after ExecWait, but my integrated installer is still working... This can explain the behavior that I mentioned before, but how I can be sure that the installer, called in silent mode (also compiled with NSIS) is finished? I thought that it is enough to call it with ExecWait...
I understood what is the reason. The integrated installer/uninstaller is copied to temp-folder and started from there (typical behavior). ExecWait exist after the started of the second executable. If I already know the problem, Google can help me to fin a solution.
Registry plugin v4.1 triggers AVG virus
Just downloaded the NSIS registry plugin (http://nsis.sourceforge.net/Registry_plug-in). Tried to install it, and AVG alerted it was infected with a virus (Trojan horse Generic_s.CNY).
Anybody else have this?
Just downloaded the NSIS registry plugin (http://nsis.sourceforge.net/Registry_plug-in). Tried to install it, and AVG alerted it was infected with a virus (Trojan horse Generic_s.CNY).
Anybody else have this?
"Generic" means it is probably a false positive. Try uploading the plugin to VirusTotal to ease your mind...Originally Posted by JaysonPrichard View PostJust downloaded the NSIS registry plugin (http://nsis.sourceforge.net/Registry_plug-in). Tried to install it, and AVG alerted it was infected with a virus (Trojan horse Generic_s.CNY).
Anybody else have this?
CRASH in VERSION 4.1 with NSIS 2.3
Hello, I´m executing a script with Registry.dll (Windows 8) to look for some keys under HKU node, but for some reason, application crashes in a find call (when some nodes have already been found). I have tried to run RegistryTest.exe with the example of "Search for value 'Content Type'", but replacing HKEY_CURRENT_USER with HKEY_USERS and the result is the same: at some point, app crashes.
Anyone has the same problem or can provide some info about this??
Thank you in advance...
Hello, I´m executing a script with Registry.dll (Windows 8) to look for some keys under HKU node, but for some reason, application crashes in a find call (when some nodes have already been found). I have tried to run RegistryTest.exe with the example of "Search for value 'Content Type'", but replacing HKEY_CURRENT_USER with HKEY_USERS and the result is the same: at some point, app crashes.
Anyone has the same problem or can provide some info about this??
Thank you in advance...
Are you sure you are using NSIS v2.3? That is very old, try upgrading to 2.46...Originally Posted by piaranda View Post
Anyone has the same problem or can provide some info about this??
Plugin crash....
Excuse me, yes, I´m using NSIS 2.46, but if I open "About" window in MakeNsisW.exe it tells me version 2.3...
Excuse me, yes, I´m using NSIS 2.46, but if I open "About" window in MakeNsisW.exe it tells me version 2.3...
Registry plugin crash
Has anyone experienced this problem with registry plugin when trying to search in HKEY_USERS node???
Thanks in advance.
Has anyone experienced this problem with registry plugin when trying to search in HKEY_USERS node???
Thanks in advance.
registry::KeyExists returns invalid results
Hello,
For some reason, the KeyExists function of the registry plugin returns -1 on registry keys that exist.
For example, here are 4 registry keys that I've copied from my registry. Out of those, registry::KeyExists returns 0 for the first two keys, and -1 for the last two keys (wrong, should also be 0).
Also, the installer is a Unicode one.
Any help or suggestions would be greatly appreciated.
Hello,
For some reason, the KeyExists function of the registry plugin returns -1 on registry keys that exist.
For example, here are 4 registry keys that I've copied from my registry. Out of those, registry::KeyExists returns 0 for the first two keys, and -1 for the last two keys (wrong, should also be 0).
I'm using NSIS v3.0b0, and the latest version of the plugin (v4.1) available.
${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Fontcore" $8
MessageBox MB_OK "$8" # Prints 0
${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectX" $8
MessageBox MB_OK "$8" # Prints 0
${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\CCleaner" $8
MessageBox MB_OK "$8" # Prints -1
${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Loki" $8
MessageBox MB_OK "$8" # Prints -1
Also, the installer is a Unicode one.
Any help or suggestions would be greatly appreciated.
Is this a 64-bit system?Originally Posted by mikhail78 View PostFor some reason, the KeyExists function of the registry plugin returns -1 on registry keys that exist.