You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
just stumbled upon an interesting issue with the DMF_VirtualHidMini module. I have a device which (for compatibility reasons) doesn't utilize Report IDs in its HID Report Descriptor. It exposes one input, feature and output report. Snippet of Output Report definition in descriptor:
Everything works fine except writing an output report, WriteFile / GetOverlappedResult failed with ERROR_INSUFFICIENT_BUFFER despite the same code working perfectly with the legacy kernel-driver equivalent of my new UMDF-only code, which got me curious.
I am aware of the trickery necessary to get the Report ID delivered from mshidumdf.sys to the reflector and my driver so I examined the VirtualHidMini_RequestGetHidXferPacket_ToWriteToDevice implementation of DmfU and I think I found a bug:
Accessing the output buffer fails with STATUS_BUFFER_TOO_SMALL and my own callback isn't even invoked, the module answers this request with an error. Assuming that a zero-length buffer is the result of an absence of a Report ID (being effectively 0) I introduced this experimental hack and sure enough, my code works now, I receive the buffer content and the user-land API completes with success:
// Get report Id from output buffer length.//ntStatus=WdfRequestRetrieveOutputMemory(Request,
&outputMemory);
if ( !NT_SUCCESS(ntStatus) &&ntStatus!=STATUS_BUFFER_TOO_SMALL )
{
TraceEvents(TRACE_LEVEL_ERROR, DMF_TRACE, "WdfRequestRetrieveOutputMemory fails: ntStatus=%!STATUS!", ntStatus);
goto Exit;
}
// React to this specific case by assuming 0//if (ntStatus==STATUS_BUFFER_TOO_SMALL)
{
Packet->reportId=0;
}
else
{
WdfMemoryGetBuffer(outputMemory,
&outputBufferLength);
Packet->reportId= (UCHAR)outputBufferLength;
}
If my assumptions are correct I'd gladly provide a PR and see this change merged so the framework can handle this edge-case properly as well 😁
Thank you!
The text was updated successfully, but these errors were encountered:
Greetings,
just stumbled upon an interesting issue with the
DMF_VirtualHidMini
module. I have a device which (for compatibility reasons) doesn't utilize Report IDs in its HID Report Descriptor. It exposes one input, feature and output report. Snippet of Output Report definition in descriptor:Everything works fine except writing an output report,
WriteFile
/GetOverlappedResult
failed withERROR_INSUFFICIENT_BUFFER
despite the same code working perfectly with the legacy kernel-driver equivalent of my new UMDF-only code, which got me curious.I am aware of the trickery necessary to get the Report ID delivered from
mshidumdf.sys
to the reflector and my driver so I examined theVirtualHidMini_RequestGetHidXferPacket_ToWriteToDevice
implementation ofDmfU
and I think I found a bug:Accessing the output buffer fails with
STATUS_BUFFER_TOO_SMALL
and my own callback isn't even invoked, the module answers this request with an error. Assuming that a zero-length buffer is the result of an absence of a Report ID (being effectively 0) I introduced this experimental hack and sure enough, my code works now, I receive the buffer content and the user-land API completes with success:If my assumptions are correct I'd gladly provide a PR and see this change merged so the framework can handle this edge-case properly as well 😁
Thank you!
The text was updated successfully, but these errors were encountered: