I am attempting to read a Dword value from a registry key, write a value to that key, and then write the original value back to the key when I am done. My code looks like this:
; first I read the current values
ReadRegStr $0 HKEY_CURRENT_USER "Software\Whatever" "User Name"
ReadRegStr $1 HKEY_CURRENT_USER "Software\Whatever\Users\$0" "SpecialKey"
; then I write the temporary value
WriteRegDword HKEY_CURRENT_USER "Software\Whatever\Users\$0" "SpecialKey" 0x1
; I do some unrelated stuff here
; then I try to write back the original value
WriteRegDword HKEY_CURRENT_USER "Software\Whatever\Users\$0" "SpecialKey" $1
I have also tried 0x$1, "$1", "0x$1", etc. as values in the final WriteRegDword. The statement is failing specifically on that variable because, when I replace it with 0x0, it works just fine.
Does this mean that you can only read and write string variables with NSIS? Is there a workaround?
Thoughts?