Hi,
I have a requirement of opening a device driver (using CreateFile or
OpenFile call). All I know about this device driver is its name(say,
xxDriver.sys) from a registry key
/HKLM/system/currentcontrolset/services/xxDriver.
I understand that I have to supply the device name as one of the parameters
of the CreateFile or OpenFile calls.
But, how do I programatically find (I mean, any APIs??) the device name when
the only info. available to me is the device driver name (xxDriver.sys)?
Thanks in advance
-Raghu
>But, how do I programatically find (I mean, any APIs??) the device name when
the only info. available to me is the device driver name (xxDriver.sys)?
There is no way to map from a driver filename to a device object name.
Drivers are free to create device objects with any name they want. I’d have
to think a bit if there is some way to enumerate ALL the device objects,
and then map back to it’s associated driver filename, looking for a match.
>>But, how do I programatically find (I mean, any APIs??) the device name
when
>the only info. available to me is the device driver name (xxDriver.sys)?
There is no way to map from a driver filename to a device object name.
Drivers are free to create device objects with any name they want. I’d have
to think a bit if there is some way to enumerate ALL the device objects,
and then map back to it’s associated driver filename, looking for a match.
Hi Jan,
Thanks a lot for the input. I have a hunch…
Is there any way that I can associate the .sys file with the Global name
space where the device names ( DosDevices) are announced when the driver is
loaded…
To be precise,
suppose my xxDriver.sys calls IoCreateSymbolicLink() with some some name
say xxDev…, will the OS keep track of the .sys file from which it is
called
OR
can I write some kernel mode driver that hooks on to such messages/calls
(like we do SetWindowsHookEx() from an application for various Windows
messages…). I mean installing Kernel mode Hooks for specific calls… like
ypu hook on to the DosDevices so that any access to that would call my
callback from where I can track…
Hope my statements make sense
-Raghu