VirtualBox

Ignore:
Timestamp:
Dec 7, 2018 11:47:53 AM (6 years ago)
Author:
vboxsync
Message:

SUPDrv-win.cpp: Figure out the correct pool type before we call ExAllocatePoolWithTag in DriverEntry (bugcheck 0xc2, 0x20000,).

File:
1 edited

Legend:

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

    r75282 r76054  
    8686/** Enables the fast I/O control code path. */
    8787#define VBOXDRV_WITH_FAST_IO
     88
     89/* Missing if we're compiling against older WDKs. */
     90#ifndef NonPagedPoolNx
     91# define NonPagedPoolNx     ((POOL_TYPE)512)
     92#endif
    8893
    8994
     
    321326*   Global Variables                                                                                                             *
    322327*********************************************************************************************************************************/
     328/** The non-paged pool type to use, NonPagedPool or NonPagedPoolNx. */
     329static POOL_TYPE      g_enmNonPagedPoolType = NonPagedPool;
    323330/** Pointer to the system device instance. */
    324331static PDEVICE_OBJECT g_pDevObjSys = NULL;
     
    589596
    590597    /*
     598     * Figure out if we can use NonPagedPoolNx or not.
     599     */
     600    ULONG ulMajorVersion, ulMinorVersion, ulBuildNumber;
     601    PsGetVersion(&ulMajorVersion, &ulMinorVersion, &ulBuildNumber, NULL);
     602    if (ulMajorVersion > 6 || (ulMajorVersion == 6 && ulMinorVersion >= 2)) /* >= 6.2 (W8)*/
     603        g_enmNonPagedPoolType = NonPagedPoolNx;
     604
     605    /*
    591606     * Query options first so any overflows on unpatched machines will do less
    592607     * harm (see MS11-011 / 2393802 / 2011-03-18).
     
    596611     */
    597612    NTSTATUS rcNt;
    598     PWSTR pwszCopy = (PWSTR)ExAllocatePoolWithTag(NonPagedPool, pRegPath->Length + sizeof(WCHAR), 'VBox');
     613    PWSTR pwszCopy = (PWSTR)ExAllocatePoolWithTag(g_enmNonPagedPoolType, pRegPath->Length + sizeof(WCHAR), 'VBox');
    599614    if (pwszCopy)
    600615    {
     
    11921207                {
    11931208                    /* Allocate a buffer and copy all the input into it. */
    1194                     PSUPREQHDR pHdr = (PSUPREQHDR)ExAllocatePoolWithTag(NonPagedPool, cbBuf, 'VBox');
     1209                    PSUPREQHDR pHdr = (PSUPREQHDR)ExAllocatePoolWithTag(g_enmNonPagedPoolType, cbBuf, 'VBox');
    11951210                    if (pHdr)
    11961211                    {
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