You are here

Search for a Registry Value

12 posts / 0 new
Last post
Simeon
Simeon's picture
Offline
Last seen: 10 years 2 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Search for a Registry Value

I know that it is rather easy to search for a registry key with the Registry plugin but doesn anyone know a methode to search for a registry value?

My problem is this:
PopMan can be set to autostart with Windows and it does that by writing a registry value called

HKCU\Software\Microsoft\Windows\CurrentVersion\Run:
PopMan: "J:\PortableApps\PopManPortable\App\PopMan\PopMan.exe -minimize"

Now I want to check if the value is there, back it up if it is, run the program and delete it afterwards and, if necessary, restore the old one. This way I could ensure that even if the user sets this option, the host registry remains clean.

So now I want to check if the "PopMan"-entry is there but the Registry-Plugin's "${registry::KeyExists}"-Function only checkes for a key and not for the value.
I think I have to use the "${registry::Find}"-Function but I dont know how.

Anyone know more or can help me?

LOGAN-Portable
LOGAN-Portable's picture
Offline
Last seen: 11 years 11 months ago
Developer
Joined: 2007-09-11 12:24
Not sure though, but would it

Not sure though, but would it not be easier to read the registry entry for run and then let the NSIS script check if PopMan is included?

Simeon
Simeon's picture
Offline
Last seen: 10 years 2 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
maybe

but I dont know how to do that either.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

digitxp
digitxp's picture
Offline
Last seen: 13 years 3 months ago
Joined: 2007-11-03 18:33
Hm...

IMO, you should check if the Popman KEY exists and assume it was set to start if it does.
Or you could do it the hard way and try to copy it and see if it fails. Then if it fails you could assume that it was never there in the first place and not move it back ;).

Insert original signature here with Greasemonkey Script.

Simeon
Simeon's picture
Offline
Last seen: 10 years 2 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
I would

but there is no PopMan Key.
There is the "Run" key as described above (HKCU\Software\Microsoft\Windows\CurrentVersion\Run)
and then normally there are several values inside that key. Normally ther's an empty one and one called "CTFMON.EXE". The way I understand it is that all exes inside the run key are run on windows start. I know how to check for the key but not for a specific value inside a key.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

digitxp
digitxp's picture
Offline
Last seen: 13 years 3 months ago
Joined: 2007-11-03 18:33
Either way

I was thinking that the menu could check the built in autostart keys, delete them, and automagically add it to the autorun list or something.
As for the value...
Oh and I found the stuff under find in registry.nsh:

!macro registry::Find _HANDLE _PATH _VALUEORKEY _STRING _TYPE
	registry::_Find /NOUNLOAD `${_HANDLE}`
	Pop ${_PATH}
	Pop ${_VALUEORKEY}
	Pop ${_STRING}
	Pop ${_TYPE}
!macroend

Insert original signature here with Greasemonkey Script.

solanus
solanus's picture
Offline
Last seen: 10 years 2 months ago
Joined: 2006-01-21 19:12
Pardon me if this is too basic...

but if you are working on your own home machine, can't you just open regedit.exe and do a Find?
It will look for Keys, Data and Values.
Also, once you are there, you can highlight the Key and do a File>Export Registry File.

Of course, if you don't have admin rights, you may have probs.

I made this half-pony, half-monkey monster to please you.

Simeon
Simeon's picture
Offline
Last seen: 10 years 2 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
It does work

even without Admin rights.
But I want to do it with NSIS so I can put it into the PopMan launcher.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

wraithdu
Offline
Last seen: 11 years 6 months ago
Developer
Joined: 2007-06-27 20:22
${registry::Read}
${registry::Read} "[fullpath]" "[value]" $var1 $var2

$var2 = TYPE

According to readme:

TYPE:
	""                                -Value does not exist
	"REG_BINARY"                      -Raw binary data
	"REG_DWORD"                       -Double word in machine format (low-endian on Intel)
	"REG_DWORD_BIG_ENDIAN"            -Double word in big-endian format
	"REG_EXPAND_SZ"                   -String with unexpanded environment variables
	"REG_MULTI_SZ"                    -Multiple strings, next string separated by new line '$\n'
	"REG_NONE"                        -Undefined type
	"REG_SZ"                          -Null-terminated string
	"REG_LINK"                        -Unicode symbolic link
	"REG_RESOURCE_LIST"               -Device-driver resource list
	"REG_FULL_RESOURCE_DESCRIPTOR"    -Resource list in the hardware description
	"REG_RESOURCE_REQUIREMENTS_LIST"  -
	"REG_QWORD"                       -64-bit number
	"INVALID"                         -Invalid type code

So check if $var2 is blank. If it is, then your value doesn't exist.

Simeon
Simeon's picture
Offline
Last seen: 10 years 2 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Thank you

for once more helping me with NSIS!

EDIT

It works now Smile

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

digitxp
digitxp's picture
Offline
Last seen: 13 years 3 months ago
Joined: 2007-11-03 18:33
readme?

Where?

Insert original signature here with Greasemonkey Script.

Simeon
Simeon's picture
Offline
Last seen: 10 years 2 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Plugin

if you download the plugin, there is a readme included.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

Log in or register to post comments