Skip to content
⌘ NSIS Forum Archive

Registry plugin

229 posts

groove1963#edited
Hello "Instructor",

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

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:

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
groove1963#
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#
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:


${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#
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
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:


${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=-
glab#
I also have an issue with Windows 7 (64 bit).

The following operation results in an unsuccessful open.


;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.
ChocJunkie#
Hi

I'm kind of struggeling using the RestoreKey functionality. I'm using:
${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
Brewster333#
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?
MSG#
Originally posted by Brewster333
Hello! I need to delete keys from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB key. Standard NSIS function can't do this.
Yes it can. You probably need administrative priviledges.
Brewster333#
Originally posted by MSG
Yes it can. You probably need administrative priviledges.
I've test it (on Windows Vista). But user with administrative rights can't delete nodes in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\. Using RegSetKeySecurity (WinAPI) is needed to do this I suppose...
ChocJunkie#edited
No ideas about my problem?

--- EDIT ---

I've found accidently found the problem.

I'm executing RestoreKey, logging a related status message and deleting the file used by the plug-in. If I don't delete the file or Sleep some ms, everything works fine.
ChocJunkie#
I came to notice no flag/constant indicates if the header file has already been included.
What's about include the !ifndef...!define comands in the plugin? Or does no one else need it?

CJ
gringoloco023#
Unicode NSIS update

Would there be any chance to get an update of Registry.dll what works with Unicode NSIS ?

Thanx !
carillan#
Multivalues in a REG_MULTI_SZ key

I'm trying to create a REG_MULTI_SZ key with several values, but i have no way to give it more than one value. How should I give the values? I've tried separating with "\n" and "\0" but it didn't work.

I use this instruction:
${registry::Write} "HKCU\${COMPANY_REGKEY}\Settings" "Name" "Generic Value" "REG_MULTI_SZ" $R0
Thaks in advance!
carillan
gringoloco023#
REG_MULTI_SZ read/write

I've included some scripts which should do the job !

The reader I've used myself and works fine, but you'll have to make some modifications to store the value into a string !

The writer I haven't tried jet !
gringoloco023#
Recompiled for Unicode NSIS

I recompiled it my self in the end !

Although I tested it thoroughly, there could still be some minor issues.
Let me know if there is any behavior difference compared with the ansi version.

portableapps.com/node/21879

By the way: MULTI_SZ needs '$\n'
mj_blue#
open finding blank entry when further files exist

Hi,

I am trying to clean up the registry from some previous bad installations and have about 30 entries registry keys called:

HKEY_LOCAL_MACHINE\SOFTWARE\MozillaPlugins\@antixlabs.com/npagp,version={VERSION}

where version varies.

I wanted to loop through and delete all these but currently when I do this it seems to find 9 entries and then find returns blank entry. If I run it again it find more entries until another blank entry is returned.

My code is below, am I doing something wrong?

${registry::Open} "HKLM\SOFTWARE\MozillaPlugins" '/K=1 /V=0 /S=0 /NS="@antixlabs"' $0
    StrCmp $0 0 0 loopkey
    MessageBox MB_OK "Error" IDOK closemozillakeyfind
    goto closemozillakeyfind
    loopkey:
    ${registry::Find} "$0" $1 $2 $3 $4
    StrCmp $4 '' closemozillakeyfind 0
        ${registry::DeleteKey} "HKEY_LOCAL_MACHINE\$1\$2" $R1
        goto loopkey
        closemozillakeyfind:
    ${registry::Close} "$0"
    ${registry::Unload} 
Thanks for any help in this

Mark
sentromed#
Instructor,

Please add support of "SetRegView 64" or something similar to it. I used v3.6.
I am running 32-bit installer on 64-bit Windows system. My issue is that value is wirtten to "Software\Wow6432Node\" instead of "Software\"

Thanks,
Valery.
Afrow UK#
This plug-in needs updating.
For NSIS plug-ins, the extra_parameters->g_exec_flags->alter_reg_view field will be set to KEY_WOW64_64KEY if the calling script used SetRegView 64. The plug-in would need to use this field accordingly. I do not know if the Registry plug-in does this, but if not it needs to be modified to do so.
Stu
isawen#
using NSIS Unicode version

Did any of you used this plugin with the Unicode version of NSIS?
I don't know why but it doesn't work. Could someone give me a clue in this?

Thanks,
Isawen
gringoloco023#
You will need a unicode version of the plug-in

... to use in Unicode Nsis

On the following web page their are a few converted plug-ins, including the Registry one:
Outdated: this has been released. Application: Unicode NSIS Category: Development Description: Unicode NSIS is the Nullsoft Scriptable Installer System with unicode support packaged as a portable app. NSIS is the language used to write all of the launchers at PortableApps.com. Unicode NSIS contains the capabilities to deal with unicode utf-16LE. Unicode NSIS Portable 2.46 &
isawen#
Originally Posted by gringoloco023 View Post
... to use in Unicode Nsis

On the following web page their are a few converted plug-ins, including the Registry one:
http://portableapps.com/node/21879
Thanks gringoloco023, you did a good job with it.
At a first try the plugin methods are working. Is there any drawback in this unicode plugin?
gringoloco023#
No drawbacks that I know of.

I done a basic test on every function after I converted it.

That said, we only used it in the portableapps.com launchers.
The launchers basically only use the following functions:
  1. CopyKey
  2. MoveKey
  3. SaveKey
  4. RestoreKey

And that on Windows XP to Windows 7 and Wine.

So using any other function you'd wanna be a little bit more carefull, but it should be fine.

regards
Instructor#
Added: full unicode support on NSIS Unicode.
Added: support for SetRegView 64.
Added: export key contents to the file in unicode "Windows Registry Editor Version 5.00" format.


Registry plugin v4.0
Instructor#
Added: separate functions:
  • ${registry::StrToHexA} - convert string to ansi hex values;
  • ${registry::StrToHexW} - convert string to unicode hex values.
    For backward compatibility: ${registry::StrToHex} is the same as ${registry::StrToHexA}.

Added: separate functions:
  • ${registry::HexToStrA} - convert ansi hex values to string;
  • ${registry::HexToStrW} - convert unicode hex values to string.
    For backward compatibility: ${registry::HexToStr} is the same as ${registry::HexToStrA}.


Registry plugin v4.1