Preface |
|
iii | |
A Step-by-step Approach |
|
iv | (1) |
Which Version of Windows? |
|
iv | (1) |
About the Book |
|
iv | |
|
|
1 | (6) |
|
|
1 | (1) |
|
Privileged and Non-Privileged Packages |
|
|
1 | (1) |
|
|
2 | (1) |
|
What Kind of a Driver Do I Need to Write? |
|
|
2 | (1) |
|
|
2 | (2) |
|
What Kind of Hardware Interface? |
|
|
4 | (1) |
|
What are the Performance Requirements? |
|
|
5 | (1) |
|
|
5 | (2) |
Part 1 Windows Execution Environment and VxDs |
|
7 | (280) |
|
Chapter 2 The Virtual World of Windows |
|
|
9 | (10) |
|
What is a Virtual Machine? |
|
|
10 | (1) |
|
|
11 | (1) |
|
Virtual Memory through Demand Paging |
|
|
11 | (1) |
|
|
12 | (1) |
|
|
13 | (1) |
|
|
14 | (1) |
|
Windows Execution Environments |
|
|
15 | (2) |
|
|
17 | (2) |
|
Chapter 3 How Windows Implements the Virtual Environments |
|
|
19 | (18) |
|
|
19 | (3) |
|
Trapping Access to Memory-mapped Devices |
|
|
22 | (1) |
|
Trapping Interrupts and Exceptions |
|
|
22 | (1) |
|
|
23 | (1) |
|
A Closer Look at Linear Addresses and Paging |
|
|
23 | (3) |
|
Competing Address Requirements of Win32, Win16, and DOS Applications |
|
|
26 | (1) |
|
Win32 Address Requirements |
|
|
26 | (1) |
|
Win16 Address Requirements |
|
|
26 | (2) |
|
|
28 | (1) |
|
Satisfying Address Requirements of Win16 and DOS Applications: How Does Windows 3.x Do It? |
|
|
28 | (4) |
|
Satisfying Address Requirements of Win32, Win16, and DOS Applications: How Does Windows 95 Do It? |
|
|
32 | (4) |
|
|
36 | (1) |
|
Chapter 4 Introduction to VxDs |
|
|
37 | (18) |
|
|
38 | (1) |
|
|
39 | (1) |
|
The Device Descriptor Block |
|
|
40 | (2) |
|
Supporting Data Structures |
|
|
42 | (5) |
|
|
47 | (2) |
|
Statically Loaded VxD Initialization and Termination Messages |
|
|
49 | (1) |
|
Dynamically Loaded VxD Initialization and Termination Messages |
|
|
50 | (1) |
|
|
51 | (2) |
|
|
53 | (1) |
|
|
54 | (1) |
|
|
54 | (1) |
|
|
55 | (24) |
|
|
55 | (2) |
|
"DDK" Version Source Files |
|
|
57 | (3) |
|
The DDB and Device Control Procedure: SKELCTRL. ASM |
|
|
60 | (3) |
|
|
63 | (4) |
|
A Windows 3.x Version of SKELETON |
|
|
67 | (1) |
|
|
68 | (11) |
|
Chapter 6 VxD Talks to Hardware |
|
|
79 | (28) |
|
I/O-mapped versus Memory-mapped |
|
|
79 | (1) |
|
Talking to an I/O-mapped Device |
|
|
80 | (1) |
|
Talking to a Memory-mapped Device |
|
|
81 | (1) |
|
Statically Configured Memory-mapped Devices |
|
|
82 | (1) |
|
Dynamically Configurable Devices |
|
|
82 | (3) |
|
Another Data Transfer Method: DMA |
|
|
85 | (1) |
|
|
86 | (1) |
|
System DMA Buffer Requirements |
|
|
86 | (2) |
|
A Function for Allocating a System DMA Buffer |
|
|
88 | (2) |
|
Overview of VDMAD Services |
|
|
90 | (1) |
|
|
91 | (2) |
|
|
93 | (3) |
|
The Right Way to Use VDMAD_Scatter_Lock |
|
|
96 | (3) |
|
Using Events With Bus-master DMA Transfers |
|
|
99 | (1) |
|
|
100 | (1) |
|
|
100 | (7) |
|
Chapter 7 Handling Hardware Interrupts in a VxD |
|
|
107 | (20) |
|
|
108 | (1) |
|
|
109 | (1) |
|
Examining VPICD Services in Detail: VXDRO C |
|
|
110 | (2) |
|
Assembly Thunks and C Handlers |
|
|
112 | (1) |
|
The HwIntProc Callback: DDBISR. ASM and VXDISR. C |
|
|
112 | (1) |
|
|
113 | (1) |
|
|
114 | (2) |
|
|
116 | (11) |
|
Chapter 8 VxDs for Virtualization |
|
|
127 | (44) |
|
VMM and Processor Exception |
|
|
128 | (1) |
|
|
129 | (1) |
|
Virtualizing an I/O-mapped Device: The PORTTRAP Example |
|
|
130 | (1) |
|
The Intialization Routine: OnDevicenInit |
|
|
130 | (1) |
|
Handling Different IO Types: Port TrapHandler |
|
|
131 | (2) |
|
Checking Ownership: PortTrapThunk |
|
|
133 | (3) |
|
|
136 | (1) |
|
|
136 | (1) |
|
Virtualizing a Memory-mapped Device |
|
|
137 | (1) |
|
The Initialization Routine |
|
|
137 | (3) |
|
The Fault Handler Routine |
|
|
140 | (2) |
|
|
142 | (1) |
|
|
142 | (1) |
|
Virtualizing a Hardware Interrupt |
|
|
143 | (1) |
|
|
143 | (1) |
|
A VxD for Hardware Interrupt Reflection |
|
|
144 | (2) |
|
Callbacks: MaskChangeHandler |
|
|
146 | (2) |
|
|
148 | (1) |
|
|
149 | (1) |
|
Callbacks: VirtInHandler and IRETHandler |
|
|
150 | (1) |
|
|
150 | (21) |
|
Chapter 9 Plug and Play: The Big Picture |
|
|
171 | (12) |
|
|
172 | (2) |
|
Plug and Play Cpmponents During Windows 95 Installation |
|
|
174 | (2) |
|
Plug and Play Components During Device Installation |
|
|
176 | (1) |
|
Plug and Play Components During Boot |
|
|
176 | (5) |
|
|
181 | (2) |
|
Chapter 10 Plug and Play Device Driver VxDs |
|
|
183 | (32) |
|
Plug and Play VxD Installation |
|
|
183 | (1) |
|
|
184 | (3) |
|
Plug and Play Boot Process |
|
|
187 | (5) |
|
Other Plug and Play Configuration Scenarios |
|
|
192 | (1) |
|
|
192 | (2) |
|
|
194 | (1) |
|
|
194 | (1) |
|
A Sample Plug and Play Driver VxD: TRICORD.VxD |
|
|
195 | (1) |
|
|
196 | (1) |
|
|
197 | (6) |
|
|
203 | (12) |
|
Chapter 11 Communication from Applications to VxDs |
|
|
215 | (30) |
|
Win 16 Application to VxD: View from VxD Side |
|
|
216 | (1) |
|
Win 16 Application to VxD: View form Application Side |
|
|
217 | (2) |
|
Win 16 Application to VxD: Example Code |
|
|
219 | (5) |
|
Win 32 Application to VxD: View from VxD side |
|
|
224 | (2) |
|
Win32 Application to VxD: View from the Application Side |
|
|
226 | (3) |
|
Win32 Application to VxD: Example Code |
|
|
229 | (3) |
|
|
232 | (13) |
|
Chapter 12 Communication from VxDs to Applications |
|
|
245 | (42) |
|
Difficulties with Calling from a VxD to a Win 16 Application |
|
|
246 | (1) |
|
VxD to Win 16 Application Under Windows 3.x |
|
|
247 | (3) |
|
Using Nested Execution Services |
|
|
250 | (3) |
|
VxD to Win 16 Application under Windows 95: PostMessage |
|
|
253 | (1) |
|
VxD to Win 16 Application: Appy Time |
|
|
254 | (2) |
|
Windows 95 VxD to Win32 Application: Asynchronous Procedure Calls |
|
|
256 | (1) |
|
|
256 | (4) |
|
Windows 95 VxD to Win32 Application: Win32 Events |
|
|
260 | (2) |
|
|
262 | (4) |
|
|
268 | (19) |
Part 2 DLL-based Drivers |
|
287 | (134) |
|
Chapter 13 Introduction to 16-bit Driver DLLs |
|
|
289 | (14) |
|
Why Driver DLLs are Always 16-bit |
|
|
289 | (1) |
|
Interfacing 16-bit DLL to 32-Bit Application Requires a Thunk |
|
|
290 | (1) |
|
Static versus Dynamic Libraries |
|
|
290 | (1) |
|
Why Package Drivers in a DLL? |
|
|
291 | (1) |
|
|
291 | (1) |
|
|
292 | (1) |
|
|
293 | (1) |
|
DLLs and Ownership of Dynamically Allocated Memory |
|
|
293 | (1) |
|
DLL Initialization and Termination |
|
|
294 | (1) |
|
DLL Function Requirements |
|
|
295 | (1) |
|
|
295 | (1) |
|
Building the Skeleton Driver |
|
|
296 | (1) |
|
DLL Requires an Application |
|
|
297 | (2) |
|
Debugging Tools for Driver DLLs |
|
|
299 | (1) |
|
|
299 | (4) |
|
Chapter 14 Driver DLLs: Connecting to the Hardware |
|
|
303 | (22) |
|
|
303 | (1) |
|
|
304 | (2) |
|
Driver Design Conventions |
|
|
306 | (1) |
|
|
307 | (3) |
|
Accessing Memory-mapped Devices |
|
|
310 | (1) |
|
|
311 | (1) |
|
|
312 | (5) |
|
|
317 | (8) |
|
Chapter 15 Driver DLL: Interrupt Handling |
|
|
325 | (36) |
|
Windows Memory Management Strategy Overview |
|
|
326 | (6) |
|
Memory Requirements for an Interrupt-safe Driver |
|
|
332 | (2) |
|
Static Interrupt-safe Code and Data: The Easy Way |
|
|
334 | (1) |
|
Use the Right Way under Windows 3.x |
|
|
334 | (1) |
|
Dynamically Allocating Interrupt-safe Buffers: The Easy Way |
|
|
335 | (1) |
|
Dynamically Allocating Interrupt-safe Buffers: The Right Way |
|
|
336 | (3) |
|
Installing an Interrupt Handler |
|
|
339 | (1) |
|
The New Driver: An Overview |
|
|
340 | (1) |
|
|
341 | (5) |
|
|
346 | (15) |
|
Chapter 16 Driver DLLs: Using DMA |
|
|
361 | (6) |
|
|
361 | (1) |
|
How to Allocate a DMA Buffer |
|
|
362 | (1) |
|
DMA DOS Applications Under Windows |
|
|
362 | (1) |
|
DMA Windows Applications Can Use this Knowledge |
|
|
363 | (1) |
|
Using Virtual DMA Services Is Better |
|
|
363 | (3) |
|
|
366 | (1) |
|
Chapter 17 Driver DLLs: Using Real Mode Services |
|
|
367 | (26) |
|
Talking to DOS Device Driver |
|
|
368 | (2) |
|
Special Handling for IOCTLs |
|
|
370 | (2) |
|
|
372 | (12) |
|
|
384 | (9) |
|
Chapter 18 Thunks: Calling from 32-bit to 16-bit |
|
|
393 | (22) |
|
|
394 | (2) |
|
|
396 | (1) |
|
|
397 | (2) |
|
Creating a Thunk Layer, Step by Step |
|
|
399 | (4) |
|
Building the Thunk Layer, Step by Step |
|
|
403 | (1) |
|
|
404 | (11) |
|
Chapter 19 Driver DLLs: Using Timers |
|
|
415 | (6) |
|
Timers for Periodic Notification |
|
|
415 | (1) |
|
|
416 | (1) |
|
Hooking INT ICh and INT 8h |
|
|
416 | (1) |
|
Don't Depend on 18.2 Ticks per Second |
|
|
417 | (1) |
|
Using timeSetEvent : Pros and Cons |
|
|
417 | (1) |
|
If All Else Fails ... Use a VxD |
|
|
418 | (1) |
|
|
419 | (1) |
|
Choices: GetTickCount, timeGetTime, and QueryPerformanceCounter |
|
|
419 | (1) |
|
|
419 | (2) |
Appendix A Intel Architecture |
|
421 | (12) |
8086/8088 and Real Mode |
|
421 | (1) |
80286 and Protected Mode |
|
422 | (1) |
Selectors and Descriptors |
|
423 | (2) |
Interrupts and Exceptions |
|
425 | (1) |
Protection Mechanisms |
|
426 | (1) |
Privilege Levels |
|
427 | (1) |
80386 and Virtual-8086 Mode |
|
428 | (3) |
Virtual-8086 Mode |
|
431 | (2) |
Appendix B Using Assembly Language With Your VxD Written in C |
|
433 | (32) |
Declaring the DDB |
|
434 | (1) |
Coding the Device Control Procedure |
|
434 | (3) |
Adding "Thunks" to Support Callbacks from VMM/VxDs |
|
437 | (1) |
Introducing the Wrapper Library |
|
438 | (2) |
WRAPPERS. H |
|
440 | (1) |
Overview of WRAPPERS. ASM |
|
441 | (5) |
Building the Wrapper Library |
|
446 | (1) |
Summary |
|
447 | (18) |
Index |
|
465 | |