DWORD CUsbIo::GetStatus( USHORT& StatusValue, USBIO_REQUEST_RECIPIENT Recipient, USHORT Index/*=0*/ ) { DWORD Status; USBIO_STATUS_REQUEST req; USBIO_STATUS_REQUEST_DATA data; // zero the structs if any fields are added... ZeroMemory(&req,sizeof(req)); ZeroMemory(&data,sizeof(data)); req.Recipient = Recipient; req.Index = Index; Status = IoctlSync( IOCTL_USBIO_GET_STATUS, &req, sizeof(req), &data, sizeof(data), NULL ); StatusValue = data.Status; return Status; }
DWORD CUsbIo::SetDescriptor( const void* Buffer, DWORD& ByteCount, USBIO_REQUEST_RECIPIENT Recipient, UCHAR DescriptorType, UCHAR DescriptorIndex/*=0*/, USHORT LanguageId/*=0*/ ) { DWORD Status; USBIO_DESCRIPTOR_REQUEST req; // zero the struct if any fields are added... ZeroMemory(&req,sizeof(req)); req.Recipient = Recipient; req.DescriptorType = DescriptorType; req.DescriptorIndex = DescriptorIndex; req.LanguageId = LanguageId; Status = IoctlSync( IOCTL_USBIO_SET_DESCRIPTOR, &req, sizeof(req), (void*)Buffer, ByteCount, &ByteCount ); return Status; }
DWORD CUsbIo::ClearFeature( USBIO_REQUEST_RECIPIENT Recipient, USHORT FeatureSelector, USHORT Index/*=0*/ ) { DWORD Status; USBIO_FEATURE_REQUEST req; // zero the struct if any fields are added... ZeroMemory(&req,sizeof(req)); req.Recipient = Recipient; req.FeatureSelector = FeatureSelector; req.Index = Index; Status = IoctlSync( IOCTL_USBIO_CLEAR_FEATURE, &req, sizeof(req), NULL, 0, NULL ); return Status; }
DWORD CUsbIo::GetInterface( UCHAR& AlternateSetting, USHORT Interface/*=0*/ ) { DWORD Status; USBIO_GET_INTERFACE req; USBIO_GET_INTERFACE_DATA data; // zero the structs if any fields are added... ZeroMemory(&req,sizeof(req)); ZeroMemory(&data,sizeof(data)); req.Interface = Interface; Status = IoctlSync( IOCTL_USBIO_GET_INTERFACE, &req, sizeof(req), &data, sizeof(data), NULL ); AlternateSetting = data.AlternateSetting; return Status; }
void UsbDkRedirectorAccess::SetAltsetting(ULONG64 InterfaceIdx, ULONG64 AltSettingIdx) { USBDK_ALTSETTINGS_IDXS AltSetting; AltSetting.InterfaceIdx = InterfaceIdx; AltSetting.AltSettingIdx = AltSettingIdx; IoctlSync(IOCTL_USBDK_DEVICE_SET_ALTSETTING, false, &AltSetting, sizeof(AltSetting)); }
DWORD CUsbIo::GetBandwidthInfo(USBIO_BANDWIDTH_INFO* BandwidthInfo) { return IoctlSync( IOCTL_USBIO_GET_BANDWIDTH_INFO, NULL, 0, BandwidthInfo, sizeof(USBIO_BANDWIDTH_INFO), NULL ); }
DWORD CUsbIo::GetDeviceInfo(USBIO_DEVICE_INFO* DeviceInfo) { return IoctlSync( IOCTL_USBIO_GET_DEVICE_INFO, NULL, 0, DeviceInfo, sizeof(USBIO_DEVICE_INFO), NULL ); }
DWORD CUsbIo::UnconfigureDevice() { DWORD Status; Status = IoctlSync( IOCTL_USBIO_UNCONFIGURE_DEVICE, NULL, 0, NULL, 0, NULL ); return Status; }
DWORD CUsbIo::SetConfiguration(const USBIO_SET_CONFIGURATION* Conf) { DWORD Status; Status = IoctlSync( IOCTL_USBIO_SET_CONFIGURATION, Conf, sizeof(USBIO_SET_CONFIGURATION), NULL, 0, NULL ); return Status; }
DWORD CUsbIo::ReleaseDevice() { DWORD Status; Status = IoctlSync( IOCTL_USBIO_RELEASE_DEVICE, NULL, 0, NULL, 0, NULL ); return Status; }
DWORD CUsbIo::SetInterface(const USBIO_INTERFACE_SETTING* Setting) { DWORD Status; Status = IoctlSync( IOCTL_USBIO_SET_INTERFACE, Setting, sizeof(USBIO_INTERFACE_SETTING), NULL, 0, NULL ); return Status; }
DWORD CUsbIo::GetDriverInfo(USBIO_DRIVER_INFO *DriverInfo) { DWORD Status; Status = IoctlSync( IOCTL_USBIO_GET_DRIVER_INFO, NULL, 0, DriverInfo, sizeof(USBIO_DRIVER_INFO), NULL ); return Status; }
DWORD CUsbIo::CyclePort() { DWORD Status; Status = IoctlSync( IOCTL_USBIO_CYCLE_PORT, NULL, 0, NULL, 0, NULL ); return Status; }
DWORD CUsbIo::SetDevicePowerState(USBIO_DEVICE_POWER_STATE DevicePowerState) { USBIO_DEVICE_POWER PowerRequest; PowerRequest.DevicePowerState = DevicePowerState; return IoctlSync( IOCTL_USBIO_SET_DEVICE_POWER_STATE, &PowerRequest, sizeof(USBIO_DEVICE_POWER), NULL, 0, NULL ); }
DWORD CUsbIo::SetDeviceParameters(const USBIO_DEVICE_PARAMETERS *DevParam) { DWORD Status; Status = IoctlSync( IOCTL_USBIO_SET_DEVICE_PARAMETERS, DevParam, sizeof(USBIO_DEVICE_PARAMETERS), NULL, 0, NULL ); return Status; }
DWORD CUsbIo::ResetDevice() { DWORD Status; Status = IoctlSync( IOCTL_USBIO_RESET_DEVICE, NULL, 0, NULL, 0, NULL ); return Status; }
DWORD CUsbIo::StoreConfigurationDescriptor(const USB_CONFIGURATION_DESCRIPTOR *Desc) { DWORD Status; Status = IoctlSync( IOCTL_USBIO_STORE_CONFIG_DESCRIPTOR, Desc, Desc->wTotalLength, NULL, 0, NULL ); return Status; }
DWORD CUsbIo::AcquireDevice() { DWORD Status; Status = IoctlSync( IOCTL_USBIO_ACQUIRE_DEVICE, NULL, 0, NULL, 0, NULL ); return Status; }
DWORD CUsbIo::GetDeviceParameters(USBIO_DEVICE_PARAMETERS *DevParam) { DWORD Status; // zero the struct if any fields are added... ZeroMemory(DevParam,sizeof(USBIO_DEVICE_PARAMETERS)); Status = IoctlSync( IOCTL_USBIO_GET_DEVICE_PARAMETERS, NULL, 0, DevParam, sizeof(USBIO_DEVICE_PARAMETERS), NULL ); return Status; }
DWORD CUsbIo::GetConfigurationInfo(USBIO_CONFIGURATION_INFO *Info) { DWORD Status; // zero the struct if any fields are added... ZeroMemory(Info,sizeof(USBIO_CONFIGURATION_INFO)); Status = IoctlSync( IOCTL_USBIO_GET_CONFIGURATION_INFO, NULL, 0, Info, sizeof(USBIO_CONFIGURATION_INFO), NULL ); return Status; }
DWORD CUsbIo::ClassOrVendorOutRequest( const void* Buffer, DWORD& ByteCount, const USBIO_CLASS_OR_VENDOR_REQUEST* Request ) { DWORD Status; Status = IoctlSync( IOCTL_USBIO_CLASS_OR_VENDOR_OUT_REQUEST, Request, sizeof(USBIO_CLASS_OR_VENDOR_REQUEST), (void*)Buffer, ByteCount, &ByteCount ); return Status; }
DWORD CUsbIo::GetDevicePowerState(USBIO_DEVICE_POWER_STATE& DevicePowerState) { USBIO_DEVICE_POWER PowerRequest; DWORD err; // zero the struct if any fields are added... ZeroMemory(&PowerRequest,sizeof(PowerRequest)); err = IoctlSync( IOCTL_USBIO_GET_DEVICE_POWER_STATE, NULL, 0, &PowerRequest, sizeof(USBIO_DEVICE_POWER), NULL ); if ( err == USBIO_ERR_SUCCESS ) { DevicePowerState = PowerRequest.DevicePowerState; } return err; }
DWORD CUsbIo::GetCurrentFrameNumber(DWORD &FrameNumber) { DWORD Status; USBIO_FRAME_NUMBER data; // zero the struct if any fields are added... ZeroMemory(&data,sizeof(data)); Status = IoctlSync( IOCTL_USBIO_GET_CURRENT_FRAME_NUMBER, NULL, 0, &data, sizeof(data), NULL ); FrameNumber = data.FrameNumber; return Status; }
DWORD CUsbIo::GetConfiguration(UCHAR& ConfigurationValue) { DWORD Status; USBIO_GET_CONFIGURATION_DATA data; // zero the struct ZeroMemory(&data,sizeof(data)); Status = IoctlSync( IOCTL_USBIO_GET_CONFIGURATION, NULL, 0, &data, sizeof(data), NULL ); ConfigurationValue = data.ConfigurationValue; return Status; }
void UsbDkRedirectorAccess::ResetDevice() { IoctlSync(IOCTL_USBDK_DEVICE_RESET_DEVICE); }
void UsbDkRedirectorAccess::ResetPipe(ULONG64 PipeAddress) { IoctlSync(IOCTL_USBDK_DEVICE_RESET_PIPE, false, &PipeAddress, sizeof(PipeAddress)); }