summaryrefslogtreecommitdiff
path: root/libusb/os/windows_usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'libusb/os/windows_usb.c')
-rw-r--r--libusb/os/windows_usb.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
index 1cba34f..7f05576 100644
--- a/libusb/os/windows_usb.c
+++ b/libusb/os/windows_usb.c
@@ -404,11 +404,6 @@ static int windows_init(struct libusb_context *ctx)
struct windows_hcd_priv** _hcd_cur;
TCHAR sem_name[11+1+8]; // strlen(libusb_init)+'\0'+(32-bit hex PID)
- if (Cfgmgr32_init() != LIBUSB_SUCCESS) {
- usbi_err(ctx, "could not resolve Cfgmgr32.dll functions");
- return LIBUSB_ERROR_OTHER;
- }
-
sprintf(sem_name, "libusb_init%08X", (unsigned int)GetCurrentProcessId()&0xFFFFFFFF);
semaphore = CreateSemaphore(NULL, 1, 1, sem_name);
if (semaphore == NULL) {
@@ -449,6 +444,12 @@ static int windows_init(struct libusb_context *ctx)
// Initialize pollable file descriptors
init_polling();
+ // Load missing CFGMGR32.DLL imports
+ if (Cfgmgr32_init() != LIBUSB_SUCCESS) {
+ usbi_err(ctx, "could not resolve Cfgmgr32.dll functions");
+ return LIBUSB_ERROR_OTHER;
+ }
+
// Initialize the low level APIs
for (i=0; i<USB_API_MAX; i++) {
r = usb_api_backend[i].init(ctx);