Needed by winusb.h.
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- include/Makefile.in | 1 + include/ddk/winusbio.h | 66 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 include/ddk/winusbio.h
diff --git a/include/Makefile.in b/include/Makefile.in index f3e62c4bb5a..58bf7db1e13 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -211,6 +211,7 @@ SOURCES = \ ddk/wdm.h \ ddk/winddiui.h \ ddk/winsplp.h \ + ddk/winusbio.h \ ddk/wsk.h \ ddraw.h \ ddrawgdi.h \ diff --git a/include/ddk/winusbio.h b/include/ddk/winusbio.h new file mode 100644 index 00000000000..14d8230d87f --- /dev/null +++ b/include/ddk/winusbio.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2022 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _WINUSBIO_H_ +#define _WINUSBIO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +DEFINE_GUID(WinUSB_TestGuid, 0XDA812BFF, 0X12C3, 0X46A2, 0X8E, 0X2B, 0XDB, 0XD3, 0XB7, 0X83, 0X4C, 0X43); + +#define SHORT_PACKET_TERMINATE 0x01 +#define AUTO_CLEAR_STALL 0x02 +#define PIPE_TRANSFER_TIMEOUT 0x03 +#define IGNORE_SHORT_PACKETS 0x04 +#define ALLOW_PARTIAL_READS 0x05 +#define AUTO_FLUSH 0x06 +#define RAW_IO 0x07 +#define MAXIMUM_TRANSFER_SIZE 0x08 +#define RESET_PIPE_ON_RESUME 0x09 + +typedef struct _WINUSB_PIPE_INFORMATION { + USBD_PIPE_TYPE PipeType; + UCHAR PipeId; + USHORT MaximumPacketSize; + UCHAR Interval; +} WINUSB_PIPE_INFORMATION, *PWINUSB_PIPE_INFORMATION; + +#define AUTO_SUSPEND 0x81 +#define SUSPEND_DELAY 0x83 + +#define DEVICE_SPEED 0x01 + +#define LowSpeed 0x01 +#define FullSpeed 0x02 +#define HighSpeed 0x03 + +typedef struct _WINUSB_PIPE_INFORMATION_EX { + USBD_PIPE_TYPE PipeType; + UCHAR PipeId; + USHORT MaximumPacketSize; + UCHAR Interval; + ULONG MaximumBytesPerInterval; +} WINUSB_PIPE_INFORMATION_EX, *PWINUSB_PIPE_INFORMATION_EX; + +#ifdef __cplusplus +} +#endif + +#endif /* _WINUSBIO_H_ */
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- v6: - Add ddk/winusbio dependent prototypes. --- include/Makefile.in | 1 + include/winusb.h | 101 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 include/winusb.h
diff --git a/include/Makefile.in b/include/Makefile.in index 58bf7db1e13..89356d2a6ee 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -845,6 +845,7 @@ SOURCES = \ wintabx.h \ winternl.h \ wintrust.h \ + winusb.h \ winuser.h \ winuser.rh \ winver.h \ diff --git a/include/winusb.h b/include/winusb.h new file mode 100644 index 00000000000..d30c83db85c --- /dev/null +++ b/include/winusb.h @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2022 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _WINUSB_H_ +#define _WINUSB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ddk/winusbio.h" + +typedef PVOID WINUSB_INTERFACE_HANDLE, *PWINUSB_INTERFACE_HANDLE; +typedef PVOID WINUSB_ISOCH_BUFFER_HANDLE, *PWINUSB_ISOCH_BUFFER_HANDLE; + +typedef struct _WINUSB_SETUP_PACKET { + UCHAR RequestType; + UCHAR Request; + USHORT Value; + USHORT Index; + USHORT Length; +} WINUSB_SETUP_PACKET, *PWINUSB_SETUP_PACKET; + +typedef struct _USB_START_TRACKING_FOR_TIME_SYNC_INFORMATION { + HANDLE TimeTrackingHandle; + BOOLEAN IsStartupDelayTolerable; +} USB_START_TRACKING_FOR_TIME_SYNC_INFORMATION, *PUSB_START_TRACKING_FOR_TIME_SYNC_INFORMATION; + +typedef struct _USB_STOP_TRACKING_FOR_TIME_SYNC_INFORMATION { + HANDLE TimeTrackingHandle; +} USB_STOP_TRACKING_FOR_TIME_SYNC_INFORMATION, *PUSB_STOP_TRACKING_FOR_TIME_SYNC_INFORMATION; + +typedef struct _USB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION { + HANDLE TimeTrackingHandle; + ULONG InputFrameNumber; + ULONG InputMicroFrameNumber; + LARGE_INTEGER QueryPerformanceCounterAtInputFrameOrMicroFrame; + LARGE_INTEGER QueryPerformanceCounterFrequency; + ULONG PredictedAccuracyInMicroSeconds; + ULONG CurrentGenerationID; + LARGE_INTEGER CurrentQueryPerformanceCounter; + ULONG CurrentHardwareFrameNumber; + ULONG CurrentHardwareMicroFrameNumber; + ULONG CurrentUSBFrameNumber; +} USB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION, *PUSB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION; + +BOOL WINAPI WinUsb_AbortPipe(WINUSB_INTERFACE_HANDLE,UCHAR); +BOOL WINAPI WinUsb_ControlTransfer(WINUSB_INTERFACE_HANDLE,WINUSB_SETUP_PACKET,PUCHAR,ULONG,PULONG,LPOVERLAPPED); +BOOL WINAPI WinUsb_FlushPipe(WINUSB_INTERFACE_HANDLE,UCHAR); +BOOL WINAPI WinUsb_Free(WINUSB_INTERFACE_HANDLE); +BOOL WINAPI WinUsb_GetAdjustedFrameNumber(PULONG,LARGE_INTEGER); +BOOL WINAPI WinUsb_GetAssociatedInterface(WINUSB_INTERFACE_HANDLE,UCHAR,PWINUSB_INTERFACE_HANDLE); +BOOL WINAPI WinUsb_GetCurrentAlternateSetting(WINUSB_INTERFACE_HANDLE,PUCHAR); +BOOL WINAPI WinUsb_GetCurrentFrameNumber(WINUSB_INTERFACE_HANDLE,PULONG,LARGE_INTEGER*); +BOOL WINAPI WinUsb_GetCurrentFrameNumberAndQpc(WINUSB_INTERFACE_HANDLE,PUSB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION); +BOOL WINAPI WinUsb_GetDescriptor(WINUSB_INTERFACE_HANDLE,UCHAR,UCHAR,USHORT,PUCHAR,ULONG,PULONG); +BOOL WINAPI WinUsb_GetOverlappedResult(WINUSB_INTERFACE_HANDLE,LPOVERLAPPED,LPDWORD,BOOL); +BOOL WINAPI WinUsb_GetPipePolicy(WINUSB_INTERFACE_HANDLE,UCHAR,ULONG,PULONG,PVOID); +BOOL WINAPI WinUsb_GetPowerPolicy(WINUSB_INTERFACE_HANDLE,ULONG,PULONG,PVOID); +BOOL WINAPI WinUsb_Initialize(HANDLE,PWINUSB_INTERFACE_HANDLE); +PUSB_INTERFACE_DESCRIPTOR WINAPI WinUsb_ParseConfigurationDescriptor(PUSB_CONFIGURATION_DESCRIPTOR,PVOID,LONG,LONG,LONG,LONG,LONG); +PUSB_COMMON_DESCRIPTOR WINAPI WinUsb_ParseDescriptors(PVOID,ULONG,PVOID,LONG); +BOOL WINAPI WinUsb_QueryDeviceInformation(WINUSB_INTERFACE_HANDLE,ULONG,PULONG,PVOID); +BOOL WINAPI WinUsb_QueryInterfaceSettings(WINUSB_INTERFACE_HANDLE,UCHAR,PUSB_INTERFACE_DESCRIPTOR); +BOOL WINAPI WinUsb_QueryPipe(WINUSB_INTERFACE_HANDLE,UCHAR,UCHAR,PWINUSB_PIPE_INFORMATION); +BOOL WINAPI WinUsb_QueryPipeEx(WINUSB_INTERFACE_HANDLE,UCHAR,UCHAR,PWINUSB_PIPE_INFORMATION_EX); +BOOL WINAPI WinUsb_ReadIsochPipe(WINUSB_ISOCH_BUFFER_HANDLE,ULONG,ULONG,PULONG,ULONG,PUSBD_ISO_PACKET_DESCRIPTOR,LPOVERLAPPED); +BOOL WINAPI WinUsb_ReadIsochPipeAsap(WINUSB_ISOCH_BUFFER_HANDLE,ULONG,ULONG,BOOL,ULONG,PUSBD_ISO_PACKET_DESCRIPTOR,LPOVERLAPPED); +BOOL WINAPI WinUsb_ReadPipe(WINUSB_INTERFACE_HANDLE,UCHAR,PUCHAR,ULONG,PULONG,LPOVERLAPPED); +BOOL WINAPI WinUsb_RegisterIsochBuffer(WINUSB_INTERFACE_HANDLE,UCHAR,PUCHAR,ULONG,PWINUSB_ISOCH_BUFFER_HANDLE); +BOOL WINAPI WinUsb_ResetPipe(WINUSB_INTERFACE_HANDLE,UCHAR); +BOOL WINAPI WinUsb_SetCurrentAlternateSetting(WINUSB_INTERFACE_HANDLE,UCHAR); +BOOL WINAPI WinUsb_SetPipePolicy(WINUSB_INTERFACE_HANDLE,UCHAR,ULONG,ULONG,PVOID); +BOOL WINAPI WinUsb_SetPowerPolicy(WINUSB_INTERFACE_HANDLE,ULONG,ULONG,PVOID); +BOOL WINAPI WinUsb_StartTrackingForTimeSync(WINUSB_INTERFACE_HANDLE,PUSB_START_TRACKING_FOR_TIME_SYNC_INFORMATION); +BOOL WINAPI WinUsb_StopTrackingForTimeSync(WINUSB_INTERFACE_HANDLE,PUSB_STOP_TRACKING_FOR_TIME_SYNC_INFORMATION); +BOOL WINAPI WinUsb_UnregisterIsochBuffer(WINUSB_ISOCH_BUFFER_HANDLE); +BOOL WINAPI WinUsb_WriteIsochPipe(WINUSB_ISOCH_BUFFER_HANDLE,ULONG,ULONG,PULONG,LPOVERLAPPED); +BOOL WINAPI WinUsb_WriteIsochPipeAsap(WINUSB_ISOCH_BUFFER_HANDLE,ULONG,ULONG,BOOL,LPOVERLAPPED); +BOOL WINAPI WinUsb_WritePipe(WINUSB_INTERFACE_HANDLE,UCHAR,PUCHAR,ULONG,PULONG,LPOVERLAPPED); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINUSB_H_ */
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- include/ddk/usb100.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/include/ddk/usb100.h b/include/ddk/usb100.h index 7ec74933d0f..0942c8f615a 100644 --- a/include/ddk/usb100.h +++ b/include/ddk/usb100.h @@ -28,6 +28,18 @@ #define USB_CONFIG_POWER_DESCRIPTOR_TYPE 0x07 #define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 0x08
+#define USB_REQUEST_GET_STATUS 0x00 +#define USB_REQUEST_CLEAR_FEATURE 0x01 +#define USB_REQUEST_SET_FEATURE 0x03 +#define USB_REQUEST_SET_ADDRESS 0x05 +#define USB_REQUEST_GET_DESCRIPTOR 0x06 +#define USB_REQUEST_SET_DESCRIPTOR 0x07 +#define USB_REQUEST_GET_CONFIGURATION 0x08 +#define USB_REQUEST_SET_CONFIGURATION 0x09 +#define USB_REQUEST_GET_INTERFACE 0x0A +#define USB_REQUEST_SET_INTERFACE 0x0B +#define USB_REQUEST_SYNC_FRAME 0x0C + #include <pshpack1.h>
typedef struct _USB_DEVICE_DESCRIPTOR {
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52677 Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- v6: - Include headers for ddk/winusbio.h dependent functions. --- dlls/winusb/Makefile.in | 5 +++++ dlls/winusb/main.c | 41 +++++++++++++++++++++++++++++++++++++++++ dlls/winusb/winusb.spec | 2 +- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 dlls/winusb/main.c
diff --git a/dlls/winusb/Makefile.in b/dlls/winusb/Makefile.in index c8cab4dbed9..b6f01a1346c 100644 --- a/dlls/winusb/Makefile.in +++ b/dlls/winusb/Makefile.in @@ -1 +1,6 @@ MODULE = winusb.dll + +EXTRADLLFLAGS = -Wb,--prefer-native + +C_SRCS = \ + main.c diff --git a/dlls/winusb/main.c b/dlls/winusb/main.c new file mode 100644 index 00000000000..8513adf0b52 --- /dev/null +++ b/dlls/winusb/main.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winternl.h" +#include "ddk/wdm.h" +#include "ddk/usb.h" +#include "winusb.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(winusb); + +/*********************************************************************** + * WinUsb_Free (winusb.@) + */ +BOOL WINAPI WinUsb_Free(WINUSB_INTERFACE_HANDLE handle) +{ + FIXME( "(%p) - stub\n", handle ); + return TRUE; +} diff --git a/dlls/winusb/winusb.spec b/dlls/winusb/winusb.spec index 09371e9ee46..a0b57d58096 100644 --- a/dlls/winusb/winusb.spec +++ b/dlls/winusb/winusb.spec @@ -1,7 +1,7 @@ @ stub WinUsb_AbortPipe @ stub WinUsb_ControlTransfer @ stub WinUsb_FlushPipe -@ stub WinUsb_Free +@ stdcall WinUsb_Free(ptr) @ stub WinUsb_GetAssociatedInterface @ stub WinUsb_GetCurrentAlternateSetting @ stub WinUsb_GetDescriptor
File version: 10.0.19041.1 (Windows 10).
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/winusb/winusb.spec | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/dlls/winusb/winusb.spec b/dlls/winusb/winusb.spec index a0b57d58096..648ddf0a4f5 100644 --- a/dlls/winusb/winusb.spec +++ b/dlls/winusb/winusb.spec @@ -1,9 +1,13 @@ @ stub WinUsb_AbortPipe +@ stub WinUsb_AbortPipeAsync @ stub WinUsb_ControlTransfer @ stub WinUsb_FlushPipe @ stdcall WinUsb_Free(ptr) +@ stub WinUsb_GetAdjustedFrameNumber @ stub WinUsb_GetAssociatedInterface @ stub WinUsb_GetCurrentAlternateSetting +@ stub WinUsb_GetCurrentFrameNumber +@ stub WinUsb_GetCurrentFrameNumberAndQpc @ stub WinUsb_GetDescriptor @ stub WinUsb_GetOverlappedResult @ stub WinUsb_GetPipePolicy @@ -14,9 +18,20 @@ @ stub WinUsb_QueryDeviceInformation @ stub WinUsb_QueryInterfaceSettings @ stub WinUsb_QueryPipe +@ stub WinUsb_QueryPipeEx +@ stub WinUsb_ReadIsochPipe +@ stub WinUsb_ReadIsochPipeAsap @ stub WinUsb_ReadPipe +@ stub WinUsb_RegisterIsochBuffer @ stub WinUsb_ResetPipe +@ stub WinUsb_ResetPipeAsync @ stub WinUsb_SetCurrentAlternateSetting +@ stub WinUsb_SetCurrentAlternateSettingAsync @ stub WinUsb_SetPipePolicy @ stub WinUsb_SetPowerPolicy +@ stub WinUsb_StartTrackingForTimeSync +@ stub WinUsb_StopTrackingForTimeSync +@ stub WinUsb_UnregisterIsochBuffer +@ stub WinUsb_WriteIsochPipe +@ stub WinUsb_WriteIsochPipeAsap @ stub WinUsb_WritePipe
On Sun, May 1, 2022 at 10:05 PM Mohamad Al-Jaf mohamadaljaf@gmail.com wrote:
+#ifdef __cplusplus +extern "C" { +#endif
Hi,
I'm not sure what the status of this patch is but this line was only added for copyright purposes. It's redundant as in winusb.h the header is included within that wrapper. I can remove it if necessary. I made as many changes as I could without affecting the code itself. It's based on the existing headers that are also small. -- Kind regards, Mohamad