Click here to Skip to main content
14,667,169 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am writing keys to the registry using a .reg file. The keys are deemed to go to

on my Windows 7 64 bits machine, this works fine. I can read the keys using RegOpenKeyEx(..., KEY_READ | KEY_WOW64_64KEY, ...).

Anyway, on another Windows 7 64 bits, they go to the 32 bits reflected part of the registry

instead. In this case I need to use RegOpenKeyEx(..., KEY_READ | KEY_WOW64_32KEY, ...).

The .reg file simply goes like this:
Windows Registry Editor Version 5.00
"ComputerName"="Computer Name"

I cannot figure out what causes the different behaviors on similar machines.

Any hint ?
Updated 2-Feb-12 0:23am

Rate this:
Please Sign up or sign in to vote.

Solution 1

I think you may need to remove the KEY_WOW64_64KEY selector; see here[^] for Microsoft's explanation of these features.
YvesDaoust 2-Feb-12 6:52am
I agree with that, but I still want to understand what causes the redirection on one machine and not on the other.

BTW: I haven't solved this.
Richard MacCutchan 2-Feb-12 6:59am
Read the Microsoft documentation: not that it really explains it clearly. The whole 32/64 implementation has been what we in the UK would call a bit of a dog's breakfast.
Rate this:
Please Sign up or sign in to vote.

Solution 2

1) the .REG file has nothing to do with where the symbol goes with respect to the WOW / 64 bit redirection.

2) the application that *processes* the .REG file will end up being the determining factor.

3) if you ran the REG file through regedit32, it will go into the WOW redirected area. If you ran it through regedit64 (or the default regedit application), it will go into the normal location.

4) You should *not* be coding WOW keys directly. If your code has to know if the key is redirected or not, then you are mixing 32 and 64 bit applications which can happen but it rare enough that all you'll end up doing is confusing yourself. Windows will figure out where to look based on the "bitness" of your application.
YvesDaoust 2-Feb-12 8:06am
1) I agree with that
2) with that too
3) the same regedit.exe is run in both cases (the file associations were left as default on both machines), this is what makes the case unintelligible
4) this is exactly what I would like to avoid, I don't want this redirection

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100