Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having difficulty do understand this. If I'm correct, A 32bit Python can't run a code and change registry values in 64bit. Do I get it right? Or is there a switch to turn on in which enables this functionality?

There is this:

But how do I use it with the following code?

Thanks, Oz

share|improve this question
You should just be able to replace KEY_ALL_ACCESS with (KEY_ALL_ACCESS <bitwise or> KEY_WOW64_64KEY). If KEY_WOW64_64KEY isn't defined, use the explicit value 0x0100. – Harry Johnston Dec 15 '11 at 20:51
replace where? what is Flag in Windows terminology??? – Oz123 Dec 16 '11 at 10:46
Where the existing code says KEY_ALL_ACCESS. A flag is a parameter, or a single bit in a parameter, which changes the behaviour of a function call. – Harry Johnston Jan 9 '12 at 22:27
up vote -1 down vote accepted

edit: Sorry, I misunderstood the question. Do the flag thing. :p

If you are on a 64bit operating system, you will have a "folder" in the HKLM\Software and HKCU\Software keys named Wow6432Node. That is like a junction point that allows Windows to maintain backwards compatibility across architectures, and basically transparently redirects the 32bit program that is accessing the registry.

So even if you are executing 32bit code, if you are on a 64bit version of Windows, modifying HKLM\Software\Mysoftware is the 64bit registry. If you needed to modify the 32bit registry, it would HKLM\Software\Wow6432Node\MySoftware.

Here I am about to set 32bit ODBC connections, even on a 64bit OS. It also works on a 32bit OS. No flag setting is required. This code works.


share|improve this answer
-1, this is wrong. 32-bit code accessing HKLM\Software\Mysoftware is NOT modifying the 64-bit registry, it is transparently redirected to HKLM\Software\Wow6432Node\MySoftware unless you explicitly specify KEY_WOW64_64KEY. – Harry Johnston Jan 9 '12 at 6:04
While I appreciate your candorous downvote, this 32bit code 100% works on both 32bit and 64bit versions of Windows. When on a 64bit OS you just have to be mindful of whether the key you want is actually down Wow6432Node or not. No flag-setting is required. I did not say that playing with the KEY_WOW64_64KEY flags will not work or is not an alternative, I'm just saying that you do not have to do it that way. If it was my wording that you disagreed with, then let the code speak for itself. – Ryan Ries Jan 9 '12 at 14:20
@RyanRies You should replace the screenshot of code with a code block containing the code. – jscott Jan 9 '12 at 14:23
You don't need to set a flag if you're wanting to write to the 32-bit view, from either 32-bit or 64-bit apps. But this question is about writing to the 64-bit view from a 32-bit app. So, depending on interpretation, your answer is either wrong or irrelevant to the question. – Harry Johnston Jan 9 '12 at 22:01
Regarding your code fragment: assuming this is meant to be 32-bit code as stated, you don't need to use Wow6432Node. The two paths are equivalent, so the if statement is redundant. – Harry Johnston Jan 9 '12 at 22:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.