Hi Tim,
It’s the mouse class lower filter driver. I want to borrow the idea from the WDK sample VFeature.
[Version]
Signature = “$Windows NT$”
CatalogFile = mc_mouse_hid_filter.cat
Class = Mouse
ClassGUID = {4D36E96F-E325-11CE-BFC1-08002BE10318}
Provider = %MC%
DriverVer=05/12/2017,0.01.999
…
[Hid_LowerFilter]
HKR,“LowerFilters”,%REG_MULTI_SZ%,“mc_generic_hid_filter”
Since this is on the mouse stack, I open the remote IO target with the FILE_WRITE_ACCESS.
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
attributes.ParentObject = hDevice;
status = WdfIoTargetCreate(hDevice, &attributes, &hIoTarget);
IfFailGoToExit(status, LSH_IO, “WdfIoTargetCreate failed”);
WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME(
&openParams,
pTargetName,
FILE_WRITE_ACCESS
);
//
// We will let the framework to respond automatically to the pnp
// state changes of the target by closing and opening the handle.
//
openParams.ShareAccess = FILE_SHARE_WRITE | FILE_SHARE_READ;
status = WdfIoTargetOpen(hIoTarget, &openParams);
IfFailGoToExit(status, LSH_IO, “WdfIoTargetOpen failed”);
When the raw pdo receives the read request from the application, it creates the new request to send out the IOCTL code.
status = WdfRequestRetrieveOutputMemory(Request, &hMemory);
IfFailGoToExit(status, LSH_IO, “WdfRequestRetrieveOutputMemory failed”);
WdfMemoryGetBuffer(hMemory, &bufferSize);
status = WdfMemoryCreate(
WDF_NO_OBJECT_ATTRIBUTES,
NonPagedPoolNx,
DRIVERTAG,
bufferSize,
&hMemory,
NULL
);
status = WdfRequestCreate(NULL, pFileObjectExtension->hIoTarget, &hRequest);
status = WdfIoTargetFormatRequestForInternalIoctl(pFileObjectExtension->hIoTarget,
hRequest, IOCTL_HID_READ_REPORT, NULL, NULL, hMemory, NULL);
IfFailGoToExit(status, LSH_IO, “WdfIoTargetFormatRequestForIoctl failed”);
Thanks,
Marshall