News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Writing DWORD Value to Registry?

Started by Ksbunker, September 27, 2005, 02:30:52 AM

Previous topic - Next topic

Ksbunker

I've been trying to ge this working, but to no avail. Its meant to get the chosen colour, which is colref, and write that value to the registry, but its not just working and im not suer too sure what im doing wrong, any help with would highly apreciated.

im not sure what dwdisp  is, it was just in the example and didn't provide much info about it, and msdn just confused me, I included it just as dsdisp dd ?

dwdisp dd ?
colref db 12 dup(?)    
szTestKey db "Software\Microsoft\Internet Gaming Zone\Chat", 0
hKey dd ?
szFontColor db "Font Color", 0

Invoke RegOpenKeyEx, HKEY_CURRENT_USER, addr szTestKey, 0, KEY_WRITE, offset hKey
.if eax == ERROR_SUCCESS
Invoke RegSetValueEx, hKey, addr szFontColor, 0, REG_DWORD, addr colref, offset dwdisp
Invoke RegCloseKey, offset hKey
.elseif
Invoke MessageBox, NULL, addr lpText, addr lpText, MB_OK
.endif


can anyone help? thanks

sluggy

Your call to RegSetValueEx is incorrect, it is the last parameter that is faulty. At the moment you are passing a pointer to an uninitialised variable (which could contain anything). It should actually be a literal value and contain the size of the buffer that you are passing in, IOW it should be the size of the colorref which is 12 bytes. Check here for more details.



diablo2oo2

i have found some code in masm folder. dont remember where. there are some usefull registry functions.



[attachment deleted by admin]