Win32 driver development (DDK stuff) using MinGW


I've been wondering for some time (years) if it would be possible to build a Windows driver using the GNU toolchain (i.e., the MinGW environment). Years ago, I did some reading about the PE-COFF format, got some PE-COFF header editor etc., read some Windows-specific documentation to GCC+LD, found some excellent articles at, installed MinGW and did some user-space coding... but I never made it to the "holy grail": never wrote a kernel-mode driver using pure MinGW. Never wrote a Windows kernel-mode driver of any kind, for that matter.

A few weeks ago, by pure chance, I stumbled over a gem of source code, written by Marcel Telka many years ago, which demonstrates just that :-) Marcel has managed all the black magic = "under the hood setup" to get a proper kernel-mode Windows binary out of GCC. Well it's just a couple cmdline arguments to MinGW-GCC in the Makefile.
His source was a little rough-cut / serving a specific purpose, so I shuffled the code a bit to meet my esthetic measures :-)

This webpage is currently just an "HTML face plate" for my sample skeleton driver. I plan to add more info if I manage to produce any.

Ahh well. I've managed to produce an NT-level skeleton that compiles and works in 32bit Windows XP (not even a proper full-fledged WDM driver) - while the current mainstream is Windows 7 WDF and maybe 64bit. MinGW-w64 is already past release 1.0 - but I'm already running ouf of time and energy for further adventures in that vein...

The skeleton driver

Here's the source code - feel free to use it as a starting point for your own adventures. This is its primary purpose. It doesn't need much further comment. The Makefile is written by bare hand. I'm using VIM to edit my source code - there is a VIM script + a batch file that load all the files into your VIM session.


I.e., where I got the hard facts (quite some part of the source code, actually):


This HTML page was pieced together by: Frank Rysanek [ rysanek AT fccps DOT cz ]
Last update: 11th January 2011