none
WdfFdoQueryForInterface() return error code 0xC00000BB which is STATUS_NOT_SUPPORTED (HID miniport driver) RRS feed

  • Question

  • I am developing a HID miniport driver which is targeting to receive ACPI event from BIOS and then send a airplane mode HID event to OS. This driver is installed on a virtual ACPI device which is created by BIOS. While I am trying to register ACPI event callback, the WdfFdoQueryForInterface() return error code 0xC00000BB which is STATUS_NOT_SUPPORTED. Need your input to move on.

    Following are the code I developed.

    //

    //Driver.c

    //

    NTSTATUS DriverEntry(_In_ PDRIVER_OBJECT  DriverObject, _In_ PUNICODE_STRING RegistryPath)
    {
    NTSTATUS status;
    WDF_DRIVER_CONFIG config;
    WDF_OBJECT_ATTRIBUTES  attributes;

    DbgPrint("KmdfHelloWorld: DriverEntry\n");
    WDF_DRIVER_CONFIG_INIT(&config, KmdfHelloWorldEvtDeviceAdd);
    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);

    status = WdfDriverCreate(DriverObject, RegistryPath, &attributes, &config, WDF_NO_HANDLE);
    if (!NT_SUCCESS(status))
    return status;
    return status;
    }

    NTSTATUS KmdfHelloWorldEvtDeviceAdd(_In_ WDFDRIVER Driver, _Inout_ PWDFDEVICE_INIT DeviceInit)
    {
    NTSTATUS status;
    WDFDEVICE hDevice;
        WDF_OBJECT_ATTRIBUTES attributes;
    PDEVICE_CONTEXT context;
    //WDF_IO_QUEUE_CONFIG queueConfig;
    //WDFQUEUE hQueue;


    UNREFERENCED_PARAMETER(Driver);
    DbgPrint("KmdfHelloWorldEvtDeviceAdd enter\n");

    // Create a framework device object.This call will in turn create a WDM device object, attach to the lower stack.
    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, DEVICE_CONTEXT);
    status = WdfDeviceCreate(&DeviceInit, &attributes, &hDevice);
    DbgPrint("WdfDeviceCreate status: %x\n", status);
    if (!NT_SUCCESS(status))
    return status;
    context = GetDeviceContext(hDevice);

    status = WdfFdoQueryForInterface(
    hDevice,
    &GUID_ACPI_INTERFACE_STANDARD2,
    (PINTERFACE)&context->AcpiCtx.AcpiInterface,
    sizeof(ACPI_INTERFACE_STANDARD2),
    1,
    NULL);

    DbgPrint("WdfFdoQueryForInterface status: %x\n", status);

    context->AcpiCtx.Initialized = TRUE;

    if (!NT_SUCCESS(status))
    return status;
    status =context->AcpiCtx.AcpiInterface.RegisterForDeviceNotifications(
    context->AcpiCtx.AcpiInterface.Context,
    AcpiNotifyCallback,
    hDevice);
    DbgPrint("RegisterForDeviceNotifications status: %x\n", status);

    if (!NT_SUCCESS(status))
    return status;

    return status;
    }

    //

    //Driver.h

    //

    typedef enum _DRIVER_MODE
    {
    DM_BUTTON = 1,
    DM_BUTTON_AND_LED,
    DM_SLIDER_SWITCH,
    DM_SLIDER_SWITCH_AND_LED,
    DM_LED_ONLY
    } DRIVER_MODE;

    typedef UCHAR HID_REPORT_DESCRIPTOR, *PHID_REPORT_DESCRIPTOR;

    typedef struct _ACPI_CONTEXT
    {
    BOOLEAN Initialized;
    ACPI_INTERFACE_STANDARD2 AcpiInterface;
    BOOLEAN RegisteredForNotifications;
    } ACPI_CONTEXT, *PACPI_CONTEXT;

    typedef struct _DEVICE_CONTEXT
    {
    WDFDEVICE               Device;
    WDFQUEUE                DefaultQueue;
    WDFQUEUE                ManualQueue;
    HID_DEVICE_ATTRIBUTES   HidDeviceAttributes;
    BYTE                    DeviceData;
    HID_DESCRIPTOR          HidDescriptor;
    PHID_REPORT_DESCRIPTOR  ReportDescriptor;
    BOOLEAN                 ReadReportDescFromRegistry;
    //add
    DRIVER_MODE driverMode;
    ACPI_CONTEXT AcpiCtx;
    } DEVICE_CONTEXT, *PDEVICE_CONTEXT;

    typedef struct _HIDFX2_IO_REPORT
    {
    unsigned char bReportId;                //Report ID for the collection
    unsigned char bData;                    //one-byte data for switch/LED
    }HIDFX2_IO_REPORT, *PHIDFX2_IO_REPORT;

    WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT, GetDeviceContext);



    Wednesday, April 26, 2017 11:13 AM

Answers

  • How did you install the driver? If you used devcon install, you created a root enumerated device outside of acpi. You u need to use devcon update or another method to inject the driver package into the driver store.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, April 27, 2017 3:32 AM

All replies

  • Try moving the WdfFdoQueryForInterface to EvtPrepareHardware, many drivers don't always have the interface live until that point in PNP.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Wednesday, April 26, 2017 8:35 PM
  • How did you install the driver? If you used devcon install, you created a root enumerated device outside of acpi. You u need to use devcon update or another method to inject the driver package into the driver store.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, April 27, 2017 3:32 AM
  • Hi Doron,

    Thanks for your advise, the WdfFdoQueryForInterface() can query interface successfully after doing "devcon update". Deeply appreciated.


    • Edited by WillyLiao Friday, April 28, 2017 10:57 AM
    Friday, April 28, 2017 10:39 AM
  • Hi Don,

    Thanks for your advise, I will try this and see if works.


    • Edited by WillyLiao Friday, April 28, 2017 10:57 AM
    Friday, April 28, 2017 10:40 AM
  • Hi Don,

    I tried to call WdfFdoQueryForInterface() in the EvtPrepareHardware entry, it works and the driver can now listen to ACPI notification now.

    Tuesday, May 2, 2017 4:45 AM
  • Hi Doron,

    As I had finished the implementation of driver and I would like to submit to WU, I heard that devcon method is not available for driver submission especially for the Cloud OS. Can you advise another way for driver installation even which is also available for drivers on WU even Cloud or normal OS?  Thanks. 


    Tuesday, May 2, 2017 4:48 AM