From 18aafad258d2903f18e08cbcdcec74e27899e6af Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 11 Sep 2006 17:32:18 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11137 --- checkin_notes | 5 +++++ lib/procinfo_win.C | 41 +++++++---------------------------------- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/checkin_notes b/checkin_notes index d48756b673..5a12c855ef 100755 --- a/checkin_notes +++ b/checkin_notes @@ -10117,4 +10117,9 @@ Bruce 10 Sept 2006 db_dump.C validator.C +David 11 Sept 2006 + - core client: code to get mem usage should now work on all versions + of Windows (it's a no-op on 9X, ME) + lib/ + procinfo_win.C diff --git a/lib/procinfo_win.C b/lib/procinfo_win.C index e550a1fa61..c714e3b3a3 100644 --- a/lib/procinfo_win.C +++ b/lib/procinfo_win.C @@ -11,9 +11,6 @@ typedef NTSTATUS (WINAPI *tNTQSI)( PULONG ReturnLength ); -// OpenThread -typedef HANDLE (WINAPI *tOT)(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId); - static int get_process_information(PVOID* ppBuffer, PULONG pcbBuffer) { int retval = 0; NTSTATUS Status = STATUS_INFO_LENGTH_MISMATCH; @@ -49,15 +46,13 @@ static int get_process_information(PVOID* ppBuffer, PULONG pcbBuffer) { return retval; } +// Note: the following will work on both NT and XP, +// because the NT process structure differs only at the end +// int get_procinfo_XP(vector& pi) { ULONG cbBuffer = 32*1024; // 32k initial buffer PVOID pBuffer = NULL; PSYSTEM_PROCESSES pProcesses = NULL; - HMODULE hKernel32Lib; - tOT pOT = NULL; - - hKernel32Lib = GetModuleHandle("kernel32.dll"); - pOT = (tOT) GetProcAddress( hKernel32Lib, "OpenThread" ); get_process_information(&pBuffer, &cbBuffer); pProcesses = (PSYSTEM_PROCESSES)pBuffer; @@ -84,12 +79,6 @@ int get_procinfo_XP(vector& pi) { if (pBuffer) HeapFree(GetProcessHeap(), NULL, pBuffer); return 0; } -int get_procinfo_NT(vector&) { - return 0; -} -int get_procinfo_9X(vector&) { - return 0; -} // get a list of all running processes. // @@ -103,27 +92,11 @@ int procinfo_setup(vector& pi) { switch(osvi.dwPlatformId) { case VER_PLATFORM_WIN32_WINDOWS: // Win95, Win98, WinME - return get_procinfo_9X(pi); + return 0; // not supported case VER_PLATFORM_WIN32_NT: - switch(osvi.dwMajorVersion) { - case 4: - // WinNT 4.0 - return get_procinfo_NT(pi); - case 5: - // Win2k, WinXP, Win2k3 - return get_procinfo_XP(pi); - case 6: - if (osvi.dwMinorVersion == 0) { - // WinVista - return get_procinfo_XP(pi); - } else { - return get_procinfo_9X(pi); - } - default: - return get_procinfo_9X(pi); - } + return get_procinfo_XP(pi); } - return get_procinfo_9X(pi); + return 0; } // scan the process table from the given point, @@ -167,4 +140,4 @@ void procinfo_other(PROCINFO& pi, vector& piv) { p.is_boinc_app = true; } } -} \ No newline at end of file +}