search for books and compare prices
Tables of Contents for Programming Applications for Microsoft Windows
Chapter/Section Title
Page #
Page Count
Introduction
xxiii
 
PART I: REQUIRED READING
Error Handling
3
14
You Can Do This Too
8
1
The ErrorShow Sample Application
9
8
Unicode
17
24
Character Sets
17
3
Single-Byte and Double-Byte Character Sets
18
1
Unicode: The Wide-Byte Character Set
18
2
Why You Should Use Unicode
20
1
Windows 2000 and Unicode
20
1
Windows 98 and Unicode
21
1
Windows CE and Unicode
22
1
Keeping Score
22
1
A Quick Word About COM
22
1
How to Write Unicode Source Code
23
6
Unicode Support in the C Run-Time Library
23
3
Unicode Data Types Defined by Windows
26
1
Unicode and ANSI Functions in Windows
26
2
Windows String Functions
28
1
Making Your Application ANSI- and Unicode-Ready
29
12
Windows String Functions
30
3
Resources
33
1
Determining If Text Is ANSI or Unicode
34
1
Translating Strings Between Unicode and ANSI
35
6
Kernel Objects
41
28
What Is a Kernel Object?
41
5
Usage Counting
42
1
Security
43
3
A Process's Kernel Object Handle Table
46
3
Creating a Kernel Object
46
2
Closing a Kernel Object
48
1
Sharing Kernel Objects Across Process Boundaries
49
20
Object Handle Inheritance
50
5
Named Objects
55
5
Duplicating Object Handles
60
9
PART II: GETTING WORK DONE
Processes
69
68
Writing Your First Windows Application
71
19
A Process's Instance Handle
76
1
A Process's Previous Instance Handle
77
1
A Process's Command Line
78
1
A Process's Environment Variables
79
4
A Process's Affinity
83
1
A Process's Error Mode
83
1
A Process's Current Drive and Directory
84
2
The System Version
86
4
The CreateProcess Function
90
17
pszApplicationName and pszCommandLine
91
3
psaProcess, psaThread, and blnheritHandles
94
2
fdwCreate
96
3
pvEnvironment
99
1
pszCurDir
100
1
psiStartInfo
100
5
ppiProcInfo
105
2
Terminating a Process
107
5
The Primary Thread's Entry-Point Function Returns
107
1
The ExitProcess Function
108
2
The TerminateProcess Function
110
1
When All the Threads in the Process Die
110
1
When a Process Terminates
111
1
Child Processes
112
2
Running Detached Child Processes
114
1
Enumerating the Processes Running in the System
114
23
The Process Information Sample Application
115
22
Jobs
137
44
Placing Restrictions on a Job's Processes
140
9
Placing a Process in a Job
149
1
Terminating All Processes in a Job
150
1
Querying Job Statistics
151
4
Job Notifications
155
3
The JobLab Sample Application
158
23
Thread Basics
181
32
When to Create a Thread
182
2
When Not to Create a Thread
184
1
Writing Your First Thread Function
185
1
The CreateThread Function
186
5
psa
187
1
cbStack
187
1
pfnStartAddr and pvParam
188
2
fdwCreate
190
1
pdwThreadID
190
1
Terminating a Thread
191
3
The Thread Function Returns
191
1
The ExitThread Function
191
1
The TerminateThread Function
192
1
When a Process Terminates
193
1
When a Thread Terminates
193
1
Some Thread Internals
194
4
C/C++ Run-Time Library Considerations
198
11
Oops---I Called CreateThread Instead of _beginthreadex by Mistake
208
1
C/C++ Run-Time Library Functions That You Should Never Call
208
1
Gaining a Sense of One's Own Identity
209
4
Converting a Pseudo-Handle to a Real Handle
210
3
Thread Scheduling, Priorities, and Affinities
213
44
Suspending and Resuming a Thread
215
1
Suspending and Resuming a Process
216
2
Sleeping
218
1
Switching to Another Thread
219
1
A Thread's Execution Times
219
4
Putting the Context in Context
223
5
Thread Priorities
228
2
An Abstract View of Priorities
230
5
Programming Priorities
235
15
Dynamically Boosting Thread Priority Levels
238
2
Tweaking the Scheduler for the Foreground Process
240
1
The Scheduling Lab Sample Application
241
9
Affinities
250
7
Thread Synchronization in User Mode
257
28
Atomic Access: The Interlocked Family of Functions
258
7
Cache Lines
265
2
Advanced Thread Synchronization
267
2
A Technique to Avoid
268
1
Critical Sections
269
16
Critical Sections: The Fine Print
273
4
Critical Sections and Spinlocks
277
1
Critical Sections and Error Handling
278
1
Useful Tips and Techniques
279
6
Thread Synchronization with Kernel Objects
285
52
Wait Functions
287
4
Successful Wait Side Effects
291
2
Event Kernel Objects
293
12
The Handshake Sample Application
297
8
Waitable Timer Kernel Objects
305
8
Having Waitable Timers Queue APC Entries
309
3
Timer Loose Ends
312
1
Semaphore Kernel Objects
313
2
Mutex Kernel Objects
315
16
Abandonment Issues
317
1
Mutexes vs. Critical Sections
318
1
The Queue Sample Application
319
12
A Handy Thread Synchronization Object Chart
331
1
Other Thread Synchronization Functions
332
5
Asynchronous Device I/O
332
1
WaitForInputIdle
332
1
MsgWaitForMultipleObjects(Ex)
333
1
WaitForDebugEvent
334
1
SignalObjectAndWait
334
3
Thread Synchronization Toolkit
337
62
Implementing a Critical Section: The Optex
337
16
The Optex Sample Application
340
13
Creating Thread-Safe Datatypes and Inverse Semaphores
353
15
The InterlockedType Sample Application
358
10
The Single Writer/Multiple Reader Guard (SWMRG)
368
12
The SWMRG Sample Application
371
9
Implementing a WaitForMultipleExpressions Function
380
19
The WaitForMultipleExpressions Sample Application
382
17
Thread Pooling
399
18
Call Functions Asynchronously
401
2
Call Functions at Timed Intervals
403
9
The TimedMsgBox Sample Application
407
5
Call Functions When Single Kernel Objects Become Signaled
412
3
Call Functions When Asynchronous I/O Requests Complete
415
2
Fibers
417
18
Working with Fibers
417
18
The Counter Sample Application
421
14
PART III: MEMORY MANAGEMENT
Windows Memory Architecture
435
36
A Process's Virtual Address Space
435
1
How a Virtual Address Space Is Partitioned
436
7
Null-Pointer Assignment Partition (Windows 2000 and Windows 98)
438
1
MS-DOS/16-Bit Windows Application Compatibility Partition (Windows 98 Only)
438
1
User-Mode Partition (Windows 2000 and Windows 98)
439
2
64-KB Off-Limits Partition (Windows 2000 Only)
441
1
Shared MMF Partition (Windows 98 Only)
442
1
Kernel-Mode Partition (Windows 2000 and Windows 98)
442
1
Regions in an Address Space
443
1
Committing Physical Storage Within a Region
444
1
Physical Storage and the Paging File
444
5
Physical Storage Not Maintained in the Paging File
447
2
Protection Attributes
449
3
Copy-On-Write Access
450
2
Special Access Protection Attribute Flags
452
1
Bringing It All Home
452
13
Inside the Regions
456
5
Address Space Differences for Windows 98
461
4
The Importance of Data Alignment
465
6
Exploring Virtual Memory
471
42
System Information
471
10
The System Information Sample Application
473
8
Virtual Memory Status
481
8
The Virtual Memory Status Sample Application
483
6
Determining the State of an Address Space
489
24
The VMQuery Function
490
9
The Virtual Memory Map Sample Application
499
14
Using Virtual Memory in your Own Applications
513
46
Reserving a Region in an Address Space
513
3
Committing Storage in a Reserved Region
516
1
Reserving a Region and Committing Storage Simultaneously
517
1
When to Commit Physical Storage
518
2
Decommitting Physical Storage and Releasing a Region
520
14
When to Decommit Physical Storage
521
2
The Virtual Memory Allocation Sample Application
523
11
Changing Protection Attributes
534
2
Resetting the Contents of Physical Storage
536
4
The MemReset Sample Application
537
3
Address Windowing Extensions (Windows 2000 only)
540
19
The AWE Sample Application
546
13
A Thread's Stack
559
18
A Thread's Stack Under Windows 98
563
2
The C/C++ Run-Time Library's Stack-Checking Function
565
2
The Summation Sample Application
567
10
Memory-Mapped Files
577
78
Memory-Mapped Executables and DLLs
578
16
Static Data Is Not Shared by Multiple Instances of an Executable or a DLL
579
3
Sharing Static Data Across Multiple Instances of an Executable or a DLL
582
6
The AppInst Sample Application
588
6
Memory-Mapped Data Files
594
3
One File, One Buffer
595
1
Two Files, One Buffer
595
1
One File, Two Buffers
596
1
One File, Zero Buffers
596
1
Using Memory-Mapped Files
597
23
Creating or Opening a File Kernel Object
597
2
Creating a File-Mapping Kernel Object
599
4
Mapping the File's Data into the Process's Address Space
603
3
Unmapping the File's Data from the Process's Address Space
606
2
Closing the File-Mapping Object and the File Object
608
1
The File Reverse Sample Application
609
11
Processing a Big File Using Memory-Mapped Files
620
1
Memory-Mapped Files and Coherence
621
1
Specifying the Base Address of a Memory-Mapped File
622
2
Implementation Details of Memory-Mapped Files
624
3
Using Memory-Mapped Files to Share Data Among Processes
627
1
Memory-Mapped Files Backed by the Paging File
628
8
The Memory-Mapped File Sharing Sample Application
630
6
Sparsely Committed Memory-Mapped Files
636
19
The Sparse Memory-Mapped File Sample Application
638
17
Heaps
655
20
A Process's Default Heap
656
1
Reasons to Create Additional Heaps
657
3
Component Protection
657
1
More Efficient Memory Management
658
1
Local Access
659
1
Avoiding Thread Synchronization Overhead
660
1
Quick Free
660
1
How to Create an Additional Heap
660
10
Allocating a Block of Memory from a Heap
662
2
Changing the Size of a Block
664
1
Obtaining the Size of a Block
665
1
Freeing a Block
665
1
Destroying a Heap
665
1
Using Heaps with C++
666
4
Miscellaneous Heap Functions
670
5
PART IV: DYNAMIC-LINK LIBRARIES
DLL Basics
675
20
DLLs and a Process's Address Space
677
2
The Overall Picture
679
4
Building the DLL Module
683
6
What Exporting Really Means
685
3
Creating DLLs for Use with Non--Visual C++ Tools
688
1
Building the Executable Module
689
3
What Importing Really Means
690
2
Running the Executable Module
692
3
DLL Advanced Techniques
695
48
Explicit DLL Module Loading and Symbol Linking
695
7
Explicitly Loading the DLL Module
697
1
Explicitly Unloading the DLL Module
698
3
Explicitly Linking to an Exported Symbol
701
1
The DLL's Entry-Point Function
702
12
The DLL_PROCESS_ATTACH Notification
703
2
The DLL_PROCESS_DETACH Notification
705
2
The DLL_THREAD_ATTACH Notification
707
1
The DLL_THREAD_DETACH Notification
708
1
Serialized Calls to DllMain
709
3
DllMain and the C/C++ Run-Time Library
712
2
Delay-Loading a DLL
714
13
The DelayLoadApp Sample Application
719
8
Function Forwarders
727
1
Known DLLs
728
1
DLL Redirection
729
1
Rebasing Modules
730
8
Binding Modules
738
5
Thread-Local Storage
743
8
Dynamic TLS
744
5
Using Dynamic TLS
747
2
Static TLS
749
2
DLL Injection and API Hooking
751
72
DLL Injection: An Example
752
2
Injecting a DLL Using the Registry
754
3
Injecting a DLL Using Windows Hooks
757
17
The Desktop Item Position Saver (DIPS) Utility
759
15
Injecting a DLL Using Remote Threads
774
18
The Inject Library Sample Application
779
10
The Image Walk DLL
789
3
Injecting a DLL with a Trojan DLL
792
1
Injecting a DLL as a Debugger
793
1
Injecting Code with a Memory-Mapped File on Windows 98
793
1
Injecting Code with CreateProcess
794
1
API Hooking: An Example
795
28
API Hooking by Overwriting Code
796
1
API Hooking by Manipulating a Module's Import Section
797
4
The LastMsgBoxInfo Sample Application
801
22
PART V: STRUCTURED EXCEPTION HANDLING
Termination Handlers
823
20
Understanding Termination Handlers by Example
825
18
Funcenstein1
825
1
Funcenstein2
826
2
Funcenstein3
828
1
Funcfurter1
829
1
Pop Quiz Time: FuncaDoodleDoo
830
1
Funcenstein4
831
1
Funcarama1
832
1
Funcarama2
833
1
Funcarama3
834
1
Funcarama4: The Final Frontier
835
2
Notes About the finally Block
837
1
Funcfurter2
838
1
The SEH Termination Sample Application
839
4
Exception Handlers and Software Exceptions
843
32
Understanding Exception Filters and Exception Handlers by Example
844
3
Funcmeister1
844
1
Funcmeister2
845
2
Exception_Execute_Handler
847
9
Some Useful Examples
848
3
Global Unwinds
851
4
Halting Global Unwinds
855
1
Exception_Continue_Execution
856
2
Use Exception_Continue_Execution with Caution
857
1
Exception_Continue_Search
858
3
GetExceptionCode
861
5
Memory-Related Exceptions
861
1
Exception-Related Exceptions
862
1
Debugging-Related Exceptions
862
1
Integer-Related Exceptions
862
1
Floating Point-Related Exceptions
863
3
GetExceptionInformation
866
4
Software Exceptions
870
5
Unhandled Exceptions and C++ Exceptions
875
36
Just-In-Time Debugging
878
2
Turning Off the Exception Message Box
880
2
Forcing the Process to Die
880
1
Wrapping a Thread Function
880
1
Wrapping All Thread Functions
881
1
Automatically Invoking the Debugger
882
1
Calling UnhandledExceptionFilter Yourself
882
1
Inside the UnhandledExceptionFilter Function
883
2
Exceptions and the Debugger
885
19
The Spreadsheet Sample Application
889
15
C++ Exceptions Versus Structured Exceptions
904
7
Catching Structured Exceptions with C++
906
5
PART VI: WINDOWING
Window Messaging
911
34
A Thread's Message Queue
912
2
Posting Messages to a Thread's Message Queue
914
1
Sending Messages to a Window
915
7
Waking a Thread
922
10
The Queue Status Flags
923
2
The Algorithm for Extracting Messages from a Thread's Queue
925
3
Waking a Thread with Kernel Objects or with Queue Status Flags
928
4
Sending Data with Messages
932
9
The CopyData Sample Application
935
6
How Windows Handle ANSI/Unicode Characters and Strings
941
4
The Hardware Input Model and Local Input State
945
44
The Raw Input Thread
945
2
Local Input State
947
8
Keyboard Input and Focus
948
5
Mouse Cursor Management
953
2
Attaching Virtualized Input Queues and Local Input State Together
955
34
The Local Input State Laboratory (LISLab) Sample Application
957
21
The Local Input State Watch (LISWatch) Sample Application
978
11
APPENDIX A THE BUILD ENVIRONMENT
989
16
The CmnHdr.h Header File
989
16
Windows Version Build Option
990
1
Unicode Build Option
990
1
Windows Definitions and Warning Level 4
991
1
The Pragma Message Helper Macro
991
1
The chINRANGE and chDIMOF Macros
992
1
The chBEGINTHREADEX Macro
992
2
DebugBreak Improvement for x86 Platforms
994
1
Creating Software Exception Codes
994
1
The chMB Macro
995
1
The chASSERT and chVERIFY Macros
995
1
The chHANDLE_DLGMSG Macro
995
1
The chSETDLGICONS Macro
995
1
The OS Version Check Inline Functions
995
1
Making Sure the Host System Supports Unicode
996
1
Forcing the Linker to Look for a (w)WinMain Entry-Point Function
996
9
APPENDIX B MESSAGE CRACKERS, CHILD CONTROL MACROS, AND API MACROS
1005
6
Message Crackers
1006
3
Child Control Macros
1009
1
API Macros
1010
1
Index
1011