Building NT File System Drivers
Windows NT
A Guide
O'REILLY
Rajeev Nagar
Windows NT File System Internals
This book is dedicated to:
My parents, Maya and Yogesh
My wife and best friend, Priya
Our beautiful daughters, Sana and Ria
For it is their faith, support, and encouragement
that inspires me to keep striving
Table of Contents
Preface
.....................................................................................................................
ix
I.
Overview
....................................................................................................
l
1. Windows NT System Components ....................................................... 3
The
Basics
........................................................................................................
3
The
Windows
NT
Kernel
.................................................................................
9
The Windows NT Executive ... ... .................................................................... 15
2. File System, Driver Development....................................................... 20
What Are File System Drivers? ....................................................................... 21
What Are Filter Drivers? ................................................................................. 33
Common Driver Development Issues ........................................................... 36
Windows NT Object Name Space ................................................................. 56
Filename Handling for Network Redirectors ................................................ 60
3. Structured Driver Development........................................................ 65
Exception
Dispatching
Support
.....................................................................
66
Structured Exception Handling (SEH) .......................................................... 74
Event
Logging
.................................................................................................
86
Driver Synchronization Mechanisms ............................................................. 93
Supporting Routines (RTLs) ......................................................................... 112
vii
Table of Contents
II. The
Managers
....................................................................................
115
4. The NT I/O
Manager
...........................................................................
The NT I/O Subsystem ................................................................................ 118
Common Data Structures ............................................................................. 735
I/O Requests: A Discussion ......................................................................... 180
System
Boot
Sequence
.................................................................................
185
5. The NT
Virtual
Memory
Manager
..................................................
194
Functionality .........................................'........................................................ 195
Process
Address
Space
.................................................................................
196
Physical
Memory
Management
....................................................................
201
Virtual Address Support ............................................................................... 204
Shared Memory and Memory-Mapped File Support .................................. 213
Modified and Mapped Page Writer ............................................................. 224
Page
Fault
Handling
.....................................................................................
230
Interactions with File System Drivers .......................................................... 233
6. The NT
Cache
Manager
I
...................................................................
243
Functionality
.................................................................................................
244
File
Streams
..................................................................................................
245
Virtual
Block
Caching
..................................................................................
246
Caching During Read and Write Operations .............................................. 248
Cache
Manager
Interfaces
............................................................................
255
Cache Manager Clients ................................................................................ 258
Some Important Data Structures ................................................................. 250
File
Size
Considerations
...............................................................................
257
7. The NT Cache Manager II ................................................................. 270
Cache
Manager
Structures
...........................................................................
Interaction with Clients (File Systems and Network Redirectors) ............. 273
Cache
Manager
Interfaces
............................................................................
2.93
8. The NT Cache Manager HI ................................................................ 325
Flushing the Cache ...................................................................................... 325
Termination of Caching ............................................................................... 328
Miscellaneous File Stream Manipulation Functions ................................... 334
Interactions
with
the VMM
..........................................................................
344
Interactions with the I/O Manager .............................................................. 348
The Read-Ahead Module ............................................................................. 349
Lazy- Write Functionality .............................................................................. 352