Sign in to follow this  
Followers 0
markloman

Bug In Regenumkey Under X64

4 posts in this topic

#1 ·  Posted (edited)

I am building x64-Bit support for my AntiSpyware tool Hitman Pro. I stumbled upon a problem with RegEnumKey. Under X86 it runs fine but when I run it under X64 I only get the first subkey (tested with the latest AutoIt beta, version 3.1.1.119). Below an example from the AutoIt documentation:

X86: (HKCR\Installer\Products)

For $i= 1 to 10
    $var = RegEnumKey("HKCR\Installer\Products", $i)
    If @error <> 0 then ExitLoop
    MsgBox(4096, "SubKey #" & $i & " under HKCR\Installer\Products: ", $var)
Next

Running on X64: (HKCR64\Installer\Products)

For $i= 1 to 10
    $var = RegEnumKey("HKCR64\Installer\Products", $i)
    If @error <> 0 then ExitLoop
    MsgBox(4096, "SubKey #" & $i & " under HKCR64\Installer\Products: ", $var)
Next

There are at least 20 subkeys unders the keyname. After the first instance, RegEnumKey returns -1: unable to retrieve requested subkey (key instance out of range).

Anyone here who can help?

Edited by markloman

Share this post


Link to post
Share on other sites



I reproduce your problem but I will need sometime to fix it as I have very small access to machine running 64-bit windows edition.

Stay tune :think:

Share this post


Link to post
Share on other sites

I don't know if I can do more than don't use the HKCR64\Installer\Products but use the HKLM64\Software\Classes\Installer\Products.

I read the MSDN doc and it seems that some keys as HKCR64 cannot be enumerated correctly from a 32-bit process as AutoIt is.

For me it is a kind of Windows bug but as HKCR64 is an alias of HKLM64\Software\Classes use the direct key.

Tell me if it works in your case. :think:

Share this post


Link to post
Share on other sites

I don't know if I can do more than don't use the HKCR64\Installer\Products but use the HKLM64\Software\Classes\Installer\Products.

I read the MSDN doc and it seems that some keys as HKCR64 cannot be enumerated correctly from a 32-bit process as AutoIt is.

For me it is a kind of Windows bug but as HKCR64 is an alias of HKLM64\Software\Classes use the direct key.

Tell me if it works in your case. :(

I have changed the code from HKCR64\... to HKLM64\SOFTWARE\Classes\... and it works! Thanks-a-million! :)

Regards, Mark

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0