The [Guidelines for Using
SetupAPI](http://msdn.microsoft.com/en-us/library/windows/hardware/ff545011.aspx)
state that if a SetupAPI function fails then the return value of
GetLastError() must be converted to a HRESULT value with the
HRESULT_FROM_SETUPAPI macro before passing it to FormatMessage().
Without this translation FormatMessage() will not understand the SetupAPI error
codes from SetupAPI functions and report ERROR_MR_MID_NOT_FOUND itself:
"The system cannot find message text for message number 0x%1 in the
message file for %2."
A new setupapi_error_str() function is added that takes care of the translation
and calls windows_error_str() internally. This new function is called for
SetupAPI errors instead of windows_error_str().
I came across this problem while trying to debug another problem and triggering
a SetupAPI function to fail during this. Then FormatMessage() failed and I went
to figure out why.
You can merge this Pull Request by running:
git pull https://github.com/photron/libusbx windows-fix-2
Or you can view, comment on it, or merge it online at:
https://github.com/libusbx/libusbx/pull/166
-- Commit Summary --
* Windows: Fix error formatting for SetupAPI errors
-- File Changes --
M libusb/os/windows_usb.c (33)
-- Patch Links --
https://github.com/libusbx/libusbx/pull/166.patch
https://github.com/libusbx/libusbx/pull/166.diff
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel