The sample I gave did not initialize the irp status value correctly, my
mistake.
WDF_REQUEST_REUSE_PARAMS reuse;
status = WdfRequestCreate(WDF_NO_OBJECT_ATTRIBUTES, target, &request);
if (!NT_SUCCESS(status)) {
return status;
}
// new code…
WDF_REQUEST_REUSE_PARAMS_INIT(&reuse, WDF_REQUEST_REUSE_NO_FLAGS,
STATUS_NOT_SUPPORTED);
WdfRequestReuse(request, &reuse);
// …new code
RtlZeroMemory(&stack, sizeof(stack));
…
Alternatively, you could do this instead of a Reuse() call:
WdfRequestWdmGetIrp(request)->IoStatus.Status = STATUS_NOT_SUPPORTED;
d
-----Original Message-----
From: Doron Holan
Sent: Monday, June 05, 2006 10:00 AM
To: ‘Windows System Software Devs Interest List’
Subject: RE: [ntdev] Sending IRP_MJ_PNP from a KMDF driver
Pls excuse bad style and formatting:
WDFIOTARGET target = WdfDeviceGetIoTarget(Device);
WDFREQUEST request;
NTSTATUS status;
IO_STACK_LOCATION stack;
status = WdfRequestCreate(WDF_NO_OBJECT_ATTRIBUTES, target, &request);
if (!NT_SUCCESS(status)) {
return status;
}
RtlZeroMemory(&stack, sizeof(stack));
Stack.MajorFunction = IRP_MJ_PNP;
Stack.MinorFunction = IRP_MN_READ_CONFIG;
…more stack formatting…
WdfRequestWdmFormatUsingStackLocation(request, &stack);
WdfRequestSend(request, target);
status = WdfRequestGetStatus(request); // get final status
…deal with results of the irp…
WdfObjectDelete(request);
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Don Ward
Sent: Monday, June 05, 2006 9:18 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Sending IRP_MJ_PNP from a KMDF driver
I’m porting an existing driver to KMDF. It uses the technique described
in
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q253232 to
interrogate
the PCI config space (essentially by sending IRP_MJ_PNP down the stack).
I can’t see an obvious way to create a WDFRequest that would do the job.
Should I just use WdfIoTargetGetTargetDeviceObject and then send the
request
the old way, essentially as described in Q253232, or is there a better,
more
KMDF-like way of doing it?
Don
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer