Changeset 95140 in vbox for trunk/src/VBox/Frontends/VBoxAutostart
- Timestamp:
- May 31, 2022 9:11:39 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxAutostart
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxAutostart/VBoxAutostartStart.cpp
r95139 r95140 87 87 */ 88 88 com::SafeIfaceArray<IMachine> machines; 89 HRESULT rc = g_pVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));90 if (SUCCEEDED( rc))89 HRESULT hrc = g_pVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines)); 90 if (SUCCEEDED(hrc)) 91 91 { 92 92 /* … … 131 131 * just to add this log, hence a bit of duplicate logic here. 132 132 */ 133 if (SUCCEEDED( rc))133 if (SUCCEEDED(hrc)) 134 134 { 135 135 if (machines.size() == 0) … … 142 142 } 143 143 else 144 autostartSvcLogError("Enumerating virtual machines failed with %Rhrc\n", rc);145 146 if ( SUCCEEDED( rc)144 autostartSvcLogError("Enumerating virtual machines failed with %Rhrc\n", hrc); 145 146 if ( SUCCEEDED(hrc) 147 147 && !listVM.empty()) 148 148 { … … 173 173 CHECK_ERROR_BREAK(machine, LaunchVMProcess(g_pSession, Bstr("headless").raw(), 174 174 ComSafeArrayNullInParam(), progress.asOutParam())); 175 if (SUCCEEDED( rc) && !progress.isNull())175 if (SUCCEEDED(hrc) && !progress.isNull()) 176 176 { 177 177 autostartSvcLogVerbose(1, "Waiting for machine '%ls' to power on ...\n", strName.raw()); 178 178 CHECK_ERROR(progress, WaitForCompletion(-1)); 179 if (SUCCEEDED( rc))179 if (SUCCEEDED(hrc)) 180 180 { 181 181 BOOL completed = true; 182 182 CHECK_ERROR(progress, COMGETTER(Completed)(&completed)); 183 if (SUCCEEDED( rc))183 if (SUCCEEDED(hrc)) 184 184 { 185 185 ASSERT(completed); … … 187 187 LONG iRc; 188 188 CHECK_ERROR(progress, COMGETTER(ResultCode)(&iRc)); 189 if (SUCCEEDED( rc))189 if (SUCCEEDED(hrc)) 190 190 { 191 191 if (FAILED(iRc)) … … 202 202 SessionState_T enmSessionState; 203 203 CHECK_ERROR(g_pSession, COMGETTER(State)(&enmSessionState)); 204 if (SUCCEEDED( rc) && enmSessionState == SessionState_Locked)204 if (SUCCEEDED(hrc) && enmSessionState == SessionState_Locked) 205 205 g_pSession->UnlockMachine(); 206 206 } -
trunk/src/VBox/Frontends/VBoxAutostart/VBoxAutostartStop.cpp
r95139 r95140 49 49 static HRESULT autostartSaveVMState(ComPtr<IConsole> &console) 50 50 { 51 HRESULT rc = S_OK;51 HRESULT hrc = S_OK; 52 52 ComPtr<IMachine> machine; 53 53 ComPtr<IProgress> progress; … … 57 57 /* first pause so we don't trigger a live save which needs more time/resources */ 58 58 bool fPaused = false; 59 rc = console->Pause();60 if (FAILED( rc))59 hrc = console->Pause(); 60 if (FAILED(hrc)) 61 61 { 62 62 bool fError = true; 63 if ( rc == VBOX_E_INVALID_VM_STATE)63 if (hrc == VBOX_E_INVALID_VM_STATE) 64 64 { 65 65 /* check if we are already paused */ … … 67 67 CHECK_ERROR_BREAK(console, COMGETTER(State)(&machineState)); 68 68 /* the error code was lost by the previous instruction */ 69 rc = VBOX_E_INVALID_VM_STATE;69 hrc = VBOX_E_INVALID_VM_STATE; 70 70 if (machineState != MachineState_Paused) 71 71 { … … 85 85 CHECK_ERROR(console, COMGETTER(Machine)(machine.asOutParam())); 86 86 CHECK_ERROR(machine, SaveState(progress.asOutParam())); 87 if (FAILED( rc))87 if (FAILED(hrc)) 88 88 { 89 89 if (!fPaused) … … 92 92 } 93 93 94 rc = showProgress(progress);94 hrc = showProgress(progress); 95 95 CHECK_PROGRESS_ERROR(progress, ("Failed to save machine state")); 96 if (FAILED( rc))96 if (FAILED(hrc)) 97 97 { 98 98 if (!fPaused) … … 101 101 } while (0); 102 102 103 return rc;103 return hrc; 104 104 } 105 105 … … 116 116 */ 117 117 com::SafeIfaceArray<IMachine> machines; 118 HRESULT rc = g_pVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));119 if (SUCCEEDED( rc))118 HRESULT hrc = g_pVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines)); 119 if (SUCCEEDED(hrc)) 120 120 { 121 121 /* … … 155 155 } 156 156 157 if ( SUCCEEDED( rc)157 if ( SUCCEEDED(hrc) 158 158 && !listVM.empty()) 159 159 { … … 197 197 case AutostopType_SaveState: 198 198 { 199 rc = autostartSaveVMState(console);199 hrc = autostartSaveVMState(console); 200 200 break; 201 201 } … … 204 204 CHECK_ERROR_BREAK(console, PowerDown(progress.asOutParam())); 205 205 206 rc = showProgress(progress);206 hrc = showProgress(progress); 207 207 CHECK_PROGRESS_ERROR(progress, ("Failed to powering off machine '%ls'", strName.raw())); 208 if (FAILED( rc))209 autostartSvcLogError("Powering off machine '%ls' failed with %Rhrc\n", strName.raw(), rc);208 if (FAILED(hrc)) 209 autostartSvcLogError("Powering off machine '%ls' failed with %Rhrc\n", strName.raw(), hrc); 210 210 break; 211 211 } … … 240 240 autostartSvcLogWarning("The guest of machine '%ls' does not support ACPI shutdown or is currently paused, saving state...\n", 241 241 strName.raw()); 242 rc = autostartSaveVMState(console);242 hrc = autostartSaveVMState(console); 243 243 } 244 244 break;
Note:
See TracChangeset
for help on using the changeset viewer.