[python-win32] python and wow64 filesystem redirection

Tim Roberts timr at probo.com
Tue Jun 23 22:44:24 CEST 2009


Mike Driscoll wrote:
> Guy,
>> Hi all,
>>
>> I have (2003/2008) x64 systems with 32bit python installed, and my
>> code needs access to %SystemRoot%\system32, but the wow64 filesystem
>> redirection thing is in my way.
>> I looked from the *Wow64DisableWow64FsRedirection *function in the
>> win32 extensions, but I can't find it.
>>
>> So, my question is, if that function is implemented in the extensions
>> at all? is there another way to disable the redirection in python? or
>> do I need to write a binary module that disables/enables the
>> redirection?
>>
>>
>> Thanks in advance,
>> Guy
>>
>
> The usual answer is that if PyWin32 doesn't wrap it, do it with
> ctypes. Sometimes Roger or one of the others has some special way of
> accomplishing the task though...

I use this:

import ctypes
k32 = ctypes.windll.kernel32
wow64 = ctypes.c_long( 0 )
k32.Wow64DisableWow64FsRedirection( ctypes.byref(wow64) )
# ... do stuff ...
k32.Wow64EnableWow64FsRedirection( wow64 )

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list