Windows – Change 64bit Registry from 32bit Python

32bit-64bitpythonwindows

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: http://msdn.microsoft.com/en-us/library/aa384129%28v=VS.85%29.aspx

But how do I use it with the following code? http://www.blog.pythonlibrary.org/2010/03/20/pythons-_winreg-editing-the-windows-registry/

Thanks, Oz

Best Answer

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.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms724072(v=vs.85).aspx

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.

code

Related Topic