32bit masm app reading from 64bit registry

Started by ChillyWilly, January 22, 2010, 12:04:39 AM

Previous topic - Next topic

ChillyWilly

which version of windows are you guys running?

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.

dacid

ChillyWilly .. I have the same problem here. If I use KEY_WOW64_64KEY I get an error 5 = "access denied" and if I dont use it, I can open the key but I cant read the value (error 2 = DONT_FOUND). I tried running as an Administrator and Disabling UAC with no sucess. Im on Windows 7 x64.

Let me know if you found what the problem is and the solution...

ChillyWilly

yea thats where im at too
not sure how its working on sinsi if its not working on us

GregL

It works for me if I remove the KEY_WOW64_64KEY.  Windows 7 Pro x64 retail.

ChillyWilly

what about reading the digitalproductid key?

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
DigitalProductId

GregL

#21
Quotewhat about reading the digitalproductid key?

Not without modifying your code quite a bit.  I can read it with PowerShell since I already had a script to do that. Good for retrieving the Windows Product Key.


sinsi

DigitalProductId is REG_BINARY, not REG_SZ, so yeah lots of modification to your code.
Light travels faster than sound, that's why some people seem bright until you hear them.

ChillyWilly

ok ill try to whip something up tomorrow and test it and ill post back if its not working

dacid

I have problems reading the "DigitalProductId"... the code works on Windows XP SP3 (x86) and Windows Vista SP2 (x86)... so it doesnt work in 64 bits Windows. Still dunno why.

I tried opening the key with:  KEY_QUERY_VALUE, KEY_READ and KEY_ALL_ACCESS and reading the "DigitalPRoductId" with REG_BINARY and REG_DWORD and as I said it works ok in 32 bits but fails in 64bits:

If I use KEY_WOW64_64KEY to open the key I get an error 5 = "access denied" and if I dont use it, I can open the key but I cant read the value "DigitalProductId" (error 2 = DONT_FOUND).

dedndave

i would be curious to see the results of the last attachment in this post...

http://www.masm32.com/board/index.php?topic=11963.msg90835#msg90835

if you browse through that thread, there are posted results from 64-bit OS's

dacid


DednDave OS Info Dump Ver 2.03

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 7 Ultimate"
"CurrentVersion"="6.1"
"CurrentBuildNumber"="7600"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="7600.win7_rtm.090713-1255"
"ProductId"=(Value not found)

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="6.0"

OSVERSIONINFOEX Structure:

       Version.Build: 6.1.7600
         Platform ID: Win32 on Windows NT
         CSD Version:
Service Pack Version: 0.0
          Suite Mask: 0000000100000000
        Product Type: Windows 2000 Pro/XP/Vista Workstation

Press any key to exit



Im seeing right now the ProductId value in Regedit...  :eek

Im reading a lot on info online and in all examples they use KEY_WOW64_64KEY with success... why we get the "permission denied" error? ...

dedndave

that's what i mean - lol
i didn't do anything special in that program - i am pretty sure the source code is there   :bg

dacid

All people with 64 bits posted:  "ProductId"=(Value not found)

You need to use KEY_WOW64_64KEY  when open the key... but, at least here, I get the error code = 5 (access denied)

dedndave