Changeset 106839 in vbox
- Timestamp:
- Nov 5, 2024 5:22:30 PM (7 months ago)
- svn:sync-xref-src-repo-rev:
- 165750
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/VBoxWinDrvInst.h
r106323 r106839 95 95 unsigned VBoxWinDrvInstSetVerbosity(VBOXWINDRVINST hDrvInst, uint8_t uVerbosity); 96 96 void VBoxWinDrvInstSetLogCallback(VBOXWINDRVINST hDrvInst, PFNVBOXWINDRIVERLOGMSG pfnLog, void *pvUser); 97 int VBoxWinDrvInstInstall(VBOXWINDRVINST hDrvInst, const char *pszInfFile, const char *pszPnpId, uint32_t fFlags); 97 int VBoxWinDrvInstInstallEx(VBOXWINDRVINST hDrvInst, const char *pszInfFile, const char *pszModel, const char *pszPnpId, uint32_t fFlags); 98 int VBoxWinDrvInstInstall(VBOXWINDRVINST hDrvInst, const char *pszInfFile, uint32_t fFlags); 98 99 int VBoxWinDrvInstInstallExecuteInf(VBOXWINDRVINST hDrvInst, const char *pszInfFile, const char *pszSection, uint32_t fFlags); 99 100 int VBoxWinDrvInstUninstall(VBOXWINDRVINST hDrvInst, const char *pszInfFile, const char *pszModel, const char *pszPnPId, uint32_t fFlags); -
trunk/src/VBox/Additions/WINNT/Installer/VBoxDrvInst.cpp
r106529 r106839 617 617 if (RT_SUCCESS(rc)) 618 618 { 619 rc = VBoxWinDrvInstInstall (hWinDrvInst, pszInfFile, pszPnpId,620 VBOX_WIN_DRIVERINSTALL_F_SILENT | VBOX_WIN_DRIVERINSTALL_F_FORCE);619 rc = VBoxWinDrvInstInstallEx(hWinDrvInst, pszInfFile, NULL /* pszModel */, pszPnpId, 620 VBOX_WIN_DRIVERINSTALL_F_SILENT | VBOX_WIN_DRIVERINSTALL_F_FORCE); 621 621 622 622 VBoxWinDrvInstDestroy(hWinDrvInst); -
trunk/src/VBox/GuestHost/installation/VBoxWinDrvCommon.cpp
r106395 r106839 139 139 * 140 140 * @returns VBox status code. 141 * @retval VERR_NOT_FOUND if no model has been found. 141 142 * @param hInf INF handle to use. 142 143 * @param ppwszValue Where to return the model name on success. 143 144 * @param pcwcValue Where to return the number of characters for \a ppwszValue. Optional an can be NULL. 145 * 146 * @note Only for non-"primitive" drivers. 144 147 */ 145 148 int VBoxWinDrvInfQueryModelsSectionName(HINF hInf, PRTUTF16 *ppwszValue, PDWORD pcwcValue) … … 152 155 static PRTUTF16 s_apwszSections[] = 153 156 { 154 /* The more specific (using decorations), the better. Try these first. */ 155 L"Manufacturer" VBOXWINDRVINF_DOT_NT_NATIVE_ARCH_STR, 156 L"DefaultInstall" VBOXWINDRVINF_DOT_NT_NATIVE_ARCH_STR, 157 L"DefaultUninstall" VBOXWINDRVINF_DOT_NT_NATIVE_ARCH_STR, 158 /* Try undecorated sections last. */ 157 /* Most likely (and doesn't have a decoration). */ 159 158 L"Manufacturer", 160 L"DefaultInstall", 161 L"DefaultUninstall" 159 L"Manufacturer" VBOXWINDRVINF_DOT_NT_NATIVE_ARCH_STR, 160 /* Note: Don't search for "DefaultInstall" or "DefaultUninstall" sections here, as 161 * those only are used for "primitive" drivers. */ 162 162 }; 163 163 … … 419 419 * 420 420 * @returns VBox status code. 421 * @retval VERR_NOT_FOUND if no model has been found. 421 422 * @param hInf INF handle to use. 422 423 * @param ppwszModel Where to return the model on success. 423 424 * Needs to be free'd by RTUtf16Free(). 425 * 426 * @note Only for non-"primitive" drivers. 424 427 */ 425 428 int VBoxWinDrvInfQueryFirstModel(HINF hInf, PRTUTF16 *ppwszModel) … … 434 437 * 435 438 * @returns VBox status code. 439 * @retval VERR_NOT_FOUND if no PnP ID has been found. 436 440 * @param hInf INF handle to use. 437 441 * @param pwszModel Model to query PnP ID for. 438 442 * @param ppwszPnPId Where to return the PnP ID on success. 439 443 * Needs to be free'd by RTUtf16Free(). 444 * 445 * @note Only for non-"primitive" drivers. 440 446 */ 441 447 int VBoxWinDrvInfQueryFirstPnPId(HINF hInf, PRTUTF16 pwszModel, PRTUTF16 *ppwszPnPId) 442 448 { 449 if (!pwszModel) /* No model given? Bail out early. */ 450 return VERR_NOT_FOUND; 451 443 452 *ppwszPnPId = NULL; 444 453 -
trunk/src/VBox/GuestHost/installation/VBoxWinDrvInst.cpp
r106828 r106839 647 647 case VBOXWINDRVINSTMODE_UNINSTALL: 648 648 { 649 RTUtf16Free(pParms->u.UnInstall.pwszModel); 650 pParms->u.UnInstall.pwszModel = NULL; 649 651 RTUtf16Free(pParms->u.UnInstall.pwszPnpId); 650 652 pParms->u.UnInstall.pwszPnpId = NULL; … … 758 760 * @param pwszInfPathAbs Absolute path of INF file to use for [un]installation. 759 761 * @param pwszSection Section to invoke for [un]installation. 762 * If NULL, the "DefaultInstall" / "DefaultUninstall" section will be tried. 760 763 * @param pfnCallback Callback to invoke for each found section. 761 764 */ … … 763 766 PFNVBOXWINDRVINST_TRYINFSECTION_CALLBACK pfnCallback) 764 767 { 765 vboxWinDrvInstLogVerbose(pCtx, 1, "Trying section \"%ls\"", pwszSection); 768 if (pwszSection) 769 vboxWinDrvInstLogVerbose(pCtx, 1, "Trying section \"%ls\"", pwszSection); 766 770 767 771 /* Sorted by most likely-ness. */ … … 812 816 vboxWinDrvInstLogError(pCtx, "Trying INF section failed with %Rrc", rc); 813 817 } 818 819 if (RT_SUCCESS(rc)) /* Bail out if callback above succeeded. */ 820 break; 814 821 } 815 822 816 823 if (rc == VERR_NOT_FOUND) 817 824 { 818 vboxWinDrvInstLogWarn(pCtx, "No matching section to try found -- buggy driver?");825 vboxWinDrvInstLogWarn(pCtx, "No matching sections to try found -- buggy driver?"); 819 826 rc = VINF_SUCCESS; 820 827 } … … 1058 1065 static int vboxWinDrvInstallPerform(PVBOXWINDRVINSTINTERNAL pCtx, PVBOXWINDRVINSTPARMS pParms) 1059 1066 { 1060 int rc = VINF_SUCCESS; 1067 int rc = vboxWinDrvParmsDetermine(pCtx, pParms, false /* fForce */); 1068 if (RT_FAILURE(rc)) 1069 return rc; 1061 1070 1062 1071 switch (pParms->enmMode) … … 1076 1085 */ 1077 1086 DWORD dwInstallFlags = 0; 1078 if (uNtVer >= RTSYSTEM_MAKE_NT_VERSION(6 , 0, 0)) /* for Vista / 2008 Server and up. */1087 if (uNtVer >= RTSYSTEM_MAKE_NT_VERSION(66, 0, 0)) /* for Vista / 2008 Server and up. */ 1079 1088 { 1080 1089 if (pParms->fFlags & VBOX_WIN_DRIVERINSTALL_F_FORCE) … … 1084 1093 1085 1094 fRc = g_pfnDiInstallDriverW(NULL /* hWndParent */, pParms->pwszInfFile, dwInstallFlags, &fReboot); 1095 if (!fRc) 1096 { 1097 DWORD const dwErr = GetLastError(); 1098 1099 /* 1100 * Work around an error code wich only appears on old(er) Windows Server editions (e.g. 2012 R2 or 2016) 1101 * where SetupAPI tells "unable to mark devices that match new inf", which ultimately results in 1102 * ERROR_LINE_NOT_FOUND. This probably is because of primitive drivers which don't have a PnP ID set in 1103 * the INF file. 1104 * 1105 * pnputil.exe also gives the same error in the SetupAPI log when handling the very same INF file. 1106 * 1107 * So skip this error and pretend everything is fine. */ 1108 if (dwErr == ERROR_LINE_NOT_FOUND) 1109 fRc = true; 1110 1111 if (!fRc) 1112 rc = vboxWinDrvInstLogLastError(pCtx, "DiInstallDriverW() failed"); 1113 } 1114 1086 1115 if (fRc) 1087 1116 { 1088 rc = vboxWinDrvParmsDetermine(pCtx, pParms, true /* fForce */); 1089 if (RT_SUCCESS(rc)) 1090 /* rc ignored, keep going */ vboxWinDrvTryInfSection(pCtx, 1091 pParms->pwszInfFile, pParms->u.UnInstall.pwszModel, 1092 vboxWinDrvInstallTryInfSectionCallback); 1117 rc = vboxWinDrvTryInfSection(pCtx, 1118 pParms->pwszInfFile, pParms->u.UnInstall.pwszModel, 1119 vboxWinDrvInstallTryInfSectionCallback); 1093 1120 } 1094 else1095 rc = vboxWinDrvInstLogLastError(pCtx, "DiInstallDriverW() failed");1096 1121 } 1097 1122 else /* For Windows 2000 and below. */ 1098 1123 { 1099 /* If no PnP ID (Hardware ID) is explicitly given, try guessing the PnP ID from the given INF file. */ 1100 size_t cchPnpId = RTUtf16Len(pParms->u.UnInstall.pwszPnpId); 1101 if ( !cchPnpId 1102 || cchPnpId > MAX_DEVICE_ID_LEN) 1103 { 1104 vboxWinDrvInstLogInfo(pCtx, "PnP ID not specified explicitly or invalid, determining from given INF file"); 1105 rc = vboxWinDrvParmsDetermine(pCtx, pParms, true /* fForce */); 1106 if (RT_SUCCESS(rc)) 1107 cchPnpId = RTUtf16Len(pParms->u.UnInstall.pwszPnpId); 1108 } 1109 1110 if (RT_FAILURE(rc)) 1111 break; 1112 1113 /* Still not having any PnP ID? */ 1114 if (cchPnpId == 0) 1115 { 1116 vboxWinDrvInstLogError(pCtx, "No (valid) PnP ID found; can't continue"); 1117 rc = VERR_NOT_FOUND; 1118 break; 1119 } 1120 else 1124 bool fPreInstall = false; /* Whether to pre-install the driver. */ 1125 bool fInstallSection = false; /* Whether to install the section of the specified driver model. */ 1126 1127 if (pParms->u.UnInstall.pwszPnpId) 1121 1128 { 1122 1129 if (pParms->fFlags & VBOX_WIN_DRIVERINSTALL_F_SILENT) … … 1147 1154 vboxWinDrvInstLogInfo(pCtx, "Device (\"%ls\") not found (yet), pre-installing driver ...", 1148 1155 pParms->u.UnInstall.pwszPnpId); 1149 1150 RTUTF16 wszInfFileAbs[RTPATH_MAX] = { 0 }; 1151 LPWSTR pwszInfFile = NULL; 1152 if ( GetFullPathNameW(pParms->pwszInfFile, RT_ELEMENTS(wszInfFileAbs), wszInfFileAbs, &pwszInfFile) 1153 && pwszInfFile) 1154 { 1155 RTUTF16 wszSrcPathAbs[RTPATH_MAX] = { 0 }; 1156 rc = RTUtf16CopyEx(wszSrcPathAbs, RT_ELEMENTS(wszSrcPathAbs), wszInfFileAbs, 1157 RTUtf16Len(wszInfFileAbs) - RTUtf16Len(pwszInfFile)); 1158 if (RT_SUCCESS(rc)) 1159 { 1160 RTUTF16 wszDstPathAbs[RTPATH_MAX] = { 0 }; 1161 fRc = g_pfnSetupCopyOEMInfW(wszInfFileAbs, wszSrcPathAbs, SPOST_PATH, 0, 1162 wszDstPathAbs, RT_ELEMENTS(wszDstPathAbs), NULL, NULL); 1163 1164 vboxWinDrvInstLogVerbose(pCtx, 1, " INF file: %ls", wszInfFileAbs); 1165 vboxWinDrvInstLogVerbose(pCtx, 1, "Source path: %ls", wszSrcPathAbs); 1166 vboxWinDrvInstLogVerbose(pCtx, 1, " Dest path: %ls", wszDstPathAbs); 1167 1168 if (fRc) 1169 vboxWinDrvInstLogInfo(pCtx, "Copying OEM INF successful"); 1170 else 1171 rc = vboxWinDrvInstLogLastError(pCtx, "Installation(SetupCopyOEMInfW) failed"); 1172 } 1173 } 1174 else 1175 rc = vboxWinDrvInstLogLastError(pCtx, "GetFullPathNameW() failed"); 1156 fPreInstall = true; 1176 1157 break; 1177 1158 } … … 1179 1160 case ERROR_NO_DRIVER_SELECTED: 1180 1161 { 1181 rc = vboxWinDrvParmsDetermine(pCtx, pParms, true /* fForce */); 1182 if (RT_SUCCESS(rc)) 1183 { 1184 if (pParms->u.UnInstall.pwszModel) 1185 rc = vboxWinDrvInstallInfSectionEx(pCtx, pCtx->Parms.pwszInfFile, 1186 pParms->u.UnInstall.pwszModel); 1187 } 1162 vboxWinDrvInstLogWarn(pCtx, "Not able to select a driver from the given INF, using given model"); 1163 fInstallSection = true; 1188 1164 break; 1189 1165 } … … 1195 1171 } 1196 1172 } 1173 else 1174 { 1175 fPreInstall = true; 1176 fInstallSection = true; 1177 } 1178 1179 if (fPreInstall) 1180 { 1181 RTUTF16 wszInfFileAbs[RTPATH_MAX] = { 0 }; 1182 LPWSTR pwszInfFile = NULL; 1183 if ( GetFullPathNameW(pParms->pwszInfFile, RT_ELEMENTS(wszInfFileAbs), wszInfFileAbs, &pwszInfFile) 1184 && pwszInfFile) 1185 { 1186 RTUTF16 wszSrcPathAbs[RTPATH_MAX] = { 0 }; 1187 rc = RTUtf16CopyEx(wszSrcPathAbs, RT_ELEMENTS(wszSrcPathAbs), wszInfFileAbs, 1188 RTUtf16Len(wszInfFileAbs) - RTUtf16Len(pwszInfFile)); 1189 if (RT_SUCCESS(rc)) 1190 { 1191 RTUTF16 wszDstPathAbs[RTPATH_MAX] = { 0 }; 1192 fRc = g_pfnSetupCopyOEMInfW(wszInfFileAbs, wszSrcPathAbs, SPOST_PATH, 0, 1193 wszDstPathAbs, RT_ELEMENTS(wszDstPathAbs), NULL, NULL); 1194 1195 vboxWinDrvInstLogVerbose(pCtx, 1, " INF file: %ls", wszInfFileAbs); 1196 vboxWinDrvInstLogVerbose(pCtx, 1, "Source path: %ls", wszSrcPathAbs); 1197 vboxWinDrvInstLogVerbose(pCtx, 1, " Dest path: %ls", wszDstPathAbs); 1198 1199 if (fRc) 1200 vboxWinDrvInstLogInfo(pCtx, "Copying OEM INF successful"); 1201 else 1202 rc = vboxWinDrvInstLogLastError(pCtx, "Installation(SetupCopyOEMInfW) failed"); 1203 } 1204 } 1205 else 1206 rc = vboxWinDrvInstLogLastError(pCtx, "GetFullPathNameW() failed"); 1207 } 1208 1209 if (fInstallSection) 1210 { 1211 rc = vboxWinDrvTryInfSection(pCtx, 1212 pParms->pwszInfFile, pParms->u.UnInstall.pwszModel, 1213 vboxWinDrvInstallTryInfSectionCallback); 1214 } 1197 1215 } 1198 1216 … … 1218 1236 1219 1237 /** 1238 * Returns whether the given (in)installation parameters are valid or not. 1239 * 1240 * @returns \c true if valid, \c false if not. 1241 * @param pCtx Windows driver installer context. 1242 * @param pParms Windows driver (un)installation parameters to validate. 1243 */ 1244 static bool vboxWinDrvParmsAreValid(PVBOXWINDRVINSTINTERNAL pCtx, PVBOXWINDRVINSTPARMS pParms) 1245 { 1246 if (pParms->u.UnInstall.pwszPnpId) 1247 { 1248 size_t const cchPnpId = RTUtf16Len(pParms->u.UnInstall.pwszPnpId); 1249 if ( !cchPnpId 1250 || cchPnpId > MAX_DEVICE_ID_LEN) 1251 { 1252 vboxWinDrvInstLogVerbose(pCtx, 1, "PnP ID not specified explicitly or invalid"); 1253 return false; 1254 } 1255 } 1256 1257 return true; 1258 } 1259 1260 /** 1220 1261 * Determines (un)installation parameters from a given set of parameters, logged. 1221 1262 * … … 1225 1266 * @param pParms Windows driver installation parameters to determine for. 1226 1267 * @param fForce Whether to overwrite already set parameters or not. 1268 * 1269 * @note Only can deal with the first model / PnP ID found for now. 1227 1270 */ 1228 1271 static int vboxWinDrvParmsDetermine(PVBOXWINDRVINSTINTERNAL pCtx, PVBOXWINDRVINSTPARMS pParms, bool fForce) … … 1240 1283 if (!pParms->u.UnInstall.pwszModel || fForce) 1241 1284 { 1242 vboxWinDrvInstLogVerbose(pCtx, 1, "Determining first model ..."); 1243 VBoxWinDrvInfQueryFirstModel(hInf, &pParms->u.UnInstall.pwszModel); 1285 vboxWinDrvInstLogVerbose(pCtx, 1, "Determining model ..."); 1286 if (fForce) 1287 { 1288 RTUtf16Free(pParms->u.UnInstall.pwszModel); 1289 pParms->u.UnInstall.pwszModel = NULL; 1290 } 1291 rc = VBoxWinDrvInfQueryFirstModel(hInf, &pParms->u.UnInstall.pwszModel); 1292 if (rc == VERR_NOT_FOUND) 1293 { 1294 vboxWinDrvInstLogVerbose(pCtx, 1, "No model found, probably a primitive driver"); 1295 rc = VINF_SUCCESS; /* Reset rc, non-fatal. */ 1296 } 1244 1297 } 1245 1298 if (!pParms->u.UnInstall.pwszPnpId || fForce) 1246 1299 { 1247 vboxWinDrvInstLogVerbose(pCtx, 1, "Determining first PnP ID ..."); 1248 VBoxWinDrvInfQueryFirstPnPId(hInf, 1249 pParms->u.UnInstall.pwszModel, &pParms->u.UnInstall.pwszPnpId); 1300 if (pParms->u.UnInstall.pwszModel) 1301 { 1302 vboxWinDrvInstLogVerbose(pCtx, 1, "Determining PnP ID ..."); 1303 if (fForce) 1304 { 1305 RTUtf16Free(pParms->u.UnInstall.pwszPnpId); 1306 pParms->u.UnInstall.pwszPnpId = NULL; 1307 } 1308 /* ignore rc */ VBoxWinDrvInfQueryFirstPnPId(hInf, 1309 pParms->u.UnInstall.pwszModel, &pParms->u.UnInstall.pwszPnpId); 1310 } 1311 else 1312 vboxWinDrvInstLogVerbose(pCtx, 1, "No first model found/set, skipping determining PnP ID"); 1250 1313 } 1251 1314 VBoxWinDrvInfClose(hInf); … … 1258 1321 || pParms->u.UnInstall.pwszPnpId) 1259 1322 { 1323 /* Nothing to do for us here. */ 1260 1324 rc = VINF_SUCCESS; 1261 1325 } … … 1439 1503 { 1440 1504 rc = vboxWinDrvUninstallFromDriverStore(pCtx, pParms, pList); 1441 if (RT_SUCCESS(rc))1442 {1443 1444 }1445 1505 1446 1506 VBoxWinDrvStoreListFree(pList); … … 1494 1554 } 1495 1555 1556 if (!vboxWinDrvParmsAreValid(pCtx, pParms)) 1557 { 1558 vboxWinDrvInstLogError(pCtx, "%s parameters are invalid, can't continue", fInstall ? "Installation" : "Uninstallation"); 1559 return VERR_INVALID_PARAMETER; 1560 } 1561 1496 1562 int rc; 1497 1563 if (fInstall) … … 1510 1576 } 1511 1577 } 1512 else 1513 vboxWinDrvInstLogError(pCtx, "Unable to %sinstall driver, rc=%Rrc", fInstall ? "" : "un", rc); 1578 1579 /* Note: Call vboxWinDrvInstLogEx() to not increase the error/warn count here. */ 1580 if (pCtx->cErrors) 1581 vboxWinDrvInstLogEx(pCtx, VBOXWINDRIVERLOGTYPE_ERROR, "%sstalling driver(s) failed with %u errors, %u warnings (rc=%Rrc)", 1582 fInstall ? "In" : "Unin", pCtx->cErrors, pCtx->cWarnings, rc); 1583 else if (pCtx->cWarnings) 1584 vboxWinDrvInstLogEx(pCtx, VBOXWINDRIVERLOGTYPE_WARN, "%sstalling driver(s) succeeded with %u warnings", 1585 fInstall ? "In" : "Unin", pCtx->cWarnings); 1514 1586 1515 1587 return rc; … … 1665 1737 1666 1738 /** 1667 * Installs a driver .1739 * Installs a driver, extended version. 1668 1740 * 1669 1741 * @returns VBox status code. 1670 1742 * @param hDrvInst Windows driver installer handle to use. 1671 1743 * @param pszInfFile INF file to use. 1744 * @param pszModel Model name to use. Optional and can be NULL. 1672 1745 * @param pszPnpId PnP ID to use. NT-style wildcards supported. Optional and can be NULL. 1673 1746 * @param fFlags Installation flags (of type VBOX_WIN_DRIVERINSTALL_F_XXX) to use. 1674 1747 */ 1675 int VBoxWinDrvInstInstall(VBOXWINDRVINST hDrvInst, const char *pszInfFile, const char *pszPnpId, uint32_t fFlags) 1748 int VBoxWinDrvInstInstallEx(VBOXWINDRVINST hDrvInst, 1749 const char *pszInfFile, const char *pszModel, const char *pszPnpId, uint32_t fFlags) 1676 1750 { 1677 1751 PVBOXWINDRVINSTINTERNAL pCtx = hDrvInst; … … 1691 1765 vboxWinDrvInstLogError(pCtx, "Failed to build path for INF file \"%s\", rc=%Rrc", pszInfFile, rc); 1692 1766 1693 if (RT_SUCCESS(rc) && pszPnpId) /* PnP ID is optional. */ 1767 if (RT_SUCCESS(rc) && pszModel) /* Model is optional. */ 1768 rc = RTStrToUtf16(pszModel, &pCtx->Parms.u.UnInstall.pwszModel); 1769 if (RT_SUCCESS(rc) && pszPnpId) /* Ditto. */ 1694 1770 rc = RTStrToUtf16(pszPnpId, &pCtx->Parms.u.UnInstall.pwszPnpId); 1695 1771 … … 1708 1784 1709 1785 return rc; 1786 } 1787 1788 /** 1789 * Installs a driver. 1790 * 1791 * @returns VBox status code. 1792 * @param hDrvInst Windows driver installer handle to use. 1793 * @param pszInfFile INF file to use. 1794 * @param fFlags Installation flags (of type VBOX_WIN_DRIVERINSTALL_F_XXX) to use. 1795 * 1796 * @note This function tries determining the model / PnP ID from the given INF file. 1797 * To control the behavior exactly, use VBoxWinDrvInstInstallEx(). 1798 */ 1799 int VBoxWinDrvInstInstall(VBOXWINDRVINST hDrvInst, const char *pszInfFile, uint32_t fFlags) 1800 { 1801 return VBoxWinDrvInstInstallEx(hDrvInst, pszInfFile, NULL /* pszModel */, NULL /* pszPnpId */, fFlags); 1710 1802 } 1711 1803 -
trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp
r106822 r106839 1472 1472 || rc == VERR_NOT_FOUND) /* VBoxDrvInstInfSection is optional. */ 1473 1473 { 1474 char *psz PnpId= NULL;1475 rc = VBoxMsiQueryPropUtf8(hModule, "VBoxDrvInst PnpId", &pszPnpId);1474 char *pszModel = NULL; 1475 rc = VBoxMsiQueryPropUtf8(hModule, "VBoxDrvInstModel", &pszModel); 1476 1476 if ( RT_SUCCESS(rc) 1477 || rc == VERR_NOT_FOUND) /* VBoxDrvInstHwId is optional. */ 1478 { 1479 uint32_t fFlags = VBOX_WIN_DRIVERINSTALL_F_NONE; 1480 1481 DWORD dwVal; 1482 rc = VBoxMsiQueryPropInt32(hModule, "VBoxDrvInstFlagForce", &dwVal); 1483 if (RT_SUCCESS(rc)) 1484 fFlags |= VBOX_WIN_DRIVERINSTALL_F_FORCE; 1485 rc = VBoxMsiQueryPropInt32(hModule, "VBoxDrvInstFlagSilent", &dwVal); 1486 if (RT_SUCCESS(rc)) 1487 fFlags |= VBOX_WIN_DRIVERINSTALL_F_SILENT; 1488 1489 VBOXWINDRVINST hWinDrvInst; 1490 rc = VBoxWinDrvInstCreateEx(&hWinDrvInst, 1 /* uVerbostiy */, &vboxWinDrvInstLogCallback, &hModule /* pvUser */); 1491 if (RT_SUCCESS(rc)) 1477 || rc == VERR_NOT_FOUND) /* VBoxDrvInstModel is optional. */ 1478 { 1479 char *pszPnpId = NULL; 1480 rc = VBoxMsiQueryPropUtf8(hModule, "VBoxDrvInstPnpId", &pszPnpId); 1481 if ( RT_SUCCESS(rc) 1482 || rc == VERR_NOT_FOUND) /* VBoxDrvInstPnpId is optional. */ 1492 1483 { 1493 if (pszInfSection && *pszInfSection) 1494 rc = VBoxWinDrvInstInstallExecuteInf(hWinDrvInst, pszInfFile, pszInfSection, fFlags); 1495 else 1496 rc = VBoxWinDrvInstInstall(hWinDrvInst, pszInfFile, pszPnpId, fFlags); 1497 1498 VBoxWinDrvInstDestroy(hWinDrvInst); 1484 uint32_t fFlags = VBOX_WIN_DRIVERINSTALL_F_NONE; 1485 1486 DWORD dwVal; 1487 rc = VBoxMsiQueryPropInt32(hModule, "VBoxDrvInstFlagForce", &dwVal); 1488 if (RT_SUCCESS(rc)) 1489 fFlags |= VBOX_WIN_DRIVERINSTALL_F_FORCE; 1490 rc = VBoxMsiQueryPropInt32(hModule, "VBoxDrvInstFlagSilent", &dwVal); 1491 if (RT_SUCCESS(rc)) 1492 fFlags |= VBOX_WIN_DRIVERINSTALL_F_SILENT; 1493 1494 VBOXWINDRVINST hWinDrvInst; 1495 rc = VBoxWinDrvInstCreateEx(&hWinDrvInst, 1 /* uVerbostiy */, &vboxWinDrvInstLogCallback, &hModule /* pvUser */); 1496 if (RT_SUCCESS(rc)) 1497 { 1498 if (pszInfSection && *pszInfSection) 1499 rc = VBoxWinDrvInstInstallExecuteInf(hWinDrvInst, pszInfFile, pszInfSection, fFlags); 1500 else 1501 rc = VBoxWinDrvInstInstallEx(hWinDrvInst, pszInfFile, pszModel, pszPnpId, fFlags); 1502 1503 VBoxWinDrvInstDestroy(hWinDrvInst); 1504 } 1505 1506 RTStrFree(pszPnpId); 1499 1507 } 1500 1508 1501 RTStrFree(psz PnpId);1509 RTStrFree(pszModel); 1502 1510 } 1503 1511
Note:
See TracChangeset
for help on using the changeset viewer.