[wdmaudiodev] SetupDiXxx return wrong facility codes in GetLastError

  • From: Eugene Muzychenko <emuzychenko@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Sat, 13 Jan 2007 20:10:34 +0600

Working with SetupAPI for several years, from Win95 to Vista, I
noticed strange error codes periodically returned by SetupDiXxx
functions (GetLastError). These codes have FACILITY_NULL, were unknown
to FormatMessage and I could not find them in winerror.h. I thought
they are a kind of internal codes and didn't investigate them more.

But today I tried to open a non-existent device instance and got an
error code 0xE000020B (523 decimal). Previously I searched winerror.h
only for a decimal definition because FACILITY_NULL codes are defined
in decimal form. But today I tried to search in hex form (20b) and
found SPAPI_E_NO_SUCH_DEVINST (0x800F020B) - an exactly matching
definition. Being passed to FormatMessage, this code produces an
appropriate text description.

Recently, trying to erratically install 32-bit driver under Vista64, I
got error 0xE0000235. Searching the similar way, I found
SPAPI_E_IN_WOW64 (0x800F0235) - one more exact match.

It means that setupapi.dll returns FACILITY_NULL instead of
FACILITY_SETUPAPI within TEN years (from 1995 to 2006).

Does anybody know what is a cause? It cannot be a simple bug otherwise
it might be quickly found and fixed. But searching the Net, I found no
error reports related to this issue.

Finally, what is a proper way to determine such error codes? I can
compare them like that:

DWORD const Err = GetLastError ();

if (
  HRESULT_FACILITY (Err) == FACILITY_NULL
  && HRESULT_CODE (Err) == HRESULT_CODE (SPAPI_E_NO_SUCH_DEVINST))
) {
  ...
}

but such way is very ugly and it will not work if there really is an
error in setupapi.dll and it will be fixed.


******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts:

  • » [wdmaudiodev] SetupDiXxx return wrong facility codes in GetLastError