VirtualBox

Ignore:
Timestamp:
Dec 15, 2017 3:07:27 PM (7 years ago)
Author:
vboxsync
Message:

IPRT: Don't call ExAllocatePool[WithTag] directly unless you must, use RTMemAlloc et al instead. Simplified the NT4 ExAllocatePool/ExAllocatePoolWithTag unwrapping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp

    r69111 r70153  
    4646    if (!(fFlags & RTMEMHDR_FLAG_ANY_CTX))
    4747    {
    48 #if 1 /* This allegedly makes the driver verifier happier... */
    49         POOL_TYPE enmPoolType = NonPagedPool;
    50         if (!(fFlags & RTMEMHDR_FLAG_EXEC) && g_uRtNtVersion >= RTNT_MAKE_VERSION(8,0))
    51             enmPoolType = NonPagedPoolNx;
    52         PRTMEMHDR pHdr = (PRTMEMHDR)ExAllocatePoolWithTag(enmPoolType, cb + sizeof(*pHdr), IPRT_NT_POOL_TAG);
    53 #else
    54         PRTMEMHDR pHdr = (PRTMEMHDR)ExAllocatePoolWithTag(NonPagedPool, cb + sizeof(*pHdr), IPRT_NT_POOL_TAG);
    55 #endif
     48        PRTMEMHDR pHdr;
     49        if (g_pfnrtExAllocatePoolWithTag)
     50        {
     51            if (!(fFlags & RTMEMHDR_FLAG_EXEC) && g_uRtNtVersion >= RTNT_MAKE_VERSION(8,0))
     52                pHdr = (PRTMEMHDR)ExAllocatePoolWithTag(NonPagedPoolNx, cb + sizeof(*pHdr), IPRT_NT_POOL_TAG);
     53            else
     54                pHdr = (PRTMEMHDR)ExAllocatePoolWithTag(NonPagedPool, cb + sizeof(*pHdr), IPRT_NT_POOL_TAG);
     55        }
     56        else
     57            pHdr = (PRTMEMHDR)ExAllocatePool(NonPagedPool, cb + sizeof(*pHdr));
    5658        if (pHdr)
    5759        {
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