From d504ab49057dcdf20bab2dd3108c6e2eea3440a7 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 6 Mar 2008 17:18:59 +0000 Subject: [PATCH] - CLI: Make the CreateProcessAsUser process work again on Wndows. It broke after the change of removing the call to LogonUserEx. client/ app_start.C lib/ util.C svn path=/trunk/boinc/; revision=14859 --- checkin_notes | 9 +++++++++ client/app_start.C | 3 +++ lib/util.C | 6 +++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/checkin_notes b/checkin_notes index 63af1f3edb..8853e15ba7 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1980,3 +1980,12 @@ Charlie Mar 6 2008 clientgui/ ViewProjectsGrid.cpp,h ViewWorkGrid.cpp,h + +Rom 6 Mar 2008 + - CLI: Make the CreateProcessAsUser process work again on Wndows. + It broke after the change of removing the call to LogonUserEx. + + client/ + app_start.C + lib/ + util.C diff --git a/client/app_start.C b/client/app_start.C index 3c6ec005c0..a19373b02b 100644 --- a/client/app_start.C +++ b/client/app_start.C @@ -500,7 +500,9 @@ int ACTIVE_TASK::start(bool first_time) { cmd_line = exec_path + std::string(" ") + wup->command_line; relative_to_absolute(slot_dir, slotdirpath); bool success = false; + get_sandbox_account_token(); + for (i=0; i<5; i++) { if (sandbox_account_token != NULL) { @@ -568,6 +570,7 @@ int ACTIVE_TASK::start(bool first_time) { } boinc_sleep(drand()); } + if (!success) { sprintf(buf, "CreateProcess() failed - %s", error_msg); retval = ERR_EXEC; diff --git a/lib/util.C b/lib/util.C index 8c41d6f0cd..eb97338665 100644 --- a/lib/util.C +++ b/lib/util.C @@ -324,7 +324,7 @@ void get_sandbox_account_token() { LOGON32_PROVIDER_DEFAULT, &sandbox_account_token ); - if (!retval) { + if (retval) { GetAccountSid(domainname_str.c_str(), username_str.c_str(), &sandbox_account_sid); } } else { @@ -337,7 +337,7 @@ void get_sandbox_account_token() { LOGON32_PROVIDER_DEFAULT, &sandbox_account_token ); - if (!retval) { + if (retval) { GetAccountSid(NULL, username_str.c_str(), &sandbox_account_sid); } } @@ -461,7 +461,7 @@ int run_program( */ if (!retval) { windows_error_string(error_msg, sizeof(error_msg)); - fprintf(stderr, "CreateProcessAsUser failed: '%s'\n", error_msg); + fprintf(stderr, "CreateProcess failed: '%s'\n", error_msg); return -1; // CreateProcess returns 1 if successful, false if it failed. }