VirtualBox

Changeset 107059 in vbox


Ignore:
Timestamp:
Nov 20, 2024 1:50:22 PM (2 months ago)
Author:
vboxsync
Message:

Windows driver installation: Added VBOX_WIN_DRIVERINSTALL_F_DRYRUN to make it possible to run in dry-run mode (no actual installation performed). Required for testcases. bugref:10762

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/GuestHost/VBoxWinDrvInst.h

    r106839 r107059  
    8585/** Force driver installation, even if a newer driver version already is installed (overwrite). */
    8686#define VBOX_WIN_DRIVERINSTALL_F_FORCE      RT_BIT(1)
     87/** Run in dry mode (no real (un)installation performed). */
     88#define VBOX_WIN_DRIVERINSTALL_F_DRYRUN     RT_BIT(2)
    8789/** Validation mask. */
    88 #define VBOX_WIN_DRIVERINSTALL_F_VALID_MASK 0x3
     90#define VBOX_WIN_DRIVERINSTALL_F_VALID_MASK 0x7
    8991
    9092int VBoxWinDrvInstCreate(PVBOXWINDRVINST hDrvInst);
  • trunk/src/VBox/GuestHost/installation/VBoxWinDrvInst.cpp

    r106890 r107059  
    10111011                vboxWinDrvInstLogVerbose(pCtx, 1, "Using g_pfnDiInstallDriverW(), dwInstallFlags=%#x", dwInstallFlags);
    10121012
    1013                 fRc = g_pfnDiInstallDriverW(NULL /* hWndParent */, pParms->pwszInfFile, dwInstallFlags, &fReboot);
     1013                if (!(pParms->fFlags & VBOX_WIN_DRIVERINSTALL_F_DRYRUN))
     1014                    fRc = g_pfnDiInstallDriverW(NULL /* hWndParent */, pParms->pwszInfFile, dwInstallFlags, &fReboot);
     1015                else
     1016                    fRc = TRUE;
    10141017                if (!fRc)
    10151018                {
     
    10561059                                             pParms->u.UnInstall.pwszPnpId, pParms->pwszInfFile, dwInstallFlags);
    10571060
    1058                     fRc = g_pfnUpdateDriverForPlugAndPlayDevicesW(NULL /* hWndParent */,
    1059                                                                   pParms->u.UnInstall.pwszPnpId,
    1060                                                                   pParms->pwszInfFile, dwInstallFlags, &fReboot);
     1061                    if (!(pParms->fFlags & VBOX_WIN_DRIVERINSTALL_F_DRYRUN))
     1062                        fRc = g_pfnUpdateDriverForPlugAndPlayDevicesW(NULL /* hWndParent */,
     1063                                                                      pParms->u.UnInstall.pwszPnpId,
     1064                                                                      pParms->pwszInfFile, dwInstallFlags, &fReboot);
     1065                    else
     1066                        fRc = TRUE;
     1067
    10611068                    if (!fRc)
    10621069                    {
     
    11011108                    {
    11021109                        RTUTF16 wszDstPathAbs[RTPATH_MAX] = { 0 };
    1103                         fRc = g_pfnSetupCopyOEMInfW(wszInfFileAbs, wszSrcPathAbs, SPOST_PATH, 0,
    1104                                                     wszDstPathAbs, RT_ELEMENTS(wszDstPathAbs), NULL, NULL);
     1110                        if (!(pParms->fFlags & VBOX_WIN_DRIVERINSTALL_F_DRYRUN))
     1111                            fRc = g_pfnSetupCopyOEMInfW(wszInfFileAbs, wszSrcPathAbs, SPOST_PATH, 0,
     1112                                                        wszDstPathAbs, RT_ELEMENTS(wszDstPathAbs), NULL, NULL);
     1113                        else
     1114                            fRc = TRUE;
    11051115
    11061116                        vboxWinDrvInstLogVerbose(pCtx, 1, "   INF file: %ls", wszInfFileAbs);
     
    14451455            vboxWinDrvInstLogVerbose(pCtx, 1, "Using DiUninstallDriverW()");
    14461456            BOOL fReboot = FALSE;
    1447             fRc = g_pfnDiUninstallDriverW(NULL /* hWndParent */, pCur->wszInfFile, 0 /* Flags */, &fReboot);
     1457            if (!(pParms->fFlags & VBOX_WIN_DRIVERINSTALL_F_DRYRUN))
     1458                fRc = g_pfnDiUninstallDriverW(NULL /* hWndParent */, pCur->wszInfFile, 0 /* Flags */, &fReboot);
     1459            else
     1460                fRc = TRUE;
    14481461            if (fRc)
    14491462                pCtx->fReboot = RT_BOOL(fReboot);
     
    14661479                dwUninstallFlags |= SUOI_FORCEDELETE;
    14671480
    1468             fRc = g_pfnSetupUninstallOEMInfW(pCur->wszInfFile, dwUninstallFlags, NULL /* pReserved */);
     1481            if (!(pParms->fFlags & VBOX_WIN_DRIVERINSTALL_F_DRYRUN))
     1482                fRc = g_pfnSetupUninstallOEMInfW(pCur->wszInfFile, dwUninstallFlags, NULL /* pReserved */);
     1483            else
     1484                fRc = FALSE;
    14691485        }
    14701486
     
    15501566    bool const fInstall = pParms->enmMode == VBOXWINDRVINSTMODE_INSTALL
    15511567                       || pParms->enmMode == VBOXWINDRVINSTMODE_INSTALL_INFSECTION;
     1568
     1569    if (pParms->fFlags & VBOX_WIN_DRIVERINSTALL_F_DRYRUN)
     1570        vboxWinDrvInstLogWarn(pCtx, "Dry-run mode active -- no installation performed!");
    15521571
    15531572    const char * const pszLogAction = fInstall ? "Installing" : "Uninstalling";
     
    15631582    {
    15641583        vboxWinDrvInstLogInfo(pCtx, "Setting non-interactive mode ...");
    1565         g_pfnSetupSetNonInteractiveMode(TRUE /* fEnable */);
     1584        if (!(pParms->fFlags & VBOX_WIN_DRIVERINSTALL_F_DRYRUN))
     1585            g_pfnSetupSetNonInteractiveMode(TRUE /* fEnable */);
    15661586    }
    15671587
     
    17721792    int rc = RTPathReal(pszInfFile, szInfPathAbs, sizeof(szInfPathAbs));
    17731793    if (RT_SUCCESS(rc))
     1794    {
    17741795        rc = RTStrToUtf16(szInfPathAbs, &pCtx->Parms.pwszInfFile);
    1775 
    1776     if (RT_FAILURE(rc))
    1777         vboxWinDrvInstLogError(pCtx, "Failed to build path for INF file \"%s\", rc=%Rrc", pszInfFile, rc);
     1796        if (RT_FAILURE(rc))
     1797            vboxWinDrvInstLogError(pCtx, "Failed to build path for INF file \"%s\", rc=%Rrc", pszInfFile, rc);
     1798    }
     1799    else
     1800        vboxWinDrvInstLogError(pCtx, "Determining real path for INF file \"%s\" failed, rc=%Rrc", pszInfFile, rc);
    17781801
    17791802    if (RT_SUCCESS(rc) && pszModel) /* Model is optional. */
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