mirror of
https://github.com/nefarius/ViGEmBus.git
synced 2025-08-10 00:52:17 +00:00
Changed function
This commit is contained in:
@@ -456,8 +456,8 @@ EmulationTargetPDO(ULONG Serial, LONG SessionId, USHORT VendorId, USHORT Product
|
||||
KeInitializeEvent(&this->_PdoBootNotificationEvent, NotificationEvent, FALSE);
|
||||
}
|
||||
|
||||
ViGEm::Bus::Core::EmulationTargetPDO* ViGEm::Bus::Core::EmulationTargetPDO::GetPdoBySerial(
|
||||
IN WDFDEVICE ParentDevice, IN ULONG SerialNo)
|
||||
bool ViGEm::Bus::Core::EmulationTargetPDO::GetPdoBySerial(
|
||||
IN WDFDEVICE ParentDevice, IN ULONG SerialNo, OUT EmulationTargetPDO** Object)
|
||||
{
|
||||
WDF_CHILD_RETRIEVE_INFO info;
|
||||
|
||||
@@ -474,9 +474,11 @@ ViGEm::Bus::Core::EmulationTargetPDO* ViGEm::Bus::Core::EmulationTargetPDO::GetP
|
||||
const WDFDEVICE pdoDevice = WdfChildListRetrievePdo(list, &info);
|
||||
|
||||
if (pdoDevice == nullptr)
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
return EmulationTargetPdoGetContext(pdoDevice)->Target;
|
||||
*Object = EmulationTargetPdoGetContext(pdoDevice)->Target;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::EvtDevicePrepareHardware(
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace ViGEm::Bus::Core
|
||||
|
||||
virtual ~EmulationTargetPDO() = default;
|
||||
|
||||
static EmulationTargetPDO* GetPdoBySerial(IN WDFDEVICE ParentDevice, IN ULONG SerialNo);
|
||||
static bool GetPdoBySerial(IN WDFDEVICE ParentDevice, IN ULONG SerialNo, OUT EmulationTargetPDO** Object);
|
||||
|
||||
virtual NTSTATUS PdoPrepareDevice(PWDFDEVICE_INIT DeviceInit,
|
||||
PUNICODE_STRING DeviceId,
|
||||
|
||||
@@ -164,9 +164,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
break;
|
||||
}
|
||||
|
||||
pdo = EmulationTargetPDO::GetPdoBySerial(Device, xusbSubmit->SerialNo);
|
||||
|
||||
if (pdo == nullptr)
|
||||
if (!EmulationTargetPDO::GetPdoBySerial(Device, xusbSubmit->SerialNo, &pdo))
|
||||
status = STATUS_DEVICE_DOES_NOT_EXIST;
|
||||
else
|
||||
status = pdo->SubmitReport(xusbSubmit);
|
||||
@@ -262,10 +260,8 @@ VOID Bus_EvtIoDeviceControl(
|
||||
status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
pdo = EmulationTargetPDO::GetPdoBySerial(Device, ds4Submit->SerialNo);
|
||||
|
||||
if (pdo == nullptr)
|
||||
|
||||
if (!EmulationTargetPDO::GetPdoBySerial(Device, ds4Submit->SerialNo, &pdo))
|
||||
status = STATUS_DEVICE_DOES_NOT_EXIST;
|
||||
else
|
||||
status = pdo->SubmitReport(ds4Submit);
|
||||
|
||||
@@ -384,13 +384,12 @@ EXTERN_C NTSTATUS Bus_XusbSubmitReport(WDFDEVICE Device, ULONG SerialNo, PXUSB_S
|
||||
EXTERN_C NTSTATUS Bus_QueueNotification(WDFDEVICE Device, ULONG SerialNo, WDFREQUEST Request)
|
||||
{
|
||||
NTSTATUS status;
|
||||
EmulationTargetPDO* pdo;
|
||||
|
||||
TraceDbg(TRACE_BUSENUM, "%!FUNC! Entry");
|
||||
|
||||
const auto pdo = EmulationTargetPDO::GetPdoBySerial(Device, SerialNo);
|
||||
|
||||
// Validate child
|
||||
if (pdo == nullptr)
|
||||
if (!EmulationTargetPDO::GetPdoBySerial(Device, SerialNo, &pdo))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_BUSENUM,
|
||||
@@ -420,12 +419,12 @@ NTSTATUS Bus_Ds4SubmitReport(WDFDEVICE Device, ULONG SerialNo, PDS4_SUBMIT_REPOR
|
||||
|
||||
EXTERN_C NTSTATUS Bus_SubmitReport(WDFDEVICE Device, ULONG SerialNo, PVOID Report, BOOLEAN FromInterface)
|
||||
{
|
||||
EmulationTargetPDO* pdo;
|
||||
|
||||
UNREFERENCED_PARAMETER(FromInterface);
|
||||
|
||||
const auto pdo = EmulationTargetPDO::GetPdoBySerial(Device, SerialNo);
|
||||
|
||||
// Validate child
|
||||
if (pdo == nullptr)
|
||||
if (!EmulationTargetPDO::GetPdoBySerial(Device, SerialNo, &pdo))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_BUSENUM,
|
||||
|
||||
Reference in New Issue
Block a user