Skip to content

Commit

Permalink
driver: fix detection of win8 WDK and SDK, to include both win8 SDK a…
Browse files Browse the repository at this point in the history
…nd win8 target
  • Loading branch information
dontech committed Feb 14, 2024
1 parent 4283b1b commit b369259
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions libusb/src/driver/libusb_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ NTSTATUS DDKAPI add_device(DRIVER_OBJECT *driver_object,
return STATUS_NO_SUCH_DEVICE;
}

#if (NTDDI_VERSION >= NTDDI_WIN8)
#ifdef LIBUSB_ENABLE_CONTRACT_VERSION_602
status = USBD_CreateHandle(device_object,
dev->next_stack_device,
USBD_CLIENT_CONTRACT_VERSION_602,
Expand Down Expand Up @@ -432,7 +432,7 @@ NTSTATUS DDKAPI add_device(DRIVER_OBJECT *driver_object,
#else
dev->speed = FullSpeed;
status = STATUS_SUCCESS;
#endif
#endif /* LIBUSB_ENABLE_CONTRACT_VERSION_602 */

USBDBG("[%s] id=#%d %s, speed=%d\n", dev->is_filter ? "filter_mode" : "normal-mode", dev->id, dev->device_id, dev->speed);

Expand Down
8 changes: 6 additions & 2 deletions libusb/src/driver/libusb_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
//#define SKIP_DEVICES_WINUSB
//#define SKIP_DEVICES_PICOPP

#if (defined(WDK_NTDDI_VERSION) && (WDK_NTDDI_VERSION >= NTDDI_WIN8)) || (defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_WIN8))
#define LIBUSB_ENABLE_CONTRACT_VERSION_602
#endif /* (WDK_NTDDI_VERSION >= NTDDI_WIN8) || (NTDDI_VERSION >= NTDDI_WIN8) */

#include <ntifs.h>
#ifdef __GNUC__
#define NTSTATUS LONG
Expand Down Expand Up @@ -185,9 +189,9 @@ typedef struct
DEVICE_OBJECT *physical_device_object;
DEVICE_OBJECT *next_stack_device;
DEVICE_OBJECT *target_device;
#if (NTDDI_VERSION >= NTDDI_WIN8)
#ifdef LIBUSB_ENABLE_CONTRACT_VERSION_602
USBD_HANDLE handle;
#endif
#endif /* LIBUSB_ENABLE_CONTRACT_VERSION_602 */
libusb_remove_lock_t remove_lock;
bool_t is_filter;
bool_t is_started;
Expand Down
4 changes: 2 additions & 2 deletions libusb/src/driver/pnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ NTSTATUS dispatch_pnp(libusb_device_t *dev, IRP *irp)
/* wait until all outstanding requests are finished */
remove_lock_release_and_wait(dev);

#if (NTDDI_VERSION >= NTDDI_WIN8)
#ifdef LIBUSB_ENABLE_CONTRACT_VERSION_602
/* Close handle to USBD */
USBD_CloseHandle(dev->handle);
#endif
#endif /* LIBUSB_ENABLE_CONTRACT_VERSION_602 */

status = pass_irp_down(dev, irp, NULL, NULL);

Expand Down

0 comments on commit b369259

Please sign in to comment.