Commit 77684998 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

taskmgr: Show whether the process is running under WOW64.

parent 123c670f
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
static PROCNTQSI pNtQuerySystemInformation = NULL; static PROCNTQSI pNtQuerySystemInformation = NULL;
static PROCGGR pGetGuiResources = NULL; static PROCGGR pGetGuiResources = NULL;
static PROCGPIC pGetProcessIoCounters = NULL; static PROCGPIC pGetProcessIoCounters = NULL;
static PROCISW64 pIsWow64Process = NULL;
static CRITICAL_SECTION PerfDataCriticalSection; static CRITICAL_SECTION PerfDataCriticalSection;
static PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */ static PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */
static PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */ static PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */
...@@ -60,6 +61,7 @@ BOOL PerfDataInitialize(void) ...@@ -60,6 +61,7 @@ BOOL PerfDataInitialize(void)
pNtQuerySystemInformation = (PROCNTQSI)GetProcAddress(GetModuleHandleW(wszNtdll), "NtQuerySystemInformation"); pNtQuerySystemInformation = (PROCNTQSI)GetProcAddress(GetModuleHandleW(wszNtdll), "NtQuerySystemInformation");
pGetGuiResources = (PROCGGR)GetProcAddress(GetModuleHandleW(wszUser32), "GetGuiResources"); pGetGuiResources = (PROCGGR)GetProcAddress(GetModuleHandleW(wszUser32), "GetGuiResources");
pGetProcessIoCounters = (PROCGPIC)GetProcAddress(GetModuleHandleW(wszKernel32), "GetProcessIoCounters"); pGetProcessIoCounters = (PROCGPIC)GetProcAddress(GetModuleHandleW(wszKernel32), "GetProcessIoCounters");
pIsWow64Process = (PROCISW64)GetProcAddress(GetModuleHandleW(wszKernel32), "IsWow64Process");
InitializeCriticalSection(&PerfDataCriticalSection); InitializeCriticalSection(&PerfDataCriticalSection);
...@@ -296,6 +298,8 @@ void PerfDataRefresh(void) ...@@ -296,6 +298,8 @@ void PerfDataRefresh(void)
} }
if (pGetProcessIoCounters) if (pGetProcessIoCounters)
pGetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters); pGetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters);
if (pIsWow64Process)
pIsWow64Process(hProcess, &pPerfData[Idx].Wow64Process);
CloseHandle(hProcess); CloseHandle(hProcess);
} }
pPerfData[Idx].UserTime.QuadPart = pSPI->UserTime.QuadPart; pPerfData[Idx].UserTime.QuadPart = pSPI->UserTime.QuadPart;
...@@ -331,12 +335,16 @@ ULONG PerfDataGetProcessorSystemUsage(void) ...@@ -331,12 +335,16 @@ ULONG PerfDataGetProcessorSystemUsage(void)
BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, int nMaxCount) BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, int nMaxCount)
{ {
static const WCHAR proc32W[] = {' ','*','3','2',0};
BOOL bSuccessful; BOOL bSuccessful;
EnterCriticalSection(&PerfDataCriticalSection); EnterCriticalSection(&PerfDataCriticalSection);
if (Index < ProcessCount) { if (Index < ProcessCount) {
wcsncpy(lpImageName, pPerfData[Index].ImageName, nMaxCount); wcsncpy(lpImageName, pPerfData[Index].ImageName, nMaxCount);
if (pPerfData[Index].Wow64Process &&
nMaxCount - lstrlenW(lpImageName) > 4 /* =lstrlenW(proc32W) */)
lstrcatW(lpImageName, proc32W);
bSuccessful = TRUE; bSuccessful = TRUE;
} else { } else {
bSuccessful = FALSE; bSuccessful = FALSE;
......
...@@ -47,6 +47,7 @@ typedef struct _PERFDATA ...@@ -47,6 +47,7 @@ typedef struct _PERFDATA
TIME UserTime; TIME UserTime;
TIME KernelTime; TIME KernelTime;
BOOL Wow64Process;
} PERFDATA, *PPERFDATA; } PERFDATA, *PPERFDATA;
/* SystemPageFileInformation (18) */ /* SystemPageFileInformation (18) */
...@@ -68,6 +69,7 @@ struct _SYSTEM_PAGEFILE_INFORMATION ...@@ -68,6 +69,7 @@ struct _SYSTEM_PAGEFILE_INFORMATION
typedef LONG (WINAPI *PROCNTQSI)(UINT,PVOID,ULONG,PULONG); typedef LONG (WINAPI *PROCNTQSI)(UINT,PVOID,ULONG,PULONG);
typedef DWORD (WINAPI *PROCGGR)(HANDLE,DWORD); typedef DWORD (WINAPI *PROCGGR)(HANDLE,DWORD);
typedef BOOL (WINAPI *PROCGPIC)(HANDLE,PIO_COUNTERS); typedef BOOL (WINAPI *PROCGPIC)(HANDLE,PIO_COUNTERS);
typedef BOOL (WINAPI *PROCISW64)(HANDLE,PBOOL);
BOOL PerfDataInitialize(void); BOOL PerfDataInitialize(void);
void PerfDataRefresh(void); void PerfDataRefresh(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment