none
Enabling MEM_TOP_DOWN allocations seems to break SetupDiEnumDeviceInterfaces() on Windows 8 RRS feed

  • Question

  • The following code, when built normally as a 32-bit application, works on a normal 64-bit Windows system and on a system set up to perform MEM_TOP_DOWN allocations as per this article. When this code is linked with the  /LARGEADDRESSAWARE flag it works on the normal system but fails on the MEM_TOP_DOWN system. Either SetupDiGetClassDevs() or SetupDiEnumDeviceInterfaces() is breaking and as a result no matching device interfaces are found.

    I've seen this behaviour with the COM port GUID, and a GUID for my custom device interface. So far I've only tried this on Windows 8, so I'm not sure how widespread it is. Is it a known issue?

    #include "gtest/gtest.h"
    
    #include <windows.h>
    #include <setupapi.h>
    #include <guiddef.h>
    
    TEST(SetupAPI, FindDevInterface)
    {
       GUID                       interfaceGUID_ =
         { 0x86E0D1E0, 0x8089, 0x11D0, { 0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73 } }; // GUID for COM port system device interface class
    
       HDEVINFO                   devInfoSet_;
       DWORD                      indexIntoSet_ = 0;
       SP_DEVICE_INTERFACE_DATA   deviceInterfaceData_;
       BOOL                       isValid;
    
       deviceInterfaceData_.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
    
       DWORD flags = DIGCF_PRESENT | DIGCF_DEVICEINTERFACE;
    
       devInfoSet_ = SetupDiGetClassDevs( &interfaceGUID_,
                                          NULL, // Define no enumerator (global)
                                          NULL, // Define no parent
                                          flags);
    
       ASSERT_TRUE( devInfoSet_ != INVALID_HANDLE_VALUE );
    
    
       isValid = SetupDiEnumDeviceInterfaces(  devInfoSet_,
                                               NULL,
                                               &interfaceGUID_,
                                               indexIntoSet_,
                                               &deviceInterfaceData_ );
    
       EXPECT_TRUE( isValid != 0 );
    }
    


    Thursday, September 12, 2013 2:40 PM

Answers

  • This has been identified as bug in Windows 8. Only possible workaround is not to use MEM_TOP_DOWN.

    Makarand Sonare

    • Proposed as answer by makason Thursday, October 3, 2013 11:50 PM
    • Marked as answer by Doron Holan [MSFT] Friday, October 4, 2013 12:06 AM
    Thursday, October 3, 2013 11:50 PM

All replies

  • This has been identified as bug in Windows 8. Only possible workaround is not to use MEM_TOP_DOWN.

    Makarand Sonare

    • Proposed as answer by makason Thursday, October 3, 2013 11:50 PM
    • Marked as answer by Doron Holan [MSFT] Friday, October 4, 2013 12:06 AM
    Thursday, October 3, 2013 11:50 PM
  • We have just been bitten by this bug. Our software uses a USB key for software protection and Windows 8 reports that no USB devices are plugged in once .NET has allocated above the 2Gb mark (with LARGEADDRESSAWARE enabled in 32 bit). 64 bit is an option but .NET runs significantly slower so it's not ideal.
    Wednesday, March 11, 2015 1:05 PM