Changeset 107825 in vbox
- Timestamp:
- Jan 16, 2025 4:29:03 PM (2 months ago)
- svn:sync-xref-src-repo-rev:
- 167001
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/installation/VBoxWinDrvInst.cpp
r107823 r107825 268 268 269 269 /** 270 * Logs an error message. 271 * 272 * @returns VBox status code. 273 * @param pCtx Windows driver installer context. 270 * Logs an error message, extended version. 271 * 272 * @returns VBox status code. 273 * @param pCtx Windows driver installer context. 274 * @param fIgnore Whether to ignore the error in the error count or not. 274 275 * @param pszFormat Format string to log. 275 */ 276 DECLINLINE(void) vboxWinDrvInstLogError(PVBOXWINDRVINSTINTERNAL pCtx, const char *pszFormat, ...) 276 * @param args va_list for \a pszFormat. 277 */ 278 DECLINLINE(void) vboxWinDrvInstLogErrorExV(PVBOXWINDRVINSTINTERNAL pCtx, bool fIgnore, const char *pszFormat, va_list args) 279 { 280 vboxWinDrvInstLogExV(pCtx, VBOXWINDRIVERLOGTYPE_ERROR, pszFormat, args); 281 if (!fIgnore) 282 pCtx->cErrors++; 283 } 284 285 /** 286 * Logs an error message but ignores (skips) the error count. 287 * 288 * @returns VBox status code. 289 * @param pCtx Windows driver installer context. 290 * @param pszFormat Format string to log. 291 * @param ... Variable arguments for \a pszFormat. 292 */ 293 DECLINLINE(void) vboxWinDrvInstLogErrorIgn(PVBOXWINDRVINSTINTERNAL pCtx, const char *pszFormat, ...) 277 294 { 278 295 va_list args; 279 296 va_start(args, pszFormat); 280 vboxWinDrvInstLogE xV(pCtx, VBOXWINDRIVERLOGTYPE_ERROR, pszFormat, args);297 vboxWinDrvInstLogErrorExV(pCtx, true /* fIgnore */, pszFormat, args); 281 298 va_end(args); 282 283 pCtx->cErrors++; 299 } 300 301 /** 302 * Logs an error message, ignores (skips) the error count and returns the given rc for convenience. 303 * 304 * @returns VBox status code, given by \a rc. 305 * @param pCtx Windows driver installer context. 306 * @param rc rc to return. 307 * @param pszFormat Format string to log. 308 * @param ... Variable arguments for \a pszFormat. 309 */ 310 DECLINLINE(int) vboxWinDrvInstLogErrorRetIgn(PVBOXWINDRVINSTINTERNAL pCtx, int rc, const char *pszFormat, ...) 311 { 312 va_list args; 313 va_start(args, pszFormat); 314 vboxWinDrvInstLogErrorExV(pCtx, true /* fIgnore */, pszFormat, args); 315 va_end(args); 316 317 return rc; 318 } 319 320 /** 321 * Logs an error message. 322 * 323 * @returns VBox status code. 324 * @param pCtx Windows driver installer context. 325 * @param pszFormat Format string to log. 326 */ 327 DECLINLINE(void) vboxWinDrvInstLogError(PVBOXWINDRVINSTINTERNAL pCtx, const char *pszFormat, ...) 328 { 329 va_list args; 330 va_start(args, pszFormat); 331 vboxWinDrvInstLogErrorExV(pCtx, false /* fIgnore */, pszFormat, args); 332 va_end(args); 284 333 } 285 334 … … 937 986 938 987 #ifdef RT_ARCH_X86 939 /** @todo Make use of the regular logging facilities of VBoxWinDrvInst. */ 940 DECLINLINE(int) vboxWinDrvInterceptedWinVerifyTrustError(const char *pszFormat, ...) 941 { 942 va_list args; 943 va_start(args, pszFormat); 944 char *psz = NULL; 945 RTStrAPrintfV(&psz, pszFormat, args); 946 AssertPtrReturn(psz, -1); 947 948 RTStrmPrintf(g_pStdErr, "Error: %s\n", psz); 949 950 RTStrFree(psz); 951 va_end(args); 952 953 return -1; 954 } 955 956 /** @todo Make use of the regular logging facilities of VBoxWinDrvInst. */ 957 DECLINLINE(void) vboxWinDrvInterceptedWinVerifyTrustPrint(const char *pszFormat, ...) 958 { 959 va_list args; 960 va_start(args, pszFormat); 961 char *psz = NULL; 962 RTStrAPrintfV(&psz, pszFormat, args); 963 AssertPtrReturnVoid(psz); 964 965 RTStrmPrintf(g_pStdOut, "%s\n", psz); 966 967 RTStrFree(psz); 968 va_end(args); 969 } 988 /** Static pointer to the internal driver installer handle, used by vboxWinDrvInterceptedWinVerifyTrust(). */ 989 static PVBOXWINDRVINSTINTERNAL s_vboxWinDrvInterceptedWinVerifyTrustCtx = NULL; 970 990 971 991 /** … … 975 995 * This crudely modifies the driver verification request from a WHQL/logo driver 976 996 * check to a simple Authenticode check. 997 * 998 * s_vboxWinDrvInterceptedWinVerifyTrustCtx must be set. 977 999 */ 978 1000 static LONG WINAPI vboxWinDrvInterceptedWinVerifyTrust(HWND hwnd, GUID *pActionId, void *pvData) 979 1001 { 1002 AssertPtrReturn(s_vboxWinDrvInterceptedWinVerifyTrustCtx, TRUST_E_SYSTEM_ERROR); 1003 980 1004 /* 981 1005 * Resolve the real WinVerifyTrust function. … … 990 1014 if (!hmod) 991 1015 { 992 vboxWinDrvIn terceptedWinVerifyTrustError("InterceptedWinVerifyTrust: Failed to load wintrust.dll");1016 vboxWinDrvInstLogErrorIgn(s_vboxWinDrvInterceptedWinVerifyTrustCtx, "InterceptedWinVerifyTrust: Failed to load wintrust.dll"); 993 1017 return TRUST_E_SYSTEM_ERROR; 994 1018 } … … 996 1020 if (!pfnRealWinVerifyTrust) 997 1021 { 998 vboxWinDrvIn terceptedWinVerifyTrustError("InterceptedWinVerifyTrust: Failed to locate WinVerifyTrust in wintrust.dll");1022 vboxWinDrvInstLogErrorIgn(s_vboxWinDrvInterceptedWinVerifyTrustCtx, "InterceptedWinVerifyTrust: Failed to locate WinVerifyTrust in wintrust.dll"); 999 1023 return TRUST_E_SYSTEM_ERROR; 1000 1024 } … … 1013 1037 { 1014 1038 /** @todo don't apply to obvious NT components... */ 1015 vboxWinDrvIn terceptedWinVerifyTrustPrint("DRIVER_ACTION_VERIFY: Changing it to WINTRUST_ACTION_GENERIC_VERIFY_V2");1039 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "DRIVER_ACTION_VERIFY: Changing it to WINTRUST_ACTION_GENERIC_VERIFY_V2"); 1016 1040 pActionId = (GUID *)&s_GuidActionGenericVerify2; 1017 1041 } 1018 1042 else if (memcmp(pActionId, &s_GuidActionGenericChainVerify, sizeof(*pActionId)) == 0) 1019 vboxWinDrvIn terceptedWinVerifyTrustPrint("WINTRUST_ACTION_GENERIC_CHAIN_VERIFY");1043 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "WINTRUST_ACTION_GENERIC_CHAIN_VERIFY"); 1020 1044 else if (memcmp(pActionId, &s_GuidActionGenericVerify2, sizeof(*pActionId)) == 0) 1021 vboxWinDrvIn terceptedWinVerifyTrustPrint("WINTRUST_ACTION_GENERIC_VERIFY_V2");1045 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "WINTRUST_ACTION_GENERIC_VERIFY_V2"); 1022 1046 else 1023 vboxWinDrvIn terceptedWinVerifyTrustPrint("WINTRUST_ACTION_UNKNOWN");1047 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "WINTRUST_ACTION_UNKNOWN"); 1024 1048 } 1025 1049 … … 1030 1054 { 1031 1055 WINTRUST_DATA *pData = (WINTRUST_DATA *)pvData; 1032 vboxWinDrvIn terceptedWinVerifyTrustPrint(" cbStruct = %ld", pData->cbStruct);1056 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " cbStruct = %ld", pData->cbStruct); 1033 1057 # ifdef DEBUG 1034 vboxWinDrvIn terceptedWinVerifyTrustPrint(" dwUIChoice = %ld", pData->dwUIChoice);1035 vboxWinDrvIn terceptedWinVerifyTrustPrint(" fdwRevocationChecks = %ld", pData->fdwRevocationChecks);1036 vboxWinDrvIn terceptedWinVerifyTrustPrint(" dwStateAction = %ld", pData->dwStateAction);1037 vboxWinDrvIn terceptedWinVerifyTrustPrint(" hWVTStateData = %p", (uintptr_t)pData->hWVTStateData);1058 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " dwUIChoice = %ld", pData->dwUIChoice); 1059 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " fdwRevocationChecks = %ld", pData->fdwRevocationChecks); 1060 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " dwStateAction = %ld", pData->dwStateAction); 1061 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " hWVTStateData = %p", (uintptr_t)pData->hWVTStateData); 1038 1062 # endif 1039 1063 if (pData->cbStruct >= 7*sizeof(uint32_t)) … … 1042 1066 { 1043 1067 case WTD_CHOICE_FILE: 1044 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pFile = %p", (uintptr_t)pData->pFile);1068 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pFile = %p", (uintptr_t)pData->pFile); 1045 1069 if (RT_VALID_PTR(pData->pFile)) 1046 1070 { 1047 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pFile->cbStruct = %ld", pData->pFile->cbStruct);1071 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pFile->cbStruct = %ld", pData->pFile->cbStruct); 1048 1072 # ifndef DEBUG 1049 1073 if (pData->pFile->hFile) 1050 1074 # endif 1051 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pFile->hFile = %p", (uintptr_t)pData->pFile->hFile);1075 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pFile->hFile = %p", (uintptr_t)pData->pFile->hFile); 1052 1076 if (RT_VALID_PTR(pData->pFile->pcwszFilePath)) 1053 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pFile->pcwszFilePath = %ls", pData->pFile->pcwszFilePath);1077 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pFile->pcwszFilePath = %ls", pData->pFile->pcwszFilePath); 1054 1078 # ifdef DEBUG 1055 1079 else 1056 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pFile->pcwszFilePath = %ls", (uintptr_t)pData->pFile->pcwszFilePath);1057 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pFile->pgKnownSubject = %p", (uintptr_t)pData->pFile->pgKnownSubject);1080 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pFile->pcwszFilePath = %ls", (uintptr_t)pData->pFile->pcwszFilePath); 1081 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pFile->pgKnownSubject = %p", (uintptr_t)pData->pFile->pgKnownSubject); 1058 1082 # endif 1059 1083 } … … 1061 1085 1062 1086 case WTD_CHOICE_CATALOG: 1063 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pCatalog = %p", (uintptr_t)pData->pCatalog);1087 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCatalog = %p", (uintptr_t)pData->pCatalog); 1064 1088 if (RT_VALID_PTR(pData->pCatalog)) 1065 1089 { 1066 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pCat->cbStruct = %ld", pData->pCatalog->cbStruct);1090 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCat->cbStruct = %ld", pData->pCatalog->cbStruct); 1067 1091 # ifdef DEBUG 1068 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pCat->dwCatalogVersion = %ld", pData->pCatalog->dwCatalogVersion);1092 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCat->dwCatalogVersion = %ld", pData->pCatalog->dwCatalogVersion); 1069 1093 # endif 1070 1094 if (RT_VALID_PTR(pData->pCatalog->pcwszCatalogFilePath)) 1071 vboxWinDrvIn terceptedWinVerifyTrustPrint("pCat->pcwszCatalogFilePath = %ls", pData->pCatalog->pcwszCatalogFilePath);1095 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "pCat->pcwszCatalogFilePath = %ls", pData->pCatalog->pcwszCatalogFilePath); 1072 1096 # ifdef DEBUG 1073 1097 else 1074 vboxWinDrvIn terceptedWinVerifyTrustPrint("pCat->pcwszCatalogFilePath = %ls", (uintptr_t)pData->pCatalog->pcwszCatalogFilePath);1098 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "pCat->pcwszCatalogFilePath = %ls", (uintptr_t)pData->pCatalog->pcwszCatalogFilePath); 1075 1099 # endif 1076 1100 if (RT_VALID_PTR(pData->pCatalog->pcwszMemberTag)) 1077 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pCat->pcwszMemberTag = %ls", pData->pCatalog->pcwszMemberTag);1101 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCat->pcwszMemberTag = %ls", pData->pCatalog->pcwszMemberTag); 1078 1102 # ifdef DEBUG 1079 1103 else 1080 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pCat->pcwszMemberTag = %ls", (uintptr_t)pData->pCatalog->pcwszMemberTag);1104 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCat->pcwszMemberTag = %ls", (uintptr_t)pData->pCatalog->pcwszMemberTag); 1081 1105 # endif 1082 1106 if (RT_VALID_PTR(pData->pCatalog->pcwszMemberFilePath)) 1083 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pCat->pcwszMemberFilePath = %ls", pData->pCatalog->pcwszMemberFilePath);1107 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCat->pcwszMemberFilePath = %ls", pData->pCatalog->pcwszMemberFilePath); 1084 1108 # ifdef DEBUG 1085 1109 else 1086 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pCat->pcwszMemberFilePath = %ls", (uintptr_t)pData->pCatalog->pcwszMemberFilePath);1110 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCat->pcwszMemberFilePath = %ls", (uintptr_t)pData->pCatalog->pcwszMemberFilePath); 1087 1111 # else 1088 1112 if (pData->pCatalog->hMemberFile) 1089 1113 # endif 1090 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pCat->hMemberFile = %p", (uintptr_t)pData->pCatalog->hMemberFile);1114 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCat->hMemberFile = %p", (uintptr_t)pData->pCatalog->hMemberFile); 1091 1115 # ifdef DEBUG 1092 vboxWinDrvIn terceptedWinVerifyTrustPrint("pCat->pbCalculatedFileHash = %p", (uintptr_t)pData->pCatalog->pbCalculatedFileHash);1093 vboxWinDrvIn terceptedWinVerifyTrustPrint("pCat->cbCalculatedFileHash = %ld", pData->pCatalog->cbCalculatedFileHash);1094 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pCat->pcCatalogContext = %p", (uintptr_t)pData->pCatalog->pcCatalogContext);1116 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "pCat->pbCalculatedFileHash = %p", (uintptr_t)pData->pCatalog->pbCalculatedFileHash); 1117 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "pCat->cbCalculatedFileHash = %ld", pData->pCatalog->cbCalculatedFileHash); 1118 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCat->pcCatalogContext = %p", (uintptr_t)pData->pCatalog->pcCatalogContext); 1095 1119 # endif 1096 1120 } … … 1098 1122 1099 1123 case WTD_CHOICE_BLOB: 1100 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pBlob = %p\n", (uintptr_t)pData->pBlob);1124 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pBlob = %p\n", (uintptr_t)pData->pBlob); 1101 1125 break; 1102 1126 1103 1127 case WTD_CHOICE_SIGNER: 1104 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pSgnr = %p", (uintptr_t)pData->pSgnr);1128 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pSgnr = %p", (uintptr_t)pData->pSgnr); 1105 1129 break; 1106 1130 1107 1131 case WTD_CHOICE_CERT: 1108 vboxWinDrvIn terceptedWinVerifyTrustPrint(" pCert = %p", (uintptr_t)pData->pCert);1132 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCert = %p", (uintptr_t)pData->pCert); 1109 1133 break; 1110 1134 1111 1135 default: 1112 vboxWinDrvIn terceptedWinVerifyTrustPrint(" dwUnionChoice = %ld", pData->dwUnionChoice);1136 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " dwUnionChoice = %ld", pData->dwUnionChoice); 1113 1137 break; 1114 1138 } … … 1119 1143 * Make the call. 1120 1144 */ 1121 vboxWinDrvIn terceptedWinVerifyTrustPrint("Calling WinVerifyTrust ...");1145 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "Calling WinVerifyTrust ..."); 1122 1146 LONG iRet = pfnRealWinVerifyTrust(hwnd, pActionId, pvData); 1123 vboxWinDrvIn terceptedWinVerifyTrustPrint("WinVerifyTrust returns %ld", iRet);1147 vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "WinVerifyTrust returns %ld", iRet); 1124 1148 1125 1149 return iRet; … … 1133 1157 * Authenticode signature by intercepting the verification call. 1134 1158 * 1135 * @return Ignored, just a convenience for saving space in error paths. 1136 */ 1137 static int vboxWinDrvInstallWinVerifyTrustInterceptorInSetupApi(void) 1159 * @returns VBox status code. 1160 * @param pCtx Windows driver installer context. 1161 */ 1162 static int vboxWinDrvInstallWinVerifyTrustInterceptorInSetupApi(PVBOXWINDRVINSTINTERNAL pCtx) 1138 1163 { 1139 1164 /* Check the version: */ … … 1141 1166 GetVersionExW(&VerInfo); 1142 1167 if (VerInfo.dwMajorVersion != 5) 1143 return 1; 1168 { 1169 vboxWinDrvInstLogVerbose(pCtx, 1, "OS not supported to intercept WinVerifyTrust, skipping"); 1170 return VERR_NOT_SUPPORTED; 1171 } 1172 1173 # define PRINT_ERROR_AND_RETURN(a_Msg, ...) \ 1174 return vboxWinDrvInstLogErrorRetIgn(pCtx, VERR_NOT_SUPPORTED, a_Msg, __VA_ARGS__); 1144 1175 1145 1176 /* The the target module: */ 1146 HMODULE hModSetupApi = GetModuleHandleW(L"SETUPAPI.DLL");1177 HMODULE const hModSetupApi = GetModuleHandleW(L"SETUPAPI.DLL"); 1147 1178 if (!hModSetupApi) 1148 1179 { 1149 1180 DWORD const dwLastErr = GetLastError(); 1150 return vboxWinDrvInterceptedWinVerifyTrustError("Failed to locate SETUPAPI.DLL in the process: %ld / %#x", 1151 dwLastErr, dwLastErr); 1181 PRINT_ERROR_AND_RETURN("Failed to locate SETUPAPI.DLL in the process: %ld / %#x", dwLastErr, dwLastErr); 1152 1182 } 1153 1183 … … 1159 1189 + ( pDosHdr->e_magic == IMAGE_DOS_SIGNATURE 1160 1190 ? pDosHdr->e_lfanew : 0)); 1191 1161 1192 if (pNtHdrs->Signature != IMAGE_NT_SIGNATURE) 1162 return vboxWinDrvInterceptedWinVerifyTrustError("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception:");1193 PRINT_ERROR_AND_RETURN("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception: #1"); 1163 1194 if (pNtHdrs->OptionalHeader.Magic != IMAGE_NT_OPTIONAL_HDR_MAGIC) 1164 return vboxWinDrvInterceptedWinVerifyTrustError("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception:");1195 PRINT_ERROR_AND_RETURN("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception: #2"); 1165 1196 if (pNtHdrs->OptionalHeader.NumberOfRvaAndSizes <= IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT) 1166 return vboxWinDrvInterceptedWinVerifyTrustError("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception:");1197 PRINT_ERROR_AND_RETURN("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception: #3"); 1167 1198 1168 1199 uint32_t const cbDir = pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT].Size; 1169 1200 if (cbDir < sizeof(IMAGE_DELAYLOAD_DESCRIPTOR)) 1170 return vboxWinDrvInterceptedWinVerifyTrustError("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception:");1201 PRINT_ERROR_AND_RETURN("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception: #4"); 1171 1202 uint32_t const cbImages = pNtHdrs->OptionalHeader.SizeOfImage; 1172 1203 if (cbDir >= cbImages) 1173 return vboxWinDrvInterceptedWinVerifyTrustError("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception:");1204 PRINT_ERROR_AND_RETURN("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception: #5"); 1174 1205 uint32_t const offDir = pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT].VirtualAddress; 1175 1206 if (offDir > cbImages - cbDir) 1176 return vboxWinDrvInterceptedWinVerifyTrustError("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception:");1207 PRINT_ERROR_AND_RETURN("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception: #6"); 1177 1208 1178 1209 /* … … 1198 1229 if (RTStrCmp(pName->Name, "WinVerifyTrust") == 0) 1199 1230 { 1200 vboxWinDrvIn terceptedWinVerifyTrustPrint("Intercepting WinVerifyTrust for SETUPAPI.DLL (old: %p)", paIat[iSym]);1231 vboxWinDrvInstLogVerbose(pCtx, 1, "Intercepting WinVerifyTrust for SETUPAPI.DLL (old: %p)", paIat[iSym]); 1201 1232 paIat[iSym] = (uintptr_t)vboxWinDrvInterceptedWinVerifyTrust; 1202 1233 return 0; 1203 1234 } 1204 1235 } 1205 return vboxWinDrvInterceptedWinVerifyTrustError("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception:"); 1206 } 1207 } 1208 return vboxWinDrvInterceptedWinVerifyTrustError("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception:"); 1236 PRINT_ERROR_AND_RETURN("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception: #9"); 1237 } 1238 } 1239 PRINT_ERROR_AND_RETURN("Failed to parse SETUPAPI.DLL for WinVerifyTrust interception: #10"); 1240 1241 # undef PRINT_ERROR_AND_RETURN 1209 1242 } 1210 1243 #endif /* RT_ARCH_X86 */ … … 1231 1264 1232 1265 #ifdef RT_ARCH_X86 1233 vboxWinDrvInstallWinVerifyTrustInterceptorInSetupApi(); 1266 s_vboxWinDrvInterceptedWinVerifyTrustCtx = pCtx; /* Hand over the driver installer context. */ 1267 vboxWinDrvInstallWinVerifyTrustInterceptorInSetupApi(pCtx); 1234 1268 #endif 1235 1269 /*
Note:
See TracChangeset
for help on using the changeset viewer.