Old 6th December 2006, 15:44   #1
Install-O-Matic
Junior Member
 
Join Date: Nov 2006
Posts: 19
Problem using WriteRegDWORD

I am trying to write an integer stored in a variable into a REG_DWORD and I am having some problems. The line I am using to store this integer is:
WriteRegDWORD HKLM "Software\Classes\ClassName" "class_key" $ClassKey

$ClassKey holds an 8 character decimal number entered by the user. If $ClassKey is “11111111” then it is stored into the registry OK. If $ClassKey is “01111111” (which is 0x1f447) then what is actually stored in the registry is 299593 (which is 0x49249)
If $ClassKey is “1111111”, (no leading 0) then it will be stored correctly. I have to allow for the user to enter leading zeros.
Can someone tell me what I am doing wrong and how I can get around it?

Thanks.
Install-O-Matic is offline   Reply With Quote
Old 6th December 2006, 15:52   #2
glory_man
Senior Member
 
Join Date: Sep 2004
Location: Mogilev (Belarus)
Posts: 372
It is all right.
01111111 (octal) = 0x49249 (hexadecimal).

Quote:
“01111111” (which is 0x1f447)
Why?

EDIT:
0x1f447 (hex) = 0372107 (octal) - to my mind.
glory_man is offline   Reply With Quote
Old 6th December 2006, 16:01   #3
Install-O-Matic
Junior Member
 
Join Date: Nov 2006
Posts: 19
Thanks glory_man. I should have realized that.
Is there a command or macro to remove leading zeros from a string, or do I just need to create my own string modifying function?
Install-O-Matic is offline   Reply With Quote
Old 6th December 2006, 16:31   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
You may use registry plugin to solve that. EX
code:
${registry::Write} "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ClassName" "class_key" "01111111" "REG_DWORD" $R0

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

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