setupapi

SetupDiGetClassDescription returns FALSE, sets error 0xE0000206


I've been playing with the SetupApi on Windows 2003 over the last couple of days, and I'm seeing a bunch of errors I'm not expecting. For example, if I pass GUID_NULL to SetupDiGetClassDescription, it returns FALSE and GetLastError() returns 0xE0000206.

The GUID_NULL came from SetupDiEnumDeviceInfo; I'm not doing this deliberately.

I've also seen error 0xE0000209. Where are these "0xE" error values declared, defined or documented?


Solution

  • It turns out that they're in SetupAPI.h, but disguised.

    0xE0000206 is ERROR_INVALID_CLASS:

    #define ERROR_INVALID_CLASS (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x206)
    

    ...and 0xE0000209 is ERROR_INVALID_REG_PROPERTY:

    #define ERROR_INVALID_REG_PROPERTY (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x209)
    

    (and, in WinNT.h)...

    #define APPLICATION_ERROR_MASK       0x20000000
    #define ERROR_SEVERITY_ERROR         0xC0000000
    

    0xC | 0x2 is 0xE.