News:

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

Having problems reading keys from the Registry

Started by Lightman, February 25, 2008, 01:51:57 PM

Previous topic - Next topic

Lightman

Hi Everybody,

I have been writing a bit of code to practice reading from the system registry.  I collected a number of examples from this forum and the example files that came with Masm and had a go at my own.  I wanted to open a registry key and then read a value from it.  There is no real objective here; I am just learning the ropes.

In this case I am trying read from the registry. I can open the key OK, but the registry key comes out as being empty. RegEdit tells me otherwise; when I check for myself there is a value there. I am puzzled. Can anyone have a quick look and tell me where I am going wrong?

Attached is my code, It's a RadASM project.

Regards,

Lightman

[attachment deleted by admin]

ToutEnMasm


Many files here,perhaps a little piece of code , a proc with a buffer to receive the key will be less difficult to read.

MichaelW

The attachment is an example that reads the value of:

HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Identifier

In case it's not clear, the Microsoft documentation refers to the lpValueName parameter of RegQueryValueEx, in this case "Identifier", as the name of the value, and "AT/AT COMPATIBLE" is the value.


[attachment deleted by admin]
eschew obfuscation

sebart7

You did 2 small mistakes.
Here is Your code fixed and commented to lets You understand where and why You did mistakes.


[attachment deleted by admin]

Lightman

Thanks Guys,

Now that I have a working version, it's clear where I have been making the mistakes...

I was carefully saving the value returned in eax without realising this is the same register I am checking to see if an error occoured..  :dazzled:

Well, you live and learn...


Regards,

Lightman