Changeset 83508 in vbox for trunk/src/VBox
- Timestamp:
- Apr 1, 2020 4:24:33 PM (5 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
r83420 r83508 1039 1039 * 1040 1040 * @return IPRT status code. 1041 * @param pszArgv0 First argument (argv0), either original or modified version. Optional.1041 * @param pszArgv0 First argument (argv0), either original or modified version. 1042 1042 * @param papszArgs Original argv command line from the host, starting at argv[1]. 1043 1043 * @param fFlags The process creation flags pass to us from the host. … … 1048 1048 char ***ppapszArgv) 1049 1049 { 1050 AssertPtrReturn(ppapszArgv, VERR_INVALID_POINTER);1051 1052 1050 VGSvcVerbose(3, "VGSvcGstCtrlProcessPrepareArgv: pszArgv0=%p, papszArgs=%p, fFlags=%#x, ppapszArgv=%p\n", 1053 1051 pszArgv0, papszArgs, fFlags, ppapszArgv); 1052 1053 AssertPtrReturn(pszArgv0, VERR_INVALID_POINTER); 1054 AssertPtrReturn(ppapszArgv, VERR_INVALID_POINTER); 1054 1055 1055 1056 int rc = VINF_SUCCESS; … … 1067 1068 return VERR_NO_MEMORY; 1068 1069 1070 VGSvcVerbose(3, "VGSvcGstCtrlProcessAllocateArgv: pszArgv0 = '%s', cArgs=%RU32, cbSize=%zu\n", pszArgv0, cArgs, cbSize); 1069 1071 #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]); 1073 VGSvcVerbose(3, "VGSvcGstCtrlProcessAllocateArgv: cbSize=%RU32, cArgs=%RU32\n", cbSize, cArgs); 1072 if (cArgs) 1073 { 1074 for (uint32_t i = 0; i < cArgs; i++) 1075 VGSvcVerbose(3, "VGSvcGstCtrlProcessAllocateArgv: papszArgs[%RU32] = '%s'\n", i, papszArgs[i]); 1076 } 1074 1077 #endif 1075 1078 … … 1081 1084 || !strpbrk(pszArgv0, " \t\n\r") 1082 1085 || pszArgv0[0] == '"') 1086 { 1083 1087 rc = RTStrDupEx(&papszNewArgv[0], pszArgv0); 1088 } 1084 1089 else 1085 1090 { 1086 1091 size_t cchArgv0 = strlen(pszArgv0); 1092 AssertReturn(cchArgv0, VERR_INVALID_PARAMETER); /* Paranoia. */ 1087 1093 rc = RTStrAllocEx(&papszNewArgv[0], 1 + cchArgv0 + 1 + 1); 1088 1094 if (RT_SUCCESS(rc)) … … 1349 1355 * 1350 1356 * - 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 do1357 * unmodified executable name (pszExec) as the (default) argv[0]. This is wrong, but we can't do 1352 1358 * much about it. The rest (argv[1,2,n]) then gets set starting at papszArgs[0]. 1353 1359 * … … 1357 1363 const bool fHasArgv0 = RT_BOOL(g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_PROCESS_ARGV0); 1358 1364 1365 const char *pcszArgv0 = (fHasArgv0 && papszArgs[0]) ? papszArgs[0] : pszExec; 1366 AssertPtrReturn(pcszArgv0, VERR_INVALID_POINTER); /* Paranoia. */ 1367 1368 const char * const *pcszArgvN = fHasArgv0 && papszArgs + 1 ? papszArgs + 1 : papszArgs; 1369 AssertPtrReturn(pcszArgvN, VERR_INVALID_POINTER); /* Ditto. */ 1370 1371 VGSvcVerbose(3, "vgsvcGstCtrlProcessCreateProcess: fHasArgv0=%RTbool, pcszArgv0=%p, pcszArgvN=%p, g_fControlHostFeatures0=%#x\n", 1372 fHasArgv0, pcszArgv0, pcszArgvN, g_fControlHostFeatures0); 1373 1359 1374 char **papszArgsExp; 1360 rc = vgsvcGstCtrlProcessAllocateArgv(fHasArgv0 ? papszArgs[0] : pszExec, 1361 fHasArgv0 ? &papszArgs[1] : &papszArgs[0], 1362 fFlags, &papszArgsExp); 1375 rc = vgsvcGstCtrlProcessAllocateArgv(pcszArgv0, pcszArgvN, fFlags, &papszArgsExp); 1363 1376 if (RT_FAILURE(rc)) 1364 1377 { … … 1526 1539 1527 1540 #ifdef VBOX_STRICT 1528 const bool fHasArgv0 = RT_BOOL(g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_PROCESS_ARGV0); 1541 const bool fHasArgv0 = RT_BOOL(g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_PROCESS_ARGV0); RT_NOREF(fHasArgv0); 1542 const int cArgsToCheck = cArgs; /** @ŧodo Do we still need to do this? + (fHasArgv0 ? 0 : 1); */ 1529 1543 1530 1544 /* Did we get the same result? 1531 1545 * Take into account that we might not have supplied a (correct) argv[0] from the host. */ 1532 AssertMsg((int)pProcess->StartupInfo.uNumArgs == cArgs + fHasArgv0 ? 0 : 1,1533 (" StartupInfo.uNumArgs=%RU32 !=cArgs=%d, fHostFeatures0=%#x\n",1534 pProcess->StartupInfo.uNumArgs, cArgs, g_fControlHostFeatures0));1546 AssertMsg((int)pProcess->StartupInfo.uNumArgs == cArgsToCheck, 1547 ("rc=%Rrc, StartupInfo.uNumArgs=%RU32 != cArgsToCheck=%d, cArgs=%d, fHostFeatures0=%#x\n", 1548 rc, pProcess->StartupInfo.uNumArgs, cArgsToCheck, cArgs, g_fControlHostFeatures0)); 1535 1549 #endif 1536 1550 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
r83441 r83508 1720 1720 g_fControlSupportsOptimizations = VbglR3GuestCtrlSupportsOptimizations(idClient); 1721 1721 g_idControlSvcClient = idClient; 1722 VbglR3GuestCtrlQueryFeatures(idClient, &g_fControlHostFeatures0); 1722 1723 int rc2 = VbglR3GuestCtrlQueryFeatures(idClient, &g_fControlHostFeatures0); 1724 if (RT_FAILURE(rc2)) /* Querying host features is not fatal -- do not use rc here. */ 1725 VGSvcVerbose(1, "Querying host features failed with %Rrc\n", rc2); 1723 1726 1724 1727 rc = vgsvcGstCtrlSessionReadKeyAndAccept(idClient, pSession->StartupInfo.uSessionID); 1725 1728 if (RT_SUCCESS(rc)) 1726 1729 { 1727 VGSvcVerbose(1, "Using client ID=%RU32 \n", idClient);1730 VGSvcVerbose(1, "Using client ID=%RU32, g_fControlHostFeatures0=%#x\n", idClient, g_fControlHostFeatures0); 1728 1731 1729 1732 /*
Note:
See TracChangeset
for help on using the changeset viewer.