[python-win32] 32bit python on x64 bit machine cannot access registry

Mark Hammond mhammond at skippinet.com.au
Wed Jul 23 09:40:28 CEST 2008


> i cannot access some of the values from registry using
> 32bit python on x64bit machine

See the article at
http://blogs.msdn.com/junfeng/archive/2004/04/05/107433.aspx for an overview
of how the registry works in such systems.  The short story is that you can
combine the value KEY_WOW64_64KEY (==256) with the 'samDesired' paramater to
win32api.RegOpenKey/_winreg.OpenKey and the CreateKey versions.  I've
personally used:

            if
win32process.IsWow64Process(win32process.GetCurrentProcess()):
                reg_flags |= KEY_WOW64_64KEY

to achieve that (which requires pywin32-211)

Hope that helps,

Mark



More information about the python-win32 mailing list