Implemented new DS4_SUBMIT_REPORT_EX

This commit is contained in:
Benjamin Höglinger-Stelzer
2020-09-07 21:44:46 +02:00
parent 0c920602e7
commit 5611bbd3fa
3 changed files with 93 additions and 24 deletions

View File

@@ -300,25 +300,54 @@ VOID Bus_EvtIoDeviceControl(
break;
}
if ((sizeof(DS4_SUBMIT_REPORT) == ds4Submit->Size) && (length == InputBufferLength))
//
// Check if buffer is within expected bounds
//
if (length < sizeof(DS4_SUBMIT_REPORT) || length > sizeof(DS4_SUBMIT_REPORT_EX))
{
// This request only supports a single PDO at a time
if (ds4Submit->SerialNo == 0)
{
TraceEvents(TRACE_LEVEL_ERROR,
TRACE_QUEUE,
"Invalid serial 0 submitted");
TraceDbg(
TRACE_QUEUE,
"Unexpected buffer size: %d",
static_cast<ULONG>(length)
);
status = STATUS_INVALID_PARAMETER;
break;
}
if (!EmulationTargetPDO::GetPdoByTypeAndSerial(Device, DualShock4Wired, ds4Submit->SerialNo, &pdo))
status = STATUS_DEVICE_DOES_NOT_EXIST;
else
status = pdo->SubmitReport(ds4Submit);
status = STATUS_INVALID_BUFFER_SIZE;
break;
}
//
// Check if this makes sense before passing it on
//
if (length != ds4Submit->Size)
{
TraceDbg(
TRACE_QUEUE,
"Invalid buffer size: %d",
ds4Submit->Size
);
status = STATUS_INVALID_BUFFER_SIZE;
break;
}
//
// This request only supports a single PDO at a time
//
if (ds4Submit->SerialNo == 0)
{
TraceEvents(TRACE_LEVEL_ERROR,
TRACE_QUEUE,
"Invalid serial 0 submitted");
status = STATUS_INVALID_PARAMETER;
break;
}
if (!EmulationTargetPDO::GetPdoByTypeAndSerial(Device, DualShock4Wired, ds4Submit->SerialNo, &pdo))
status = STATUS_DEVICE_DOES_NOT_EXIST;
else
status = pdo->SubmitReport(ds4Submit);
break;
#pragma endregion