VirtualBox

Changeset 107764 in vbox for trunk/src/VBox/GuestHost


Ignore:
Timestamp:
Jan 15, 2025 9:57:00 AM (4 weeks ago)
Author:
vboxsync
Message:

Windows driver installation/VBoxDrvInst: Added the possibility to manually tweak the OS version to use for (un)installation with VBoxWinDrvInstSetOsVersion(). Can be set via '--debug-os-ver n:n' with VBoxDrvInst.

Location:
trunk/src/VBox/GuestHost/installation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/installation/VBoxDrvInst.cpp

    r107393 r107764  
    141141    VBOXDRVINST_INSTALL_OPT_NOT_FORCE,
    142142    VBOXDRVINST_INSTALL_OPT_NOT_SILENT,
    143     VBOXDRVINST_INSTALL_OPT_IGNORE_REBOOT
     143    VBOXDRVINST_INSTALL_OPT_IGNORE_REBOOT,
     144    VBOXDRVINST_INSTALL_OPT_DEBUG_OS_VER
    144145};
    145146
     
    157158    { "--not-force",     VBOXDRVINST_INSTALL_OPT_NOT_FORCE,     RTGETOPT_REQ_NOTHING },
    158159    { "--not-silent",    VBOXDRVINST_INSTALL_OPT_NOT_SILENT,    RTGETOPT_REQ_NOTHING },
    159     { "--ignore-reboot", VBOXDRVINST_INSTALL_OPT_IGNORE_REBOOT, RTGETOPT_REQ_NOTHING }
     160    { "--ignore-reboot", VBOXDRVINST_INSTALL_OPT_IGNORE_REBOOT, RTGETOPT_REQ_NOTHING },
     161    { "--debug-os-ver",  VBOXDRVINST_INSTALL_OPT_DEBUG_OS_VER,  RTGETOPT_REQ_UINT32_PAIR }
    160162};
    161163
     
    414416        case VBOXDRVINST_INSTALL_OPT_NOT_SILENT:    return "Installation will not run in silent mode";
    415417        case VBOXDRVINST_INSTALL_OPT_IGNORE_REBOOT: return "Ignores reboot requirements";
     418        case VBOXDRVINST_INSTALL_OPT_DEBUG_OS_VER:  return "Overwrites the detected OS version";
    416419        default:
    417420            break;
     
    432435    char *pszPnpId = NULL;
    433436    char *pszInfSection = NULL;
     437    uint64_t uOsVer = 0;
    434438
    435439    /* By default we want to force an installation and be silent. */
     
    487491                break;
    488492
     493            case VBOXDRVINST_INSTALL_OPT_DEBUG_OS_VER:
     494                uOsVer = RTSYSTEM_MAKE_NT_VERSION(ValueUnion.PairU32.uFirst, ValueUnion.PairU32.uSecond,
     495                                                  0 /* Build Version */);
     496                break;
     497
    489498            default:
    490499                return RTGetOptPrintError(ch, &ValueUnion);
     
    503512    if (RT_SUCCESS(rc))
    504513    {
     514        if (uOsVer)
     515            VBoxWinDrvInstSetOsVersion(hWinDrvInst, uOsVer);
     516
    505517        rc = VBoxWinDrvInstInstallEx(hWinDrvInst, pszInfFile, pszModel, pszPnpId, fInstall);
    506518        if (RT_SUCCESS(rc))
     
    712724    RTStrmPrintf(pStrm, "\nExamples:\n");
    713725    RTStrmPrintf(pStrm, "\t%s install   --inf-file C:\\Path\\To\\VBoxUSB.inf\n", pszProcName);
     726    RTStrmPrintf(pStrm, "\t%s install   --debug-os-ver 6:0 --inf-file C:\\Path\\To\\VBoxGuest.inf\n", pszProcName);
    714727    RTStrmPrintf(pStrm, "\t%s uninstall --inf -file C:\\Path\\To\\VBoxUSB.inf --pnp-id \"USB\\VID_80EE&PID_CAFE\"\n", pszProcName);
    715728    RTStrmPrintf(pStrm, "\t%s uninstall --model \"VBoxUSB.AMD64\"\n", pszProcName);
  • trunk/src/VBox/GuestHost/installation/VBoxWinDrvInst.cpp

    r107061 r107764  
    160160    /** Whether a reboot is needed in order to perform the current (un)installation. */
    161161    bool                   fReboot;
     162    /** OS version to use. Detected on creation. RTSYSTEM_NT_VERSION_GET_XXX style.
     163     *  Can be overwritten via VBoxWinDrvInstSetOsVersion(). */
     164    uint64_t               uOsVer;
    162165    /** Parameters for (un)installation. */
    163166    VBOXWINDRVINSTPARMS    Parms;
     
    948951            BOOL fReboot = FALSE;
    949952
    950             uint64_t const uNtVer = RTSystemGetNtVersion();
    951 
    952953            /*
    953954             * Pre-install driver.
    954955             */
    955956            DWORD dwInstallFlags = 0;
    956             if (uNtVer >= RTSYSTEM_MAKE_NT_VERSION(6, 0, 0)) /* for Vista / 2008 Server and up. */
     957            if (pCtx->uOsVer >= RTSYSTEM_MAKE_NT_VERSION(6, 0, 0)) /* for Vista / 2008 Server and up. */
    957958            {
    958959                if (pParms->fFlags & VBOX_WIN_DRIVERINSTALL_F_FORCE)
     
    997998                    {
    998999                        /* Using INSTALLFLAG_NONINTERACTIVE will trigger an invalid parameter error on Windows 2000. */
    999                         if (uNtVer >= RTSYSTEM_MAKE_NT_VERSION(5, 1, 0))
     1000                        if (pCtx->uOsVer >= RTSYSTEM_MAKE_NT_VERSION(5, 1, 0))
    10001001                            dwInstallFlags |= INSTALLFLAG_NONINTERACTIVE;
    10011002                        else
     
    15911592        pCtx->pvUser     = pvUser;
    15921593
    1593         uint64_t const uNtVer = RTSystemGetNtVersion();
     1594        pCtx->uOsVer     = RTSystemGetNtVersion(); /* Might be overwritten later via VBoxWinDrvInstSetOsVersion(). */
    15941595
    15951596        vboxWinDrvInstLogInfo(pCtx, VBOX_PRODUCT " Version " VBOX_VERSION_STRING " - r%s", RTBldCfgRevisionStr());
    1596         vboxWinDrvInstLogInfo(pCtx, "Detected Windows version %d.%d.%d (%s)", RTSYSTEM_NT_VERSION_GET_MAJOR(uNtVer),
    1597                                                                               RTSYSTEM_NT_VERSION_GET_MINOR(uNtVer),
    1598                                                                               RTSYSTEM_NT_VERSION_GET_BUILD(uNtVer),
     1597        vboxWinDrvInstLogInfo(pCtx, "Detected Windows version %d.%d.%d (%s)", RTSYSTEM_NT_VERSION_GET_MAJOR(pCtx->uOsVer),
     1598                                                                              RTSYSTEM_NT_VERSION_GET_MINOR(pCtx->uOsVer),
     1599                                                                              RTSYSTEM_NT_VERSION_GET_BUILD(pCtx->uOsVer),
    15991600                                                                              RTBldCfgTargetArch());
    16001601
     
    16851686
    16861687/**
     1688 * Sets (overwrites) the current OS version used for the (un)installation code.
     1689 *
     1690 * @param   hDrvInst            Windows driver installer handle.
     1691 * @param   uOsVer              OS version to set. RTSYSTEM_MAKE_NT_VERSION style.
     1692 */
     1693void VBoxWinDrvInstSetOsVersion(VBOXWINDRVINST hDrvInst, uint64_t uOsVer)
     1694{
     1695    PVBOXWINDRVINSTINTERNAL pCtx = hDrvInst;
     1696    VBOXWINDRVINST_VALID_RETURN_VOID(pCtx);
     1697
     1698    pCtx->uOsVer = uOsVer;
     1699
     1700    vboxWinDrvInstLogInfo(pCtx, "Set OS version to: %u.%u\n", RTSYSTEM_NT_VERSION_GET_MAJOR(pCtx->uOsVer),
     1701                                                              RTSYSTEM_NT_VERSION_GET_MINOR(pCtx->uOsVer));
     1702}
     1703
     1704/**
    16871705 * Sets the verbosity of a Windows driver installer instance.
    16881706 *
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