// JP opened flex table

Click to See Complete Forum and Search --> : How to learn to write device drivers


Martin O
November 2nd, 2004, 10:27 AM
Hi. I want to write a virtual midi driver. Basically I have a midi program that I want to have its own midi port. The problem is that I don't know how to write drivers. I got the DDK & it's docs are sort of difficult to understand (because I'm trying to skip to only what I need -- there's no hardware involved in my case).

So my efforts to find a 'fast-track' to writing a virtual midi driver have failed. I decided that I must bite the bullet & learn ALL of device driver writing, then I will know what I need to write my virtual midi driver.

Personally, I need a hands on learning experience. I predict it will be difficult for me to read the entire DDK (or a book on WDM or windows device drivers) without actually having something to play with -- some simple piece of hardware to write a device driver for.

My question is, how can I learn device driver writing? Is there any simple hardware I could write a driver for? Any tutorials that actually come with hardware? Could I write a driver for an existing device, like a joystick? (in other words, write my own driver for the joystick & bypass the one from the company).

Also, would I need a lot of knowledge of assembly and or electrical engineering? (could I get away with very little?)

Thanks for any advice.

ahoodin
November 2nd, 2004, 10:55 AM
I suggest getting a few books:

1. Windows Driver Model by Walter Oney.

2. NT Device Driver Development by Viscarola and W Anthony.

3. WDM Device Drivers By Chris Cant.

Then I suggest using one of Walter Oney's samples as a template driver.
Books 2 and 3 have working samples. It is just good to have 1 for conceptual reasons.

HTH,

ahoodin

PS If you want to thank me, just rate me high!

Martin O
November 3rd, 2004, 04:27 PM
Thanks ahoodin.

You know, I've really not entirely given up on a 'fast-track' to a virtual midi driver. This much I've been able to figure out:

- I don't need kernel-mode, it can be user-mode. (I may need to make it a high-priority thread though)

- For a very basic driver that does nothing I should be able to implement the DriverProc function with standard returns (i.e DefDriverProc).

The problem is that the sample I need to reference (mmdrv.dll) is only in the NT4.0 ddk, not in the XP or 2000 ddk. It looks like the newer DDK doesn't have an example of DriverProc use, instead it uses a new driver format (direct music?). So how can I get the older ddk? Looking on MSDN it seems that I could only get the older ddk's if I had MSDN Subscription. Now the price increases from $20-ish dollars for the 2000 DDK to $1000-ish dollars for the Subscription. Is this right? If it is, can anyone send me the mmdrv sample please?

I think that I should be able to do this in steps:
1- Write a driver shell (implementing DriverProc) that does nothing. It would just show up in a midi app as a midi port but no messages would come from it.
2- Add functionality to send a midi message every 10 seconds. (I'd need to implement another entry point -- midMessage)
3- If I could accomplish steps 1 & 2 then I think I could do the rest.

Thanks.

zedraken
January 28th, 2005, 06:34 AM
Hi !

Why not learn with some simple examples ? There is an article on CodeGuru about a RAM disk. It uses no specific hardware (except the memory of course) and is quite easy to understand.

enfekted
January 30th, 2005, 11:13 AM
zedraken,

Do you have a link for this article?

bismillah
January 30th, 2005, 07:54 PM
Hi,

I myself wanted to develop virtual driver for printers but i couldnt get much help on code guru. Some one suggested me to buy Windows Driver Model from Walter Oney and I bought that and my money was waste.

I cant help you how to develop but I can save u time and money which u spend on those books recommended. Those books dont cover anything relevant to virtual drivers.

thanks.

zedraken
January 31st, 2005, 07:08 AM
Here is the link:

http://www.codeguru.com/Cpp/W-P/system/devicedriverdevelopment/article.php/c5789/

I confirm the previous post that the book related to device driver development using the WDM does not cover the virtual drivers.

Have a nice day !

ahoodin
March 7th, 2005, 07:49 AM
I think you guys have it all wrong.

Martin Wants to write a Virtual MIDI Driver. That is an internal MIDI device for transferring MIDI data between computer programs. Its a virtual MIDI port not a Virtual Device Driver VDD/VxD. That is so last decade. :p

I won't bother to supply any links. You guys. Jeese.

just google virtual midi driver.

Thanks.

ahoodin

PS: I mean come on guys get a band!
Every body else has one.

sulacco
March 7th, 2005, 02:54 PM
Well, maybe you have to write something with
timer and internal speaker? It can generate sounds and you can build simple synthesizer. I've got
some good tutorial on www.wasm.ru but this is
in russian and in assembler. Actually I'm working to do it in C++.
I'd like to create synthesizer. And someday I will
try to put it on codeguru.com. If you want you
can join me. We can work it out. Anyway working with someone is much easier to do things then by yourself. If you will decide to do it send me a
notice in private box. You just start with simple
beast. Sir Neuton once said that practice is more important then theory. I would rather say they are
equal. One never goes without another.

Good luck.

p.s. We can do it on sourceforge.net.

ahoodin
March 16th, 2005, 02:20 PM
You just start with simple beast

Well sure you can, but if you want to write a device driver for a product that you will market, you might as well write on that works on Windows 98, Windows 2000 and Windows XP. This will allow your product to work on most Windows Users home Home PCs. WDM does this throught Kernel32.vxd which mimics the functionality of the Windows NT Kernel.

WDM drivers actually use plug and play to find the devices, as well as using a .inf for installation. NT device drivers are not bad, but as I said they do not really use plug and play fully, relying on an installation program. WDM drivers are based on NT device drivers, and can use the same calls.

ahoodin

//JP added flex table