Skip to content
⌘ NSIS Forum Archive

Reading registry Binary and

4 posts

Benoni#

Reading registry Binary and

Is there anyway to read a registry binary value as I can only find ReadRegDWORD and ReadRegStr. Also, can you get the currently loged-on username and computername using ReadEnvStr or any other method, and is there somewhere I can get a list of other environment strings?
Thanks
kichik#
You can't read binary data from the registry using NSIS because NSIS can only handle the string data type. You can always write an extension DLL (plug-in) to do this. You can find an example in Contrib\ExDLL.

To get the user name under NT (NT, 2000, or XP) use the UserInfo DLL. To get a list of environment variables use nsExec to execute the command set:

ReadEnvStr $0 "COMSPEC"
nsExec::ExecToLog "$0 /C set"
# or...
nsExec::ExecToStack "$0 /C set" 
I am not sure it will fit to a NSIS variable, so you can also direct it into a temporary file and read it from there (using "$0 /C set > $TEMP\file.txt" for example).

%COMPUTERNAME% holds the name of the computer but I am not sure it is available on Windows 9x too... You will have to check that.
Benoni#
Thanks for that.
I meant to ask in the original post if anyone knew how to get the date/time: anyone know?
kichik#
NSISdt by Robert Rainwater should help you there: