confused about opening a device driver

  • Thread starter Bruno van Dooren
  • Start date
B

Bruno van Dooren

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.
 
A

Andrea De Nardis

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
 
B

Bruno van Dooren

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top