diff --git a/Context.h b/Context.h
index f301c5e..4bf4bbd 100644
--- a/Context.h
+++ b/Context.h
@@ -106,21 +106,11 @@ typedef struct _PDO_DEVICE_DATA
//
WDFQUEUE PendingUsbInRequests;
- //
- // Lock for queue for incoming data interrupt transfer
- //
- WDFSPINLOCK PendingUsbInRequestsLock;
-
//
// Queue for inverted calls
//
WDFQUEUE PendingNotificationRequests;
- //
- // Lock for queue for inverted calls
- //
- WDFSPINLOCK PendingNotificationRequestsLock;
-
} PDO_DEVICE_DATA, *PPDO_DEVICE_DATA;
WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(PDO_DEVICE_DATA, PdoGetData)
diff --git a/Ds4.c b/Ds4.c
index 256a9c8..027ee2a 100644
--- a/Ds4.c
+++ b/Ds4.c
@@ -351,13 +351,10 @@ VOID Ds4_PendingUsbRequestsTimerFunc(
ds4Data = Ds4GetData(hChild);
// Get pending USB request
- WdfSpinLockAcquire(pdoData->PendingUsbInRequestsLock);
status = WdfIoQueueRetrieveNextRequest(pdoData->PendingUsbInRequests, &usbRequest);
if (NT_SUCCESS(status))
{
- // KdPrint((DRIVERNAME "Ds4_PendingUsbRequestsTimerFunc: pending IRP found\n"));
-
// Get pending IRP
pendingIrp = WdfRequestWdmGetIrp(usbRequest);
irpStack = IoGetCurrentIrpStackLocation(pendingIrp);
@@ -371,12 +368,11 @@ VOID Ds4_PendingUsbRequestsTimerFunc(
urb->UrbBulkOrInterruptTransfer.TransferBufferLength = DS4_REPORT_SIZE;
// Copy cached report to transfer buffer
- RtlCopyBytes(Buffer, ds4Data->Report, DS4_REPORT_SIZE);
+ if (Buffer)
+ RtlCopyBytes(Buffer, ds4Data->Report, DS4_REPORT_SIZE);
// Complete pending request
WdfRequestComplete(usbRequest, status);
}
-
- WdfSpinLockRelease(pdoData->PendingUsbInRequestsLock);
}
diff --git a/ViGEmBus.rc b/ViGEmBus.rc
index 92bf9fe..1600f26 100644
--- a/ViGEmBus.rc
+++ b/ViGEmBus.rc
@@ -51,8 +51,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,13,2,0
- PRODUCTVERSION 1,13,2,0
+ FILEVERSION 1,13,8,0
+ PRODUCTVERSION 1,13,8,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -69,12 +69,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Benjamin Höglinger-Stelzer"
VALUE "FileDescription", "Virtual Gamepad Emulation Bus Driver"
-VALUE "FileVersion", "1.13.2.0"
+VALUE "FileVersion", "1.13.8.0"
VALUE "InternalName", "Virtual Gamepad Emulation Bus Driver"
VALUE "LegalCopyright", "Copyright (C) Benjamin Höglinger-Stelzer 2016"
VALUE "OriginalFilename", "vigembus.sys"
VALUE "ProductName", "Virtual Gamepad Emulation Bus Driver"
-VALUE "ProductVersion", "1.13.2.0"
+VALUE "ProductVersion", "1.13.8.0"
END
END
BLOCK "VarFileInfo"
diff --git a/ViGEmBus.vcxproj b/ViGEmBus.vcxproj
index e927bde..636a217 100644
--- a/ViGEmBus.vcxproj
+++ b/ViGEmBus.vcxproj
@@ -182,7 +182,7 @@
- 1.13.2.0
+ 1.13.8.0
$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)
@@ -190,7 +190,7 @@
- 1.13.2.0
+ 1.13.8.0
$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)
@@ -198,7 +198,7 @@
- 1.13.2.0
+ 1.13.8.0
$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)
@@ -206,7 +206,7 @@
- 1.13.2.0
+ 1.13.8.0
$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)
@@ -214,7 +214,7 @@
- 1.13.2.0
+ 1.13.8.0
$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)
@@ -222,7 +222,7 @@
- 1.13.2.0
+ 1.13.8.0
$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)
@@ -230,7 +230,7 @@
- 1.13.2.0
+ 1.13.8.0
$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)
@@ -238,7 +238,7 @@
- 1.13.2.0
+ 1.13.8.0
$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)
diff --git a/busenum.c b/busenum.c
index 05f1985..8b536ca 100644
--- a/busenum.c
+++ b/busenum.c
@@ -361,9 +361,7 @@ NTSTATUS Bus_QueueNotification(WDFDEVICE Device, ULONG SerialNo, WDFREQUEST Requ
if (xusbData == NULL) break;
- WdfSpinLockAcquire(pdoData->PendingNotificationRequestsLock);
status = WdfRequestForwardToIoQueue(Request, pdoData->PendingNotificationRequests);
- WdfSpinLockRelease(pdoData->PendingNotificationRequestsLock);
break;
case DualShock4Wired:
@@ -372,9 +370,7 @@ NTSTATUS Bus_QueueNotification(WDFDEVICE Device, ULONG SerialNo, WDFREQUEST Requ
if (ds4Data == NULL) break;
- WdfSpinLockAcquire(pdoData->PendingNotificationRequestsLock);
status = WdfRequestForwardToIoQueue(Request, pdoData->PendingNotificationRequests);
- WdfSpinLockRelease(pdoData->PendingNotificationRequestsLock);
break;
default:
@@ -496,13 +492,11 @@ NTSTATUS Bus_SubmitReport(WDFDEVICE Device, ULONG SerialNo, PVOID Report, BOOLEA
KdPrint((DRIVERNAME "Bus_SubmitReport: received new report\n"));
- WdfSpinLockAcquire(pdoData->PendingUsbInRequestsLock);
-
// Get pending USB request
switch (pdoData->TargetType)
{
case Xbox360Wired:
-
+
status = WdfIoQueueRetrieveNextRequest(pdoData->PendingUsbInRequests, &usbRequest);
break;
@@ -530,7 +524,7 @@ NTSTATUS Bus_SubmitReport(WDFDEVICE Device, ULONG SerialNo, PVOID Report, BOOLEA
if (!NT_SUCCESS(status))
{
KdPrint((DRIVERNAME "WdfMemoryCreate failed with status 0x%X\n", status));
- goto releaseAndExit;
+ goto endSubmitReport;
}
// Copy interrupt buffer to memory object
@@ -538,7 +532,7 @@ NTSTATUS Bus_SubmitReport(WDFDEVICE Device, ULONG SerialNo, PVOID Report, BOOLEA
if (!NT_SUCCESS(status))
{
KdPrint((DRIVERNAME "WdfMemoryCopyFromBuffer failed with status 0x%X\n", status));
- goto releaseAndExit;
+ goto endSubmitReport;
}
// Add memory object to collection
@@ -546,7 +540,7 @@ NTSTATUS Bus_SubmitReport(WDFDEVICE Device, ULONG SerialNo, PVOID Report, BOOLEA
if (!NT_SUCCESS(status))
{
KdPrint((DRIVERNAME "WdfCollectionAdd failed with status 0x%X\n", status));
- goto releaseAndExit;
+ goto endSubmitReport;
}
// Check if all packets have been received
@@ -559,7 +553,7 @@ NTSTATUS Bus_SubmitReport(WDFDEVICE Device, ULONG SerialNo, PVOID Report, BOOLEA
WdfTimerStart(xgip->XboxgipSysInitTimer, XGIP_SYS_INIT_PERIOD);
}
- goto releaseAndExit;
+ goto endSubmitReport;
}
status = WdfIoQueueRetrieveNextRequest(XgipGetData(hChild)->PendingUsbInRequests, &usbRequest);
@@ -568,11 +562,11 @@ NTSTATUS Bus_SubmitReport(WDFDEVICE Device, ULONG SerialNo, PVOID Report, BOOLEA
default:
status = STATUS_NOT_SUPPORTED;
- goto releaseAndExit;
+ goto endSubmitReport;
}
if (!NT_SUCCESS(status))
- goto releaseAndExit;
+ goto endSubmitReport;
KdPrint((DRIVERNAME "Bus_SubmitReport: pending IRP found\n"));
@@ -604,7 +598,9 @@ NTSTATUS Bus_SubmitReport(WDFDEVICE Device, ULONG SerialNo, PVOID Report, BOOLEA
/* Copy report to cache and transfer buffer
* Skip first byte as it contains the never changing report id */
RtlCopyBytes(Ds4GetData(hChild)->Report + 1, &((PDS4_SUBMIT_REPORT)Report)->Report, sizeof(DS4_REPORT));
- RtlCopyBytes(Buffer, Ds4GetData(hChild)->Report, DS4_REPORT_SIZE);
+
+ if (Buffer)
+ RtlCopyBytes(Buffer, Ds4GetData(hChild)->Report, DS4_REPORT_SIZE);
break;
case XboxOneWired:
@@ -634,8 +630,7 @@ NTSTATUS Bus_SubmitReport(WDFDEVICE Device, ULONG SerialNo, PVOID Report, BOOLEA
// Complete pending request
WdfRequestComplete(usbRequest, status);
-releaseAndExit:
- WdfSpinLockRelease(pdoData->PendingUsbInRequestsLock);
+endSubmitReport:
return status;
}
diff --git a/buspdo.c b/buspdo.c
index 2c79010..7bfb799 100644
--- a/buspdo.c
+++ b/buspdo.c
@@ -367,14 +367,6 @@ NTSTATUS Bus_CreatePdo(
KdPrint((DRIVERNAME "WdfIoQueueCreate (PendingUsbInRequests) failed 0x%x\n", status));
goto endCreatePdo;
}
-
- // Create lock for queue
- status = WdfSpinLockCreate(&attributes, &pdoData->PendingUsbInRequestsLock);
- if (!NT_SUCCESS(status))
- {
- KdPrint((DRIVERNAME "WdfSpinLockCreate (PendingUsbInRequestsLock) failed 0x%x\n", status));
- goto endCreatePdo;
- }
// Create and assign queue for user-land notification requests
WDF_IO_QUEUE_CONFIG_INIT(¬ificationsQueueConfig, WdfIoQueueDispatchManual);
@@ -386,14 +378,6 @@ NTSTATUS Bus_CreatePdo(
goto endCreatePdo;
}
- // Create lock for queue
- status = WdfSpinLockCreate(&attributes, &pdoData->PendingNotificationRequestsLock);
- if (!NT_SUCCESS(status))
- {
- KdPrint((DRIVERNAME "WdfSpinLockCreate (PendingNotificationRequestsLock) failed 0x%x\n", status));
- goto endCreatePdo;
- }
-
#pragma endregion
#pragma region Default I/O queue setup
diff --git a/usbpdo.c b/usbpdo.c
index f8a2d56..04c962d 100644
--- a/usbpdo.c
+++ b/usbpdo.c
@@ -507,9 +507,7 @@ NTSTATUS UsbPdo_BulkOrInterruptTransfer(PURB urb, WDFDEVICE Device, WDFREQUEST R
/* This request is sent periodically and relies on data the "feeder"
* has to supply, so we queue this request and return with STATUS_PENDING.
* The request gets completed as soon as the "feeder" sent an update. */
- WdfSpinLockAcquire(pdoData->PendingUsbInRequestsLock);
status = WdfRequestForwardToIoQueue(Request, pdoData->PendingUsbInRequests);
- WdfSpinLockRelease(pdoData->PendingUsbInRequestsLock);
return (NT_SUCCESS(status)) ? STATUS_PENDING : status;
}
@@ -567,7 +565,6 @@ NTSTATUS UsbPdo_BulkOrInterruptTransfer(PURB urb, WDFDEVICE Device, WDFREQUEST R
}
// Notify user-mode process that new data is available
- WdfSpinLockAcquire(pdoData->PendingNotificationRequestsLock);
status = WdfIoQueueRetrieveNextRequest(pdoData->PendingNotificationRequests, ¬ifyRequest);
if (NT_SUCCESS(status))
@@ -593,8 +590,6 @@ NTSTATUS UsbPdo_BulkOrInterruptTransfer(PURB urb, WDFDEVICE Device, WDFREQUEST R
}
}
- WdfSpinLockRelease(pdoData->PendingNotificationRequestsLock);
-
break;
}
case DualShock4Wired: