- Timestamp:
- Dec 29, 2017 4:51:03 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 119993
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestProcessImpl.h
r69500 r70388 190 190 int guestRc; 191 191 /** The process tool's returned exit code. */ 192 LONG lExitCode;192 int32_t iExitCode; 193 193 }; 194 194 … … 229 229 bool i_isRunning(void); 230 230 231 int i_terminatedOk( LONG *plExitCode = NULL);231 int i_terminatedOk(int32_t *piExitCode = NULL); 232 232 233 233 int i_terminate(uint32_t uTimeoutMS, int *pGuestRc); … … 245 245 GuestCtrlStreamObjects *pStrmOutObjects, uint32_t cStrmOutObjects, GuestProcessToolErrorInfo &errorInfo); 246 246 247 static int i_exitCodeToRc(const GuestProcessStartupInfo &startupInfo, LONG lExitCode);248 249 static int i_exitCodeToRc(const char *pszTool, LONG lExitCode);247 static int i_exitCodeToRc(const GuestProcessStartupInfo &startupInfo, int32_t iExitCode); 248 249 static int i_exitCodeToRc(const char *pszTool, int32_t iExitCode); 250 250 251 251 protected: -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r69500 r70388 2066 2066 { 2067 2067 if (errorInfo.guestRc == VWRN_GSTCTL_PROCESS_EXIT_CODE) 2068 { 2069 guestRc = GuestProcessTool::i_exitCodeToRc(startupInfo, errorInfo.lExitCode); 2070 } 2068 guestRc = GuestProcessTool::i_exitCodeToRc(startupInfo, errorInfo.iExitCode); 2071 2069 else 2072 2070 guestRc = errorInfo.guestRc; … … 2122 2120 { 2123 2121 if (errorInfo.guestRc == VWRN_GSTCTL_PROCESS_EXIT_CODE) 2124 { 2125 guestRc = GuestProcessTool::i_exitCodeToRc(startupInfo, errorInfo.lExitCode); 2126 } 2122 guestRc = GuestProcessTool::i_exitCodeToRc(startupInfo, errorInfo.iExitCode); 2127 2123 else 2128 2124 guestRc = errorInfo.guestRc; … … 2193 2189 vrc = procTool.i_wait(GUESTPROCESSTOOL_FLAG_NONE, &errorInfo.guestRc); 2194 2190 if (RT_SUCCESS(vrc)) 2195 errorInfo.guestRc = procTool.i_terminatedOk(&errorInfo. lExitCode);2196 } 2197 2198 LogFlowFunc(("Returned rc=%Rrc, guestRc=%Rrc, exitCode=%ld\n", vrc, errorInfo.guestRc, errorInfo.lExitCode));2191 errorInfo.guestRc = procTool.i_terminatedOk(&errorInfo.iExitCode); 2192 } 2193 2194 LogFlowFunc(("Returned rc=%Rrc, guestRc=%Rrc, iExitCode=%d\n", vrc, errorInfo.guestRc, errorInfo.iExitCode)); 2199 2195 return vrc; 2200 2196 } … … 2207 2203 * or VINF_SUCCESS otherwise. 2208 2204 * 2209 * @param p lExitCode Exit code of the tool. Optional.2205 * @param piExitCode Exit code of the tool. Optional. 2210 2206 */ 2211 int GuestProcessTool::i_terminatedOk( LONG *plExitCode /* = NULL */)2207 int GuestProcessTool::i_terminatedOk(int32_t *piExitCode /* = NULL */) 2212 2208 { 2213 2209 Assert(!pProcess.isNull()); … … 2217 2213 if (!i_isRunning()) 2218 2214 { 2219 LONG lExitCode = -1;2220 HRESULT hr = pProcess->COMGETTER(ExitCode(& lExitCode));2215 LONG iExitCode = -1; 2216 HRESULT hr = pProcess->COMGETTER(ExitCode(&iExitCode)); 2221 2217 AssertComRC(hr); 2222 2218 2223 if (plExitCode) 2224 *plExitCode = lExitCode; 2225 2226 vrc = (lExitCode != 0) 2227 ? VWRN_GSTCTL_PROCESS_EXIT_CODE : VINF_SUCCESS; 2219 if (piExitCode) 2220 *piExitCode = iExitCode; 2221 2222 vrc = iExitCode != 0 ? VWRN_GSTCTL_PROCESS_EXIT_CODE : VINF_SUCCESS; 2228 2223 } 2229 2224 else … … 2241 2236 int GuestProcessTool::i_waitEx(uint32_t fFlags, GuestProcessStreamBlock *pStrmBlkOut, int *pGuestRc) 2242 2237 { 2243 LogFlowThisFunc(("fFlags=0x%x, pStreamBlock=%p, pGuestRc=%p\n", 2244 fFlags, pStrmBlkOut, pGuestRc)); 2238 LogFlowThisFunc(("fFlags=0x%x, pStreamBlock=%p, pGuestRc=%p\n", fFlags, pStrmBlkOut, pGuestRc)); 2245 2239 2246 2240 /* Can we parse the next block without waiting? */ … … 2448 2442 * Converts a toolbox tool's exit code to an IPRT error code. 2449 2443 * 2450 * @return int 2451 * @param startupInfo 2452 * @param lExitCodeThe toolbox tool's exit code to lookup IPRT error for.2444 * @return int Returned IPRT error for the particular tool. 2445 * @param startupInfo Startup info of the toolbox tool to lookup error code for. 2446 * @param iExitCode The toolbox tool's exit code to lookup IPRT error for. 2453 2447 */ 2454 2448 /* static */ 2455 int GuestProcessTool::i_exitCodeToRc(const GuestProcessStartupInfo &startupInfo, LONG lExitCode)2449 int GuestProcessTool::i_exitCodeToRc(const GuestProcessStartupInfo &startupInfo, int32_t iExitCode) 2456 2450 { 2457 2451 if (startupInfo.mArguments.size() == 0) … … 2461 2455 } 2462 2456 2463 return i_exitCodeToRc(startupInfo.mArguments[0].c_str(), lExitCode);2457 return i_exitCodeToRc(startupInfo.mArguments[0].c_str(), iExitCode); 2464 2458 } 2465 2459 … … 2469 2463 * @return Returned IPRT error for the particular tool. 2470 2464 * @param pszTool Name of toolbox tool to lookup error code for. 2471 * @param lExitCode The toolbox tool's exit code to lookup IPRT error for.2465 * @param iExitCode The toolbox tool's exit code to lookup IPRT error for. 2472 2466 */ 2473 2467 /* static */ 2474 int GuestProcessTool::i_exitCodeToRc(const char *pszTool, LONG lExitCode)2468 int GuestProcessTool::i_exitCodeToRc(const char *pszTool, int32_t iExitCode) 2475 2469 { 2476 2470 AssertPtrReturn(pszTool, VERR_INVALID_POINTER); 2477 2471 2478 LogFlowFunc(("%s: % ld\n", pszTool, lExitCode));2479 2480 if ( lExitCode == 0) /* No error? Bail out early. */2472 LogFlowFunc(("%s: %d\n", pszTool, iExitCode)); 2473 2474 if (iExitCode == 0) /* No error? Bail out early. */ 2481 2475 return VINF_SUCCESS; 2482 2476 2483 2477 if (!RTStrICmp(pszTool, VBOXSERVICE_TOOL_CAT)) 2484 2478 { 2485 switch ( lExitCode)2479 switch (iExitCode) 2486 2480 { 2487 2481 case VBOXSERVICETOOLBOX_CAT_EXITCODE_ACCESS_DENIED: return VERR_ACCESS_DENIED; … … 2495 2489 else if (!RTStrICmp(pszTool, VBOXSERVICE_TOOL_STAT)) 2496 2490 { 2497 switch ( lExitCode)2491 switch (iExitCode) 2498 2492 { 2499 2493 case VBOXSERVICETOOLBOX_STAT_EXITCODE_ACCESS_DENIED: return VERR_ACCESS_DENIED; … … 2504 2498 } 2505 2499 } 2506 2507 AssertMsgFailed(("Error code %ld for tool '%s' not handled\n", lExitCode, pszTool)); 2500 else if (!RTStrICmp(pszTool, VBOXSERVICE_TOOL_MKDIR)) 2501 { 2502 switch (iExitCode) 2503 { 2504 case RTEXITCODE_FAILURE: return VERR_CANT_CREATE; 2505 } 2506 } 2507 2508 #ifdef DEBUG_andy 2509 AssertMsgFailed(("Exit code %d for tool '%s' not handled\n", iExitCode, pszTool)); 2510 #endif 2511 if (iExitCode == RTEXITCODE_SYNTAX) 2512 return VERR_INTERNAL_ERROR_5; 2508 2513 return VERR_GENERAL_FAILURE; 2509 2514 }
Note:
See TracChangeset
for help on using the changeset viewer.