VirtualBox

Ignore:
Timestamp:
Oct 30, 2018 2:47:16 PM (6 years ago)
Author:
vboxsync
Message:

SUPDrv/darwin: Show details on VERR_LDR_MISMATCH_NATIVE.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp

    r75053 r75180  
    15451545        return VINF_SUCCESS;
    15461546
    1547     RT_NOREF(pDevExt, pReq);
     1547    /*
     1548     * Try show what when wrong (code is copied from supdrvNtCompare).
     1549     */
     1550    uint32_t        cbLeft       = pImage->cbImageBits;
     1551    const uint8_t  *pbNativeBits = (const uint8_t *)pImage->pvImage;
     1552    for (size_t off = 0; cbLeft > 0; off++, cbLeft--)
     1553        if (pbNativeBits[off] != pbImageBits[off])
     1554        {
     1555            /* Note! We need to copy image bits into a temporary stack buffer here as we'd
     1556                     otherwise risk overwriting them while formatting the error message. */
     1557            uint8_t abBytes[64];
     1558            memcpy(abBytes, &pbImageBits[off], RT_MIN(64, cbLeft));
     1559            supdrvLdrLoadError(VERR_LDR_MISMATCH_NATIVE, pReq,
     1560                               "Mismatch at %#x (%p) of %s loaded at %p:\n"
     1561                               "ring-0: %.*Rhxs\n"
     1562                               "ring-3: %.*Rhxs",
     1563                               off, &pbNativeBits[off], pImage->szName, pImage->pvImage,
     1564                               RT_MIN(64, cbLeft), &pbNativeBits[off],
     1565                               RT_MIN(64, cbLeft), &abBytes[0]);
     1566            printf("SUPDrv: %s", pReq->u.Out.szError);
     1567            break;
     1568        }
     1569
     1570    RT_NOREF(pDevExt);
    15481571    return VERR_LDR_MISMATCH_NATIVE;
    15491572
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