ReactOS 0.4.16-dev-297-gc569aee
fxusbdeviceum.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxUsbDeviceUm.cpp
8
9Abstract:
10
11Author:
12
13Environment:
14
15 User mode only
16
17Revision History:
18
19--*/
20extern "C" {
21#include <initguid.h>
22
23}
24#include "fxusbpch.hpp"
25extern "C" {
26#include "FxUsbDeviceUm.tmh"
27}
28
32 __in FxSyncRequest* Request,
34 )
35{
38
41
42 status = SubmitSync(Request->m_TrueRequest, &options);
43 if (!NT_SUCCESS(status)) {
45 "FxUsbDevice SubmitSync failed");
46 goto Done;
47 }
48
49Done:
50 return status;
51}
52
56 __inout PUMURB Urb,
58 __in_opt WDFREQUEST Request,
60 )
61{
64 FxSyncRequest request(GetDriverGlobals(), NULL, Request);
65
66 status = request.Initialize();
67 if (!NT_SUCCESS(status)) {
69 "Failed to initialize FxSyncRequest");
70 return status;
71 }
72
73 if (NULL == Options) {
75 }
76
79
80 status = request.m_TrueRequest->ValidateTarget(this);
81 if (NT_SUCCESS(status)) {
82 FxUsbUmFormatRequest(request.m_TrueRequest, &Urb->UmUrbHeader, m_pHostTargetFile);
83 status = SubmitSync(request.m_TrueRequest, Options);
84 if (!NT_SUCCESS(status)) {
86 "FxUsbDevice SubmitSync failed");
87 return status;
88 }
89 }
90
91 return status;
92}
93
97 __in ULONG USBDClientContractVersionForWdfClient
98 )
99{
100 HRESULT hr = S_OK;
102
103 IWudfDevice* device = NULL;
104 IWudfDeviceStack2* devstack2 = NULL;
105
106 UMURB urb;
108 USHORT wTotalLength = 0;
109
112
114 USHORT deviceStatus = 0;
115 UCHAR deviceSpeed = 0;
116
117 FxSyncRequest request(GetDriverGlobals(), NULL);
118 FxSyncRequest request2(GetDriverGlobals(), &context);
119
120
121
122
123 UNREFERENCED_PARAMETER(USBDClientContractVersionForWdfClient);
124
125 status = request.Initialize();
126 if (!NT_SUCCESS(status)) {
128 "Failed to initialize FxSyncRequest");
129 goto Done;
130 }
131
132 status = request2.Initialize();
133 if (!NT_SUCCESS(status)) {
135 "Failed to initialize second FxSyncRequest");
136 goto Done;
137 }
138
139 status = request.m_TrueRequest->ValidateTarget(this);
140 if (!NT_SUCCESS(status)) {
142 "Failed to validate FxSyncRequest target");
143 goto Done;
144 }
145
146 status = request2.m_TrueRequest->ValidateTarget(this);
147 if (!NT_SUCCESS(status)) {
149 "Failed to validate second FxSyncRequest target");
150 goto Done;
151 }
152
153 RtlZeroMemory(&urb, sizeof(urb));
154
156 devstack2 = m_Device->GetDeviceStack2();
157
158 if (m_pHostTargetFile == NULL) {
159
160 //
161 // Opens a handle on the reflector for USB side-band communication
162 // based on the currently selected dispatcher type.
163 //
164 hr = devstack2->OpenUSBCommunicationChannel(device,
165 device->GetAttachedDevice(),
167
168 if (SUCCEEDED(hr)) {
169 m_WinUsbHandle = (WINUSB_INTERFACE_HANDLE)m_pHostTargetFile->GetCreateContext();
170 }
171 }
172
173 //
174 // Get USB device descriptor
175 //
179 sizeof(m_DeviceDescriptor),
181 FxUsbUmFormatRequest(request.m_TrueRequest,
182 &urb.UmUrbHeader,
184 TRUE);
186 if (!NT_SUCCESS(status)) {
187 goto Done;
188 }
189
190 //
191 // Get USB configuration descriptor
192 //
196 sizeof(config),
197 &config);
198 FxUsbUmFormatRequest(request.m_TrueRequest,
199 &urb.UmUrbHeader,
201 TRUE);
203 if (!NT_SUCCESS(status)) {
204 goto Done;
205 }
206
207 if (config.wTotalLength < sizeof(USB_CONFIGURATION_DESCRIPTOR)) {
208
209 //
210 // Not enough info returned
211 //
215 "Could not retrieve config descriptor size, config.wTotalLength %d < "
216 "sizeof(config descriptor) (%d), %!STATUS!",
217 config.wTotalLength, sizeof(USB_CONFIGURATION_DESCRIPTOR), status);
218 goto Done;
219 }
220
221 wTotalLength = config.wTotalLength;
223 FxPoolAllocate(GetDriverGlobals(),
225 wTotalLength);
226 if (NULL == m_ConfigDescriptor) {
230 "Could not allocate %d bytes for config descriptor, %!STATUS!",
232 goto Done;
233 }
234
235 //
236 // Get USB configuration descriptor and subsequent interface descriptors, etc.
237 //
241 wTotalLength,
243 FxUsbUmFormatRequest(request.m_TrueRequest,
244 &urb.UmUrbHeader,
246 TRUE);
248 if (!NT_SUCCESS(status)) {
249 goto Done;
250 } else if (m_ConfigDescriptor->wTotalLength != wTotalLength) {
251 //
252 // Invalid wTotalLength
253 //
257 "Defective USB device reported two different config descriptor "
258 "wTotalLength values: %d and %d, %!STATUS!",
259 wTotalLength, m_ConfigDescriptor->wTotalLength, status);
260 goto Done;
261 }
262
264
265 //
266 // Check to see if we are wait wake capable
267 //
270 }
271
272 //
273 // Get the device status to check if device is self-powered.
274 //
277 0); // Device status
278
279 buf.SetBuffer(&deviceStatus, sizeof(USHORT));
280
281 status = FormatControlRequest(request2.m_TrueRequest,
282 &setupPacket,
283 &buf);
284 if (!NT_SUCCESS(status)) {
285 goto Done;
286 }
287
288 status = SendSyncRequest(&request2, 5);
289 if (!NT_SUCCESS(status)) {
290 goto Done;
291 }
292
293 if (deviceStatus & USB_GETSTATUS_SELF_POWERED) {
295 }
296
297 //
298 // Get device speed information.
299 //
302 sizeof(UCHAR),
303 &deviceSpeed);
304 FxUsbUmFormatRequest(request.m_TrueRequest,
305 &urb.UmUrbHeader,
307 TRUE);
309 if (!NT_SUCCESS(status)) {
310 goto Done;
311 }
312
313 if (deviceSpeed == 3) {
315 }
316
317 //
318 // User-mode events must be initialized manually.
319 //
321 if (!NT_SUCCESS(status)) {
322 goto Done;
323 }
324
325Done:
326 return status;
327}
328
329
330
331
339 __in_opt WDFREQUEST Request,
341 )
342{
343 UMURB urb;
344 PUSB_STRING_DESCRIPTOR pDescriptor;
345 PVOID buffer = NULL;
349
350 if (String != NULL) {
351 length = sizeof(USB_STRING_DESCRIPTOR) + (*NumCharacters - 1) * sizeof(WCHAR);
352
353 buffer = FxPoolAllocate(GetDriverGlobals(),
355 length);
356
357 if (buffer == NULL) {
359 goto Done;
360 }
361
363 pDescriptor = (PUSB_STRING_DESCRIPTOR) buffer;
364 }
365 else {
366 RtlZeroMemory(&common, sizeof(common));
367
369 pDescriptor = (PUSB_STRING_DESCRIPTOR) &common;
370 }
371
375 length,
376 pDescriptor);
378 urb.UmUrbDescriptorRequest.LanguageID = LangID;
379
380 status = SendSyncUmUrb(&urb, 2, Request, Options);
381 if (NT_SUCCESS(status)) {
383
384 //
385 // Make sure we got an even number of bytes and that we got a header
386 //
387 if ((pDescriptor->bLength & 0x1) ||
388 pDescriptor->bLength < sizeof(USB_COMMON_DESCRIPTOR)) {
390 }
391 else {
392 //
393 // bLength is the length of the entire descriptor. Subtract off
394 // the descriptor header and then divide by the size of a WCHAR.
395 //
396 numChars =
397 (pDescriptor->bLength - sizeof(USB_COMMON_DESCRIPTOR)) / sizeof(WCHAR);
398
399 if (String != NULL) {
400 if (*NumCharacters >= numChars) {
401 length = numChars * sizeof(WCHAR);
402 }
403 else {
404 length = *NumCharacters * sizeof(WCHAR);
406 }
407
409 RtlCopyMemory(String, pDescriptor->bString, length);
410 }
411 else {
413 }
414 }
415 }
416
417 if (buffer != NULL) {
419 }
420
421Done:
422
423 return status;
424}
425
430 __in FxRequestBuffer *RequestBuffer,
433 )
434/*++
435
436Routine Description:
437 Formats a request to retrieve a string from a string descriptor
438
439Arguments:
440 Request - request to format
441
442 RequestBuffer - Buffer to be filled in when the request has completed
443
444 StringIndex - index of the string
445
446 LandID - language ID of the string to be retrieved
447
448Return Value:
449 NTSTATUS
450
451 --*/
452{
454 FxUsbDeviceStringContext* pContext;
455
456 status = Request->ValidateTarget(this);
457 if (NT_SUCCESS(status)) {
459 "WDFUSBDEVICE %p, Request %p, setting target failed, "
460 "%!STATUS!", GetHandle(), Request, status);
461
462 return status;
463 }
464
465 if (Request->HasContextType(FX_RCT_USB_STRING_REQUEST)) {
466 pContext = (FxUsbDeviceStringContext*) Request->GetContext();
467 }
468 else {
470 if (pContext == NULL) {
472 }
473
474 Request->SetContext(pContext);
475 }
476
480 0,
481 NULL);
482
484 RequestBuffer->GetBufferLength());
485 if (!NT_SUCCESS(status)) {
486 return status;
487 }
488
489 pContext->StoreAndReferenceMemory(RequestBuffer);
490 pContext->SetUrbInfo(StringIndex, LangID);
491
493
494 return STATUS_SUCCESS;
495}
496
502 __in FxRequestBuffer *RequestBuffer
503 )
504{
507 size_t bufferSize;
508
509 bufferSize = RequestBuffer->GetBufferLength();
510
511 //
512 // We can only transfer 2 bytes worth of data, so if the buffer is larger,
513 // fail here.
514 //
515 if (bufferSize > 0xFFFF) {
518 "Control transfer buffer is limited to 0xFFFF bytes in size, "
519 "%I64d requested ", bufferSize);
520
522 }
523
524 status = Request->ValidateTarget(this);
525 if (!NT_SUCCESS(status)) {
527 "WDFUSBDEVICE %p, Request %p, setting target failed, "
528 "%!STATUS!", GetHandle(), Request, status);
529 return status;
530 }
531
532 if (Request->HasContextType(FX_RCT_USB_CONTROL_REQUEST)) {
533 pContext = (FxUsbDeviceControlContext*) Request->GetContext();
534 }
535 else {
537 if (pContext == NULL) {
539 }
540
541 Request->SetContext(pContext);
542 }
543
546 0,
547 NULL);
548
549 pContext->StoreAndReferenceMemory(this, RequestBuffer, SetupPacket);
550
552
553 return STATUS_SUCCESS;
554}
555
556VOID
561 )
562{
564
566
567 //
568 // Convert WDF_USB_CONTROL_SETUP_PACKET to WINUSB_SETUP_PACKET
569 //
570 m_UmUrb.UmUrbControlTransfer.SetupPacket.RequestType = SetupPacket->Packet.bm.Byte;
571 m_UmUrb.UmUrbControlTransfer.SetupPacket.Request = SetupPacket->Packet.bRequest;
572 m_UmUrb.UmUrbControlTransfer.SetupPacket.Value = SetupPacket->Packet.wValue.Value;
573 m_UmUrb.UmUrbControlTransfer.SetupPacket.Index = SetupPacket->Packet.wIndex.Value;
574
575 //
576 // Set the TransferBuffer values using what is stored in the Buffer
577 //
578 Buffer->AssignValues(&m_UmUrb.UmUrbControlTransfer.TransferBuffer,
579 NULL,
580 &m_UmUrb.UmUrbControlTransfer.TransferBufferLength);
581
582 m_UmUrb.UmUrbControlTransfer.SetupPacket.Length =
583 (USHORT)m_UmUrb.UmUrbControlTransfer.TransferBufferLength;
584}
585
589 __in
591 __in
596 PVOID CapabilityBuffer,
600 )
601{
603
604 if (ResultLength != NULL) {
605 *ResultLength = 0;
606 }
607
608 //
609 // We cannot send an actual query to the USB stack through winusb.
610 // However, we have the information to handle this query. It is not
611 // ideal to implement this API in this manner because we are making
612 // assumptions about the behavior of USB stack that can change in future.
613 // However, it is too late in the OS cycle to implement a correct solution.
614 // The ideal way is for winusb to expose this information. We should
615 // revisit this API in blue+1
616 //
618 &GUID_USB_CAPABILITY_DEVICE_CONNECTION_HIGH_SPEED_COMPATIBLE,
619 sizeof(GUID)) == sizeof(GUID)) {
622 } else {
624 }
625 }
627 &GUID_USB_CAPABILITY_DEVICE_CONNECTION_SUPER_SPEED_COMPATIBLE,
628 sizeof(GUID)) == sizeof(GUID)) {
629 if (m_DeviceDescriptor.bcdUSB >= 0x300) {
631 } else {
633 }
634 }
636 &GUID_USB_CAPABILITY_SELECTIVE_SUSPEND,
637 sizeof(GUID)) == sizeof(GUID)) {
638 //
639 // Both EHCI as well as XHCI stack support selective suspend.
640 // Since XHCI UCX interface is not open, there aren't any
641 // third party controller drivers to worry about. This can
642 // of course change in future
643 //
645 }
647 &GUID_USB_CAPABILITY_FUNCTION_SUSPEND,
648 sizeof(GUID)) == sizeof(GUID)) {
649 //
650 // Note that a SuperSpeed device will report a bcdUSB of 2.1
651 // when working on a 2.0 port. Therefore a bcdUSB of 3.0 also
652 // indicates that the device is actually working on 3.0, in
653 // which case we always support function suspend
654 //
655 if (m_DeviceDescriptor.bcdUSB >= 0x300) {
657 } else {
659 }
660 }
661 else {
662 //
663 // We do not support chained MDLs or streams for a UMDF driver
664 // GUID_USB_CAPABILITY_CHAINED_MDLS
665 // GUID_USB_CAPABILITY_STATIC_STREAMS
666 //
668 }
669
670 return status;
671}
672
678 )
679/*++
680
681Routine Description:
682 Since the device is already configured, all this routine
683 does is to make sure the alternate setting 0 is selected,
684 in case the client driver selected some other alternate
685 setting after the initial configuration
686
687Arguments:
688
689
690Return Value:
691 NTSTATUS
692
693 --*/
694{
696
697 RtlZeroMemory(&Params->Types.SingleInterface,
698 sizeof(Params->Types.SingleInterface));
699
700 if (m_NumInterfaces > 1) {
702
705 "WDFUSBDEVICE %p cannot be auto configured for a single interface "
706 "since there are %d interfaces on the device, %!STATUS!",
708
709 return status;
710 }
711
712 //
713 // Use AlternateSetting 0 by default
714 //
715 if (m_Interfaces[0]->GetSettingDescriptor(0) == NULL) {
718 "WDFUSBDEVICE %p could not retrieve AlternateSetting 0 for "
719 "bInterfaceNumber %d", GetHandle(),
720 m_Interfaces[0]->m_InterfaceNumber);
721
723 }
724
726
727 if (!NT_SUCCESS(status)) {
730 "WDFUSBDEVICE %p set AlternateSetting 0 for interface 0"
731 "failed, %!STATUS!", GetHandle(), status);
732
733 return status;
734 }
735
736 if (PipeAttributes) {
738 }
739
740 Params->Types.SingleInterface.ConfiguredUsbInterface =
742
743 Params->Types.SingleInterface.NumberConfiguredPipes =
745
746 return status;
747}
748
754 )
755/*++
756
757Routine Description:
758 Since the device is already configured, all this routine
759 does is to make sure the alternate setting 0 is selected
760 for all interfaces, in case the client driver selected some
761 other alternate setting after the initial configuration
762
763
764Arguments:
765 PipeAttributes - Should be NULL
766
767 Params -
768
769Return Value:
770 NTSTATUS
771
772 --*/
773{
776 UCHAR i;
778
780
781 Params->Types.MultiInterface.NumberOfConfiguredInterfaces = 0;
782
784 for (i = 0; i < m_NumInterfaces; i++) {
785
786 if (m_Interfaces[i]->GetSettingDescriptor(0) == NULL) {
789 "WDFUSBDEVICE %p could not retrieve AlternateSetting 0 for "
790 "bInterfaceNumber %d", GetHandle(),
791 m_Interfaces[i]->m_InterfaceNumber);
792
794 goto Done;
795 }
796
798 if (!NT_SUCCESS(status)) {
801 "WDFUSBDEVICE %p set AlternateSetting 0 for bInterfaceNumber %d"
802 "failed, %!STATUS!",
803 GetHandle(), m_Interfaces[i]->m_InterfaceNumber, status);
804 goto Done;
805 }
806 if (PipeAttributes) {
808 }
809 }
810 }
811 else {
812 //
813 // Type is WdfUsbTargetDeviceSelectConfigTypeInterfacesPairs
814 //
815 UCHAR interfacePairsNum = 0;
816 UCHAR bitArray[UCHAR_MAX/sizeof(UCHAR)];
817
818 //
819 // initialize the bit array
820 //
821 RtlZeroMemory(bitArray, sizeof(bitArray));
822 //
823 // Build a list of descriptors from the Setting pairs
824 // passed in by the user. There could be interfaces not
825 // covered in the setting/interface pairs array passed.
826 // If that is the case return STATUS_INVALID_PARAMETER
827 //
828 for (i = 0; i < Params->Types.MultiInterface.NumberInterfaces ; i++) {
830 UCHAR interfaceNumber;
831 UCHAR altSettingIndex;
832
833 settingPair = &Params->Types.MultiInterface.Pairs[i];
834
836 settingPair->UsbInterface,
838 (PVOID*) &pUsbInterface);
839
840 interfaceNumber = pUsbInterface->GetInterfaceNumber();
841 altSettingIndex = settingPair->SettingIndex;
842
843 //
844 // do the following only if the bit is not already set
845 //
846 if (FxBitArraySet(&bitArray[0], interfaceNumber) == FALSE) {
847
848 if (pUsbInterface->GetSettingDescriptor(altSettingIndex) == NULL) {
853 "WDFUSBDEVICE %p could not retrieve "
854 "AlternateSetting %d for "
855 "bInterfaceNumber %d, returning %!STATUS!",
856 GetHandle(),
857 altSettingIndex, interfaceNumber, status);
858 goto Done;
859 }
860
861 interfacePairsNum++;
862
863 //
864 // Ensure alternate setting 0 is selected
865 //
867 settingPair->SettingIndex);
868
869 if (!NT_SUCCESS(status)) {
872 "WDFUSBDEVICE %p set AlternateSetting %d for bInterfaceNumber %d"
873 "failed, %!STATUS!",
874 GetHandle(), altSettingIndex, m_Interfaces[i]->m_InterfaceNumber,
875 status);
876 goto Done;
877 }
878
879 if (PipeAttributes) {
881 }
882 }
883
884 }
885
886 if (m_NumInterfaces > interfacePairsNum) {
890 "WDFUSBDEVICE %p interface pairs set (%d) is not equal to actual "
891 "# of interfaces (%d) reported by the device, %!STATUS!",
892 GetObjectHandle(), interfacePairsNum, m_NumInterfaces, status);
893 goto Done;
894 }
895 } //WdfUsbTargetDeviceSelectConfigTypeInterfacesPairs
896
898 Params->Types.MultiInterface.NumberOfConfiguredInterfaces = m_NumInterfaces;
899
900Done:
901 return status;
902}
903
904
908 VOID
909 )
910{
911 UMURB urb;
913
914 RtlZeroMemory(&urb, sizeof(UMURB));
915
917 urb.UmUrbSelectInterface.Hdr.Length = sizeof(_UMURB_HEADER);
918
919 status = SendSyncUmUrb(&urb, 2);
920
921 return status;
922}
923
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174
IWudfDeviceStack2 * GetDeviceStack2(VOID)
Definition: fxdeviceum.hpp:444
_Must_inspect_result_ NTSTATUS SubmitSync(__in FxRequestBase *Request, __in_opt PWDF_REQUEST_SEND_OPTIONS Options=NULL, __out_opt PULONG Action=NULL)
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
CfxDevice * m_Device
Definition: fxobject.hpp:329
CfxDeviceBase * m_DeviceBase
Definition: fxobject.hpp:328
_Must_inspect_result_ NTSTATUS Reset(VOID)
WINUSB_INTERFACE_HANDLE m_WinUsbHandle
USB_DEVICE_DESCRIPTOR m_DeviceDescriptor
_Must_inspect_result_ NTSTATUS FormatStringRequest(__in FxRequestBase *Request, __in FxRequestBuffer *RequestBuffer, __in UCHAR StringIndex, __in USHORT LangID)
_Must_inspect_result_ NTSTATUS QueryUsbCapability(__in CONST GUID *CapabilityType, __in ULONG CapabilityBufferLength, __drv_when(CapabilityBufferLength==0, __out_opt) __drv_when(CapabilityBufferLength !=0 &&ResultLength==NULL, __out_bcount(CapabilityBufferLength)) __drv_when(CapabilityBufferLength !=0 &&ResultLength !=NULL, __out_bcount_part_opt(CapabilityBufferLength, *ResultLength)) PVOID CapabilityBuffer, __out_opt __drv_when(ResultLength !=NULL, __deref_out_range(<=, CapabilityBufferLength)) PULONG ResultLength)
_Must_inspect_result_ NTSTATUS SendSyncUmUrb(__inout PUMURB Urb, __in ULONGLONG Time, __in_opt WDFREQUEST Request=NULL, __in_opt PWDF_REQUEST_SEND_OPTIONS Options=NULL)
IWudfFile * m_pHostTargetFile
_Must_inspect_result_ NTSTATUS SendSyncRequest(__in FxSyncRequest *Request, __in ULONGLONG Time)
PUSB_CONFIGURATION_DESCRIPTOR m_ConfigDescriptor
UCHAR m_NumInterfaces
FxWaitLockInternal m_InterfaceIterationLock
_Must_inspect_result_ NTSTATUS FormatControlRequest(__in FxRequestBase *Request, __in PWDF_USB_CONTROL_SETUP_PACKET Packet, __in FxRequestBuffer *RequestBuffer)
_Must_inspect_result_ NTSTATUS GetString(__in_ecount(*NumCharacters) PUSHORT String, __in PUSHORT NumCharacters, __in UCHAR StringIndex, __in_opt USHORT LangID, __in_opt WDFREQUEST Request=NULL, __in_opt PWDF_REQUEST_SEND_OPTIONS Options=NULL)
_Must_inspect_result_ NTSTATUS InitDevice(__in ULONG USBDClientContractVersionForWdfClient)
_Must_inspect_result_ NTSTATUS SelectConfigSingle(__in PWDF_OBJECT_ATTRIBUTES PipeAttributes, __in PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params)
FxUsbInterface ** m_Interfaces
_Must_inspect_result_ NTSTATUS SelectConfigMulti(__in PWDF_OBJECT_ATTRIBUTES PipeAttributes, __in PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params)
UCHAR GetInterfaceNumber(VOID)
PUSB_INTERFACE_DESCRIPTOR GetSettingDescriptor(__in UCHAR Setting)
WDFUSBINTERFACE GetHandle(VOID)
NTSTATUS CheckAndSelectSettingByIndex(__in UCHAR SettingIndex)
UCHAR GetNumConfiguredPipes(VOID)
NTSTATUS UpdatePipeAttributes(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes)
CHECK_RETURN_IF_USER_MODE NTSTATUS Initialize()
Definition: fxwaitlock.hpp:235
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define __out_opt
Definition: dbghelp.h:65
#define __in_ecount(x)
Definition: dbghelp.h:47
#define __in
Definition: dbghelp.h:35
#define __out_bcount(x)
Definition: dbghelp.h:68
#define __inout
Definition: dbghelp.h:50
#define __in_opt
Definition: dbghelp.h:38
#define TRACINGIOTARGET
Definition: dbgtrace.h:72
struct config_s config
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define __drv_when(cond, annotes)
Definition: driverspecs.h:335
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define NonPagedPool
Definition: env_spec_w32.h:307
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
return pObject GetObjectHandle()
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), Fdo, FX_TYPE_DEVICE,(PVOID *)&pFdo)
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition: wdfpool.cpp:361
@ FX_RCT_USB_CONTROL_REQUEST
@ FX_RCT_USB_STRING_REQUEST
@ FX_TYPE_USB_INTERFACE
Definition: fxtypes.h:104
@ FxUrbTypeLegacy
Definition: fxusbdevice.hpp:27
FxUsbInterface * pUsbInterface
USHORT numChars
size_t bufferSize
GLuint buffer
Definition: glext.h:5915
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UCHAR_MAX
Definition: limits.h:25
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static PLARGE_INTEGER Time
Definition: time.c:105
#define _Must_inspect_result_
Definition: no_sal2.h:62
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
#define CONST
Definition: pedump.c:81
unsigned short USHORT
Definition: pedump.c:61
#define __deref_out_range(x, y)
Definition: sal_old.h:220
#define __out_bcount_part_opt(size, length)
Definition: sal_old.h:281
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
HRESULT hr
Definition: shlfolder.c:183
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
virtual VOID StoreAndReferenceMemory(__in FxRequestBuffer *Buffer)
VOID StoreAndReferenceMemory(__in FxUsbDevice *Device, __in FxRequestBuffer *Buffer, __in PWDF_USB_CONTROL_SETUP_PACKET SetupPacket)
VOID SetUrbInfo(__in UCHAR StringIndex, __in USHORT LangID)
_Must_inspect_result_ NTSTATUS AllocateDescriptor(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in size_t BufferSize)
VOID SetUsbType(__in WDF_USB_REQUEST_TYPE Type)
Definition: umusb.h:173
struct _UMURB_SELECT_INTERFACE UmUrbSelectInterface
Definition: umusb.h:178
struct _UMURB_CONTROL_TRANSFER UmUrbControlTransfer
Definition: umusb.h:200
struct _UMURB_HEADER UmUrbHeader
Definition: umusb.h:175
struct _UMURB_DESCRIPTOR_REQUEST UmUrbDescriptorRequest
Definition: umusb.h:245
WDFUSBINTERFACE UsbInterface
Definition: wdfusb.h:522
Definition: http.c:7252
Definition: devices.h:37
Definition: tftpd.h:86
Definition: ps.c:97
#define GetHandle(h)
Definition: treelist.c:116
uint32_t * PULONG
Definition: typedefs.h:59
uint16_t * PUSHORT
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_DEVICE_DATA_ERROR
Definition: udferr_usr.h:159
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define UMURB_FUNCTION_RESET_PORT
Definition: umusb.h:41
#define USB_GETSTATUS_SELF_POWERED
Definition: usb100.h:45
struct _USB_CONFIGURATION_DESCRIPTOR * PUSB_CONFIGURATION_DESCRIPTOR
#define USB_CONFIGURATION_DESCRIPTOR_TYPE
Definition: usb100.h:50
struct _USB_STRING_DESCRIPTOR * PUSB_STRING_DESCRIPTOR
#define USB_DEVICE_DESCRIPTOR_TYPE
Definition: usb100.h:49
#define USB_CONFIG_REMOTE_WAKEUP
Definition: usb100.h:71
#define USB_STRING_DESCRIPTOR_TYPE
Definition: usb100.h:51
struct _USB_STRING_DESCRIPTOR USB_STRING_DESCRIPTOR
struct _USB_COMMON_DESCRIPTOR USB_COMMON_DESCRIPTOR
VOID FxUsbUmInitInformationUrb(__inout PUMURB UmUrb, __in WINUSB_INTERFACE_HANDLE WinUsbHandle, __in ULONG BufferLength, __in PVOID Buffer)
Definition: usbutil.cpp:596
VOID FxUsbUmInitDescriptorUrb(__inout PUMURB UmUrb, __in WINUSB_INTERFACE_HANDLE WinUsbHandle, __in UCHAR DescriptorType, __in ULONG BufferLength, __in PVOID Buffer)
Definition: usbutil.cpp:556
VOID FxUsbUmFormatRequest(__in FxRequestBase *Request, __in_xcount(Urb->Length) PUMURB_HEADER Urb, __in IWudfFile *HostFile, __in BOOLEAN Reuse)
Definition: usbutil.cpp:486
VOID FxUsbUmInitControlTransferUrb(__inout PUMURB UmUrb, __in WINUSB_INTERFACE_HANDLE WinUsbHandle, __in ULONG BufferLength, __in PVOID Buffer)
Definition: usbutil.cpp:578
BOOLEAN __inline FxBitArraySet(__inout_xcount((BitNumber/sizeof(UCHAR))+1) PUCHAR BitArray, __in UCHAR BitNumber)
Definition: usbutil.hpp:9
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
FORCEINLINE LONGLONG WDF_REL_TIMEOUT_IN_SEC(_In_ ULONGLONG Time)
Definition: wdfcore.h:62
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3534
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
FORCEINLINE VOID WDF_REQUEST_SEND_OPTIONS_INIT(_Out_ PWDF_REQUEST_SEND_OPTIONS Options, _In_ ULONG Flags)
Definition: wdfrequest.h:409
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:308
FORCEINLINE VOID WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(_Inout_ PWDF_REQUEST_SEND_OPTIONS Options, _In_ LONGLONG Timeout)
Definition: wdfrequest.h:421
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES PipeAttributes
Definition: wdfusb.h:1242
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ CONST GUID _In_ ULONG CapabilityBufferLength
Definition: wdfusb.h:1615
FORCEINLINE VOID WDF_USB_CONTROL_SETUP_PACKET_INIT_GET_STATUS(_Out_ PWDF_USB_CONTROL_SETUP_PACKET Packet, _In_ WDF_USB_BMREQUEST_RECIPIENT BmRequestRecipient, _In_ USHORT Index)
Definition: wdfusb.h:305
@ WDF_USB_DEVICE_TRAIT_SELF_POWERED
Definition: wdfusb.h:142
@ WDF_USB_DEVICE_TRAIT_AT_HIGH_SPEED
Definition: wdfusb.h:144
@ WDF_USB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE
Definition: wdfusb.h:143
@ BmRequestToDevice
Definition: wdfusb.h:111
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT NumCharacters
Definition: wdfusb.h:1078
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ CONST GUID * CapabilityType
Definition: wdfusb.h:1613
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR StringIndex
Definition: wdfusb.h:1080
@ WdfUsbRequestTypeDeviceControlTransfer
Definition: wdfusb.h:90
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083
@ WdfUsbTargetDeviceSelectConfigTypeMultiInterface
Definition: wdfusb.h:129
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET SetupPacket
Definition: wdfusb.h:1337
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180