Changeset 99109 in vbox for trunk/src/VBox/Runtime/r3/win/process-win.cpp
- Timestamp:
- Mar 22, 2023 10:13:00 AM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/process-win.cpp
r98103 r99109 1613 1613 STARTUPINFOW *pStartupInfo, PROCESS_INFORMATION *pProcInfo, 1614 1614 uint32_t fFlags, const char *pszExec, uint32_t idDesiredSession, 1615 HANDLE hUserToken )1615 HANDLE hUserToken, PRTUTF16 pwszCwd) 1616 1616 { 1617 1617 /* … … 1804 1804 * on XP and up. */ 1805 1805 pwszzBlock, /* lpEnvironment */ 1806 NULL,/* pCurrentDirectory */1806 pwszCwd, /* pCurrentDirectory */ 1807 1807 pStartupInfo, 1808 1808 pProcInfo); … … 1942 1942 RTENV hEnv, DWORD dwCreationFlags, 1943 1943 STARTUPINFOW *pStartupInfo, PROCESS_INFORMATION *pProcInfo, 1944 uint32_t fFlags, const char *pszExec )1944 uint32_t fFlags, const char *pszExec, PRTUTF16 pwszCwd) 1945 1945 { 1946 1946 /* The CreateProcessWithLogonW API was introduced with W2K and later. It uses a service … … 2042 2042 dwCreationFlags | (fCreatedSuspended ? CREATE_SUSPENDED : 0), 2043 2043 pwszzBlock, 2044 NULL,/* pCurrentDirectory */2044 pwszCwd, /* pCurrentDirectory */ 2045 2045 pStartupInfo, 2046 2046 pProcInfo); … … 2093 2093 STARTUPINFOW *pStartupInfo, PROCESS_INFORMATION *pProcInfo, 2094 2094 uint32_t fFlags, const char *pszExec, uint32_t idDesiredSession, 2095 HANDLE hUserToken )2095 HANDLE hUserToken, PRTUTF16 pwszCwd) 2096 2096 { 2097 2097 /* … … 2105 2105 AssertPtr(pwszUser); 2106 2106 int rc = rtProcWinCreateAsUser1(pwszUser, pwszPassword, ppwszExec, pwszCmdLine, 2107 hEnv, dwCreationFlags, pStartupInfo, pProcInfo, fFlags, pszExec );2107 hEnv, dwCreationFlags, pStartupInfo, pProcInfo, fFlags, pszExec, pwszCwd); 2108 2108 if (RT_SUCCESS(rc)) 2109 2109 return rc; 2110 2110 } 2111 2111 return rtProcWinCreateAsUser2(pwszUser, pwszPassword, ppwszExec, pwszCmdLine, hEnv, dwCreationFlags, 2112 pStartupInfo, pProcInfo, fFlags, pszExec, idDesiredSession, hUserToken );2112 pStartupInfo, pProcInfo, fFlags, pszExec, idDesiredSession, hUserToken, pwszCwd); 2113 2113 } 2114 2114 … … 2262 2262 const char *pszPassword, void *pvExtraData, PRTPROCESS phProcess) 2263 2263 { 2264 int rc; 2265 2264 2266 /* 2265 2267 * Input validation … … 2281 2283 == (RTPROC_FLAGS_DESIRED_SESSION_ID | RTPROC_FLAGS_SERVICE)) 2282 2284 { 2285 AssertReturn(!(fFlags & RTPROC_FLAGS_CWD), VERR_INVALID_PARAMETER); 2283 2286 AssertPtrReturn(pvExtraData, VERR_INVALID_POINTER); 2284 2287 idDesiredSession = *(uint32_t *)pvExtraData; … … 2294 2297 * Initialize the globals. 2295 2298 */ 2296 intrc = RTOnce(&g_rtProcWinInitOnce, rtProcWinInitOnce, NULL);2299 rc = RTOnce(&g_rtProcWinInitOnce, rtProcWinInitOnce, NULL); 2297 2300 AssertRCReturn(rc, rc); 2298 2301 if ( pszAsUser … … 2433 2436 !(fFlags & RTPROC_FLAGS_UNQUOTED_ARGS) 2434 2437 ? RTGETOPTARGV_CNV_QUOTE_MS_CRT : RTGETOPTARGV_CNV_UNQUOTED); 2438 PRTUTF16 pwszExec = NULL; 2435 2439 if (RT_SUCCESS(rc)) 2436 {2437 PRTUTF16 pwszExec;2438 2440 rc = RTPathWinFromUtf8(&pwszExec, pszExec, 0 /*fFlags*/); 2439 if (RT_SUCCESS(rc)) 2440 { 2441 PRTUTF16 pwszCwd = NULL; 2442 if (RT_SUCCESS(rc) && (fFlags & RTPROC_FLAGS_CWD)) 2443 rc = RTPathWinFromUtf8(&pwszCwd, (const char *)pvExtraData, 0); 2444 if (RT_SUCCESS(rc)) 2445 { 2441 2446 /* 2442 2447 * Get going... … … 2470 2475 dwCreationFlags, 2471 2476 pwszzBlock, 2472 NULL,/* pCurrentDirectory */2477 pwszCwd, /* pCurrentDirectory */ 2473 2478 &StartupInfo, 2474 2479 &ProcInfo)) … … 2496 2501 rc = rtProcWinCreateAsUser(pwszUser, pwszPassword, &pwszExec, pwszCmdLine, hEnv, dwCreationFlags, 2497 2502 &StartupInfo, &ProcInfo, fFlags, pszExec, idDesiredSession, 2498 hUserToken );2503 hUserToken, pwszCwd); 2499 2504 2500 2505 if (pwszPassword && *pwszPassword) … … 2524 2529 rc = VINF_SUCCESS; 2525 2530 } 2526 RTPathWinFree(pwszExec);2527 }2528 RTUtf16Free(pwszCmdLine);2529 }2531 } 2532 RTPathWinFree(pwszExec); 2533 RTPathWinFree(pwszCwd); 2534 RTUtf16Free(pwszCmdLine); 2530 2535 2531 2536 if (g_pfnSetHandleInformation)
Note:
See TracChangeset
for help on using the changeset viewer.