Doc: Creating Device Objects in a Function Driver
PDO open permissions
Have tried:
FILE_READ_ACCESS | FILE_WRITE_ACCESS
STANDARD_RIGHTS_ALL
FILE_ALL_ACCESS
- Combined with/without
ShareAccess = FILE_SHARE_WRITE | FILE_SHARE_READ
... but they all lead to IOCTL_HID_GET_FEATURE failing with 0xc0000010 (STATUS_INVALID_DEVICE_REQUEST)
Secure read
Requests need file object with SeTcbPrivilege privilege
https://learn.microsoft.com/en-us/windows-hardware/drivers/hid/enforcing-a-secure-read-for-a-hid-collection
This code leads to a crash:
BYTE input = 1;
WDF_MEMORY_DESCRIPTOR inputDesc = {};
WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&inputDesc, &input, sizeof(input));
BYTE output = 1;
WDF_MEMORY_DESCRIPTOR outputDesc = {};
WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&outputDesc, &output, sizeof(output));
// enable secure read
NTSTATUS status = WdfIoTargetSendIoctlSynchronously(localTarget, NULL,
IOCTL_HID_ENABLE_SECURE_READ,
&inputDesc, // input
&outputDesc, // output
NULL, NULL);
if (!NT_SUCCESS(status)) {
DebugPrint(DPFLTR_ERROR_LEVEL, DML_ERR("TailLight: IOCTL_HID_ENABLE_SECURE_READ failed 0x%x"), status);
return status;
}
RAW device
#include <devguid.h>
status = WdfPdoInitAssignRawDevice(DeviceInit, &GUID_DEVCLASS_HIDCLASS)
ERROR: WdfPdoInitAssignRawDevice, Error c000000d (STATUS_INVALID_PARAMETER)
Changing to GUID_DEVCLASS_BATTERY does not help.
Local IO target setup
WdfDeviceInitSetIoType
Call: WdfDeviceInitSetIoType(DeviceInit, WdfDeviceIoBuffered) (has no effect on a filter driver)
WdfFdoInitSetFilter impact
WDF filter driver investigation:
WdfFdoInitSetFilter calls:
DeviceInit->Fdo.Filter = TRUE
FxDevice::FdoInitialize calls
SetFilter(DeviceInit->Fdo.Filter);
FxDevice::SetFilter calls:
NOTICE: FxDefaultIrpHandler::Dispatch always fail with STATUS_INVALID_DEVICE_REQUEST if device is not in filtering mode,
To check:
SetFilterIoType()
IsFilter()
Doc: Creating Device Objects in a Function Driver
PDO open permissions
Have tried:
FILE_READ_ACCESS | FILE_WRITE_ACCESSSTANDARD_RIGHTS_ALLFILE_ALL_ACCESSShareAccess = FILE_SHARE_WRITE | FILE_SHARE_READ... but they all lead to
IOCTL_HID_GET_FEATUREfailing with0xc0000010 (STATUS_INVALID_DEVICE_REQUEST)Secure read
Requests need file object with
SeTcbPrivilegeprivilegehttps://learn.microsoft.com/en-us/windows-hardware/drivers/hid/enforcing-a-secure-read-for-a-hid-collection
This code leads to a crash:
RAW device
Changing to
GUID_DEVCLASS_BATTERYdoes not help.Local IO target setup
WdfDeviceInitSetIoTypeCall:
WdfDeviceInitSetIoType(DeviceInit, WdfDeviceIoBuffered)(has no effect on a filter driver)WdfFdoInitSetFilter impact
WDF filter driver investigation:
WdfFdoInitSetFiltercalls:FxDevice::FdoInitializecallsFxDevice::SetFiltercalls:NOTICE:
FxDefaultIrpHandler::Dispatchalways fail withSTATUS_INVALID_DEVICE_REQUESTif device is not in filtering mode,To check:
SetFilterIoType()IsFilter()