- MGR/CLI: remove direct references to CreateEnvironmentBlock and

DestroyEnvironmentBlock since Win98 doesn't support them. This
        functionality is only required for the Windows sandbox implementation
        anyway.
    - LIB: Remove direct reference to OpenThread in win_util.C since it
        isn't supported on Win98.
    - MGR: Another fix for CC execution on a Linux machine.
        
    client/
        app_start.C
    clientgui/
        BOINCClientManager.cpp
    lib/
        proc_control.C
        win_util.C

svn path=/trunk/boinc/; revision=15117
This commit is contained in:
Rom Walton 2008-05-02 15:59:37 +00:00
parent d9645557a5
commit 3dc77154e5
7 changed files with 389 additions and 296 deletions

View File

@ -3511,3 +3511,20 @@ David May 1 2008
coproc.C coproc.C
sched/ sched/
sched_send.C sched_send.C
Rom May 2 2008
- MGR/CLI: remove direct references to CreateEnvironmentBlock and
DestroyEnvironmentBlock since Win98 doesn't support them. This
functionality is only required for the Windows sandbox implementation
anyway.
- LIB: Remove direct reference to OpenThread in win_util.C since it
isn't supported on Win98.
- MGR: Another fix for CC execution on a Linux machine.
client/
app_start.C
clientgui/
BOINCClientManager.cpp
lib/
proc_control.C
win_util.C

View File

