VirtualBox

Changeset 107990 in vbox for trunk/src/VBox/Installer


Ignore:
Timestamp:
Jan 30, 2025 12:29:09 PM (3 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167253
Message:

Host installer/win: Added ServiceControl() to the VBoxInstallHelper.dll. bugref:10762

Location:
trunk/src/VBox/Installer/win/InstallHelper
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp

    r107949 r107990  
    16171617}
    16181618
     1619UINT __stdcall ServiceControl(MSIHANDLE hModule)
     1620{
     1621    char *pszSvcCtlName;
     1622    int rc = VBoxMsiQueryPropUtf8(hModule, "VBoxSvcCtlName", &pszSvcCtlName);
     1623    if (RT_SUCCESS(rc))
     1624    {
     1625        char *pszSvcCtlFn;
     1626        rc = VBoxMsiQueryPropUtf8(hModule, "VBoxSvcCtlFn", &pszSvcCtlFn);
     1627        if (RT_SUCCESS(rc))
     1628        {
     1629            VBOXWINDRVSVCFN enmFn = VBOXWINDRVSVCFN_INVALID; /* Shut up MSVC. */
     1630            if (!RTStrICmp(pszSvcCtlFn, "start"))
     1631                enmFn = VBOXWINDRVSVCFN_START;
     1632            else if (!RTStrICmp(pszSvcCtlFn, "stop"))
     1633                enmFn = VBOXWINDRVSVCFN_STOP;
     1634            else if (!RTStrICmp(pszSvcCtlFn, "restart"))
     1635                enmFn = VBOXWINDRVSVCFN_RESTART;
     1636            else
     1637                rc = VERR_INVALID_PARAMETER;
     1638
     1639            if (RT_SUCCESS(rc))
     1640            {
     1641                RTMSINTERVAL msTimeout = 0; /* Don't wait by default. */
     1642                rc = VBoxMsiQueryPropInt32(hModule, "VBoxSvcCtlWaitMs", (DWORD *)&msTimeout);
     1643                if (   RT_SUCCESS(rc)
     1644                    || rc == VERR_NOT_FOUND) /* VBoxSvcCtlWaitMs is optional. */
     1645                {
     1646                    VBOXWINDRVINST hWinDrvInst;
     1647                    rc = VBoxWinDrvInstCreateEx(&hWinDrvInst, 1 /* uVerbostiy */,
     1648                                                &vboxWinDrvInstLogCallback, &hModule /* pvUser */);
     1649                    if (RT_SUCCESS(rc))
     1650                    {
     1651                        rc = VBoxWinDrvInstControlServiceEx(hWinDrvInst, pszSvcCtlName, enmFn,
     1652                                                            msTimeout ? VBOXWINDRVSVCFN_F_WAIT : VBOXWINDRVSVCFN_F_NONE,
     1653                                                            msTimeout);
     1654                        VBoxWinDrvInstDestroy(hWinDrvInst);
     1655                    }
     1656                }
     1657            }
     1658
     1659            RTStrFree(pszSvcCtlFn);
     1660        }
     1661
     1662        RTStrFree(pszSvcCtlName);
     1663    }
     1664
     1665    logStringF(hModule, "ServiceControl: Handling done (rc=%Rrc)", rc);
     1666    return RT_SUCCESS(rc) ? ERROR_SUCCESS : ERROR_INVALID_SERVICE_CONTROL;
     1667}
     1668
    16191669#if defined(VBOX_WITH_NETFLT) || defined(VBOX_WITH_NETADP)
    16201670
  • trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.def

    r107948 r107990  
    4848    DriverInstall
    4949    DriverUninstall
     50    ServiceControl
    5051    CreateHostOnlyInterface
    5152    StopHostOnlyInterfaces
Note: See TracChangeset for help on using the changeset viewer.

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