Windows driver examples

Windows driver examples with free source code related to file systems, virtual disks and network communication from kernel mode. Published by Bo Brantén.
Please send comments, suggestions and corrections to bosse@acc.umu.se.

Latest news

wdkundoc.h New file! Subset of ntifs.h to use with the WDK.
ntifs.h Small update so you still can compile Matt Wu:s ext2fsd with it.
RomFs Big improvements, work rather well now.
SwapFs Minor update to pass all code analyzes in WDK 7.1.0
FileDisk Bug fix for sparse files, support for more ioctl:s.
HttpDisk Support for more ioctl:s, better error handling.
If you are interested in network communication from kernel mode on Windows, so called TDI clients, you may want to read my report High performance kernel mode web server for Windows.

wdkundoc.h

Release 1 (2015-03-26)
Information that is undocumented in the Microsoft Windows Driver Kit (WDK).
wdkundoc.h
wdkundoc.html
wdkundoc.zip
wdkundoc.rar

Ntifs.h

Release 57 (2015-03-23)
I maintain a free version of the file ntifs.h. It is a collection of information of interrest to people building file system and file system filter drivers for Windows NT, Windows 2000 and Windows XP. The information has been found in books, magazines, on the Internet and received from contributors.
ntifs.h
ntifs.html
ntifs.zip
ntifs.rar

RomFs

Release 18 (2015-05-06)
romfs-18.zip romfs-18.rar I want to provide an example file system driver for Windows NT/2000/XP. For some time I have worked on an implementation of RomFs. RomFs is a small filesystem originally implemented in Linux, because of its simple disk layout its a good choice for an example driver. The current status is a working read-only driver that supports caching of file data. Also included is a file system recognizer for romfs, a file system recognizer is a small driver that loads the real file system driver when it recognizes a file system it can handle on a disk partition or removable media.
Here is a romfs floppy image that you can write to a floppy using RaWriteNT to test the driver.
Screenshot showing the debug prints from the driver when executing the command 'type a:\hello.c' on the floppy image above.

Links to other file system drivers for Windows with free source code

Ext2Fsd by Matt Wu is an ext2 file system driver for Windows NT/2000/XP.
FSDEXT2 by Peter van Sebille is an ext2fs driver for Windows 95/98.
EXT2IFS by John Newbigin is an ext2fs driver for Windows NT.
Ext2 File System Driver for Windows NT 4.0 by Manoj Paul Joseph.
Win2fs by Satish kumar Janarthanan is an Ext2 file system driver for the Microsoft Windows 2000 family of operating systems.
The arla project by Stacken at KTH is a free AFS implementation for many platforms including Windows.
OpenAFS is a free and portable AFS implementation. It contains an native network redirector for Windows that is in beta stage in the repository branch openafs-windows-kdfs-ifs-branch.
Creating User-Mode Device Drivers with a Proxy by Galen C. Hunt.
FIFS A Fremework for Implementing User-Mode File Systems in Windows NT by Danilo Almeida.
FFS File System Driver for Windows by Lee Jae-Hong allows you to get a read access to FreeBSD, NetBSD and OpenBSD FFS partitions.
ReiserDriver is an Installable File System Driver (IFSD) that allows ReiserFS partitions to be accessed under Windows. This driver has been updated by me to fix bugs and support newer versions of Windows.
Dokan is a user mode file system for windows.

SwapFs

Release 3.x (2010-07-21)
swapfs-3.03.zip swapfs-3.03.rar is a driver for Windows that let you use a Linux swap partition for temporary storage like a RAM-disk. It is possible to put Windows page file on it and it has support for Plug and Play and Power Management so that standby and hibernation works. SwapFs is implemented as a disk filter driver.
New in release 3: Support for swap partitions bigger than 4GB.
New in release 2: Support for standby and hibernation.
SwapFs release 2.1 for Windows 2000 and later
SwapFs release 1 for Windows NT 4.0

FileDisk

Release 19 (2015-04-23)
filedisk-19.zip filedisk-19.rar is a virtual disk driver for Windows that uses one or more files to emulate physical disks. A console application is included that let you dynamically mount and unmount files. FileDisk can also use ISO images from optical disks.
Latest news: Bug fix for sparse files, support for more ioctl:s.
Screenshot of an example of use.
FileDisk will use sparse files as disk images if the underlying file system supports it. A sparse file is a file were suficiently large blocks of zeros isn't allocated disk space. To see how much disk space a file actually uses right click on the file and choose properties. If you for example create a sparse file of 4GB, mounts it in FileDisk and formats it to NTFS, it will only take up 24MB on disk but look like a normal disk of 4GB. When you copy files to it the used disk space will automatically increase.
Note: To be sure to take advantage of sparse image files you should use Quick Format when formating them.
Note: To be able to see the virtual disks in Explorer on later versions of Windows you should run the mount program filedisk.exe as a normal user and not from a command prompt run as administrator.
filedisk-17p3.zip filedisk-17p3.rar is a version of FileDisk contributed by Anton Zechner that lets you use an disk image of a full harddisk with partitions.
filedisk-15-signed.zip filedisk-15-signed.rar Signed by Matt Wu so that it can be loaded on 64-bit versions of Windows without pressing F8 at boot and select "Disable enforce driver signing".
FileDisk with support for .bin CD-ROM images by Gilles Vollant.

HttpDisk

Release 8 (2015-04-29)
httpdisk-8.zip httpdisk-8.rar is a virtual disk driver for Windows that uses the HTTP protocol to mount disk images from a web server. It is also a demonstration on how to do network communication from kernel mode on Windows using the transport driver interface (TDI).
Note: To be able to see the virtual disks in Explorer on later versions of Windows you should run the mount program httpdisk.exe as a normal user and not from a command prompt run as administrator.
Latest news: Support for more ioctl:s, better error handling.

Khttpd

Release 2 (2009-10-21)
khttpd-2.zip khttpd-2.rar is a kernel mode web server for Windows that demonstrates how to do network communication from kernel mode using the transport driver interface (TDI) and how to use the MDL interface to the filesystem (IRP_MN_MDL and IRP_MN_COMPLETE_MDL). Using chained MDL:s the HTTP header and the first file data can be sent in one packet without any memory copy operation - so called zero-copy networking.
Latest news: Support for 64-bit systems.

Maintained drivers

I maintain two file system drivers that was developed by other open source groups:

ReiserFS file system driver for Windows

rfsd-0.25.5.zip rfsd-0.25.5.rar and rfsd-0.25.5-signed.zip rfsd-0.25.5-signed.rar is an Installable File System Driver (IFSD) that allows ReiserFS partitions to be accessed under Windows. This driver has been updated by me to fix bugs and support newer versions of Windows.

FFS/UFS file system driver for Windows

ffsdrv-0.5.1b.zip ffsdrv-0.5.1b.rar is a file system driver for Windows that allows you to get read access to FreeBSD, NetBSD and OpenBSD FFS/UFS partitions. This driver has been updated by me to fix bugs and support newer versions of Windows.

Links

OSR Online by Open Systems Resources, Inc.
WinImage by Gilles Vollant.
Tools and utilities for Windows by Olof Lagerkvist.
VirtualNetwork by Anton Zechner. A virtual network card, wich simulates a network card on mac level.

Last modified: Thursday, 07-May-2015 16:28:43 CEST