VirtualBox

Changeset 107825 in vbox


Ignore:
Timestamp:
Jan 16, 2025 4:29:03 PM (2 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167001
Message:

Windows driver installation/VBoxDrvInst: Finished up the remaining work from r166902 wrt unified logging facilities for vboxWinDrvInterceptedWinVerifyTrust().

File:
1 edited

Legend:

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

    r107823 r107825  
    268268
    269269/**
    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.
    274275 * @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 */
     278DECLINLINE(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 */
     293DECLINLINE(void) vboxWinDrvInstLogErrorIgn(PVBOXWINDRVINSTINTERNAL pCtx, const char *pszFormat, ...)
    277294{
    278295    va_list args;
    279296    va_start(args, pszFormat);
    280     vboxWinDrvInstLogExV(pCtx, VBOXWINDRIVERLOGTYPE_ERROR, pszFormat, args);
     297    vboxWinDrvInstLogErrorExV(pCtx, true /* fIgnore */, pszFormat, args);
    281298    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 */
     310DECLINLINE(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 */
     327DECLINLINE(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);
    284333}
    285334
     
    937986
    938987#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(). */
     989static PVBOXWINDRVINSTINTERNAL s_vboxWinDrvInterceptedWinVerifyTrustCtx = NULL;
    970990
    971991/**
     
    975995 * This crudely modifies the driver verification request from a WHQL/logo driver
    976996 * check to a simple Authenticode check.
     997 *
     998 * s_vboxWinDrvInterceptedWinVerifyTrustCtx must be set.
    977999 */
    9781000static LONG WINAPI vboxWinDrvInterceptedWinVerifyTrust(HWND hwnd, GUID *pActionId, void *pvData)
    9791001{
     1002    AssertPtrReturn(s_vboxWinDrvInterceptedWinVerifyTrustCtx, TRUST_E_SYSTEM_ERROR);
     1003
    9801004    /*
    9811005     * Resolve the real WinVerifyTrust function.
     
    9901014        if (!hmod)
    9911015        {
    992             vboxWinDrvInterceptedWinVerifyTrustError("InterceptedWinVerifyTrust: Failed to load wintrust.dll");
     1016            vboxWinDrvInstLogErrorIgn(s_vboxWinDrvInterceptedWinVerifyTrustCtx, "InterceptedWinVerifyTrust: Failed to load wintrust.dll");
    9931017            return TRUST_E_SYSTEM_ERROR;
    9941018        }
     
    9961020        if (!pfnRealWinVerifyTrust)
    9971021        {
    998             vboxWinDrvInterceptedWinVerifyTrustError("InterceptedWinVerifyTrust: Failed to locate WinVerifyTrust in wintrust.dll");
     1022            vboxWinDrvInstLogErrorIgn(s_vboxWinDrvInterceptedWinVerifyTrustCtx, "InterceptedWinVerifyTrust: Failed to locate WinVerifyTrust in wintrust.dll");
    9991023            return TRUST_E_SYSTEM_ERROR;
    10001024        }
     
    10131037        {
    10141038            /** @todo don't apply to obvious NT components... */
    1015             vboxWinDrvInterceptedWinVerifyTrustPrint("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");
    10161040            pActionId = (GUID *)&s_GuidActionGenericVerify2;
    10171041        }
    10181042        else if (memcmp(pActionId, &s_GuidActionGenericChainVerify, sizeof(*pActionId)) == 0)
    1019             vboxWinDrvInterceptedWinVerifyTrustPrint("WINTRUST_ACTION_GENERIC_CHAIN_VERIFY");
     1043            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "WINTRUST_ACTION_GENERIC_CHAIN_VERIFY");
    10201044        else if (memcmp(pActionId, &s_GuidActionGenericVerify2, sizeof(*pActionId)) == 0)
    1021             vboxWinDrvInterceptedWinVerifyTrustPrint("WINTRUST_ACTION_GENERIC_VERIFY_V2");
     1045            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "WINTRUST_ACTION_GENERIC_VERIFY_V2");
    10221046        else
    1023             vboxWinDrvInterceptedWinVerifyTrustPrint("WINTRUST_ACTION_UNKNOWN");
     1047            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "WINTRUST_ACTION_UNKNOWN");
    10241048    }
    10251049
     
    10301054    {
    10311055        WINTRUST_DATA *pData = (WINTRUST_DATA *)pvData;
    1032         vboxWinDrvInterceptedWinVerifyTrustPrint("                  cbStruct = %ld", pData->cbStruct);
     1056        vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "                  cbStruct = %ld", pData->cbStruct);
    10331057# ifdef DEBUG
    1034         vboxWinDrvInterceptedWinVerifyTrustPrint("                dwUIChoice = %ld", pData->dwUIChoice);
    1035         vboxWinDrvInterceptedWinVerifyTrustPrint("       fdwRevocationChecks = %ld", pData->fdwRevocationChecks);
    1036         vboxWinDrvInterceptedWinVerifyTrustPrint("             dwStateAction = %ld", pData->dwStateAction);
    1037         vboxWinDrvInterceptedWinVerifyTrustPrint("             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);
    10381062# endif
    10391063        if (pData->cbStruct >= 7*sizeof(uint32_t))
     
    10421066            {
    10431067                case WTD_CHOICE_FILE:
    1044                     vboxWinDrvInterceptedWinVerifyTrustPrint("                     pFile = %p", (uintptr_t)pData->pFile);
     1068                    vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "                     pFile = %p", (uintptr_t)pData->pFile);
    10451069                    if (RT_VALID_PTR(pData->pFile))
    10461070                    {
    1047                         vboxWinDrvInterceptedWinVerifyTrustPrint("           pFile->cbStruct = %ld", pData->pFile->cbStruct);
     1071                        vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "           pFile->cbStruct = %ld", pData->pFile->cbStruct);
    10481072# ifndef DEBUG
    10491073                        if (pData->pFile->hFile)
    10501074# endif
    1051                             vboxWinDrvInterceptedWinVerifyTrustPrint("              pFile->hFile = %p", (uintptr_t)pData->pFile->hFile);
     1075                            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "              pFile->hFile = %p", (uintptr_t)pData->pFile->hFile);
    10521076                        if (RT_VALID_PTR(pData->pFile->pcwszFilePath))
    1053                             vboxWinDrvInterceptedWinVerifyTrustPrint("      pFile->pcwszFilePath = %ls", pData->pFile->pcwszFilePath);
     1077                            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "      pFile->pcwszFilePath = %ls", pData->pFile->pcwszFilePath);
    10541078# ifdef DEBUG
    10551079                        else
    1056                             vboxWinDrvInterceptedWinVerifyTrustPrint("      pFile->pcwszFilePath = %ls", (uintptr_t)pData->pFile->pcwszFilePath);
    1057                         vboxWinDrvInterceptedWinVerifyTrustPrint("     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);
    10581082# endif
    10591083                    }
     
    10611085
    10621086                case WTD_CHOICE_CATALOG:
    1063                     vboxWinDrvInterceptedWinVerifyTrustPrint("                  pCatalog = %p", (uintptr_t)pData->pCatalog);
     1087                    vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "                  pCatalog = %p", (uintptr_t)pData->pCatalog);
    10641088                    if (RT_VALID_PTR(pData->pCatalog))
    10651089                    {
    1066                         vboxWinDrvInterceptedWinVerifyTrustPrint("            pCat->cbStruct = %ld", pData->pCatalog->cbStruct);
     1090                        vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "            pCat->cbStruct = %ld", pData->pCatalog->cbStruct);
    10671091# ifdef DEBUG
    1068                         vboxWinDrvInterceptedWinVerifyTrustPrint("    pCat->dwCatalogVersion = %ld", pData->pCatalog->dwCatalogVersion);
     1092                        vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "    pCat->dwCatalogVersion = %ld", pData->pCatalog->dwCatalogVersion);
    10691093# endif
    10701094                        if (RT_VALID_PTR(pData->pCatalog->pcwszCatalogFilePath))
    1071                             vboxWinDrvInterceptedWinVerifyTrustPrint("pCat->pcwszCatalogFilePath = %ls", pData->pCatalog->pcwszCatalogFilePath);
     1095                            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "pCat->pcwszCatalogFilePath = %ls", pData->pCatalog->pcwszCatalogFilePath);
    10721096# ifdef DEBUG
    10731097                        else
    1074                             vboxWinDrvInterceptedWinVerifyTrustPrint("pCat->pcwszCatalogFilePath =  %ls", (uintptr_t)pData->pCatalog->pcwszCatalogFilePath);
     1098                            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "pCat->pcwszCatalogFilePath =  %ls", (uintptr_t)pData->pCatalog->pcwszCatalogFilePath);
    10751099# endif
    10761100                        if (RT_VALID_PTR(pData->pCatalog->pcwszMemberTag))
    1077                             vboxWinDrvInterceptedWinVerifyTrustPrint("      pCat->pcwszMemberTag = %ls", pData->pCatalog->pcwszMemberTag);
     1101                            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "      pCat->pcwszMemberTag = %ls", pData->pCatalog->pcwszMemberTag);
    10781102# ifdef DEBUG
    10791103                        else
    1080                             vboxWinDrvInterceptedWinVerifyTrustPrint("      pCat->pcwszMemberTag = %ls", (uintptr_t)pData->pCatalog->pcwszMemberTag);
     1104                            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "      pCat->pcwszMemberTag = %ls", (uintptr_t)pData->pCatalog->pcwszMemberTag);
    10811105# endif
    10821106                        if (RT_VALID_PTR(pData->pCatalog->pcwszMemberFilePath))
    1083                             vboxWinDrvInterceptedWinVerifyTrustPrint(" pCat->pcwszMemberFilePath = %ls", pData->pCatalog->pcwszMemberFilePath);
     1107                            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCat->pcwszMemberFilePath = %ls", pData->pCatalog->pcwszMemberFilePath);
    10841108# ifdef DEBUG
    10851109                        else
    1086                             vboxWinDrvInterceptedWinVerifyTrustPrint(" pCat->pcwszMemberFilePath = %ls", (uintptr_t)pData->pCatalog->pcwszMemberFilePath);
     1110                            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, " pCat->pcwszMemberFilePath = %ls", (uintptr_t)pData->pCatalog->pcwszMemberFilePath);
    10871111# else
    10881112                        if (pData->pCatalog->hMemberFile)
    10891113# endif
    1090                             vboxWinDrvInterceptedWinVerifyTrustPrint("         pCat->hMemberFile = %p", (uintptr_t)pData->pCatalog->hMemberFile);
     1114                            vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "         pCat->hMemberFile = %p", (uintptr_t)pData->pCatalog->hMemberFile);
    10911115# ifdef DEBUG
    1092                         vboxWinDrvInterceptedWinVerifyTrustPrint("pCat->pbCalculatedFileHash = %p", (uintptr_t)pData->pCatalog->pbCalculatedFileHash);
    1093                         vboxWinDrvInterceptedWinVerifyTrustPrint("pCat->cbCalculatedFileHash = %ld", pData->pCatalog->cbCalculatedFileHash);
    1094                         vboxWinDrvInterceptedWinVerifyTrustPrint("    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);
    10951119# endif
    10961120                    }
     
    10981122
    10991123                case WTD_CHOICE_BLOB:
    1100                     vboxWinDrvInterceptedWinVerifyTrustPrint("                     pBlob = %p\n", (uintptr_t)pData->pBlob);
     1124                    vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "                     pBlob = %p\n", (uintptr_t)pData->pBlob);
    11011125                    break;
    11021126
    11031127                case WTD_CHOICE_SIGNER:
    1104                     vboxWinDrvInterceptedWinVerifyTrustPrint("                     pSgnr = %p", (uintptr_t)pData->pSgnr);
     1128                    vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "                     pSgnr = %p", (uintptr_t)pData->pSgnr);
    11051129                    break;
    11061130
    11071131                case WTD_CHOICE_CERT:
    1108                     vboxWinDrvInterceptedWinVerifyTrustPrint("                     pCert = %p", (uintptr_t)pData->pCert);
     1132                    vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "                     pCert = %p", (uintptr_t)pData->pCert);
    11091133                    break;
    11101134
    11111135                default:
    1112                     vboxWinDrvInterceptedWinVerifyTrustPrint("             dwUnionChoice = %ld", pData->dwUnionChoice);
     1136                    vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "             dwUnionChoice = %ld", pData->dwUnionChoice);
    11131137                    break;
    11141138            }
     
    11191143     * Make the call.
    11201144     */
    1121     vboxWinDrvInterceptedWinVerifyTrustPrint("Calling WinVerifyTrust ...");
     1145    vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "Calling WinVerifyTrust ...");
    11221146    LONG iRet = pfnRealWinVerifyTrust(hwnd, pActionId, pvData);
    1123     vboxWinDrvInterceptedWinVerifyTrustPrint("WinVerifyTrust returns %ld", iRet);
     1147    vboxWinDrvInstLogVerbose(s_vboxWinDrvInterceptedWinVerifyTrustCtx, 1, "WinVerifyTrust returns %ld", iRet);
    11241148
    11251149    return iRet;
     
    11331157 * Authenticode signature by intercepting the verification call.
    11341158 *
    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 */
     1162static int vboxWinDrvInstallWinVerifyTrustInterceptorInSetupApi(PVBOXWINDRVINSTINTERNAL pCtx)
    11381163{
    11391164    /* Check the version: */
     
    11411166    GetVersionExW(&VerInfo);
    11421167    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__);
    11441175
    11451176    /* The the target module: */
    1146     HMODULE hModSetupApi = GetModuleHandleW(L"SETUPAPI.DLL");
     1177    HMODULE const hModSetupApi = GetModuleHandleW(L"SETUPAPI.DLL");
    11471178    if (!hModSetupApi)
    11481179    {
    11491180        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);
    11521182    }
    11531183
     
    11591189                                                                 + (  pDosHdr->e_magic == IMAGE_DOS_SIGNATURE
    11601190                                                                    ? pDosHdr->e_lfanew : 0));
     1191
    11611192    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");
    11631194    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");
    11651196    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");
    11671198
    11681199    uint32_t const cbDir = pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT].Size;
    11691200    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");
    11711202    uint32_t const cbImages = pNtHdrs->OptionalHeader.SizeOfImage;
    11721203    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");
    11741205    uint32_t const offDir = pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT].VirtualAddress;
    11751206    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");
    11771208
    11781209    /*
     
    11981229                if (RTStrCmp(pName->Name, "WinVerifyTrust") == 0)
    11991230                {
    1200                     vboxWinDrvInterceptedWinVerifyTrustPrint("Intercepting WinVerifyTrust for SETUPAPI.DLL (old: %p)", paIat[iSym]);
     1231                    vboxWinDrvInstLogVerbose(pCtx, 1, "Intercepting WinVerifyTrust for SETUPAPI.DLL (old: %p)", paIat[iSym]);
    12011232                    paIat[iSym] = (uintptr_t)vboxWinDrvInterceptedWinVerifyTrust;
    12021233                    return 0;
    12031234                }
    12041235            }
    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
    12091242}
    12101243#endif /* RT_ARCH_X86 */
     
    12311264
    12321265#ifdef RT_ARCH_X86
    1233             vboxWinDrvInstallWinVerifyTrustInterceptorInSetupApi();
     1266            s_vboxWinDrvInterceptedWinVerifyTrustCtx = pCtx; /* Hand over the driver installer context. */
     1267            vboxWinDrvInstallWinVerifyTrustInterceptorInSetupApi(pCtx);
    12341268#endif
    12351269            /*
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette