The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ragdog on December 11, 2006, 05:33:23 PM

Title: read hexstring from the registry problem
Post by: ragdog on December 11, 2006, 05:33:23 PM
I am it times again :bg


i have problem with read registry string in hex to dword
when i add these 02,00,00,00 hexstrings to the start,
can“t i read my strings any more. -but why??

my source is posted

thanks in forward

ragdog


[attachment deleted by admin]
Title: Re: read hexstring from the registry problem
Post by: Darrel on December 11, 2006, 06:13:10 PM
If I understand correctly your registry has the value 02h stored as a DWORD therefore trying to display it as a string would give you the Start of Text charcter followed by 3 NULL characters, so your MessageBox will probably display nothing. You might consider converting the DWORD to ASCII.

HTH,

Darrel
Title: Re: read hexstring from the registry problem
Post by: ragdog on December 11, 2006, 06:36:01 PM
i have tested with

invoke GetRegValueInt,addr szKey,addr szRegBinary, addr hString
invoke dw2a,addr hString,addr lpBuffer
invoke MessageBox,hWnd,addr lpBuffer,0,MB_OK

result is 42006628

this works not sry :(
Title: Re: read hexstring from the registry problem
Post by: Darrel on December 11, 2006, 07:20:12 PM
As posted your Message Box should display:   (). Which is the Start of Text character followed by a terminating null character.

Try
          lea edx,hString
          add edx,4
          invoke MessageBox,hWnd,edx,0,MB_OK

or
          lea edx,hString
          add DWORD PTR[edx],030303030h
          invoke MessageBox,hWnd,addr hString,0,MB_OK

Regards,

Darrel
Title: Re: read hexstring from the registry problem
Post by: ragdog on December 11, 2006, 07:57:39 PM
great :U

thanks