KMDF Question - Support query interface on PDO

Hi All,

I am developing a KMDF driver and it needs to support XXX_GUID interface
with different interface versions. Following up WDK document, I
implemented a function, AddQueryInterface() below to support XXX_GUID.

BUT I observed that ExposedInterface’s version is 0 (actually
ExposedInterface content are all zero) when
EvtDeviceProcessQueryInterfaceRequest() be called.

If I use WdfDeviceInitAssignWdmIrpPreprocessCallback api to register
preprocess callback to handle IRP_MN_QUERY_INTERFACE, I can get correct
interface version in EvtDeviceWdmIrpPreprocess callback.

WHY WDF clear ExposedInterface content? Do I miss any anything?

Thanks in advance!!

Note:

  1. This associated device object is PDO.

  2. AddQueryInterface() return STATUS_SUCCESS.

  3. AddQueryInterface() is called from within an
    EvtDevicePrepareHardware
    ms-help:ralRef_a447de77-9692-4a48-83c2-3ced294863e4.xml.htm> callback.

    NTSTATUS

    AddQueryInterface(

    IN WDFDEVICE WdfDevice

    )

    //

    // add XXX_GUID

    //

    WDF_QUERY_INTERFACE_CONFIG_INIT(

    &Config,

    NULL,

    &XXX_GUID,

    EvtDeviceProcessQueryInterfaceRequest

    );

    Config.ImportInterface = TRUE;

    Status = WdfDeviceAddQueryInterface(WdfDevice, &Config);

    TRAP(NT_SUCCESS(Status));

    return Status;

    }

    NTSTATUS

    EvtDeviceProcessQueryInterfaceRequest(

    IN WDFDEVICE Device,

    IN LPGUID InterfaceType,

    IN OUT PINTERFACE ExposedInterface,

    IN OUT PVOID ExposedInterfaceSpecificData

    )

    {

    TRAPMSG(“Trace”, FALSE);

    return STATUS_UNSUCCESSFUL;

    }</ms-help:>

There is a known KMDF bug in the case where there are multiple versions for the same GUID, but I’m not sure if that is the cause for what you’re seeing.
Couple of questions: Is one of your interface version numbers ‘0’? And do you specify Config.ImportInterface = FALSE for that version?

wrote in message news:xxxxx@ntdev…
Hi All,

I am developing a KMDF driver and it needs to support XXX_GUID interface with different interface versions. Following up WDK document, I implemented a function, AddQueryInterface() below to support XXX_GUID.

BUT I observed that ExposedInterface’s version is 0 (actually ExposedInterface content are all zero) when EvtDeviceProcessQueryInterfaceRequest() be called.

If I use WdfDeviceInitAssignWdmIrpPreprocessCallback api to register preprocess callback to handle IRP_MN_QUERY_INTERFACE, I can get correct interface version in EvtDeviceWdmIrpPreprocess callback.

WHY WDF clear ExposedInterface content? Do I miss any anything?

Thanks in advance!!

Note:

1. This associated device object is PDO.

2. AddQueryInterface() return STATUS_SUCCESS.

3. AddQueryInterface() is called from within an EvtDevicePrepareHardware callback.

NTSTATUS

AddQueryInterface(

IN WDFDEVICE WdfDevice

)

//

// add XXX_GUID

//

WDF_QUERY_INTERFACE_CONFIG_INIT(

&Config,

NULL,

&XXX_GUID,

EvtDeviceProcessQueryInterfaceRequest

);

Config.ImportInterface = TRUE;

Status = WdfDeviceAddQueryInterface(WdfDevice, &Config);

TRAP(NT_SUCCESS(Status));

return Status;

}

NTSTATUS

EvtDeviceProcessQueryInterfaceRequest(

IN WDFDEVICE Device,

IN LPGUID InterfaceType,

IN OUT PINTERFACE ExposedInterface,

IN OUT PVOID ExposedInterfaceSpecificData

)

{

TRAPMSG(“Trace”, FALSE);

return STATUS_UNSUCCESSFUL;

}

Thanks for your reply. :slight_smile:

The version number is from 0 ~ 3, Config.ImportInterface = TRUE.

Does it have any method to solve this except
WdfDeviceInitAssignWdmIrpPreprocessCallback?

Thanks again!!

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Abhishek Ram
Sent: Friday, August 20, 2010 3:45 AM
To: Windows System Software Devs Interest List
Subject: [SPAM] Re:[ntdev] KMDF Question - Support query interface on
PDO

There is a known KMDF bug in the case where there are multiple versions
for the same GUID, but I’m not sure if that is the cause for what you’re
seeing.

Couple of questions: Is one of your interface version numbers ‘0’? And
do you specify Config.ImportInterface = FALSE for that version?

wrote in message news:xxxxx@ntdev…

