VirtualBox

Changeset 89746 in vbox


Ignore:
Timestamp:
Jun 16, 2021 2:39:18 PM (3 years ago)
Author:
vboxsync
Message:

Main: bugref:9341: Made autostart service dependent on WMI service.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxAutostart/VBoxAutostart-win.cpp

    r89571 r89746  
    637637            com::Bstr bstrUserFullName(sUserFullName);
    638638            com::Bstr bstrPwd(strPwd);
     639            com::Bstr bstrDependencies("Winmgmt\0RpcSs\0\0");
    639640
    640641            SC_HANDLE hSvc = CreateServiceW(hSCM,                            /* hSCManager */
     
    648649                                            NULL,                            /* lpLoadOrderGroup */
    649650                                            NULL,                            /* lpdwTagId */
    650                                             NULL,                            /* lpDependencies */
     651                                            bstrDependencies.raw(),          /* lpDependencies */
    651652                                            bstrUserFullName.raw(),          /* lpServiceStartName (NULL => LocalSystem) */
    652653                                            bstrPwd.raw());                  /* lpPassword */
     
    997998
    998999    /*
     1000     * Init com here for first main thread initialization.
     1001     * Service main function called in another thread
     1002     * created by service manager.
     1003     */
     1004    HRESULT hrc = com::Initialize();
     1005# ifdef VBOX_WITH_XPCOM
     1006    if (hrc == NS_ERROR_FILE_ACCESS_DENIED)
     1007    {
     1008        char szHome[RTPATH_MAX] = "";
     1009        com::GetVBoxUserHomeDirectory(szHome, sizeof(szHome));
     1010        return RTMsgErrorExit(RTEXITCODE_FAILURE,
     1011               "Failed to initialize COM because the global settings directory '%s' is not accessible!", szHome);
     1012    }
     1013# endif
     1014    if (FAILED(hrc))
     1015        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to initialize COM (%Rhrc)!", hrc);
     1016
     1017    /*
    9991018     * Initialize release logging, do this early.  This means command
    10001019     * line options (like --logfile &c) can't be introduced to affect
     
    10411060            autostartSvcLogError("Failed to create release log file: %Rrc\n", rc);
    10421061    } while (0);
    1043 
    1044     /*
    1045      * Init com here for first main thread initialization.
    1046      * Service main function called in another thread
    1047      * created by service manager.
    1048      */
    1049     HRESULT hrc = com::Initialize();
    1050 # ifdef VBOX_WITH_XPCOM
    1051     if (hrc == NS_ERROR_FILE_ACCESS_DENIED)
    1052     {
    1053         char szHome[RTPATH_MAX] = "";
    1054         com::GetVBoxUserHomeDirectory(szHome, sizeof(szHome));
    1055         return RTMsgErrorExit(RTEXITCODE_FAILURE,
    1056                "Failed to initialize COM because the global settings directory '%s' is not accessible!", szHome);
    1057     }
    1058 # endif
    1059     if (FAILED(hrc))
    1060         return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to initialize COM (%Rhrc)!", hrc);
    10611062
    10621063    /*
     
    12291230        return RTEXITCODE_FAILURE;
    12301231    }
    1231 
    1232     RTThreadSleep(10 * 1000);
    12331232
    12341233    /*
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