Changeset 27487 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Mar 18, 2010 3:54:26 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/process-win.cpp
r27475 r27487 209 209 StartupInfo.cb = sizeof(StartupInfo); 210 210 StartupInfo.dwFlags = STARTF_USESTDHANDLES; 211 /* Use WTSEnumerateSessions() for getting a list of sessions (WTS_SESSION_INFO array),212 * get wanted user with WTSQuerySessionInformation() and get session ID token with213 * WTSQueryUserToken() to use with CreateProcessAsUser(). */214 StartupInfo.lpDesktop = L"Winsta0\\Default";215 211 #if 1 /* The CRT should keep the standard handles up to date. */ 216 212 StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); … … 308 304 * The following rights are needed in order to use 309 305 * LogonUserW and CreateProcessAsUserW: 310 *311 306 * - SE_ASSIGNPRIMARYTOKEN_NAME 312 307 * - SE_INCREASE_QUOTA_NAME 313 308 * - SE_TCB_NAME 309 * 310 * So the local policy has to be modified to: 311 * - Act as part of the operating system 312 * - Create a token object 313 * - Log on as a batch job 314 314 */ 315 315 fRc = LogonUserW(pwszUser, … … 319 319 LOGON32_PROVIDER_DEFAULT, 320 320 &hToken); 321 /** @todo Add SecureZeroMemory() here for wiping the password? */ 321 322 if (fRc) 322 323 { … … 348 349 if (ERROR_PRIVILEGE_NOT_HELD == dwErr) 349 350 { 350 #if 0351 PROFILEINFOW profileInfo;352 RT_ZERO(profileInfo);353 profileInfo.dwSize = sizeof(PROFILEINFOW);354 profileInfo.lpUserName = pwszUser;355 fRc = LoadUserProfileW(hToken, &profileInfo);356 357 351 RTLDRMOD modAdvAPI32; 358 352 rc = RTLdrLoad("Advapi32.dll", &modAdvAPI32); … … 360 354 if (RT_SUCCESS(rc)) 361 355 { 356 /* This may fail on too old (NT4) platforms. */ 362 357 rc = RTLdrGetSymbol(modAdvAPI32, "CreateProcessWithLogonW", (void**)&pfnCreateProcessWithLogonW); 363 358 if (RT_SUCCESS(rc)) 364 359 { 365 #endif366 fRc = ImpersonateLoggedOnUser(hToken);367 if (fRc)368 {369 fRc = CreateProcessW(pwszExec,370 pwszCmdLine,371 NULL, /* pProcessAttributes */372 NULL, /* pThreadAttributes */373 TRUE, /* fInheritHandles */374 CREATE_UNICODE_ENVIRONMENT, /* dwCreationFlags */375 pwszzBlock,376 NULL, /* pCurrentDirectory */377 &StartupInfo,378 &ProcInfo);379 RevertToSelf();380 }381 #if 0382 360 fRc = pfnCreateProcessWithLogonW(pwszUser, 383 361 NULL, /* lpDomain*/ 384 362 pwszPassword, 385 0/*LOGON_WITH_PROFILE*/, /* dwLogonFlags */363 1 /*LOGON_WITH_PROFILE*/, /* dwLogonFlags */ 386 364 pwszExec, 387 365 pwszCmdLine, … … 394 372 RTLdrClose(modAdvAPI32); 395 373 } 396 #endif397 374 } 398 375 }
Note:
See TracChangeset
for help on using the changeset viewer.