Hi All,

I am developing a KMDF driver and it needs to support XXX_GUID
interface with different interface versions. Following up WDK document,
I implemented a function, AddQueryInterface() below to support XXX_GUID.

BUT I observed that ExposedInterface’s version is 0 (actually
ExposedInterface content are all zero) when
EvtDeviceProcessQueryInterfaceRequest() be called.

If I use WdfDeviceInitAssignWdmIrpPreprocessCallback api to
register preprocess callback to handle IRP_MN_QUERY_INTERFACE, I can get
correct interface version in EvtDeviceWdmIrpPreprocess callback.

WHY WDF clear ExposedInterface content? Do I miss any anything?

Thanks in advance!!

Note:

1. This associated device object is PDO.

2. AddQueryInterface() return STATUS_SUCCESS.

3. AddQueryInterface() is called from within an
EvtDevicePrepareHardware
ms-help:ralRef_a447de77-9692-4a48-83c2-3ced294863e4.xml.htm> callback.

NTSTATUS

AddQueryInterface(

IN WDFDEVICE WdfDevice

)

//

// add XXX_GUID

//

WDF_QUERY_INTERFACE_CONFIG_INIT(

&Config,

NULL,

&XXX_GUID,

EvtDeviceProcessQueryInterfaceRequest

);

Config.ImportInterface = TRUE;

Status = WdfDeviceAddQueryInterface(WdfDevice, &Config);

TRAP(NT_SUCCESS(Status));

return Status;

}

NTSTATUS

EvtDeviceProcessQueryInterfaceRequest(

IN WDFDEVICE Device,

IN LPGUID InterfaceType,

IN OUT PINTERFACE ExposedInterface,

IN OUT PVOID ExposedInterfaceSpecificData

)

{

TRAPMSG(“Trace”, FALSE);

return STATUS_UNSUCCESSFUL;

}


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer</ms-help:>

And I use WDF 1.9 from Windows 7 WDK (7600).

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@via.com.tw
Sent: Friday, August 20, 2010 9:48 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] KMDF Question - Support query interface on PDO

Thanks for your reply. :slight_smile:

The version number is from 0 ~ 3, Config.ImportInterface = TRUE.

Does it have any method to solve this except
WdfDeviceInitAssignWdmIrpPreprocessCallback?

Thanks again!!

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Abhishek Ram
Sent: Friday, August 20, 2010 3:45 AM
To: Windows System Software Devs Interest List
Subject: [SPAM] Re:[ntdev] KMDF Question - Support query interface on
PDO

There is a known KMDF bug in the case where there are multiple versions
for the same GUID, but I’m not sure if that is the cause for what you’re
seeing.

Couple of questions: Is one of your interface version numbers ‘0’? And
do you specify Config.ImportInterface = FALSE for that version?

wrote in message news:xxxxx@ntdev…

Hi All,

I am developing a KMDF driver and it needs to support XXX_GUID
interface with different interface versions. Following up WDK document,
I implemented a function, AddQueryInterface() below to support XXX_GUID.

BUT I observed that ExposedInterface’s version is 0 (actually
ExposedInterface content are all zero) when
EvtDeviceProcessQueryInterfaceRequest() be called.

If I use WdfDeviceInitAssignWdmIrpPreprocessCallback api to
register preprocess callback to handle IRP_MN_QUERY_INTERFACE, I can get
correct interface version in EvtDeviceWdmIrpPreprocess callback.

WHY WDF clear ExposedInterface content? Do I miss any anything?

Thanks in advance!!

Note:

1. This associated device object is PDO.

2. AddQueryInterface() return STATUS_SUCCESS.

3. AddQueryInterface() is called from within an
EvtDevicePrepareHardware
ms-help:ralRef_a447de77-9692-4a48-83c2-3ced294863e4.xml.htm> callback.

NTSTATUS

AddQueryInterface(

IN WDFDEVICE WdfDevice

)

//

// add XXX_GUID

//

WDF_QUERY_INTERFACE_CONFIG_INIT(

&Config,

NULL,

&XXX_GUID,

EvtDeviceProcessQueryInterfaceRequest

);

Config.ImportInterface = TRUE;

Status = WdfDeviceAddQueryInterface(WdfDevice, &Config);

TRAP(NT_SUCCESS(Status));

return Status;

}

NTSTATUS

EvtDeviceProcessQueryInterfaceRequest(

IN WDFDEVICE Device,

IN LPGUID InterfaceType,

IN OUT PINTERFACE ExposedInterface,

IN OUT PVOID ExposedInterfaceSpecificData

)

{

TRAPMSG(“Trace”, FALSE);

return STATUS_UNSUCCESSFUL;

}


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer</ms-help:>

Are you emulating a usb hub?

d

dent from a phpne with no keynoard


From: xxxxx@via.com.tw
Sent: August 19, 2010 6:49 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] KMDF Question - Support query interface on PDO

Thanks for your reply. :slight_smile:
The version number is from 0 ~ 3, Config.ImportInterface = TRUE.
Does it have any method to solve this except WdfDeviceInitAssignWdmIrpPreprocessCallback?
Thanks again!!
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Abhishek Ram
Sent: Friday, August 20, 2010 3:45 AM
To: Windows System Software Devs Interest List
Subject: [SPAM] Re:[ntdev] KMDF Question - Support query interface on PDO

There is a known KMDF bug in the case where there are multiple versions for the same GUID, but I’m not sure if that is the cause for what you’re seeing.
Couple of questions: Is one of your interface version numbers ‘0’? And do you specify Config.ImportInterface = FALSE for that version?

> wrote in message news:xxxxx@ntdev…
Hi All,
I am developing a KMDF driver and it needs to support XXX_GUID interface with different interface versions. Following up WDK document, I implemented a function, AddQueryInterface() below to support XXX_GUID.
BUT I observed that ExposedInterface?s version is 0 (actually ExposedInterface content are all zero) when EvtDeviceProcessQueryInterfaceRequest() be called.
If I use WdfDeviceInitAssignWdmIrpPreprocessCallback api to register preprocess callback to handle IRP_MN_QUERY_INTERFACE, I can get correct interface version in EvtDeviceWdmIrpPreprocess callback.
WHY WDF clear ExposedInterface content? Do I miss any anything?

Thanks in advance!!

Note:

1. This associated device object is PDO.

2. AddQueryInterface() return STATUS_SUCCESS.

3. AddQueryInterface() is called from within an EvtDevicePrepareHardware callback.

NTSTATUS
AddQueryInterface(
IN WDFDEVICE WdfDevice
)
//
// add XXX_GUID
//
WDF_QUERY_INTERFACE_CONFIG_INIT(
&Config,
NULL,
&XXX_GUID,
EvtDeviceProcessQueryInterfaceRequest
);
Config.ImportInterface = TRUE;

Status = WdfDeviceAddQueryInterface(WdfDevice, &Config);

TRAP(NT_SUCCESS(Status));
return Status;
}

NTSTATUS
EvtDeviceProcessQueryInterfaceRequest(
IN WDFDEVICE Device,
IN LPGUID InterfaceType,
IN OUT PINTERFACE ExposedInterface,
IN OUT PVOID ExposedInterfaceSpecificData
)
{
TRAPMSG(?Trace?, FALSE);
return STATUS_UNSUCCESSFUL;
}


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Actually I am writing a xHCI host controller driver (xHCD). And I need
to support USB_BUS_INTERFACE_USBDI_GUID interface on root hub PDO. But I
have performance concern so that I prefer WdfDeviceAddQueryInterface to
WdfDeviceInitAssignWdmIrpPreprocessCallback.

BTW … Could you give me some comment abort the following questions as
well (I know you are an usb driver professional!! : ) )

  1. For usb host controller driver, it needs to prepare resource when
    handling URB and release these allocated resource after URB completion.
    Should usb host controller driver queue URB to process later or fail it
    directly when driver has insufficient resource for handling URB? I think
    it depends on URB sender, USB client driver behavior (has re-try
    mechanism or not…)

Current I queue it in prior mentioned case because I afraid that unknown
side effect. Do I need to do this?

  1. Why usb mass-storage client driver (In WinXP) limits its bulk
    transfer size to 64KB (the under usb host controller driver can support
    more than 64KB, such as ehci driver)? Because driver wants to support
    other OS that only has 16 map registers maximally or other reason?

Much appreciated!!

-YH

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Friday, August 20, 2010 10:32 AM
To: Windows System Software Devs Interest List
Subject: RE: Re:[ntdev] KMDF Question - Support query interface on PDO

Are you emulating a usb hub?

d

dent from a phpne with no keynoard


From: xxxxx@via.com.tw
Sent: August 19, 2010 6:49 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] KMDF Question - Support query interface on PDO

Thanks for your reply. :slight_smile:

The version number is from 0 ~ 3, Config.ImportInterface = TRUE.

Does it have any method to solve this except
WdfDeviceInitAssignWdmIrpPreprocessCallback?

Thanks again!!

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Abhishek Ram
Sent: Friday, August 20, 2010 3:45 AM
To: Windows System Software Devs Interest List
Subject: [SPAM] Re:[ntdev] KMDF Question - Support query interface on
PDO

There is a known KMDF bug in the case where there are multiple versions
for the same GUID, but I’m not sure if that is the cause for what you’re
seeing.

Couple of questions: Is one of your interface version numbers ‘0’? And
do you specify Config.ImportInterface = FALSE for that version?

