Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9344
Modified Files:
win32process.i
Log Message:
Add win32process.IsWow64Process()
Index: win32process.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32process.i,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** win32process.i 3 Jun 2007 14:53:07 -0000 1.29
--- win32process.i 23 Jul 2007 08:34:04 -0000 1.30
***************
*** 67,70 ****
--- 67,72 ----
typedef DWORD (WINAPI *SetProcessAffinityMaskfunc)(HANDLE, DWORD_PTR);
static SetProcessAffinityMaskfunc pfnSetProcessAffinityMask = NULL;
+ typedef BOOL (WINAPI *IsWow64Processfunc)(HANDLE, PBOOL);
+ static IsWow64Processfunc pfnIsWow64Process = NULL;
#endif
***************
*** 1497,1500 ****
--- 1499,1529 ----
%}
+ // @pyswig bool|IsWow64Process|Determines whether the specified process is running under WOW64.
+ // @rdesc If this function is not provided by the operating system, the
+ // return value is False (ie, a NotImplemented exception will never be thrown).
+ // However, if the function exists but fails, a win32process.error exception
+ // is thrown as normal.
+ %native(IsWow64Process) PyIsWow64Process;
+ %{
+ PyObject *PyIsWow64Process(PyObject *self, PyObject *args)
+ {
+ if (pfnIsWow64Process==NULL)
+ return PyBool_FromLong(FALSE);
+ PyObject *obhprocess;
+ HANDLE hprocess;
+ // @pyparm <o PyHANDLE>|Process||Handle to a process as returned by
+ // <om win32api.OpenProcess>, <om win32api.GetCurrentProcess>, etc
+ if (!PyArg_ParseTuple(args, "O:IsWow64Process", &obhprocess))
+ return NULL;
+ BOOL ret;
+ if (!PyWinObject_AsHANDLE(obhprocess, &hprocess))
+ return NULL;
+ BOOL ok = (*pfnIsWow64Process)(hprocess, &ret);
+ if (!ok)
+ return PyWin_SetAPIError("IsWow64Process");
+ return PyBool_FromLong(ret);
+ }
+ %}
+
#endif // MS_WINCE
***************
*** 1535,1538 ****
--- 1564,1568 ----
pfnSetProcessAffinityMask=(SetProcessAffinityMaskfunc)GetProcAddress(hmodule,"SetProcessAffinityMask");
pfnGetProcessId=(GetProcessIdfunc)GetProcAddress(hmodule, "GetProcessId");
+ pfnIsWow64Process=(IsWow64Processfunc)GetProcAddress(hmodule, "IsWow64Process");
}
|