Hi,
my collegue and me are trying to implement a UMDFv2 driver able to communicate with an ACPI device (in particular to interpose it into the driver stack above an existing driver for the device).
We have looked around for an example of UMDFv2 ACPI driver but we are able only to find KMDF drivers. We already have a UMDFv2 driver able to load for the specific device (not stacked however...) but we are not able to send ACPI commands to the device because the documentation about this topic is missing. Do you know any resource about this specific topic? We ha implemented a IOCTL like this one but it does not work
case IOCTL_ACPINJECTOR_SIMPLE_INTEGER: {
DbgPrintEx(0, 0, "ACPInjector: Executing IOCTL PING...\n");
WDFDEVICE device = WdfIoQueueGetDevice(Queue);
WDFIOTARGET device_target = WdfDeviceGetIoTarget(device);
WDF_IO_TARGET_OPEN_PARAMS device_target_open_params;
WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_FILE(&device_target_open_params, NULL);
status = WdfIoTargetOpen(device_target, &device_target_open_params);
if (!NT_SUCCESS(status)) {
DbgPrintEx(0, 0, "ACPInjector: WdfIoTargetOpen failed (error 0x%x).\n", status);
goto end;
}
ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER acpi_input;
ACPI_EVAL_OUTPUT_BUFFER acpi_output = { 0 };
WDF_MEMORY_DESCRIPTOR acpi_input_mem_desc;
WDFMEMORY acpi_input_mem = NULL;
ULONG acpi_input_size = sizeof(ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER);
status = WdfMemoryCreate(WDF_NO_OBJECT_ATTRIBUTES, PagedPool, ACPI_INJECTOR_POOL_TAG, acpi_input_size, &acpi_input_mem, (PVOID*)&acpi_input);
if (!NT_SUCCESS(status)) {
DbgPrintEx(0, 0, "ACPInjector: Retrieve output buffer failed.\n");
goto end_acpi;
}
acpi_input.Signature = ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE;
acpi_input.MethodNameAsUlong = (ULONG)'TPFN';
acpi_input.IntegerArgument = 0;
DbgPrintEx(0, 0, "Method name as ulong: 0x%x.\n", 'TPFN');
WDF_MEMORY_DESCRIPTOR acpi_output_mem_desc;
WDF_MEMORY_DESCRIPTOR_INIT_HANDLE(&acpi_input_mem_desc, acpi_input_mem, 0);
WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&acpi_output_mem_desc, &acpi_output, sizeof(acpi_output));
ULONG acpi_res;
status = WdfIoTargetSendIoctlSynchronously(
device_target,
WDF_NO_HANDLE,
IOCTL_ACPI_EVAL_METHOD_EX,
&acpi_input_mem_desc,
&acpi_output_mem_desc,
NULL,
(PULONG_PTR) & acpi_res
);
if (!NT_SUCCESS(status)) {
DbgPrintEx(0, 0, "ACPInjector: SendIoctlSynchronously failed: 0x%x (0x%x).\n", status, GetLastError());
goto end_acpi;
}
DbgPrintEx(0, 0, "ACPInjector: ABC Executing IOCTL ACPI Integer Simple Done.\n");
end_acpi:
WdfIoTargetClose(device_target);
break;
}