News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Setting key value

Started by Magnum, February 09, 2013, 07:41:29 AM

Previous topic - Next topic

Magnum

I can't figure why the key value isn't being set ?

Andy


.DATA

SubKey      BYTE  "Software\AutoBot\Soldat",0              ;Name of sub key in HKEY_CURRENT_USER
;Key_Made    BYTE  "The key has been created.",0
;Failed      BYTE  "Register key NOT sucessfully created.",0
Sample      BYTE  " ",0
ValueName   BYTE  "Aktiv",0
KeyValue    DWORD  05h            ; Key set to this value

.DATA?

RegH            PHKEY    ?            ; Handle for reg. key
RegBuffer       db       256 dup(?)   ; address of value data

.code

start:

invoke RegCreateKey,HKEY_CURRENT_USER, ADDR SubKey,ADDR RegH

;.IF EAX == ERROR_SUCCESS
;invoke MessageBox, 0, ADDR Key_Made, ADDR Sample,MB_ICONINFORMATION
;.ELSE
; if failed

;invoke MessageBox, 0, ADDR Failed, ADDR Sample,MB_ICONINFORMATION

;.ENDIF

invoke RegSetValueEx, RegH, addr ValueName,
                              NULL, REG_DWORD,
                              addr RegBuffer, sizeof KeyValue

invoke RegCloseKey, RegH

invoke RegCloseKey, RegH; close handle for reg. key

Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

you might try using RegCreateKeyEx and use KEY_ALL_ACCESS as samDesired
should be no need to close the key twice