confused about opening a device driver

G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.device_driver.dev (More info?)

Hi,

how can i open a device driver in a windows application?
it seems that you can do that with the win32 function CreateFile, but where
can i find the filename that i have to supply? is there a list of device
driver file strings somewhere on my system that i can consult?

apart from that, after looking in MSDN i found that there is also
NtOpenFile, NtCreateFile, ZwOpenFile and ZwCreateFile, but i believe the
last 2 are only for use in kernel mode.
which of those functions should i use?

sorry if these are silly questions. i have programmed device drivers on
linux and BeOS, but windows device drivers seem a lot harder to understand.

kind regards,
Bruno.
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.device_driver.dev (More info?)

Hi,
CreateFile is ok, the other ones are for kernel mode.
If your drivers export an interface you are able to collect several
information on it by the calls to:
SetupDiGetClassDevs
SetupDiEnumDeviceInterfaces
SetupDiGetDeviceInterfaceDetail
ecc.
This is the WDM way to enumeration. I do not know how to do in NT4.0.
Of course the only way to interact with the driver is
WriteFile
ReadFile
DeviceIoControl
After finished your job call CloseHandle and all is gone.
There are poor infos I know but you could read Walter Oney's "Programming
Microsoft Windows Driver Model" (Microsoft Press) and the Way will be
revelaed to you.
Hope this help.
Best Regards and Happy Easter to you (if you do not mind of Easter, have a
nice week-end)!
Andrea

"Bruno van Dooren" <microvax@hotmail.com> ha scritto nel messaggio
news:OcEdu$jHEHA.2580@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> how can i open a device driver in a windows application?
> it seems that you can do that with the win32 function CreateFile, but
where
> can i find the filename that i have to supply? is there a list of device
> driver file strings somewhere on my system that i can consult?
>
> apart from that, after looking in MSDN i found that there is also
> NtOpenFile, NtCreateFile, ZwOpenFile and ZwCreateFile, but i believe the
> last 2 are only for use in kernel mode.
> which of those functions should i use?
>
> sorry if these are silly questions. i have programmed device drivers on
> linux and BeOS, but windows device drivers seem a lot harder to
understand.
>
> kind regards,
> Bruno.
>
>
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.device_driver.dev (More info?)

> Best Regards and Happy Easter to you (if you do not mind of Easter, have a
> nice week-end)!
> Andrea

thanks. happy easter to you too. :)
it will be a nice weekend anyway, since monday is a holiday (long weekend)
and my grandmother has her 90th birthday.

thanks for the help. i will look into the functions. i had noticed them, but
because of the names SetupXxx i thought that these were only used for
installing drivers.

kind regards,
Bruno.