[psutil] r1261 committed - get_env / Windows: support for 64 bit architectures

2 views
Skip to first unread message

psu...@googlecode.com

unread,
Feb 1, 2012, 6:18:12 PM2/1/12
to psutil-...@googlegroups.com
Revision: 1261
Author: g.rodola
Date: Wed Feb 1 15:17:50 2012
Log: get_env / Windows: support for 64 bit architectures
http://code.google.com/p/psutil/source/detail?r=1261

Modified:
/trunk/psutil/_psmswindows.py
/trunk/psutil/_psutil_mswindows.c

=======================================
--- /trunk/psutil/_psmswindows.py Wed Feb 1 11:05:15 2012
+++ /trunk/psutil/_psmswindows.py Wed Feb 1 15:17:50 2012
@@ -311,8 +311,8 @@
key = line[:pos].upper()
if key:
value = line[pos+1:]
- assert value, line
- ret[key] = value
+ if value:
+ ret[key] = value
return ret

@wrap_exceptions
=======================================
--- /trunk/psutil/_psutil_mswindows.c Wed Feb 1 11:05:15 2012
+++ /trunk/psutil/_psutil_mswindows.c Wed Feb 1 15:17:50 2012
@@ -2038,8 +2038,13 @@
pebAddress = GetPebAddress(processHandle);

// get the address of ProcessParameters
+#ifdef _WIN64
+ if (!ReadProcessMemory(processHandle, (PCHAR)pebAddress + 32,
+ &rtlUserProcParamsAddress, sizeof(PVOID), NULL))
+#else
if (!ReadProcessMemory(processHandle, (PCHAR)pebAddress + 0x10,
&rtlUserProcParamsAddress, sizeof(PVOID), NULL))
+#endif
{
CloseHandle(processHandle);

@@ -2055,8 +2060,13 @@
// 0x48 refers to "Environ" of RTL_USER_PROCESS_PARAMETERS
// Different but related:
//
http://wj32.wordpress.com/2009/01/24/howto-get-the-command-line-of-processes/
+#ifdef _WIN64
+ if (!ReadProcessMemory(processHandle, (PCHAR)rtlUserProcParamsAddress
+ 128,
+ &currentEnv, sizeof(currentEnv), NULL))
+#else
if (!ReadProcessMemory(processHandle, (PCHAR)rtlUserProcParamsAddress
+ 0x48,
&currentEnv, sizeof(currentEnv), NULL))
+#endif
{
CloseHandle(processHandle);
if (GetLastError() == ERROR_PARTIAL_COPY) {

Reply all
Reply to author
Forward
0 new messages