VOID Pipe_InitQueueConfig( __in PPIPE_CONTEXT pipeContext, __out WDF_IO_QUEUE_CONFIG* queueConfig) { WDF_DRIVER_VERSION_AVAILABLE_PARAMS verParams; if (!pipeContext->Pipe) { // Default (Control) pipe WDF_IO_QUEUE_CONFIG_INIT(queueConfig, WdfIoQueueDispatchSequential); queueConfig->EvtIoDeviceControl = PipeQueue_OnIoControl; return; } if (pipeContext->PipeInformation.PipeType == WdfUsbPipeTypeIsochronous || pipeContext->Policies.RawIO) { USBDBGN("Configuring parallel queue.."); WDF_IO_QUEUE_CONFIG_INIT(queueConfig, WdfIoQueueDispatchParallel); /* NOTE: WinUSB does not support RawIO OUT transfers; libusbK does. http://msdn.microsoft.com/en-us/library/windows/hardware/ff728833%28v=vs.85%29.aspx In libusbK, RawIO means we use a parallel queue. Any pipe policies or functionality that could cause multiple IO transactions per request are no longer supported. IE: Transfer splitting, ALLOW_ARTIAL_READS, AUTO_FLUSH, IGNORE_SHORT_PACKETS, SHORT_PACKET_TERMINATE. */ WDF_DRIVER_VERSION_AVAILABLE_PARAMS_INIT(&verParams, KMDF_MAJOR_VERSION, KMDF_MINOR_VERSION); if (WdfDriverIsVersionAvailable(gWdfDriver, &verParams)) { # if ((KMDF_MAJOR_VERSION==1 && KMDF_MINOR_VERSION >= 9) || (KMDF_MAJOR_VERSION > 1)) if (pipeContext->SimulParallelRequests) queueConfig->Settings.Parallel.NumberOfPresentedRequests = pipeContext->SimulParallelRequests; # endif } else { DbgPrint("Expected library version %u.%u!\n",KMDF_MAJOR_VERSION, KMDF_MINOR_VERSION); } } else { USBDBGN("Configuring sequential queue.."); WDF_IO_QUEUE_CONFIG_INIT(queueConfig, WdfIoQueueDispatchSequential); queueConfig->EvtIoStop = Queue_OnStop; queueConfig->EvtIoResume = Queue_OnResume; } queueConfig->EvtIoDeviceControl = PipeQueue_OnIoControl; if (USB_ENDPOINT_DIRECTION_IN(pipeContext->PipeInformation.EndpointAddress)) { queueConfig->EvtIoRead = PipeQueue_OnRead; } else { queueConfig->EvtIoWrite = PipeQueue_OnWrite; queueConfig->AllowZeroLengthRequests = TRUE; } }
NTSTATUS EchoPrintDriverVersion( ) /*++ Routine Description: This routine shows how to retrieve framework version string and also how to find out to which version of framework library the client driver is bound to. Arguments: Return Value: NTSTATUS --*/ { NTSTATUS status; WDFSTRING string; UNICODE_STRING us; WDF_DRIVER_VERSION_AVAILABLE_PARAMS ver; // // 1) Retreive version string and print that in the debugger. // status = WdfStringCreate(NULL, WDF_NO_OBJECT_ATTRIBUTES, &string); if (!NT_SUCCESS(status)) { KdPrint(("Error: WdfStringCreate failed 0x%x\n", status)); return status; } status = WdfDriverRetrieveVersionString(WdfGetDriver(), string); if (!NT_SUCCESS(status)) { // // No need to worry about delete the string object because // by default it's parented to the driver and it will be // deleted when the driverobject is deleted when the DriverEntry // returns a failure status. // KdPrint(("Error: WdfDriverRetrieveVersionString failed 0x%x\n", status)); return status; } WdfStringGetUnicodeString(string, &us); KdPrint(("Echo Sample %wZ\n", &us)); WdfObjectDelete(string); string = NULL; // To avoid referencing a deleted object. // // 2) Find out to which version of framework this driver is bound to. // WDF_DRIVER_VERSION_AVAILABLE_PARAMS_INIT(&ver, 1, 0); if (WdfDriverIsVersionAvailable(WdfGetDriver(), &ver) == TRUE) { KdPrint(("Yes, framework version is 1.0\n")); }else { KdPrint(("No, framework verison is not 1.0\n")); } return STATUS_SUCCESS; }