@ -77,6 +77,18 @@ using std::vector;
#include "app.h" #include "app.h"
#ifdef _WIN32
// Dynamically link to these functions at runtime, otherwise BOINC
// cannot run on Win98
// CreateEnvironmentBlock
typedef BOOL (WINAPI *tCEB)(LPVOID *lpEnvironment, HANDLE hToken, BOOL bInherit);
// DestroyEnvironmentBlock
typedef BOOL (WINAPI *tDEB)(LPVOID lpEnvironment);
#endif
// Goes through an array of strings, and prints each string // Goes through an array of strings, and prints each string
// //
#ifndef _WIN32 #ifndef _WIN32
@ -514,8 +526,18 @@ int ACTIVE_TASK::start(bool first_time) {
for (i=0; i<5; i++) { for (i=0; i<5; i++) {
if (sandbox_account_service_token != NULL) { if (sandbox_account_service_token != NULL) {
// Find CreateEnvironmentBlock/DestroyEnvironmentBlock pointers
tCEB pCEB = NULL;
tDEB pDEB = NULL;
HMODULE hUserEnvLib = NULL;
if (!CreateEnvironmentBlock(&environment_block, sandbox_account_service_token, FALSE)) { hUserEnvLib = LoadLibrary("userenv.dll");
if (hUserEnvLib) {
pCEB = (tCEB) GetProcAddress(hUserEnvLib, "CreateEnvironmentBlock");
pDEB = (tDEB) GetProcAddress(hUserEnvLib, "DestroyEnvironmentBlock");
}
if (!pCEB(&environment_block, sandbox_account_service_token, FALSE)) {
if (log_flags.task) { if (log_flags.task) {
windows_error_string(error_msg, sizeof(error_msg)); windows_error_string(error_msg, sizeof(error_msg));
msg_printf(result->project, MSG_INFO, msg_printf(result->project, MSG_INFO,
@ -546,7 +568,7 @@ int ACTIVE_TASK::start(bool first_time) {
); );
} }
if (!DestroyEnvironmentBlock(environment_block)) { if (!pDEB(environment_block)) {
if (log_flags.task) { if (log_flags.task) {
windows_error_string(error_msg, sizeof(error_msg)); windows_error_string(error_msg, sizeof(error_msg));
msg_printf(result->project, MSG_INFO, msg_printf(result->project, MSG_INFO,
@ -555,6 +577,12 @@ int ACTIVE_TASK::start(bool first_time) {
} }
} }
if (hUserEnvLib) {
pCEB = NULL;
pDEB = NULL;
FreeLibrary(hUserEnvLib);
}
} else { } else {
if (CreateProcess( if (CreateProcess(
exec_path, exec_path,

View File

@ -144,6 +144,8 @@ bool CBOINCClientManager::IsBOINCCoreRunning() {
bool CBOINCClientManager::StartupBOINCCore() { bool CBOINCClientManager::StartupBOINCCore() {
wxLogTrace(wxT("Function Start/End"), wxT("CMainDocument::CachedStateUpdate - Function Begin"));
bool bReturnValue = false; bool bReturnValue = false;
wxString strExecute = wxEmptyString; wxString strExecute = wxEmptyString;
@ -182,6 +184,9 @@ bool CBOINCClientManager::StartupBOINCCore() {
szDataDirectory = (LPTSTR)wxGetApp().GetDataDirectory().c_str(); szDataDirectory = (LPTSTR)wxGetApp().GetDataDirectory().c_str();
} }
fprintf(stderr, "CMainDocument::CachedStateUpdate - szExecute '%s'\n", szExecute);
fprintf(stderr, "CMainDocument::CachedStateUpdate - szDataDirectory '%s'\n", szDataDirectory);
bProcessStarted = CreateProcess( bProcessStarted = CreateProcess(
NULL, NULL,
szExecute, szExecute,
@ -257,7 +262,7 @@ bool CBOINCClientManager::StartupBOINCCore() {
#else // Unix based systems #else // Unix based systems
// Append boinc.exe to the end of the strExecute string and get ready to rock // Append boinc.exe to the end of the strExecute string and get ready to rock
strExecute = wxT("boinc -redirectio -launched_by_manager"); strExecute = wxT("./boinc -redirectio -launched_by_manager");
if (!g_use_sandbox) { if (!g_use_sandbox) {
strExecute += wxT(" -insecure"); strExecute += wxT(" -insecure");
} }
@ -271,6 +276,7 @@ bool CBOINCClientManager::StartupBOINCCore() {
bReturnValue = true; bReturnValue = true;
} }
wxLogTrace(wxT("Function Start/End"), wxT("CMainDocument::CachedStateUpdate - Function End"));
return bReturnValue; return bReturnValue;
} }

View File

@ -1,286 +1,311 @@
// Berkeley Open Infrastructure for Network Computing // Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu // http://boinc.berkeley.edu
// Copyright (C) 2008 University of California // Copyright (C) 2008 University of California
// //
// This is free software; you can redistribute it and/or // This is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; // License as published by the Free Software Foundation;
// either version 2.1 of the License, or (at your option) any later version. // either version 2.1 of the License, or (at your option) any later version.
// //
// This software is distributed in the hope that it will be useful, // This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details. // See the GNU Lesser General Public License for more details.
// //
// To view the GNU Lesser General Public License visit // To view the GNU Lesser General Public License visit
// http://www.gnu.org/copyleft/lesser.html // http://www.gnu.org/copyleft/lesser.html
// or write to the Free Software Foundation, Inc., // or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Code to run a BOINC application (main or graphics) under Windows // Code to run a BOINC application (main or graphics) under Windows
// Don't include this in applications // Don't include this in applications
#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) #if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
#include "boinc_win.h" #include "boinc_win.h"
#endif #endif
#include <string> #include <string>
#include "win_util.h" #include "win_util.h"
#include "filesys.h" #include "filesys.h"
#include "error_numbers.h" #include "error_numbers.h"
#include "common_defs.h" #include "common_defs.h"
#include "util.h" #include "util.h"
#include "parse.h" #include "parse.h"
#include "base64.h" #include "base64.h"
using std::string; using std::string;
HANDLE sandbox_account_interactive_token = NULL; HANDLE sandbox_account_interactive_token = NULL;
HANDLE sandbox_account_service_token = NULL; HANDLE sandbox_account_service_token = NULL;
void get_sandbox_account_interactive_token() { void get_sandbox_account_interactive_token() {
FILE* f; FILE* f;
char buf[256]; char buf[256];
std::string encoded_username_str; std::string encoded_username_str;
std::string encoded_password_str; std::string encoded_password_str;
std::string username_str; std::string username_str;
std::string domainname_str; std::string domainname_str;
std::string password_str; std::string password_str;
int retval = 0; int retval = 0;
static bool first=true; static bool first=true;
PSID sandbox_account_sid = NULL; PSID sandbox_account_sid = NULL;
if (!first) return; if (!first) return;
first = false; first = false;
f = fopen(CLIENT_AUTH_FILENAME, "r"); f = fopen(CLIENT_AUTH_FILENAME, "r");
if (!f) return; if (!f) return;
while (fgets(buf, 256, f)) { while (fgets(buf, 256, f)) {
if (parse_str(buf, "<username>", encoded_username_str)) continue; if (parse_str(buf, "<username>", encoded_username_str)) continue;
if (parse_str(buf, "<password>", encoded_password_str)) continue; if (parse_str(buf, "<password>", encoded_password_str)) continue;
} }
fclose(f); fclose(f);
password_str = r_base64_decode(encoded_password_str); password_str = r_base64_decode(encoded_password_str);
if (string::npos != encoded_username_str.find('\\')) { if (string::npos != encoded_username_str.find('\\')) {
domainname_str = encoded_username_str.substr( domainname_str = encoded_username_str.substr(
0, encoded_username_str.find('\\') 0, encoded_username_str.find('\\')
); );
username_str = encoded_username_str.substr( username_str = encoded_username_str.substr(
encoded_username_str.rfind(_T('\\')) + 1, encoded_username_str.rfind(_T('\\')) + 1,
encoded_username_str.length() - encoded_username_str.rfind(_T('\\')) - 1 encoded_username_str.length() - encoded_username_str.rfind(_T('\\')) - 1
); );
retval = LogonUser( retval = LogonUser(
(char*) username_str.c_str(), (char*) username_str.c_str(),
(char*) domainname_str.c_str(), (char*) domainname_str.c_str(),
(char*) password_str.c_str(), (char*) password_str.c_str(),
LOGON32_LOGON_INTERACTIVE, LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT, LOGON32_PROVIDER_DEFAULT,
&sandbox_account_interactive_token &sandbox_account_interactive_token
); );
if (retval) { if (retval) {
GetAccountSid(domainname_str.c_str(), username_str.c_str(), &sandbox_account_sid); GetAccountSid(domainname_str.c_str(), username_str.c_str(), &sandbox_account_sid);
} }
} else { } else {
username_str = encoded_username_str; username_str = encoded_username_str;
retval = LogonUser( retval = LogonUser(
(char*) username_str.c_str(), (char*) username_str.c_str(),
NULL, NULL,
(char*) password_str.c_str(), (char*) password_str.c_str(),
LOGON32_LOGON_INTERACTIVE, LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT, LOGON32_PROVIDER_DEFAULT,
&sandbox_account_interactive_token &sandbox_account_interactive_token
); );
if (retval) { if (retval) {
GetAccountSid(NULL, username_str.c_str(), &sandbox_account_sid); GetAccountSid(NULL, username_str.c_str(), &sandbox_account_sid);
} }
} }
if (!retval) { if (!retval) {
sandbox_account_interactive_token = NULL; sandbox_account_interactive_token = NULL;
sandbox_account_sid = NULL; sandbox_account_sid = NULL;
} else { } else {
// Adjust the permissions on the current desktop and window station // Adjust the permissions on the current desktop and window station
// to allow the sandbox user account to create windows and such. // to allow the sandbox user account to create windows and such.
// //
if (!AddAceToWindowStation(GetProcessWindowStation(), sandbox_account_sid)) { if (!AddAceToWindowStation(GetProcessWindowStation(), sandbox_account_sid)) {
fprintf(stderr, "Failed to add ACE to current WindowStation\n"); fprintf(stderr, "Failed to add ACE to current WindowStation\n");
} }
if (!AddAceToDesktop(GetThreadDesktop(GetCurrentThreadId()), sandbox_account_sid)) { if (!AddAceToDesktop(GetThreadDesktop(GetCurrentThreadId()), sandbox_account_sid)) {
fprintf(stderr, "Failed to add ACE to current Desktop\n"); fprintf(stderr, "Failed to add ACE to current Desktop\n");
} }
} }
} }
void get_sandbox_account_service_token() { void get_sandbox_account_service_token() {
FILE* f; FILE* f;
char buf[256]; char buf[256];
std::string encoded_username_str; std::string encoded_username_str;
std::string encoded_password_str; std::string encoded_password_str;
std::string username_str; std::string username_str;
std::string domainname_str; std::string domainname_str;
std::string password_str; std::string password_str;
int retval = 0; int retval = 0;
static bool first=true; static bool first=true;
if (!first) return; if (!first) return;
first = false; first = false;
f = fopen(CLIENT_AUTH_FILENAME, "r"); f = fopen(CLIENT_AUTH_FILENAME, "r");
if (!f) return; if (!f) return;
while (fgets(buf, 256, f)) { while (fgets(buf, 256, f)) {
if (parse_str(buf, "<username>", encoded_username_str)) continue; if (parse_str(buf, "<username>", encoded_username_str)) continue;
if (parse_str(buf, "<password>", encoded_password_str)) continue; if (parse_str(buf, "<password>", encoded_password_str)) continue;
} }
fclose(f); fclose(f);
password_str = r_base64_decode(encoded_password_str); password_str = r_base64_decode(encoded_password_str);
if (string::npos != encoded_username_str.find('\\')) { if (string::npos != encoded_username_str.find('\\')) {
domainname_str = encoded_username_str.substr( domainname_str = encoded_username_str.substr(
0, encoded_username_str.find('\\') 0, encoded_username_str.find('\\')
); );
username_str = encoded_username_str.substr( username_str = encoded_username_str.substr(
encoded_username_str.rfind(_T('\\')) + 1, encoded_username_str.rfind(_T('\\')) + 1,
encoded_username_str.length() - encoded_username_str.rfind(_T('\\')) - 1 encoded_username_str.length() - encoded_username_str.rfind(_T('\\')) - 1
); );
retval = LogonUser( retval = LogonUser(
(char*) username_str.c_str(), (char*) username_str.c_str(),
(char*) domainname_str.c_str(), (char*) domainname_str.c_str(),
(char*) password_str.c_str(), (char*) password_str.c_str(),
LOGON32_LOGON_SERVICE, LOGON32_LOGON_SERVICE,
LOGON32_PROVIDER_DEFAULT, LOGON32_PROVIDER_DEFAULT,
&sandbox_account_service_token &sandbox_account_service_token
); );
} else { } else {
username_str = encoded_username_str; username_str = encoded_username_str;
retval = LogonUser( retval = LogonUser(
(char*) username_str.c_str(), (char*) username_str.c_str(),
NULL, NULL,
(char*) password_str.c_str(), (char*) password_str.c_str(),
LOGON32_LOGON_SERVICE, LOGON32_LOGON_SERVICE,
LOGON32_PROVIDER_DEFAULT, LOGON32_PROVIDER_DEFAULT,
&sandbox_account_service_token &sandbox_account_service_token
); );
} }
if (!retval) { if (!retval) {
sandbox_account_service_token = NULL; sandbox_account_service_token = NULL;
} }
} }
// Run application, Windows. // Run application, Windows.
// chdir into the given directory, and run a program there. // chdir into the given directory, and run a program there.
// argv is set up Unix-style, i.e. argv[0] is the program name // argv is set up Unix-style, i.e. argv[0] is the program name
// //
int run_app_windows(
const char* dir, const char* file, int argc, char *const argv[], HANDLE& id // CreateEnvironmentBlock
) { typedef BOOL (WINAPI *tCEB)(LPVOID *lpEnvironment, HANDLE hToken, BOOL bInherit);
int retval; // DestroyEnvironmentBlock
PROCESS_INFORMATION process_info; typedef BOOL (WINAPI *tDEB)(LPVOID lpEnvironment);
STARTUPINFO startup_info;
LPVOID environment_block = NULL;
char cmdline[1024]; int run_app_windows(
char error_msg[1024]; const char* dir, const char* file, int argc, char *const argv[], HANDLE& id
) {
memset(&process_info, 0, sizeof(process_info)); int retval;
memset(&startup_info, 0, sizeof(startup_info)); PROCESS_INFORMATION process_info;
startup_info.cb = sizeof(startup_info); STARTUPINFO startup_info;
LPVOID environment_block = NULL;
strcpy(cmdline, ""); char cmdline[1024];
for (int i=0; i<argc; i++) { char error_msg[1024];
strcat(cmdline, argv[i]);
if (i<argc-1) { memset(&process_info, 0, sizeof(process_info));
strcat(cmdline, " "); memset(&startup_info, 0, sizeof(startup_info));
} startup_info.cb = sizeof(startup_info);
}
strcpy(cmdline, "");
get_sandbox_account_interactive_token(); for (int i=0; i<argc; i++) {
if (sandbox_account_interactive_token != NULL) { strcat(cmdline, argv[i]);
if (i<argc-1) {
// Retrieve the current window station and desktop names strcat(cmdline, " ");
char szWindowStation[256]; }
memset(szWindowStation, 0, sizeof(szWindowStation)); }
char szDesktop[256];
memset(szDesktop, 0, sizeof(szDesktop)); get_sandbox_account_interactive_token();
char szDesktopName[512]; if (sandbox_account_interactive_token != NULL) {
memset(szDesktopName, 0, sizeof(szDesktopName));
// Find CreateEnvironmentBlock/DestroyEnvironmentBlock pointers
if (!GetUserObjectInformation( tCEB pCEB = NULL;
GetProcessWindowStation(), tDEB pDEB = NULL;
UOI_NAME, HMODULE hUserEnvLib = NULL;
&szWindowStation,
sizeof(szWindowStation), hUserEnvLib = LoadLibrary("userenv.dll");
NULL) if (hUserEnvLib) {
) { pCEB = (tCEB) GetProcAddress(hUserEnvLib, "CreateEnvironmentBlock");
windows_error_string(error_msg, sizeof(error_msg)); pDEB = (tDEB) GetProcAddress(hUserEnvLib, "DestroyEnvironmentBlock");
fprintf(stderr, "GetUserObjectInformation failed: %s\n", error_msg); }
}
if (!GetUserObjectInformation(
GetThreadDesktop(GetCurrentThreadId()), // Retrieve the current window station and desktop names
UOI_NAME, char szWindowStation[256];
&szDesktop, memset(szWindowStation, 0, sizeof(szWindowStation));
sizeof(szDesktop), char szDesktop[256];
NULL) memset(szDesktop, 0, sizeof(szDesktop));
) { char szDesktopName[512];
windows_error_string(error_msg, sizeof(error_msg)); memset(szDesktopName, 0, sizeof(szDesktopName));
fprintf(stderr, "GetUserObjectInformation failed: %s\n", error_msg);
} if (!GetUserObjectInformation(
GetProcessWindowStation(),
// Construct the destination desktop name UOI_NAME,
strncat(szDesktopName, szWindowStation, sizeof(szDesktopName) - strlen(szDesktopName)); &szWindowStation,
strncat(szDesktopName, "\\", sizeof(szDesktopName) - strlen(szDesktopName)); sizeof(szWindowStation),
strncat(szDesktopName, szDesktop, sizeof(szDesktopName) - strlen(szDesktopName)); NULL)
) {
// Tell CreateProcessAsUser which desktop to use explicitly. windows_error_string(error_msg, sizeof(error_msg));
startup_info.lpDesktop = szDesktopName; fprintf(stderr, "GetUserObjectInformation failed: %s\n", error_msg);
}
// Construct an environment block that contains environment variables that don't if (!GetUserObjectInformation(
// describe the current user. GetThreadDesktop(GetCurrentThreadId()),
if (!CreateEnvironmentBlock(&environment_block, sandbox_account_interactive_token, FALSE)) { UOI_NAME,
windows_error_string(error_msg, sizeof(error_msg)); &szDesktop,
fprintf(stderr, "CreateEnvironmentBlock failed: %s\n", error_msg); sizeof(szDesktop),
} NULL)
) {
retval = CreateProcessAsUser( windows_error_string(error_msg, sizeof(error_msg));
sandbox_account_interactive_token, fprintf(stderr, "GetUserObjectInformation failed: %s\n", error_msg);
file, }
cmdline,
NULL, // Construct the destination desktop name
NULL, strncat(szDesktopName, szWindowStation, sizeof(szDesktopName) - strlen(szDesktopName));
FALSE, strncat(szDesktopName, "\\", sizeof(szDesktopName) - strlen(szDesktopName));
CREATE_NEW_PROCESS_GROUP|CREATE_UNICODE_ENVIRONMENT, strncat(szDesktopName, szDesktop, sizeof(szDesktopName) - strlen(szDesktopName));
environment_block,
dir, // Tell CreateProcessAsUser which desktop to use explicitly.
&startup_info, startup_info.lpDesktop = szDesktopName;
&process_info
); // Construct an environment block that contains environment variables that don't
// describe the current user.
if (!DestroyEnvironmentBlock(environment_block)) { if (!pCEB(&environment_block, sandbox_account_interactive_token, FALSE)) {
windows_error_string(error_msg, sizeof(error_msg)); windows_error_string(error_msg, sizeof(error_msg));
fprintf(stderr, "DestroyEnvironmentBlock failed: %s\n", error_msg); fprintf(stderr, "CreateEnvironmentBlock failed: %s\n", error_msg);
} }
} else {
retval = CreateProcess( retval = CreateProcessAsUser(
file, sandbox_account_interactive_token,
cmdline, file,
NULL, cmdline,
NULL, NULL,
FALSE, NULL,
0, FALSE,
NULL, CREATE_NEW_PROCESS_GROUP|CREATE_UNICODE_ENVIRONMENT,
dir, environment_block,
&startup_info, dir,
&process_info &startup_info,
); &process_info
} );
if (!retval) {
windows_error_string(error_msg, sizeof(error_msg)); if (!pDEB(environment_block)) {
fprintf(stderr, "CreateProcess failed: '%s'\n", error_msg); windows_error_string(error_msg, sizeof(error_msg));
return -1; // CreateProcess returns 1 if successful, false if it failed. fprintf(stderr, "DestroyEnvironmentBlock failed: %s\n", error_msg);
} }
id = process_info.hProcess; if (hUserEnvLib) {
return 0; pCEB = NULL;
} pDEB = NULL;
FreeLibrary(hUserEnvLib);
}
} else {
retval = CreateProcess(
file,
cmdline,
NULL,
NULL,
FALSE,
0,
NULL,
dir,
&startup_info,
&process_info
);
}
if (!retval) {
windows_error_string(error_msg, sizeof(error_msg));
fprintf(stderr, "CreateProcess failed: '%s'\n", error_msg);
return -1; // CreateProcess returns 1 if successful, false if it failed.
}
id = process_info.hProcess;
return 0;
}

View File

@ -745,10 +745,24 @@ GetAccountSid(
// all the threads in the entire system, // all the threads in the entire system,
// and find those belonging to the process (ugh!!) // and find those belonging to the process (ugh!!)
// //
// OpenThread
typedef HANDLE (WINAPI *tOT)(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId);
int suspend_or_resume_threads(DWORD pid, bool resume) { int suspend_or_resume_threads(DWORD pid, bool resume) {
HANDLE threads, thread; HANDLE threads, thread;
HMODULE hKernel32Lib = NULL;
THREADENTRY32 te = {0}; THREADENTRY32 te = {0};
tOT pOT = NULL;
// Dynamically link to the proper function pointers.
hKernel32Lib = GetModuleHandle("kernel32.dll");
pOT = (tOT) GetProcAddress( hKernel32Lib, "OpenThread" );
if (!pOT) {
return -1;
}
threads = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); threads = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
if (threads == INVALID_HANDLE_VALUE) return -1; if (threads == INVALID_HANDLE_VALUE) return -1;
@ -757,13 +771,16 @@ int suspend_or_resume_threads(DWORD pid, bool resume) {
CloseHandle(threads); CloseHandle(threads);
return -1; return -1;
} }
do { do {
if (te.th32OwnerProcessID == pid) { if (te.th32OwnerProcessID == pid) {
thread = OpenThread(THREAD_SUSPEND_RESUME, FALSE, te.th32ThreadID); thread = pOT(THREAD_SUSPEND_RESUME, FALSE, te.th32ThreadID);
resume ? ResumeThread(thread) : SuspendThread(thread); resume ? ResumeThread(thread) : SuspendThread(thread);
CloseHandle(thread); CloseHandle(thread);
} }
} while (Thread32Next(threads, &te)); } while (Thread32Next(threads, &te));
CloseHandle (threads); CloseHandle (threads);
return 0; return 0;
} }

View File

@ -85,7 +85,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="zlib1d.lib ssleay32.lib libeay32.lib libcurld_imp.lib MSVCRTD.LIB MSVCPRTD.LIB wsock32.lib wininet.lib winmm.lib libboincd.lib sensapi.lib userenv.lib" AdditionalDependencies="zlib1d.lib ssleay32.lib libeay32.lib libcurld_imp.lib MSVCRTD.LIB MSVCPRTD.LIB wsock32.lib wininet.lib winmm.lib libboincd.lib sensapi.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\boinc.exe" OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\boinc.exe"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -302,7 +302,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="zlib1.lib ssleay32.lib libeay32.lib libcurl_imp.lib MSVCRT.LIB MSVCPRT.LIB wsock32.lib wininet.lib winmm.lib libboinc.lib sensapi.lib userenv.lib" AdditionalDependencies="zlib1.lib ssleay32.lib libeay32.lib libcurl_imp.lib MSVCRT.LIB MSVCPRT.LIB wsock32.lib wininet.lib winmm.lib libboinc.lib sensapi.lib"
ShowProgress="0" ShowProgress="0"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\boinc.exe" OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\boinc.exe"
LinkIncremental="1" LinkIncremental="1"
@ -523,7 +523,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="zlib1.lib ssleay32.lib libeay32.lib libcurl_imp.lib MSVCRT.LIB MSVCPRT.LIB wsock32.lib wininet.lib winmm.lib libboinc.lib sensapi.lib userenv.lib" AdditionalDependencies="zlib1.lib ssleay32.lib libeay32.lib libcurl_imp.lib MSVCRT.LIB MSVCPRT.LIB wsock32.lib wininet.lib winmm.lib libboinc.lib sensapi.lib"
ShowProgress="0" ShowProgress="0"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\boinc.exe" OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\boinc.exe"
LinkIncremental="1" LinkIncremental="1"

View File

@ -73,7 +73,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="MSVCRT.LIB MSVCPRT.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib userenv.lib wxbase28.lib wxbase28_net.lib wxbase28_xml.lib wxmsw28_adv.lib wxmsw28_core.lib wxmsw28_html.lib wxregex.lib wxexpat.lib wxpng.lib wxzlib.lib boinc_dll.lib" AdditionalDependencies="MSVCRT.LIB MSVCPRT.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib wxbase28.lib wxbase28_net.lib wxbase28_xml.lib wxmsw28_adv.lib wxmsw28_core.lib wxmsw28_html.lib wxregex.lib wxexpat.lib wxpng.lib wxzlib.lib boinc_dll.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe" OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(WXWIN)\lib\vc_lib&quot;;&quot;$(WXWIN)\contrib\lib&quot;" AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(WXWIN)\lib\vc_lib&quot;;&quot;$(WXWIN)\contrib\lib&quot;"
@ -268,7 +268,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="MSVCRTD.LIB MSVCPRTD.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib userenv.lib wxbase28d.lib wxbase28d_net.lib wxbase28d_xml.lib wxmsw28d_adv.lib wxmsw28d_core.lib wxmsw28d_html.lib wxregexd.lib wxexpatd.lib wxpngd.lib wxzlibd.lib boinc_dll.lib" AdditionalDependencies="MSVCRTD.LIB MSVCPRTD.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib wxbase28d.lib wxbase28d_net.lib wxbase28d_xml.lib wxmsw28d_adv.lib wxmsw28d_core.lib wxmsw28d_html.lib wxregexd.lib wxexpatd.lib wxpngd.lib wxzlibd.lib boinc_dll.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe" OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe"
LinkIncremental="0" LinkIncremental="0"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(WXWIN)\lib\vc_lib&quot;;&quot;$(WXWIN)\contrib\lib&quot;" AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(WXWIN)\lib\vc_lib&quot;;&quot;$(WXWIN)\contrib\lib&quot;"
@ -457,7 +457,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="MSVCRT.LIB MSVCPRT.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib userenv.lib wxbase26.lib wxbase26_net.lib wxbase26_xml.lib wxmsw26_adv.lib wxmsw26_core.lib wxmsw26_html.lib wxregex.lib wxexpat.lib wxpng.lib wxzlib.lib boinc_dll.lib" AdditionalDependencies="MSVCRT.LIB MSVCPRT.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib wxbase26.lib wxbase26_net.lib wxbase26_xml.lib wxmsw26_adv.lib wxmsw26_core.lib wxmsw26_html.lib wxregex.lib wxexpat.lib wxpng.lib wxzlib.lib boinc_dll.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe" OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(WXWINPROD)\lib\vc_lib&quot;;&quot;$(WXWINPROD)\contrib\lib&quot;" AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(WXWINPROD)\lib\vc_lib&quot;;&quot;$(WXWINPROD)\contrib\lib&quot;"