wrote in message news:xxxxx@ntdev…

Hi All,

I am developing a KMDF driver and it needs to support XXX_GUID
interface with different interface versions. Following up WDK document,
I implemented a function, AddQueryInterface() below to support XXX_GUID.

BUT I observed that ExposedInterface’s version is 0 (actually
ExposedInterface content are all zero) when
EvtDeviceProcessQueryInterfaceRequest() be called.

If I use WdfDeviceInitAssignWdmIrpPreprocessCallback api to
register preprocess callback to handle IRP_MN_QUERY_INTERFACE, I can get
correct interface version in EvtDeviceWdmIrpPreprocess callback.

WHY WDF clear ExposedInterface content? Do I miss any anything?

Thanks in advance!!

Note:

1. This associated device object is PDO.

2. AddQueryInterface() return STATUS_SUCCESS.

3. AddQueryInterface() is called from within an
EvtDevicePrepareHardware callback.

NTSTATUS

AddQueryInterface(

IN WDFDEVICE WdfDevice

)

//

// add XXX_GUID

//

WDF_QUERY_INTERFACE_CONFIG_INIT(

&Config,

NULL,

&XXX_GUID,

EvtDeviceProcessQueryInterfaceRequest

);

Config.ImportInterface = TRUE;

Status = WdfDeviceAddQueryInterface(WdfDevice, &Config);

TRAP(NT_SUCCESS(Status));

return Status;

}

NTSTATUS

EvtDeviceProcessQueryInterfaceRequest(

IN WDFDEVICE Device,

IN LPGUID InterfaceType,

IN OUT PINTERFACE ExposedInterface,

IN OUT PVOID ExposedInterfaceSpecificData

)

{

TRAPMSG(“Trace”, FALSE);

return STATUS_UNSUCCESSFUL;

}


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Based on this info, I’m not sure why you’re seeing the version get reset to 0.
Suggestion: You can register a pre-process routine, where you set a break-on-write breakpoint for the memory location that holds the version. Then forward the request to the framework and see where the breakpoint is reached.

wrote in message news:xxxxx@ntdev…
And I use WDF 1.9 from Windows 7 WDK (7600).

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@via.com.tw
Sent: Friday, August 20, 2010 9:48 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] KMDF Question - Support query interface on PDO

Thanks for your reply. :slight_smile:

The version number is from 0 ~ 3, Config.ImportInterface = TRUE.

Does it have any method to solve this except WdfDeviceInitAssignWdmIrpPreprocessCallback?

Thanks again!!

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Abhishek Ram
Sent: Friday, August 20, 2010 3:45 AM
To: Windows System Software Devs Interest List
Subject: [SPAM] Re:[ntdev] KMDF Question - Support query interface on PDO

There is a known KMDF bug in the case where there are multiple versions for the same GUID, but I’m not sure if that is the cause for what you’re seeing.

Couple of questions: Is one of your interface version numbers ‘0’? And do you specify Config.ImportInterface = FALSE for that version?

wrote in message news:xxxxx@ntdev…

Hi All,

I am developing a KMDF driver and it needs to support XXX_GUID interface with different interface versions. Following up WDK document, I implemented a function, AddQueryInterface() below to support XXX_GUID.

BUT I observed that ExposedInterface’s version is 0 (actually ExposedInterface content are all zero) when EvtDeviceProcessQueryInterfaceRequest() be called.

If I use WdfDeviceInitAssignWdmIrpPreprocessCallback api to register preprocess callback to handle IRP_MN_QUERY_INTERFACE, I can get correct interface version in EvtDeviceWdmIrpPreprocess callback.

WHY WDF clear ExposedInterface content? Do I miss any anything?

Thanks in advance!!

Note:

1. This associated device object is PDO.

2. AddQueryInterface() return STATUS_SUCCESS.

3. AddQueryInterface() is called from within an EvtDevicePrepareHardware callback.

NTSTATUS

AddQueryInterface(

IN WDFDEVICE WdfDevice

)

//

// add XXX_GUID

//

WDF_QUERY_INTERFACE_CONFIG_INIT(

&Config,

NULL,

&XXX_GUID,

EvtDeviceProcessQueryInterfaceRequest

);

Config.ImportInterface = TRUE;

Status = WdfDeviceAddQueryInterface(WdfDevice, &Config);

TRAP(NT_SUCCESS(Status));

return Status;

}

NTSTATUS

EvtDeviceProcessQueryInterfaceRequest(

IN WDFDEVICE Device,

IN LPGUID InterfaceType,

IN OUT PINTERFACE ExposedInterface,

IN OUT PVOID ExposedInterfaceSpecificData

)

{

TRAPMSG(“Trace”, FALSE);

return STATUS_UNSUCCESSFUL;

}


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer