[2.8.10] Problem with wxRegKey on 64bit Windows

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

[2.8.10] Problem with wxRegKey on 64bit Windows

Post by JohnD »

As far as I can tell, wxRegKey makes no allowance for 32 bit apps running on 64 bit Windows, accessing redirected keys through WOW64. Can anyone verify this, and tell me if I simply need to use plain Win32?

For instance I see wxRegKey::Open calls Win32 function RegOpenKeyEx but lacks that one little detail.

edit: also what's wrong with my URL tags?
Taamalus
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Dec 09, 2009 3:31 pm
Location: Toronto

Re: [2.8.10] Problem with wxRegKey on 64bit Windows

Post by Taamalus »

JohnD wrote:As far as I can tell, wxRegKey makes no allowance for 32 bit apps running on 64 bit Windows, accessing redirected keys through WOW64. Can anyone verify this, and tell me if I simply need to use plain Win32?

For instance I see wxRegKey::Open calls Win32 function RegOpenKeyEx but lacks that one little detail.

edit: also what's wrong with my URL tags?
Your assumption is correct. If you make a 32 bit app, the current wxRegKey will work as is (plain Win32).

If you plan to make 64 bit apps, and since you are comfortable with the Registry to begin with, why not write your own class?

As for the url tags, nothing is wrong, except the addresses contain "(xyz)" - very unusual, and is not supported by phpbb.
... time waits for no one
Hank
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Post by JohnD »

It's a 32-bit app. The problem comes when it's run on a 64-bit version of Windows, certain keys are not being found, most notably HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductId which is the Windows serial number. The whole thing is a bit confusing.

I'd prefer not to totally roll my own, maybe the existing wxRegKey can be copied/derived to a new class instead.

However if wx wants to fully expose the registry functionality, can I find anywhere to request it for the future?
Taamalus
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Dec 09, 2009 3:31 pm
Location: Toronto

Post by Taamalus »

JohnD wrote:It's a 32-bit app. The problem comes when it's run on a 64-bit version of Windows, certain keys are not being found, most notably HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductId which is the Windows serial number. The whole thing is a bit confusing.

I'd prefer not to totally roll my own, maybe the existing wxRegKey can be copied/derived to a new class instead.

However if wx wants to fully expose the registry functionality, can I find anywhere to request it for the future?
Here is the solution for your specific problem. Please note this works with Visual Studio Pro. :!:

The catch: wxWidgets is open source and caters to most Operating Systems; and your problem is very Windows specific. Since you don't want to do it alone, hang out at the source ( Windows forums ) for the x86 to 64 bit issues. It will take time to enhance any registry class in the open community, and this specific problem will probably never be in any class. :wink:

Now I have a question for you: Which IDE/Compiler are you using?
... time waits for no one
Hank
modoran
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 23, 2010 1:31 pm
Location: Romania
Contact:

Post by modoran »

Functions like RegQueryValueEx() (exposed by advapi32.dll) are available in any windows compiler, no need for visual studio pro.
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Post by JohnD »

Taamalus wrote: Here is the solution for your specific problem. Please note this works with Visual Studio Pro. :!:

The catch: wxWidgets is open source and caters to most Operating Systems; and your problem is very Windows specific. Since you don't want to do it alone, hang out at the source ( Windows forums ) for the x86 to 64 bit issues. It will take time to enhance any registry class in the open community, and this specific problem will probably never be in any class. :wink:

Now I have a question for you: Which IDE/Compiler are you using?
That is just standard MSW API. The problem and the solution is well understood in terms of Win32 API - the issue is only that wx class doesn't expose this.
wx is cross-platform... mainly. It has lots of platform-specific functionality to make it a good choice even if you are only writing apps for one platform. wxRegKey class is entirely MSW-specific, it doesn't exist on other platforms at all. However I'd agree this issue would probably not be high priority... though running 32bit Windows apps on 64 bit Windows is very common.

Our current plan is to make a subclass of wxRegKey and override the 2 or 3 methods which call the Win32 API so we can gain fuller control.
Post Reply