Old 3rd July 2006, 15:44   #81
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Added: registry::Open options
            "/NS=[name]" - sensitive search for a part of name
            "/NI=[name]" - insensitive search for a part of name


"Registry" plugin v3.0
Attached Files
File Type: zip registry.zip (92.7 KB, 945 views)
Instructor is offline   Reply With Quote
Old 17th August 2006, 18:52   #82
Deuce199
Junior Member
 
Join Date: May 2006
Posts: 4
Multiple key Regsearch

Instructor,

First thanks for the help, I am sorry it took so long to get back to you.

Second, I am having the same problem, What I need is for my search algorithm to search the registry for a specific keyword. If found save the key to a reg file, then from that point, the regkey it just wrote, continue to search the rest of the registry for that keyword. If another is found then save, start from that point and continue, and so on until it hits the end of the registry.

Here is my search function:

code:

!define RegSearch `!insertmacro RegSearch`

!macro RegSearch rootKey searchWord

${registry::Open} "${rootKey}" "/K=1 /V=0 /S=0 /B=0 /N='${searchWord}'" $0
StrCmp $0 0 0 +2
MessageBox MB_OK "Error" IDOK +9
${registry::Find} "$0" $1 $2 $3 $4
StrCmp $4 '' +7
StrCmp $4 'REG_KEY' 0 +4
StrCpy $REGKEY "${rootKey}\$1\$2\$3"
${Registry::SaveKey} "$REGKEY" "${SETDIR}\Settings.reg" "/A=1 /G=1" $R0
StrCpy $RC "1"
goto -7

${registry::Close} "$0"
${registry::Unload}
!macroend



After the 'StrCpy $RC "1"' line it should jump back to the registry::find line and continue to search the registry for the next key.

What it is doing it going back to the beginning of the opened root key and starting again, So it hits the already saved key and appends it to the regfile.

Basically it creates a loop that creates a file that will keep writing the same info over and over again, until I kill it in the task manager.

Is it possible for me to do this with your plugin? If so, how should I change the code above to make it work?

thanks for all your help with this.

Deuce
Deuce199 is offline   Reply With Quote
Old 18th August 2006, 09:13   #83
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
You use relative jumps through macros.
Instructor is offline   Reply With Quote
Old 18th August 2006, 11:25   #84
Deuce199
Junior Member
 
Join Date: May 2006
Posts: 4
How would I go about coding something like that?

Right now, That is my macro. I call that macro from within my main prog script. It is my regsearch function pretty much.
Deuce199 is offline   Reply With Quote
Old 18th August 2006, 22:41   #85
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Something like this:
code:
Function RegSearch
!define RegSearch `!insertmacro RegSearchCall`

!macro RegSearchCall rootKey searchWord
Push `${rootKey}`
Push `${searchWord}`
Call RegSearch
!macroend

Exch $R1
Exch
Exch $R0
Exch
Push $0
Push $1
Push $2
Push $3
Push $4
Push $5

${registry::Open} "$R0" "/K=1 /V=0 /S=0 /B=0 /N='$R1'" $0
StrCmp $0 0 0 +2
MessageBox MB_OK "Error" IDOK end

find:
${registry::Find} "$0" $1 $2 $3 $4
StrCmp $4 '' end
StrCpy $REGKEY "$R0\$1\$2\$3"
${registry::SaveKey} "$REGKEY" "${SETDIR}\Settings.reg" "/A=1 /G=1" $5
StrCpy $RC "1"
goto find

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

Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
Pop $R1
Pop $R0
FunctionEnd

Instructor is offline   Reply With Quote
Old 12th September 2006, 19:34   #86
Deuce199
Junior Member
 
Join Date: May 2006
Posts: 4
Registry.dll left in Temp

I noticed while using your plugin in some of my code, that after the registry plugin is copied to the temp directory, it still is there even after the program is shutdown.

My point is, after running the program ten times say, I have ten temp folders all containing the registry.dll file. They add up after a time.

Is this something that can be fixed?

Thanks, Deuce.

PS. thanks for the help on the above function, I am still trying to find the time to try it out.
Deuce199 is offline   Reply With Quote
Old 10th November 2006, 10:49   #87
bholliger
Senior Member
 
Join Date: Jul 2004
Location: Switzerland
Posts: 223
Hi Deuce199!

It seems that you don't execute the 'unload'-function by the time you've finished using the plugin.

