mirror of https://github.com/BOINC/boinc.git
- CLI: CreateEnvironmentBlock always creates a Unicode Environment block.
- MGR: CreateProcessAsUser doesn't always error out when the ACLs haven't been changed for a specific Desktop and WindowStation so go ahead and Modify the ACLs with every call. It appears the ACLs revert themselves after CreateProcessAsUser is called anyway. client/ app_start.C lib/ util.C svn path=/trunk/boinc/; revision=14819
This commit is contained in:
parent
3a5cc2ab20
commit
0a737b6579
|
@ -1736,10 +1736,6 @@ Rytis Feb 28 2008
|
|||
html/inc/
|
||||
forum.inc
|
||||
|
||||
Rom FEB 28 2008 (HEAD)
|
||||
- Tag for 6.1.9 release, all platforms
|
||||
boinc_core_release_6_1_9
|
||||
|
||||
Charlie Feb 28 2008
|
||||
- MGR: When connected connecting to a different host, clear all cached
|
||||
messages (a more efficient implementation).
|
||||
|
@ -1747,3 +1743,22 @@ Charlie Feb 28 2008
|
|||
clientgui/
|
||||
MainDocument.cpp
|
||||
|
||||
Rom Feb 28 2008
|
||||
- CLI: CreateEnvironmentBlock always creates a Unicode Environment block.
|
||||
- MGR: CreateProcessAsUser doesn't always error out when the ACLs haven't
|
||||
been changed for a specific Desktop and WindowStation so go ahead
|
||||
and Modify the ACLs with every call. It appears the ACLs revert
|
||||
themselves after CreateProcessAsUser is called anyway.
|
||||
|
||||
client/
|
||||
app_start.C
|
||||
lib/
|
||||
util.C
|
||||
|
||||
Rom FEB 28 2008 (HEAD)
|
||||
- Tag for 6.1.9 release, all platforms
|
||||
boinc_core_release_6_1_9
|
||||
|
||||
/
|
||||
configure.ac
|
||||
version.h
|
||||
|
|
|
@ -503,10 +503,6 @@ int ACTIVE_TASK::start(bool first_time) {
|
|||
get_sandbox_account_token();
|
||||
for (i=0; i<5; i++) {
|
||||
if (sandbox_account_token != NULL) {
|
||||
// Forces system to create a new desktop and windowstation to host
|
||||
// the application.
|
||||
//
|
||||
startup_info.lpDesktop = "";
|
||||
|
||||
if (!CreateEnvironmentBlock(&environment_block, sandbox_account_token, FALSE)) {
|
||||
if (log_flags.task) {
|
||||
|
@ -524,7 +520,7 @@ int ACTIVE_TASK::start(bool first_time) {
|
|||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
CREATE_NEW_PROCESS_GROUP|CREATE_NO_WINDOW|IDLE_PRIORITY_CLASS,
|
||||
CREATE_NEW_PROCESS_GROUP|CREATE_NO_WINDOW|IDLE_PRIORITY_CLASS|CREATE_UNICODE_ENVIRONMENT,
|
||||
environment_block,
|
||||
slotdirpath,
|
||||
&startup_info,
|
||||
|
|
69
lib/util.C
69
lib/util.C
|
@ -367,7 +367,9 @@ int run_program(
|
|||
int retval;
|
||||
PROCESS_INFORMATION process_info;
|
||||
STARTUPINFO startup_info;
|
||||
LPVOID environment_block = NULL;
|
||||
char cmdline[1024];
|
||||
char error_msg[1024];
|
||||
unsigned long status;
|
||||
|
||||
memset(&process_info, 0, sizeof(process_info));
|
||||
|
@ -392,20 +394,14 @@ int run_program(
|
|||
memset(szDesktopName, 0, sizeof(szDesktopName));
|
||||
|
||||
// Retrieve the current window station and desktop names
|
||||
GetUserObjectInformation(
|
||||
GetProcessWindowStation(),
|
||||
UOI_NAME,
|
||||
szWindowStation,
|
||||
sizeof(szWindowStation),
|
||||
NULL
|
||||
);
|
||||
GetUserObjectInformation(
|
||||
GetThreadDesktop(GetCurrentThreadId()),
|
||||
UOI_NAME,
|
||||
szDesktop,
|
||||
sizeof(szDesktop),
|
||||
NULL
|
||||
);
|
||||
if (!GetUserObjectInformation(GetProcessWindowStation(), UOI_NAME, szWindowStation, sizeof(szWindowStation), NULL)) {
|
||||
windows_error_string(error_msg, sizeof(error_msg));
|
||||
fprintf(stderr, "GetUserObjectInformation failed: %s\n", error_msg);
|
||||
}
|
||||
if (!GetUserObjectInformation(GetThreadDesktop(GetCurrentThreadId()), UOI_NAME, szDesktop, sizeof(szDesktop), NULL)) {
|
||||
windows_error_string(error_msg, sizeof(error_msg));
|
||||
fprintf(stderr, "GetUserObjectInformation failed: %s\n", error_msg);
|
||||
}
|
||||
|
||||
// Construct the destination desktop name
|
||||
strncat(szDesktopName, szWindowStation, sizeof(szDesktopName) - strlen(szDesktopName));
|
||||
|
@ -417,6 +413,21 @@ int run_program(
|
|||
//
|
||||
startup_info.lpDesktop = szDesktopName;
|
||||
|
||||
// Add ACEs to the WindowStation and Desktop
|
||||
if (!AddAceToWindowStation(GetProcessWindowStation(), sandbox_account_sid)) {
|
||||
fprintf(stderr, "Failed to add ACE to current WindowStation\n");
|
||||
}
|
||||
if (!AddAceToDesktop(GetThreadDesktop(GetCurrentThreadId()), sandbox_account_sid)) {
|
||||
fprintf(stderr, "Failed to add ACE to current Desktop\n");
|
||||
}
|
||||
|
||||
// Construct an environment block that contains environment variables that don't
|
||||
// describe the current user.
|
||||
if (!CreateEnvironmentBlock(&environment_block, sandbox_account_token, FALSE)) {
|
||||
windows_error_string(error_msg, sizeof(error_msg));
|
||||
fprintf(stderr, "CreateEnvironmentBlock failed: %s\n", error_msg);
|
||||
}
|
||||
|
||||
retval = CreateProcessAsUser(
|
||||
sandbox_account_token,
|
||||
file,
|
||||
|
@ -424,32 +435,16 @@ int run_program(
|
|||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
0,
|
||||
NULL,
|
||||
CREATE_NEW_PROCESS_GROUP|CREATE_UNICODE_ENVIRONMENT,
|
||||
environment_block,
|
||||
dir,
|
||||
&startup_info,
|
||||
&process_info
|
||||
);
|
||||
if (!retval && GetLastError() == ERROR_ACCESS_DENIED) {
|
||||
if (!AddAceToWindowStation(GetProcessWindowStation(), sandbox_account_sid)) {
|
||||
fprintf(stderr, "Failed to add ACE to current WindowStation\n");
|
||||
}
|
||||
if (!AddAceToDesktop(GetThreadDesktop(GetCurrentThreadId()), sandbox_account_sid)) {
|
||||
fprintf(stderr, "Failed to add ACE to current Desktop\n");
|
||||
}
|
||||
retval = CreateProcessAsUser(
|
||||
sandbox_account_token,
|
||||
file,
|
||||
cmdline,
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
0,
|
||||
NULL,
|
||||
dir,
|
||||
&startup_info,
|
||||
&process_info
|
||||
);
|
||||
|
||||
if (!DestroyEnvironmentBlock(environment_block)) {
|
||||
windows_error_string(error_msg, sizeof(error_msg));
|
||||
fprintf(stderr, "DestroyEnvironmentBlock failed: %s\n", error_msg);
|
||||
}
|
||||
} else {
|
||||
retval = CreateProcess(
|
||||
|
@ -467,6 +462,8 @@ int run_program(
|
|||
}
|
||||
|
||||
if (!retval) {
|
||||
windows_error_string(error_msg, sizeof(error_msg));
|
||||
fprintf(stderr, "CreateProcessAsUser failed: '%s'\n", error_msg);
|
||||
return -1; // CreateProcess returns 1 if successful, false if it failed.
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue