Changeset 95140 in vbox for trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
- Timestamp:
- May 31, 2022 9:11:39 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r94660 r95140 992 992 } 993 993 994 HRESULT rc;995 int irc;996 997 rc = com::Initialize();994 HRESULT hrc; 995 int vrc; 996 997 hrc = com::Initialize(); 998 998 #ifdef VBOX_WITH_XPCOM 999 if ( rc == NS_ERROR_FILE_ACCESS_DENIED)999 if (hrc == NS_ERROR_FILE_ACCESS_DENIED) 1000 1000 { 1001 1001 char szHome[RTPATH_MAX] = ""; … … 1005 1005 } 1006 1006 #endif 1007 if (FAILED( rc))1007 if (FAILED(hrc)) 1008 1008 { 1009 1009 RTPrintf("VBoxHeadless: ERROR: failed to initialize COM!\n"); … … 1022 1022 do 1023 1023 { 1024 rc = pVirtualBoxClient.createInprocObject(CLSID_VirtualBoxClient);1025 if (FAILED( rc))1024 hrc = pVirtualBoxClient.createInprocObject(CLSID_VirtualBoxClient); 1025 if (FAILED(hrc)) 1026 1026 { 1027 1027 RTPrintf("VBoxHeadless: ERROR: failed to create the VirtualBoxClient object!\n"); … … 1029 1029 if (!info.isFullAvailable() && !info.isBasicAvailable()) 1030 1030 { 1031 com::GluePrintRCMessage( rc);1031 com::GluePrintRCMessage(hrc); 1032 1032 RTPrintf("Most likely, the VirtualBox COM server is not running or failed to start.\n"); 1033 1033 } … … 1037 1037 } 1038 1038 1039 rc = pVirtualBoxClient->COMGETTER(VirtualBox)(virtualBox.asOutParam());1040 if (FAILED( rc))1041 { 1042 RTPrintf("Failed to get VirtualBox object (rc=%Rhrc)!\n", rc);1039 hrc = pVirtualBoxClient->COMGETTER(VirtualBox)(virtualBox.asOutParam()); 1040 if (FAILED(hrc)) 1041 { 1042 RTPrintf("Failed to get VirtualBox object (rc=%Rhrc)!\n", hrc); 1043 1043 break; 1044 1044 } 1045 rc = pVirtualBoxClient->COMGETTER(Session)(session.asOutParam());1046 if (FAILED( rc))1047 { 1048 RTPrintf("Failed to get session object (rc=%Rhrc)!\n", rc);1045 hrc = pVirtualBoxClient->COMGETTER(Session)(session.asOutParam()); 1046 if (FAILED(hrc)) 1047 { 1048 RTPrintf("Failed to get session object (rc=%Rhrc)!\n", hrc); 1049 1049 break; 1050 1050 } … … 1053 1053 { 1054 1054 CHECK_ERROR(virtualBox, SetSettingsSecret(Bstr(pcszSettingsPw).raw())); 1055 if (FAILED( rc))1055 if (FAILED(hrc)) 1056 1056 break; 1057 1057 } … … 1065 1065 ComPtr<IMachine> m; 1066 1066 1067 rc = virtualBox->FindMachine(Bstr(pcszNameOrUUID).raw(), m.asOutParam());1068 if (FAILED( rc))1069 { 1070 LogError("Invalid machine name or UUID!\n", rc);1067 hrc = virtualBox->FindMachine(Bstr(pcszNameOrUUID).raw(), m.asOutParam()); 1068 if (FAILED(hrc)) 1069 { 1070 LogError("Invalid machine name or UUID!\n", hrc); 1071 1071 break; 1072 1072 } … … 1093 1093 } 1094 1094 Bstr bstrVMId; 1095 rc = m->COMGETTER(Id)(bstrVMId.asOutParam());1096 AssertComRC( rc);1097 if (FAILED( rc))1095 hrc = m->COMGETTER(Id)(bstrVMId.asOutParam()); 1096 AssertComRC(hrc); 1097 if (FAILED(hrc)) 1098 1098 break; 1099 1099 g_strVMUUID = bstrVMId; 1100 1100 1101 1101 Bstr bstrVMName; 1102 rc = m->COMGETTER(Name)(bstrVMName.asOutParam());1103 AssertComRC( rc);1104 if (FAILED( rc))1102 hrc = m->COMGETTER(Name)(bstrVMName.asOutParam()); 1103 AssertComRC(hrc); 1104 if (FAILED(hrc)) 1105 1105 break; 1106 1106 g_strVMName = bstrVMName; … … 1255 1255 RTPrintf("Error: Invalid VRDE property '%s'\n", aVRDEProperties[i]); 1256 1256 RTStrFree(pszProperty); 1257 rc = E_INVALIDARG;1257 hrc = E_INVALIDARG; 1258 1258 break; 1259 1259 } … … 1263 1263 { 1264 1264 RTPrintf("Error: Failed to allocate memory for VRDE property '%s'\n", aVRDEProperties[i]); 1265 rc = E_OUTOFMEMORY;1265 hrc = E_OUTOFMEMORY; 1266 1266 break; 1267 1267 } 1268 1268 } 1269 if (FAILED( rc))1269 if (FAILED(hrc)) 1270 1270 break; 1271 1271 } … … 1329 1329 CHECK_ERROR_BREAK(console, PowerUpPaused(progress.asOutParam())); 1330 1330 1331 rc = showProgress(progress);1332 if (FAILED( rc))1331 hrc = showProgress(progress); 1332 if (FAILED(hrc)) 1333 1333 { 1334 1334 com::ProgressErrorInfo info(progress); … … 1349 1349 */ 1350 1350 RTTHREAD hThrMsg; 1351 irc = RTThreadCreate(&hThrMsg,1352 windowsMessageMonitor, NULL,1353 0, /* :cbStack */1354 RTTHREADTYPE_MSG_PUMP, 0,1355 "MSG");1356 if (RT_FAILURE( irc)) /* not fatal */1357 LogRel(("VBoxHeadless: failed to start windows message monitor: %Rrc\n", irc));1351 vrc = RTThreadCreate(&hThrMsg, 1352 windowsMessageMonitor, NULL, 1353 0, /* :cbStack */ 1354 RTTHREADTYPE_MSG_PUMP, 0, 1355 "MSG"); 1356 if (RT_FAILURE(vrc)) /* not fatal */ 1357 LogRel(("VBoxHeadless: failed to start windows message monitor: %Rrc\n", vrc)); 1358 1358 #endif /* RT_OS_WINDOWS */ 1359 1359 … … 1365 1365 for (;;) 1366 1366 { 1367 irc = gEventQ->processEventQueue(RT_INDEFINITE_WAIT);1367 vrc = gEventQ->processEventQueue(RT_INDEFINITE_WAIT); 1368 1368 1369 1369 /* … … 1373 1373 if (g_fTerminateFE) 1374 1374 { 1375 LogRel(("VBoxHeadless: processEventQueue: %Rrc, termination requested\n", irc));1376 break; 1377 } 1378 1379 if (RT_FAILURE( irc))1380 { 1381 LogRel(("VBoxHeadless: processEventQueue: %Rrc\n", irc));1382 RTMsgError("event loop: %Rrc", irc);1375 LogRel(("VBoxHeadless: processEventQueue: %Rrc, termination requested\n", vrc)); 1376 break; 1377 } 1378 1379 if (RT_FAILURE(vrc)) 1380 { 1381 LogRel(("VBoxHeadless: processEventQueue: %Rrc\n", vrc)); 1382 RTMsgError("event loop: %Rrc", vrc); 1383 1383 break; 1384 1384 } … … 1409 1409 if (!machine.isNull()) 1410 1410 { 1411 rc = machine->COMGETTER(State)(&machineState);1412 if (SUCCEEDED( rc))1411 hrc = machine->COMGETTER(State)(&machineState); 1412 if (SUCCEEDED(hrc)) 1413 1413 Log(("machine state = %RU32\n", machineState)); 1414 1414 else 1415 Log(("IMachine::getState: %Rhrc\n", rc));1415 Log(("IMachine::getState: %Rhrc\n", hrc)); 1416 1416 } 1417 1417 else … … 1440 1440 CHECK_ERROR_BREAK(gConsole, PowerDown(pProgress.asOutParam())); 1441 1441 1442 rc = showProgress(pProgress);1443 if (FAILED( rc))1442 hrc = showProgress(pProgress); 1443 if (FAILED(hrc)) 1444 1444 { 1445 1445 com::ErrorInfo info; 1446 1446 if (!info.isFullAvailable() && !info.isBasicAvailable()) 1447 com::GluePrintRCMessage( rc);1447 com::GluePrintRCMessage(hrc); 1448 1448 else 1449 1449 com::GluePrintErrorInfo(info); … … 1518 1518 1519 1519 LogRel(("VBoxHeadless: exiting\n")); 1520 return FAILED(rc) ? 1 : 0;1520 return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE; 1521 1521 } 1522 1522
Note:
See TracChangeset
for help on using the changeset viewer.