Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Driver needs to know which process ID sent a WDFREQUEST

50 views
Skip to first unread message

John Bond

unread,
Jan 5, 2010, 11:15:01 AM1/5/10
to
I am still converting a massive and old WDM driver. We found where the old
driver copies the Irp->Tail.Overlay.OriginalFileObject in order to identify
which process sent the WDFREQUEST. While inspecting MSDN's docs on the IRP
struct, we noted that the OriginalFileObject member of Tail.Overlay is not
recommended for driver usage. So here is my question:

What is the ideal way for a KMDF driver to determine which instance of our
DLL (which user mode app) sent the WDFREQUEST?

What our driver must do is enforce that one and only one app open certain
items like channels on our boards.

OriginalFileObject was chosen many moons ago by another engineer for unknown
reasons with unknown guidance. I need to have a means to positively and
uniquely identify which HANDLE was used in the call to
DeviceIoControl(hDevice, ...) ---OR--- uniquely identify the process by its
process ID.

As always, all input is appreciated. John Bond

Don Burn

unread,
Jan 5, 2010, 11:23:41 AM1/5/10
to
John,

You can either use the WDFFILEOBJECT by using WdfRequestGetFileObject
or you can use

IoGetRequestorProcessId( WdfRequestWdmGetIrp( Request ) );

If you are tracking data based on this I would use the WDFFILEOBJECT
and have a context for your stuff. I've done this successfully in a couple
of drivers.


--
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

"John Bond" <john...@newsgroup.nospam> wrote in message
news:E26E5EB4-CA6C-49D2...@microsoft.com...

> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4745 (20100105) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4745 (20100105) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


Maxim S. Shatskih

unread,
Jan 5, 2010, 12:30:49 PM1/5/10
to
> What is the ideal way for a KMDF driver to determine which instance of our
> DLL (which user mode app) sent the WDFREQUEST?

IoGetRequestorProcess

--
Maxim S. Shatskih
Windows DDK MVP
ma...@storagecraft.com

http://www.storagecraft.com

Doron Holan [MSFT]

unread,
Jan 5, 2010, 1:02:34 PM1/5/10
to
specifying a context for the WDFFILEOBJECT and recording the process id in
that context in EvtDeviceFileCreate is by far the simplest way to do this.

d

--

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


"Don Burn" <bu...@stopspam.windrvr.com> wrote in message
news:#gWF1Nij...@TK2MSFTNGP02.phx.gbl...

0 new messages