I am very new to asm and when it comes to querying a registry value, DWORD in my case,
I'm absolutely lost. I was able to build a little function with the help of about 5 different examples.
Of course I know I'm doing something wrong because I always get an empty value.
This code is a simple variation, 99%, from Mincho Georgiev's registry class, the only problem is
when I use the original class from Mincho Georgiev I get an error saying 'return' is unidentified
or something to that extent.
ReadDWORD proc hKey:HKEY, subKey:DWORD, dwValue:DWORD
LOCAL phkResult :DWORD
LOCAL dwDisp :DWORD
LOCAL dwSize :DWORD
LOCAL regType :DWORD
LOCAL lpData :DWORD
invoke RegCreateKeyEx, hKey, subKey, NULL,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
addr phkResult,
addr dwDisp
.if eax == ERROR_SUCCESS
mov eax, REG_DWORD
mov regType, eax
invoke RegQueryValueEx, phkResult, dwValue, NULL,
addr regType,
addr lpData,
addr dwSize
invoke RegCloseKey, phkResult
.endif
ret
ReadDWORD endp
Any help in the right direction would be an absolute god send!!
The type is a return not a parameter, you can use NULL if you don't need to know the returned type. The second parameter is a value name, always a pointer to a string or NULL if you want the default...
mov [dwSize], 4 // Set the size of the return buffer
invoke RegQueryValueEx, [phkResult], NULL, NULL, NULL, addr lpData, addr dwSize
Hi Ghosts, welcome to the forum.
Please try the search box near the top-left of the page, chances are very good that most questions have already been asked. Here is one example from several years ago:
http://www.masm32.com/board/index.php?topic=2620.0