From 97333885a0cc20da5794cb47e466d4a9dd9f75e4 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Tue, 13 Apr 2010 09:40:22 +0000 Subject: [PATCH] client: Add code for determining non-BOINC CPU time for GR and PtP clients (Mac & Windows) svn path=/trunk/boinc/; revision=21170 --- lib/procinfo_win.cpp | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/lib/procinfo_win.cpp b/lib/procinfo_win.cpp index 123f55e915..ec73ffe46d 100644 --- a/lib/procinfo_win.cpp +++ b/lib/procinfo_win.cpp @@ -9,11 +9,6 @@ using std::vector; -// Possible values of iBrandId: -#define BOINC_BRAND_ID 0 -#define GRIDREPUBLIC_BRAND_ID 1 -#define PROGRESSTHRUPROCESSORS_BRAND_ID 2 - // NtQuerySystemInformation typedef NTSTATUS (WINAPI *tNTQSI)( ULONG SystemInformationClass, @@ -74,22 +69,10 @@ int get_procinfo_XP(vector& pi) { PVOID pBuffer = NULL; PSYSTEM_PROCESSES pProcesses = NULL; static DWORD pid = 0; - static long iBrandID = -1; if (!pid) { pid = GetCurrentProcessId(); } - - if (iBrandID < 0) { - iBrandID = BOINC_BRAND_ID; - if (boinc_file_exists("gridrepublic.exe")) { - iBrandID = GRIDREPUBLIC_BRAND_ID; - } else - if (boinc_file_exists("progressthruprocessors.exe")) { - iBrandID = PROGRESSTHRUPROCESSORS_BRAND_ID; - } - } - #if 0 printf("FILETIME: %d\n", sizeof(FILETIME)); printf("LARGE_INTEGER: %d\n", sizeof(LARGE_INTEGER)); @@ -122,19 +105,16 @@ int get_procinfo_XP(vector& pi) { ); p.is_boinc_app = (p.id == pid) || (strcasestr(p.command, "boinc") != NULL); - switch (iBrandID) { - case GRIDREPUBLIC_BRAND_ID: - if (strcasestr(p.command, "gridrepublic") != NULL) { - p.is_boinc_app = true; - } - break; - case PROGRESSTHRUPROCESSORS_BRAND_ID: - if (strcasestr(p.command, "progressthruprocessors") != NULL) { - p.is_boinc_app = true; - } - break; +#ifdef _GRIDREPUBLIC + if (strcasestr(p.command, "gridrepublic") != NULL) { + p.is_boinc_app = true; } - +#endif +ifdef _PROGRESSTHRUPROCESSORS + if (strcasestr(p.command, "progressthruprocessors") != NULL) { + p.is_boinc_app = true; + } +#endif pi.push_back(p); if (!pProcesses->NextEntryDelta) { break;