diff options
Diffstat (limited to 'libusb/os/windows_winusb.h')
-rw-r--r-- | libusb/os/windows_winusb.h | 69 |
1 files changed, 21 insertions, 48 deletions
diff --git a/libusb/os/windows_winusb.h b/libusb/os/windows_winusb.h index 49355d4..6afd5cb 100644 --- a/libusb/os/windows_winusb.h +++ b/libusb/os/windows_winusb.h @@ -23,20 +23,10 @@ #ifndef LIBUSB_WINDOWS_WINUSB_H #define LIBUSB_WINDOWS_WINUSB_H -#include "windows_common.h" - -#if defined(_MSC_VER) -// disable /W4 MSVC warnings that are benign -#pragma warning(disable:4214) // bit field types other than int -#endif +#include <devioctl.h> +#include <guiddef.h> -// Missing from MSVC6 setupapi.h -#ifndef SPDRP_ADDRESS -#define SPDRP_ADDRESS 28 -#endif -#ifndef SPDRP_INSTALL_STATE -#define SPDRP_INSTALL_STATE 34 -#endif +#include "windows_common.h" #define MAX_CTRL_BUFFER_LENGTH 4096 #define MAX_USB_STRING_LENGTH 128 @@ -55,18 +45,10 @@ // http://msdn.microsoft.com/en-us/library/ff545978.aspx // http://msdn.microsoft.com/en-us/library/ff545972.aspx // http://msdn.microsoft.com/en-us/library/ff545982.aspx -#ifndef GUID_DEVINTERFACE_USB_HOST_CONTROLLER -const GUID GUID_DEVINTERFACE_USB_HOST_CONTROLLER = {0x3ABF6F2D, 0x71C4, 0x462A, {0x8A, 0x92, 0x1E, 0x68, 0x61, 0xE6, 0xAF, 0x27}}; -#endif -#ifndef GUID_DEVINTERFACE_USB_DEVICE -const GUID GUID_DEVINTERFACE_USB_DEVICE = {0xA5DCBF10, 0x6530, 0x11D2, {0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED}}; -#endif -#ifndef GUID_DEVINTERFACE_USB_HUB -const GUID GUID_DEVINTERFACE_USB_HUB = {0xF18A0E88, 0xC30C, 0x11D0, {0x88, 0x15, 0x00, 0xA0, 0xC9, 0x06, 0xBE, 0xD8}}; -#endif -#ifndef GUID_DEVINTERFACE_LIBUSB0_FILTER -const GUID GUID_DEVINTERFACE_LIBUSB0_FILTER = {0xF9F3FF14, 0xAE21, 0x48A0, {0x8A, 0x25, 0x80, 0x11, 0xA7, 0xA9, 0x31, 0xD9}}; -#endif +static const GUID GUID_DEVINTERFACE_USB_HOST_CONTROLLER = {0x3ABF6F2D, 0x71C4, 0x462A, {0x8A, 0x92, 0x1E, 0x68, 0x61, 0xE6, 0xAF, 0x27}}; +static const GUID GUID_DEVINTERFACE_USB_HUB = {0xF18A0E88, 0xC30C, 0x11D0, {0x88, 0x15, 0x00, 0xA0, 0xC9, 0x06, 0xBE, 0xD8}}; +static const GUID GUID_DEVINTERFACE_USB_DEVICE = {0xA5DCBF10, 0x6530, 0x11D2, {0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED}}; +static const GUID GUID_DEVINTERFACE_LIBUSB0_FILTER = {0xF9F3FF14, 0xAE21, 0x48A0, {0x8A, 0x25, 0x80, 0x11, 0xA7, 0xA9, 0x31, 0xD9}}; // The following define MUST be == sizeof(USB_DESCRIPTOR_REQUEST) #define USB_DESCRIPTOR_REQUEST_SIZE 12U @@ -114,7 +96,7 @@ struct windows_usb_api_backend { extern const struct windows_usb_api_backend usb_api_backend[USB_API_MAX]; #define PRINT_UNSUPPORTED_API(fname) \ - usbi_dbg("unsupported API call for '%s' " \ + usbi_dbg(NULL, "unsupported API call for '%s' " \ "(unrecognized device driver)", #fname) #define CHECK_SUPPORTED_API(apip, fname) \ @@ -152,11 +134,6 @@ struct libusb_hid_descriptor { #define LIBUSB_REQ_IN(request_type) ((request_type) & LIBUSB_ENDPOINT_IN) #define LIBUSB_REQ_OUT(request_type) (!LIBUSB_REQ_IN(request_type)) -#ifndef CTL_CODE -#define CTL_CODE(DeviceType, Function, Method, Access) \ - (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)) -#endif - // The following are used for HID reports IOCTLs #define HID_IN_CTL_CODE(id) \ CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_IN_DIRECT, FILE_ANY_ACCESS) @@ -259,13 +236,9 @@ DLL_DECLARE_FUNC(WINAPI, CONFIGRET, CM_Get_Child, (PDEVINST, DEVINST, ULONG)); /* AdvAPI32 dependencies */ DLL_DECLARE_HANDLE(AdvAPI32); -DLL_DECLARE_FUNC_PREFIXED(WINAPI, LONG, p, RegQueryValueExW, (HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD)); +DLL_DECLARE_FUNC_PREFIXED(WINAPI, LONG, p, RegQueryValueExA, (HKEY, LPCSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD)); DLL_DECLARE_FUNC_PREFIXED(WINAPI, LONG, p, RegCloseKey, (HKEY)); -/* OLE32 dependency */ -DLL_DECLARE_HANDLE(OLE32); -DLL_DECLARE_FUNC_PREFIXED(WINAPI, HRESULT, p, IIDFromString, (LPCOLESTR, LPIID)); - /* SetupAPI dependencies */ DLL_DECLARE_HANDLE(SetupAPI); DLL_DECLARE_FUNC_PREFIXED(WINAPI, HDEVINFO, p, SetupDiGetClassDevsA, (LPCGUID, PCSTR, HWND, DWORD)); @@ -282,23 +255,12 @@ DLL_DECLARE_FUNC_PREFIXED(WINAPI, BOOL, p, SetupDiDestroyDeviceInfoList, (HDEVIN DLL_DECLARE_FUNC_PREFIXED(WINAPI, HKEY, p, SetupDiOpenDevRegKey, (HDEVINFO, PSP_DEVINFO_DATA, DWORD, DWORD, DWORD, REGSAM)); DLL_DECLARE_FUNC_PREFIXED(WINAPI, HKEY, p, SetupDiOpenDeviceInterfaceRegKey, (HDEVINFO, PSP_DEVICE_INTERFACE_DATA, DWORD, DWORD)); +#define FILE_DEVICE_USB FILE_DEVICE_UNKNOWN -#ifndef USB_GET_NODE_INFORMATION #define USB_GET_NODE_INFORMATION 258 -#endif -#ifndef USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION #define USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION 260 -#endif -#ifndef USB_GET_NODE_CONNECTION_INFORMATION_EX #define USB_GET_NODE_CONNECTION_INFORMATION_EX 274 -#endif -#ifndef USB_GET_NODE_CONNECTION_INFORMATION_EX_V2 #define USB_GET_NODE_CONNECTION_INFORMATION_EX_V2 279 -#endif - -#ifndef FILE_DEVICE_USB -#define FILE_DEVICE_USB FILE_DEVICE_UNKNOWN -#endif #define USB_CTL_CODE(id) \ CTL_CODE(FILE_DEVICE_USB, (id), METHOD_BUFFERED, FILE_ANY_ACCESS) @@ -342,6 +304,12 @@ typedef enum _USB_HUB_NODE { UsbMIParent } USB_HUB_NODE; +#if defined(_MSC_VER) +// disable /W4 MSVC warnings that are benign +#pragma warning(push) +#pragma warning(disable:4214) // bit field types other than int +#endif + // Most of the structures below need to be packed #include <pshpack1.h> @@ -439,6 +407,11 @@ typedef struct _USB_NODE_CONNECTION_INFORMATION_EX_V2 { #include <poppack.h> +#if defined(_MSC_VER) +// Restore original warnings +#pragma warning(pop) +#endif + /* winusb.dll interface */ /* pipe policies */ |