summaryrefslogtreecommitdiff
path: root/libusb
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-04-01 11:15:56 +0100
committerPete Batard <pbatard@gmail.com>2010-04-01 11:15:56 +0100
commitbaa9dc7601ba90a5068897a56f33958176089636 (patch)
tree21b8dc5094df866371e16ea1898be03eef0da293 /libusb
parentf9e40cc5bafe9ac44525d1c7313dabb7333d13f9 (diff)
downloadlibusb-r233.tar.gz
more explicit error codes on semaphore and DLL issuesr233
Diffstat (limited to 'libusb')
-rw-r--r--libusb/os/windows_usb.c6
-rw-r--r--libusb/os/windows_usb.h6
2 files changed, 6 insertions, 6 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
index 8ab7739..395c891 100644
--- a/libusb/os/windows_usb.c
+++ b/libusb/os/windows_usb.c
@@ -410,7 +410,7 @@ static int windows_init(struct libusb_context *ctx)
semaphore = CreateSemaphore(NULL, 1, 1, sem_name);
if (semaphore == NULL) {
usbi_err(ctx, "could not create semaphore: %s", windows_error_str(0));
- return LIBUSB_ERROR_OTHER;
+ return LIBUSB_ERROR_NO_MEM;
}
// A successful wait brings our semaphore count to 0 (unsignaled)
@@ -418,7 +418,7 @@ static int windows_init(struct libusb_context *ctx)
if (WaitForSingleObject(semaphore, INFINITE) != WAIT_OBJECT_0) {
usbi_err(ctx, "failure to access semaphore: %s", windows_error_str(0));
CloseHandle(semaphore);
- return LIBUSB_ERROR_OTHER;
+ return LIBUSB_ERROR_NO_MEM;
}
// NB: concurrent usage supposes that init calls are equally balanced with
@@ -449,7 +449,7 @@ static int windows_init(struct libusb_context *ctx)
// Load missing CFGMGR32.DLL imports
if (Cfgmgr32_init() != LIBUSB_SUCCESS) {
usbi_err(ctx, "could not resolve Cfgmgr32.dll functions");
- return LIBUSB_ERROR_OTHER;
+ return LIBUSB_ERROR_NOT_FOUND;
}
// Initialize the low level APIs
diff --git a/libusb/os/windows_usb.h b/libusb/os/windows_usb.h
index 330b7bb..bda5780 100644
--- a/libusb/os/windows_usb.h
+++ b/libusb/os/windows_usb.h
@@ -312,7 +312,7 @@ struct windows_transfer_priv {
/*
* API macros - from libusb-win32 1.x
*/
-#define DLL_DECLARE(api, ret, name, args) \
+#define DLL_DECLARE(api, ret, name, args) \
typedef ret (api * __dll_##name##_t)args; __dll_##name##_t name
#define DLL_LOAD(dll, name, ret_on_failure) \
@@ -321,7 +321,7 @@ struct windows_transfer_priv {
if (!h) \
h = LoadLibrary(#dll); \
if (!h) { \
- if (ret_on_failure) { return LIBUSB_ERROR_OTHER; } \
+ if (ret_on_failure) { return LIBUSB_ERROR_NOT_FOUND; }\
else { break; } \
} \
name = (__dll_##name##_t)GetProcAddress(h, #name); \
@@ -331,7 +331,7 @@ struct windows_transfer_priv {
name = (__dll_##name##_t)GetProcAddress(h, #name "W"); \
if (name) break; \
if(ret_on_failure) \
- return LIBUSB_ERROR_OTHER; \
+ return LIBUSB_ERROR_NOT_FOUND; \
} while(0)