Have a look at the excellent readme.txt for further information.

code:

; **** Unload plugin ****

${registry::Unload}



Cheers

Bruno
bholliger is offline   Reply With Quote
Old 3rd December 2006, 23:52   #88
makutaku
Junior Member
 
Join Date: Dec 2006
Posts: 2
Question Unable to use plug-in, please help !

Both Registry.dll and PPC-Registry.dll were copied to NSIS plugin directory, but when I try to use them in my nsi file I get compilation errors:

When I call either Registry::Open or PC-Registry::CeRapiInit
both generate an invalid command error.

I am able to use other plugins, such as nsislog.dll, so I don't undesrtand what's different with Registry.dll and PPC-Registry.dll. Does anybody know what I am missing ? Do I need to include anything in my nsi code to use these plugins?
makutaku is offline   Reply With Quote
Old 4th December 2006, 03:03   #89
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
You have to:[list=1][*]Get the DLLs moved to the plugins folder (which sounds like you have)[*]Move REGISTRY.NSH to the include folder[*]Add !Include 'REGISTRY.NSH' to the top of your script.[*]Make your calls using the built-in defines rather than regular plugin calls. (Example: Use ${registry::Open}, not Registry::Open)[/list=1]
See the README.TXT file included with the plugin along with the included sample script.
Comperio is offline   Reply With Quote
Old 4th December 2006, 16:56   #90
makutaku
Junior Member
 
Join Date: Dec 2006
Posts: 2
Thank you very much ! It's working now !
makutaku is offline   Reply With Quote
Old 7th February 2007, 07:11   #91
ossi01
Junior Member
 
Join Date: Feb 2007
Posts: 3
Cant access fully to x64-Registry

Hi,

whe i create a new Key in HKLM\Software with Regedit.exe than i cant read this key with ${registry::Read} (returns empty String) or ${registry::Exist} (returns -1). Also ${registry::Find} doesnt enumerate this new Key.
This only happens on Windows XP x64 or Vista x64.

What can i do?
ossi01 is offline   Reply With Quote
Old 3rd April 2007, 18:57   #92
JamesKiller
Senior Member
 
Join Date: Jan 2007
Posts: 125
seems like i have same issue. cause under 64 bit windows, the rigstry keys go to win6432node ....
JamesKiller is offline   Reply With Quote
Old 4th April 2007, 02:08   #93
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
Have a look at this thread...

edit
also look at my comments in this thread
Comperio is offline   Reply With Quote
Old 18th May 2007, 05:37   #94
Ehtyar
Junior Member
 
Join Date: May 2007
Posts: 2
Unhappy

Hi all.
I've been using this plugin to help create portable applications (most portable apps use this plugin). A problem is that if you have many and/or very large registry keys, not all of the data is inserted into the registry before the application starts. I modified the source code myself to fix this problem by adding a call to WaitForSingleObject on the handle returned by CreateProcess in the _RestoreKey function thus:
code:
if (CreateProcess(NULL, szBuf, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);


but it crashed my compiler (msvc6) when i tried to build it. If anyone wouldn't mind rebuilding this project with that modification, I'd really appreciate it.

Thanks very much, Ehtyar.
Ehtyar is offline   Reply With Quote
Old 18th May 2007, 19:45   #95
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Ehtyar
Attached Files
File Type: zip restorekeywait.zip (17.7 KB, 554 views)
Instructor is offline   Reply With Quote
Old 18th May 2007, 19:47   #96
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Changed: small optimization.


"Registry" plugin v3.1
Attached Files
File Type: zip registry.zip (91.9 KB, 557 views)
Instructor is offline   Reply With Quote
Old 18th May 2007, 20:40   #97
Ehtyar
Junior Member
 
Join Date: May 2007
Posts: 2
Oh thank you so much instructor, it works perfectly. I'm sorry i could not accomplish that without bugging you, i guess i need to check for updates :S.

Thanks again, Ehtyar.
Ehtyar is offline   Reply With Quote
Old 10th July 2007, 13:22   #98
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Fixed: possible memory overflow (changed lstrcpy to lstrcpyn).


"Registry" plugin v3.2
Attached Files
File Type: zip registry.zip (92.2 KB, 520 views)
Instructor is offline   Reply With Quote
Old 20th August 2007, 04:06   #99
wraithdu
Junior Member
 
Join Date: Sep 2002
Posts: 39
I was curious which functions in your plugin should be followed by a Sleep command, and for how long? I've noticed that some like RestoreKey perform more reliably with a Sleep 50 or 100.

So basically, which functions execute and continue on the script immediately (without waiting for the actual registry operation to finish), and which wait for the registry operation to finish before moving on in the script?

Great plugin, thanks!
wraithdu is offline   Reply With Quote
Old 21st August 2007, 02:02   #100
wraithdu
Junior Member
 
Join Date: Sep 2002
Posts: 39
I found a bug in v3.2 (big one unfortunately).

The ${registry::SaveKey} function is saving keys in HKCU as

[HKCU\<whatever>]

in the REG file. Obviously this will not import back into the registry. I checked back to v3.1 and this bug was not present.

HKLM seems to work fine and is expanded to HKEY_LOCAL_MACHINE. I'm not sure if other short names are affected or not.
wraithdu is offline   Reply With Quote
Old 21st August 2007, 12:57   #101
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Fixed: registry::SaveKey short root name didn't translated to a long name.


"Registry" plugin v3.3
Attached Files
File Type: zip registry.zip (92.3 KB, 436 views)
Instructor is offline   Reply With Quote
Old 21st August 2007, 14:44   #102
wraithdu
Junior Member
 
Join Date: Sep 2002
Posts: 39
Thanks for the quick update!

Any comment on my post above about using Sleep times with your plugin?
wraithdu is offline   Reply With Quote
Old 21st August 2007, 18:22   #103
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
wraithdu
No comments. I don't understand your post.
Instructor is offline   Reply With Quote
Old 21st August 2007, 18:43   #104
wraithdu
Junior Member
 
Join Date: Sep 2002
Posts: 39
Sorry, I'll try to be more clear.

I use NSIS to make portable app launchers. I've been in the habit of placing a 'Sleep 50' or 'Sleep 100' command after a call to your registry plugin to allow the the operation to finish before moving on in my script.

The best example is what is described above by Ehtyr. It seems the RestoreKey function does not wait for the registry information to be fully imported before moving on in the script and launching the application. He modified the DLL to fix this problem. I have just added some Sleep time.

So my question is, what other functions in your plugin behave in the same way (ie do not wait for the registry operation to finish)? Should I then keep adding the Sleep commands to compensate for this? And would it be possible to modify all the registry commands as Ehtyr did?

I hope that makes more sense.
wraithdu is offline   Reply With Quote
Old 22nd August 2007, 01:59   #105
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Quote:
So my question is, what other functions in your plugin behave in the same way (ie do not wait for the registry operation to finish)?
registry::RestoreKey is the only one.

To import all registry information before continue, you could use the following code:
code:
ExecWait 'regedit /s "[file]"' $var
Instructor is offline   Reply With Quote
Old 26th August 2007, 20:40   #106
Quib
Junior Member
 
Join Date: Aug 2007
Posts: 12
So, just confirming, all registry operations except restore wait for the operation to complete before continuing? If so, this is awesome, I get to cut a ton of sleeps out of my scripts!

Also, thank you so much for this plugin Instructor, it's wonderful.

QM
Quib is offline   Reply With Quote
Old 26th August 2007, 20:43   #107
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Quote:
So, just confirming, all registry operations except restore wait for the operation to complete before continuing?
Yes
Instructor is offline   Reply With Quote
Old 26th September 2007, 12:56   #108
JCD29
Junior Member
 
Join Date: Sep 2003
Location: FRANCE
Posts: 34
just a question : if I want to find a value in a specified root , after the method find, i have to compare the $var2 with the value I want to find ? is it exact...
i want to use your "wonderful" source code given above to test... I did this kind of algorith in my installer to check the presence of key in the registry base but it was long; with this one it is "SUPER".....

JCD
JCD29 is offline   Reply With Quote
Old 26th September 2007, 13:25   #109
JCD29
Junior Member
 
Join Date: Sep 2003
Location: FRANCE
Posts: 34
is it possible to have a error code return in $4 for the method find... if error so , doesn't find if not so seems to be good....
thks

JCD
JCD29 is offline   Reply With Quote
Old 26th September 2007, 14:51   #110
JCD29
Junior Member
 
Join Date: Sep 2003
Location: FRANCE
Posts: 34
an other question :
in the method you described above,
can we use the method read and ifkeyexist before the method close andunload ?

I try and it doesn't work.... i search a value in a root by using the find method and just after i wanted to use the values returned by the find method to read a value in a fullpath

call ${registry::Open}.... /B=0 $0
call : ${registry::Find} "$0" $1 $2 $3 $4
...ok i found the value..
call {registry::read} "$1" "$2" $R0 $R1..
call ${registry::close}

but read doesn't work...

can you help me..

JCD
JCD29 is offline   Reply With Quote
Old 31st January 2008, 13:52   #111
didava
Member
 
Join Date: May 2007
Posts: 98
How do you delete the HKLM\SYSTEM\WPA\key- (WXP-Pro)

Hi

How do you delete the HKLM\SYSTEM\WPA\key- (WXP-Pro)

I can one a make program with Nsis

What do you use or do to delete these extra keys

HKEY_LOCAL_MACHINE\SYSTEM\WPA\Key-XXXXXXXXXXXXXXXXXXXXX

Doing it the normal right click and delete it kicks out and says you can't do that BEEP )(&(^^%$%$###

Don't need the bloody extra ones

I even tried to change the permission still no go!!!!!!

plz example show me
didava is offline   Reply With Quote
Old 1st February 2008, 05:57   #112
didava
Member
 
Join Date: May 2007
Posts: 98
plz example show me
didava is offline   Reply With Quote
Old 1st February 2008, 08:57   #113
didava
Member
 
Join Date: May 2007
Posts: 98
Can you Help!?
didava is offline   Reply With Quote
Old 1st February 2008, 17:41   #114
didava
Member
 
Join Date: May 2007
Posts: 98
Hi

How do you delete the HKLM\SYSTEM\WPA\key- (WXP-Pro)

I can one a make program with Nsis

What do you use or do to delete these extra keys

HKEY_LOCAL_MACHINE\SYSTEM\WPA\Key-XXXXXXXXXXXXXXXXXXXXX

Doing it the normal right click and delete it kicks out and says you can't do that BEEP )(&(^^%$%$###

Don't need the bloody extra ones

I even tried to change the permission still no go!!!!!!

plz example show me
didava is offline   Reply With Quote
Old 3rd February 2008, 17:34   #115
didava
Member
 
Join Date: May 2007
Posts: 98
what ??
didava is offline   Reply With Quote
Old 10th March 2008, 10:06   #116
rahulsubramanya
Junior Member
 
Join Date: Mar 2008
Posts: 2
Unable to get Registry working

Hi,

I am a newbie to NSIS. Currently I am in a situation where my installer need to identify a software whether already installed or not and If installed, uninstal it and continue with my installer.
This software is under .../Uninstall of registry and it does not have a fixed key. The key depends on its GUID and package. But, there is one string called "Display string" which is constant and based on which we can search for. Can I search this string and get the key from registry and then get the UninstallString with help of key.

I tried with out using Registry.dll, but looks like not possible.

I tried using Registry.dll but unable to get it working I am gettting compilation error in registry.nsh at this line
registry::_Open /NOUNLOAD `${_PATH}` `${_OPTIONS}`

I am using registry like this
${registry::Open} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" "/K=0 /V=1 /S=1" $0

The error is "Error in macro registry:pen on macroline 1"

Help much appreciated

Cheers
Rahul
rahulsubramanya is offline   Reply With Quote
Old 10th March 2008, 15:41   #117
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
rahulsubramanya
Probably there is something with the nsh file codepage. It must be not in Unicode (or maybe you are using Unicode build).
Instructor is offline   Reply With Quote
Old 10th March 2008, 15:43   #118
rahulsubramanya
Junior Member
 
Join Date: Mar 2008
Posts: 2
Hi,
Thanks for the reply
How to check these compatibities? Any readme file tells this? or any source code?

Can I build my self?

Cheers
Rahul
rahulsubramanya is offline   Reply With Quote
Old 10th March 2008, 15:49   #119
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
OK
Are you using Unicode build?
Instructor is offline   Reply With Quote
Old 10th March 2008, 16:52   #120
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Fixed: ${registry::WriteExtra} with REG_MULTI_SZ (thanks David Irwin).

Added: now plugin can be compiled with GCC.


"Registry" plugin v3.4
Attached Files
File Type: zip registry.zip (93.4 KB, 523 views)
Instructor 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