The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: 5k3l3t0r on September 24, 2007, 09:54:17 AM

Title: REG_BINARY trouble...
Post by: 5k3l3t0r on September 24, 2007, 09:54:17 AM
hi all, i have a litle trouble with REG_BINARY keys in registry [ASM]...
when i set the value "ff d5 71 d6 8b 6a 8d 6f d5 33 93 fd" to the registry, this value was converted and i have a wrong entry...
how can i formate this to "ff d5 71 d6 8b 6a 8d 6f d5 33 93 fd" be the final value?

i have this:
my key           db         'ff d5 71 d6 8b 6a 8d 6f d5 33 93 fd',0

and use regsetvalueex...
the key is created but with other value...

can someone help me?
bye 5k3l3t0r

Title: Re: REG_BINARY trouble...
Post by: Tedd on September 24, 2007, 11:27:34 AM
You're setting it as a string, so you will get the values of the ascii characters and not the hex values you want.
Try "mykey db 0ffh,0d5h,71h,0d6h,8bh,6ah,8dh,6fh,0d5h,33h,93h,0fdh" instead.
Title: Re: REG_BINARY trouble...
Post by: evlncrn8 on September 24, 2007, 11:29:57 AM
pasting the code might help, and pasting what actually is stored in the registry might help too :)
and the data you pasted strictly speaking is stored as text...
you need

.....

my_key           db         0ffh, 0d5h, 71h, 0d6h, 8bh, 6ah, 8dh, 6fh, 0d5h, 33h 93h 0fdh,00h ; unsure if the 00 is really needed
size_of_my_key    equ $ - offset my_key

sizeofmydata dd size_of_my_key

keyname db 'my key',00h

push offset sizeofmydata
push offset my_key
push REG_BINARY
push NULL
push offset keyname   ; the name for the data
push registrykeyyouopened ; the key you're going to write to (hkey)
call RegSetValueEx


.....

something like that
Title: Re: REG_BINARY trouble...
Post by: 5k3l3t0r on September 25, 2007, 10:04:53 AM
hi, tkx to all replyes, that solved my prob...
but now i have a new prob with other key...

my key       db        0a4h,00h,00h,00h,03h,00h,00h,00h,36h,39h,38h,33h,31h,2dh,36h,34h,30h,2dh,                        31h,37h,38h,30h,35h,37h,37h,2dh,34h,35h,33h,38h,39h,00h,5ah,00h,00h,00h,41h,32h,32h,2dh,30h,30h,30h,
30h,31h,00h,00h,00h,;00h,00h,00h,00h,00h,0dh,04h,89h,0b2h,15h,1bh,0c4h,0eeh,62h,4fh,0e00h,00h,00h,00h,27h,
0edh,85h,43h,0a2h,20h,01h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,              00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,31h,34h,35h,30h,34h,00h,00h,00h,00h,00h,00h,00h,0ceh,0eh,    00h,00h,12h,42h,15h,0a0h,00h,08h,00h,00h,87h,01h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,    00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,94h,0a2h,0b3h,0ach

i thinh this is too big... is the prob... if it is how can i set this?
tkx
5k3l3t0r...
Title: Re: REG_BINARY trouble...
Post by: Tedd on September 25, 2007, 11:33:10 AM
Yes, it is - just split it across many 'db' statements.

mykey       db 0a4h,00h,00h,00h,03h,00h,00h,00h,36h,39h,38h,33h,31h,2dh,36h,34h,30h,2dh
            db 31h,37h,38h,30h,35h,37h,37h,2dh,34h,35h,33h,38h,39h,00h,5ah,00h,00h,00h,41h,32h,32h,2dh,30h,30h,30h
            db 30h,31h,00h,00h,00h,;00h,00h,00h,00h,00h,0dh,04h,89h,0b2h,15h,1bh,0c4h,0eeh,62h,4fh,0e00h,00h,00h,00h,27h
            .....
mykey_len equ $-OFFSET mykey


(You can use 'mykey_len' to replace "sizeof mykey")


But that's an assembler problem, is there a problem saving this into the registry?
Title: Re: REG_BINARY trouble...
Post by: 5k3l3t0r on September 25, 2007, 02:07:11 PM
hi tedd, no problem with the registry...
tkyou very much...
bye
5k3l3t0r