Changeset 83419 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Mar 25, 2020 4:49:34 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 136638
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
r83405 r83419 1067 1067 return VERR_NO_MEMORY; 1068 1068 1069 #ifdef DEBUG 1069 #ifdef DEBUG /* Never log this stuff in release mode! */ 1070 VGSvcVerbose(3, "VGSvcGstCtrlProcessAllocateArgv: pszArgv0 = '%s'\n", pszArgv0); 1071 for (uint32_t i = 0; i < cArgs; i++) 1072 VGSvcVerbose(3, "VGSvcGstCtrlProcessAllocateArgv: papszArgs[%RU32] = '%s'\n", i, papszArgs[i]); 1070 1073 VGSvcVerbose(3, "VGSvcGstCtrlProcessAllocateArgv: cbSize=%RU32, cArgs=%RU32\n", cbSize, cArgs); 1071 1074 #endif … … 1342 1345 if (RT_SUCCESS(rc)) 1343 1346 { 1344 const char *pszArgv0 = RT_BOOL(g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_PROCESS_ARGV0) 1345 ? papszArgs[0] : pszExec; 1347 /** 1348 * This one is a bit tricky to also support older hosts: 1349 * 1350 * - If the host does not provide a dedicated argv[0] (< VBox 6.1.x), we use the 1351 * executable name (pszExec) as the (default) argv[0]. This is wrong, but we can't do 1352 * much about it. The rest (argv[1,2,n]) then gets set starting at papszArgs[0]. 1353 * 1354 * - Newer hosts (>= VBox 6.1.x) provide a correct argv[0] independently of the actual 1355 * executable name though, so actually use argv[0] *and* argv[1,2,n] as intended. 1356 */ 1357 const bool fHasArgv0 = RT_BOOL(g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_PROCESS_ARGV0); 1358 1346 1359 char **papszArgsExp; 1347 rc = vgsvcGstCtrlProcessAllocateArgv(pszArgv0, papszArgs, 1360 rc = vgsvcGstCtrlProcessAllocateArgv(fHasArgv0 ? papszArgs[0] : pszExec, 1361 fHasArgv0 ? &papszArgs[1] : &papszArgs[0], 1348 1362 fFlags, &papszArgsExp); 1349 1363 if (RT_FAILURE(rc)) … … 1498 1512 * Prepare argument list. 1499 1513 */ 1514 VGSvcVerbose(3, "vgsvcGstCtrlProcessProcessWorker: fHostFeatures0 = %#x\n", g_fControlHostFeatures0); 1515 VGSvcVerbose(3, "vgsvcGstCtrlProcessProcessWorker: StartupInfo.szCmd = '%s'\n", pProcess->StartupInfo.szCmd); 1516 VGSvcVerbose(3, "vgsvcGstCtrlProcessProcessWorker: StartupInfo.uNumArgs = '%RU32'\n", pProcess->StartupInfo.uNumArgs); 1517 #ifdef DEBUG /* Never log this stuff in release mode! */ 1518 VGSvcVerbose(3, "vgsvcGstCtrlProcessProcessWorker: StartupInfo.szArgs = '%s'\n", pProcess->StartupInfo.szArgs); 1519 #endif 1520 1500 1521 char **papszArgs; 1501 1522 int cArgs = 0; /* Initialize in case of RTGetOptArgvFromString() is failing ... */ … … 1503 1524 pProcess->StartupInfo.uNumArgs > 0 ? pProcess->StartupInfo.szArgs : "", 1504 1525 RTGETOPTARGV_CNV_QUOTE_BOURNE_SH, NULL); 1505 /* Did we get the same result? */ 1506 Assert((int)pProcess->StartupInfo.uNumArgs == cArgs + 1 /* Take argv[0] into account */); 1507 1526 1527 const bool fHasArgv0 = RT_BOOL(g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_PROCESS_ARGV0); 1528 1529 /* Did we get the same result? 1530 * Take into account that we might not have supplied a (correct) argv[0] from the host. */ 1531 AssertMsg((int)pProcess->StartupInfo.uNumArgs == cArgs + fHasArgv0 ? 0 : 1, 1532 ("StartupInfo.uNumArgs=%RU32 != cArgs=%d, fHostFeatures0=%#x\n", 1533 pProcess->StartupInfo.uNumArgs, cArgs, g_fControlHostFeatures0)); 1508 1534 /* 1509 1535 * Create the environment.
Note:
See TracChangeset
for help on using the changeset viewer.