From c644146dd7c687e4fa0977c9759d0eb4797daaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Wed, 13 May 2020 16:36:30 +0200 Subject: [PATCH] Added _PendingPlugInRequests --- sys/EmulationTargetPDO.cpp | 30 +++++++++++++++++++++++++++++- sys/EmulationTargetPDO.hpp | 5 +++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/sys/EmulationTargetPDO.cpp b/sys/EmulationTargetPDO.cpp index 7e7f0c3..3340449 100644 --- a/sys/EmulationTargetPDO.cpp +++ b/sys/EmulationTargetPDO.cpp @@ -48,6 +48,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD WDFQUEUE defaultPdoQueue; UNICODE_STRING deviceDescription; WDF_OBJECT_ATTRIBUTES attributes; + WDF_IO_QUEUE_CONFIG plugInQueueConfig; WDF_IO_QUEUE_CONFIG usbInQueueConfig; WDF_IO_QUEUE_CONFIG notificationsQueueConfig; PEMULATION_TARGET_PDO_CONTEXT pPdoContext; @@ -234,6 +235,27 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD WDF_OBJECT_ATTRIBUTES_INIT(&attributes); attributes.ParentObject = this->_PdoDevice; + // Create and assign queue for incoming interrupt transfer + WDF_IO_QUEUE_CONFIG_INIT(&plugInQueueConfig, WdfIoQueueDispatchManual); + + status = WdfIoQueueCreate( + ParentDevice, + &plugInQueueConfig, + WDF_NO_OBJECT_ATTRIBUTES, + &this->_PendingPlugInRequests + ); + if (!NT_SUCCESS(status)) + { + TraceEvents(TRACE_LEVEL_ERROR, + TRACE_BUSPDO, + "WdfIoQueueCreate (PendingPlugInRequests) failed with status %!STATUS!", + status); + break; + } + + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = this->_PdoDevice; + // Create and assign queue for incoming interrupt transfer WDF_IO_QUEUE_CONFIG_INIT(&usbInQueueConfig, WdfIoQueueDispatchManual); @@ -252,6 +274,9 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD break; } + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = this->_PdoDevice; + // Create and assign queue for user-land notification requests WDF_IO_QUEUE_CONFIG_INIT(¬ificationsQueueConfig, WdfIoQueueDispatchManual); @@ -273,7 +298,10 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD #pragma endregion #pragma region Default I/O queue setup - + + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = this->_PdoDevice; + WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&defaultPdoQueueConfig, WdfIoQueueDispatchParallel); defaultPdoQueueConfig.EvtIoInternalDeviceControl = EvtIoInternalDeviceControl; diff --git a/sys/EmulationTargetPDO.hpp b/sys/EmulationTargetPDO.hpp index 9e429f7..306f94d 100644 --- a/sys/EmulationTargetPDO.hpp +++ b/sys/EmulationTargetPDO.hpp @@ -190,6 +190,11 @@ namespace ViGEm::Bus::Core // USHORT _ProductId{}; + // + // Queue for blocking plugin requests + // + WDFQUEUE _PendingPlugInRequests{}; + // // Queue for incoming data interrupt transfer //