Changeset 29727 in vbox
- Timestamp:
- May 21, 2010 12:26:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/process-win.cpp
r29726 r29727 35 35 #include <tlhelp32.h> 36 36 #include <process.h> 37 #include <psapi.h> /* For EnumProcesses(). */38 37 #include <errno.h> 39 38 … … 295 294 NULL, SecurityIdentification, TokenPrimary, phToken)) 296 295 { 297 /* 296 /* 298 297 * So we found a VBoxTray instance which belongs to the user we want to 299 298 * to run our new process under. This duplicated token will be used for 300 * the actual CreateProcessAsUserW() call then. 299 * the actual CreateProcessAsUserW() call then. 301 300 */ 302 fFound = TRUE; 301 fFound = TRUE; 303 302 } 304 303 else … … 360 359 procEntry.dwSize = sizeof(PROCESSENTRY32); 361 360 if (pfnProcess32First(hSnap, &procEntry)) 362 { 361 { 363 362 do 364 363 { … … 397 396 rc = RTLdrGetSymbol(hPSAPI, "GetModuleBaseName", (void**)&pfnGetModuleBaseName); 398 397 if (RT_SUCCESS(rc)) 399 { 398 { 400 399 /** @todo Retry if pBytesReturned equals cbBytes! */ 401 400 DWORD dwPIDs[4096]; /* Should be sufficient for now. */ … … 405 404 for (DWORD dwIdx = 0; dwIdx < cbBytes/sizeof(DWORD) && !fFound; dwIdx++) 406 405 { 407 HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 406 HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 408 407 FALSE, dwPIDs[dwIdx]); 409 408 if (hProc) … … 417 416 dwSize += 128; 418 417 } while (GetLastError() == ERROR_INSUFFICIENT_BUFFER); 419 418 420 419 if (pszProcName) 421 420 { … … 514 513 * - We do not want to display a process of user A run on the desktop 515 514 * of user B on multi session systems. 516 * 515 * 517 516 * The following rights are needed in order to use LogonUserW and 518 517 * CreateProcessAsUserW, so the local policy has to be modified to: … … 558 557 { 559 558 dwErr = NO_ERROR; 560 559 561 560 PSID pSID = (PSID)RTMemAlloc(cbName * sizeof(wchar_t)); 562 561 AssertPtrReturn(pSID, VERR_NO_MEMORY); 563 562 564 563 /** @todo No way to allocate a PRTUTF16 directly? */ 565 564 PRTUTF16 pwszDomain = NULL; … … 569 568 AssertPtrReturn(pwszDomain, VERR_NO_MEMORY); 570 569 } 571 570 572 571 /* Note: Also supports FQDNs! */ 573 572 if ( LookupAccountNameW(NULL, /* lpSystemName */ … … 582 581 fFound = rtProcFindProcessByName( 583 582 #ifdef VBOX 584 "VBoxTray.exe", 583 "VBoxTray.exe", 585 584 #else 586 585 "explorer.exe" … … 600 599 } 601 600 602 /* 601 /* 603 602 * If we didn't find a matching VBoxTray, just use the token we got 604 603 * above from LogonUserW(). This enables us to at least run processes with
Note:
See TracChangeset
for help on using the changeset viewer.