How To read Configuration Header In KMDF

Hi All.
I have need to read configuration header of PCI device.For which i
am trying to create IRP_MJ_PNP and Pass Minor function as a
IRP_MN_READ_CONFIG as we used to do in WDM driver.

I am struggling in doing the same thing in WDF driver.

My Confusion is how to get the self device object so that i can pass it to
IoGetAttachedDeviceReference( pDeviceObject ); for taking reference.

I would be very thakful for any kind of help in this regard.

Regards

Well, I don’t think you need to send the read config through the top of the stack, you can just send it to the stack below you. Here is a rough outline of what you want to do w/out error checking

WDFIOTARGET target = WdfDeviceGetIoTarget(device);
WDFREQUEST request;
WdfRequestCreate(WDF_NO_OBJECT_ATTRIBUTES, target, &request);

IO_STACK_LOCATION stack = { 0 };
stack.MajorFunction = IRP_MJ_PNP;
stack.MinorFunction = IRP_MN_READ_CONFIG;
set stack.Parameters.ReadWriteConfig.*

WdfRequestWdmFormatUsingStackLocation(request, &stack_;
WdfRequestWdmGetIrp(request)->IoStatus.Status = STATUS_NOT_SUPPORTED; // all pnp irps are initialized to this status

WDF_REQUEST_SEND_OPTIONS options;
WDF_REQUEST_SEND_OPTIONS_INIT(&options, WDF_REQUEST_SEND_OPTION_SYNCHRONOUS);

WdfRequestSend(request, target, &options);
WdfObjectDelete(request);

// process results

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Dipika Jha
Sent: Tuesday, March 04, 2008 8:53 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How To read Configuration Header In KMDF

Hi All.
I have need to read configuration header of PCI device.For which i am trying to create IRP_MJ_PNP and Pass Minor function as a IRP_MN_READ_CONFIG as we used to do in WDM driver.

I am struggling in doing the same thing in WDF driver.

My Confusion is how to get the self device object so that i can pass it to IoGetAttachedDeviceReference( pDeviceObject ); for taking reference.

I would be very thakful for any kind of help in this regard.

Regards
— 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