VirtualBox

Ignore:
Timestamp:
Jun 13, 2022 9:55:08 AM (3 years ago)
Author:
vboxsync
Message:

FE/VBoxAutoStart: Fixed more RTEXITCODE vs. int return codes in autostartSetup(). Added some docs.

Location:
trunk/src/VBox/Frontends/VBoxAutostart
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxAutostart/VBoxAutostart.h

    r95139 r95255  
    357357DECLHIDDEN(RTEXITCODE) autostartSvcDisplayGetOptError(const char *pszAction, int rc, PCRTGETOPTUNION pValue);
    358358
     359/**
     360 * Starts the autostart environment by initializing all needed (global) objects.
     361 *
     362 * @returns VBox status code.
     363 *
     364 * @note    This currently does NOT support multiple instances, be aware of this!
     365 */
    359366DECLHIDDEN(int) autostartSetup(void);
    360367
     368/**
     369 * Stops the autostart environment.
     370 *
     371 * @note    This currently does NOT support multiple instances, be aware of this!
     372 */
    361373DECLHIDDEN(void) autostartShutdown(void);
    362374
  • trunk/src/VBox/Frontends/VBoxAutostart/VBoxAutostartUtils.cpp

    r95139 r95255  
    263263}
    264264
    265 DECLHIDDEN(int) autostartSetup()
     265DECLHIDDEN(int) autostartSetup(void)
    266266{
    267267    autostartSvcOsLogStr("Setting up ...\n", AUTOSTARTLOGTYPE_VERBOSE);
     
    277277        char szHome[RTPATH_MAX] = "";
    278278        com::GetVBoxUserHomeDirectory(szHome, sizeof(szHome));
    279         return RTMsgErrorExit(RTEXITCODE_FAILURE,
    280                "Failed to initialize COM because the global settings directory '%s' is not accessible!", szHome);
     279        autostartSvcLogError("Failed to initialize COM because the global settings directory '%s' is not accessible!", szHome);
     280        return VERR_COM_FILE_ERROR;
    281281    }
    282282# endif
    283283    if (FAILED(hrc))
    284         return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to initialize COM (%Rhrc)!", hrc);
     284    {
     285        autostartSvcLogError("Failed to initialize COM (%Rhrc)!", hrc);
     286        return VERR_COM_UNEXPECTED;
     287    }
    285288
    286289    hrc = g_pVirtualBoxClient.createInprocObject(CLSID_VirtualBoxClient);
     
    292295        {
    293296            com::GluePrintRCMessage(hrc);
    294             RTMsgError("Most likely, the VirtualBox COM server is not running or failed to start.");
     297            autostartSvcLogError("Most likely, the VirtualBox COM server is not running or failed to start.");
    295298        }
    296299        else
    297300            com::GluePrintErrorInfo(info);
    298         return RTEXITCODE_FAILURE;
     301        return VERR_COM_UNEXPECTED;
    299302    }
    300303
     
    302305     * Setup VirtualBox + session interfaces.
    303306     */
    304     HRESULT rc = g_pVirtualBoxClient->COMGETTER(VirtualBox)(g_pVirtualBox.asOutParam());
    305     if (SUCCEEDED(rc))
    306     {
    307         rc = g_pSession.createInprocObject(CLSID_Session);
    308         if (FAILED(rc))
    309             RTMsgError("Failed to create a session object (rc=%Rhrc)!", rc);
     307    hrc = g_pVirtualBoxClient->COMGETTER(VirtualBox)(g_pVirtualBox.asOutParam());
     308    if (SUCCEEDED(hrc))
     309    {
     310        hrc = g_pSession.createInprocObject(CLSID_Session);
     311        if (FAILED(hrc))
     312            autostartSvcLogError("Failed to create a session object (rc=%Rhrc)!", hrc);
    310313    }
    311314    else
    312         RTMsgError("Failed to get VirtualBox object (rc=%Rhrc)!", rc);
    313 
    314     if (FAILED(rc))
     315        autostartSvcLogError("Failed to get VirtualBox object (rc=%Rhrc)!", hrc);
     316
     317    if (FAILED(hrc))
    315318        return VERR_COM_OBJECT_NOT_FOUND;
    316319
     
    318321}
    319322
    320 DECLHIDDEN(void) autostartShutdown()
     323DECLHIDDEN(void) autostartShutdown(void)
    321324{
    322325    autostartSvcOsLogStr("Shutting down ...\n", AUTOSTARTLOGTYPE_VERBOSE);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette