Changeset 106484 in vbox for trunk/src/VBox/GuestHost
- Timestamp:
- Oct 18, 2024 3:35:06 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/installation/VBoxWinDrvInst.cpp
r106397 r106484 746 746 * 747 747 * @returns VBox status code. 748 * @retval VERR_NOT_FOUND if the given section has not been found. 748 749 * @param pCtx Windows driver installer context. 749 750 * @param pwszInfFile INF file to execute. … … 751 752 * Can have a platform decoration (e.g. "Foobar.NTx86"). 752 753 */ 753 static int vboxWinDrvUninstallInfSectionEx(PVBOXWINDRVINSTINTERNAL pCtx, P RTUTF16 pwszInfFile, PRTUTF16 pwszSection)754 static int vboxWinDrvUninstallInfSectionEx(PVBOXWINDRVINSTINTERNAL pCtx, PCRTUTF16 pwszInfFile, PCRTUTF16 pwszSection) 754 755 { 755 756 AssertPtrReturn(pwszInfFile, VERR_INVALID_POINTER); … … 762 763 if (RT_FAILURE(rc)) 763 764 { 764 vboxWinDrvInstLogError(pCtx, "Unable to open INF file: %Rrc\n", rc); 765 if (rc == VERR_FILE_NOT_FOUND) 766 vboxWinDrvInstLogVerbose(pCtx, 1, "INF file not found anymore, skipping"); 767 else 768 vboxWinDrvInstLogError(pCtx, "Unable to open INF file: %Rrc", rc); 765 769 return rc; 766 770 } … … 783 787 DWORD const dwErr = GetLastError(); 784 788 if (dwErr == ERROR_SECTION_NOT_FOUND) 785 vboxWinDrvInstLogVerbose(pCtx, 1, "INF section \"%ls\" not found, skpping", wszSection); 789 { 790 vboxWinDrvInstLogVerbose(pCtx, 1, "INF section \"%ls\" not found", wszSection); 791 rc = VERR_NOT_FOUND; 792 } 786 793 else 787 794 { … … 819 826 * 820 827 * @returns VBox status code. 828 * @retval VERR_NOT_FOUND if the given section has not been found. 821 829 * @param pCtx Windows driver installer context. 822 830 * @param pwszInfFile INF file to execute. … … 882 890 DWORD const dwErr = GetLastError(); 883 891 if (dwErr == ERROR_SECTION_NOT_FOUND) 892 { 884 893 vboxWinDrvInstLogVerbose(pCtx, 1, "INF section \"%ls\" not found, skipping", wszSection); 894 rc = VERR_NOT_FOUND; 895 } 885 896 else if (dwErr == ERROR_SERVICE_MARKED_FOR_DELETE) 886 897 vboxWinDrvInstLogWarn(pCtx, "Service in INF section \"%ls\" already marked for deletion, skipping", wszSection); … … 927 938 * Installs a section of a given INF file. 928 939 * 929 * Only supported for the VBOXWINDRVINSTMODE_INSTALL_EXECINF + VBOXWINDRVINSTMODE_UNINSTALL_EXECINF modes. 930 * 931 * @returns VBox status code. 940 * Only supported for the VBOXWINDRVINSTMODE_INSTALL_INFSECTION + VBOXWINDRVINSTMODE_UNINSTALL_INFSECTION modes. 941 * 942 * @returns VBox status code. 943 * @retval VERR_NOT_FOUND if the given section has not been found. 932 944 * @param pCtx Windows driver installer context. 933 945 * @param pParms Windows driver installation parameters to use. … … 939 951 940 952 return vboxWinDrvInstallInfSectionEx(pCtx, pParms->pwszInfFile, pParms->u.ExecuteInf.pwszSection); 953 } 954 955 /** 956 * Tries probing a list of well-known sections for installation and will install the first one found. 957 * 958 * @returns VBox status code. 959 * @param pCtx Windows driver installer context. 960 * @param pParms Windows driver installation parameters to use. 961 */ 962 static int vboxWinDrvInstallTryInfSections(PVBOXWINDRVINSTINTERNAL pCtx, PVBOXWINDRVINSTPARMS pParms) 963 { 964 /* Sorted by most likely-ness. */ 965 PRTUTF16 apwszTryInstallSections[] = 966 { 967 /* The more specific (using decorations), the better. Try these first. */ 968 pParms->u.UnInstall.pwszModel, 969 /* Applies to primitive drivers. */ 970 L"DefaultInstall" VBOXWINDRVINF_DOT_NT_NATIVE_ARCH_STR, 971 L"DefaultInstall" 972 }; 973 974 int rc = VINF_SUCCESS; /* Shut up MSVC. */ 975 976 for (int i = 0; i < RT_ELEMENTS(apwszTryInstallSections); i++) 977 { 978 PRTUTF16 const pwszSection = apwszTryInstallSections[i]; 979 980 rc = vboxWinDrvInstallInfSectionEx(pCtx, pParms->pwszInfFile, pwszSection); 981 if (RT_SUCCESS(rc)) 982 break; 983 984 if (rc != VERR_NOT_FOUND) 985 vboxWinDrvInstLogError(pCtx, "Installing INF section failed with %Rrc", rc); 986 } 987 988 if (rc == VERR_NOT_FOUND) 989 { 990 vboxWinDrvInstLogWarn(pCtx, "No matching installation section found -- buggy driver?"); 991 rc = VINF_SUCCESS; 992 } 993 994 return rc; 941 995 } 942 996 … … 980 1034 rc = vboxWinDrvParmsDetermine(pCtx, pParms, true /* fForce */); 981 1035 if (RT_SUCCESS(rc)) 982 { 983 if (pParms->u.UnInstall.pwszModel) 984 rc = vboxWinDrvInstallInfSectionEx(pCtx, pCtx->Parms.pwszInfFile, 985 pParms->u.UnInstall.pwszModel); 986 } 1036 /* rc ignored, keep going */ vboxWinDrvInstallTryInfSections(pCtx, pParms); 987 1037 } 988 1038 else … … 1221 1271 1222 1272 /** 1273 * Tries probing a list of well-known sections for uninstallation and will uninstall the first one found. 1274 * 1275 * @returns VBox status code. 1276 * @param pCtx Windows driver installer context. 1277 * @param pParms Windows driver uninstallation parameters to use. 1278 * @param pwszInfPathAbs Absolute path of INF file to use for uninstallation. 1279 */ 1280 static int vboxWinDrvUninstallTryInfSections(PVBOXWINDRVINSTINTERNAL pCtx, PVBOXWINDRVINSTPARMS pParms, PCRTUTF16 pwszInfPathAbs) 1281 { 1282 /* Sorted by most likely-ness. */ 1283 PRTUTF16 s_apwszTryInstallSections[] = 1284 { 1285 /* The more specific (using decorations), the better. Try these first. */ 1286 pParms->u.UnInstall.pwszModel, 1287 /* Applies to primitive drivers. */ 1288 L"DefaultUninstall" VBOXWINDRVINF_DOT_NT_NATIVE_ARCH_STR, 1289 L"DefaultUninstall" 1290 }; 1291 1292 int rc = VINF_SUCCESS; /* Shut up MSVC. */ 1293 1294 for (int i = 0; i < RT_ELEMENTS(s_apwszTryInstallSections); i++) 1295 { 1296 PRTUTF16 const pwszSection = s_apwszTryInstallSections[i]; 1297 1298 rc = vboxWinDrvUninstallInfSectionEx(pCtx, pwszInfPathAbs, pwszSection); 1299 if (RT_SUCCESS(rc)) 1300 break; 1301 1302 if (rc == VERR_FILE_NOT_FOUND) /* File gone already. */ 1303 { 1304 rc = VINF_SUCCESS; 1305 break; 1306 } 1307 1308 if (rc != VERR_FILE_NOT_FOUND) 1309 vboxWinDrvInstLogError(pCtx, "Uninstalling INF section failed with %Rrc", rc); 1310 } 1311 1312 if (rc == VERR_NOT_FOUND) 1313 { 1314 vboxWinDrvInstLogWarn(pCtx, "No matching uninstallation section found -- buggy driver?"); 1315 rc = VINF_SUCCESS; 1316 } 1317 1318 return rc; 1319 } 1320 1321 /** 1223 1322 * Removes OEM INF files from the driver store. 1224 1323 * … … 1252 1351 vboxWinDrvInstLogInfo(pCtx, "Uninstalling OEM INF \"%ls\" ...", wszInfPathAbs); 1253 1352 1254 int rc2 = vboxWinDrvUninstallInfSectionEx(pCtx, wszInfPathAbs,1255 L"DefaultUninstall" VBOXWINDRVINF_DOT_NT_NATIVE_ARCH_STR);1256 if (RT_FAILURE(rc2))1257 vboxWinDrvInstLogError(pCtx, "Uninstalling INF section failed with %Rrc", rc2);1258 1259 1353 /* 1260 1354 * Remove the driver from the driver store. … … 1286 1380 else 1287 1381 rc = vboxWinDrvInstLogLastError(pCtx, "Uninstalling OEM INF \"%ls\" failed", wszInfPathAbs); 1382 1383 /* If anything failed above, try removing stuff ourselves as good as we can. */ 1384 /* rc ignored, keep going */ vboxWinDrvUninstallTryInfSections(pCtx, pParms, wszInfPathAbs); 1288 1385 } 1289 1386
Note:
See TracChangeset
for help on using the changeset viewer.