Windows System Programming (Addison-wesley Microsoft Technology Series) (4TH)

Windows System Programming (Addison-wesley Microsoft Technology Series) (4TH)

  • ただいまウェブストアではご注文を受け付けておりません。 ⇒古書を探す
  • 製本 Hardcover:ハードカバー版/ページ数 609 p.
  • 言語 ENG
  • 商品コード 9780321657749
  • DDC分類 005.3

Full Description


"If you're writing a native Win32 program or just want to know what the OS is really doing underneath, you need John's book. He covers the stuff that real systems programmers absolutely must know. Recommended." -Chris Sells, Microsoft Corporation "This fourth edition does a great job of incorporating new features in the Vista, Windows 2008, and Windows 7 API, but also stays true to teaching the foundational elements of building applications that target the Windows OS."-Jason Beres, Product Management, Infragistics The Definitive Guide to Windows API Programming, Fully Updated for Windows 7, Windows Server 2008, and Windows Vista Windows System Programming, Fourth Edition, now contains extensive new coverage of 64-bit programming, parallelism, multicore systems, and many other crucial topics. Johnson Hart's robust code examples have been updated and streamlined throughout. They have been debugged and tested in both 32-bit and 64-bit versions, on single and multiprocessor systems, and under Windows 7, Vista, Server 2008, and Windows XP. To clarify program operation, sample programs are now illustrated with dozens of screenshots. Hart systematically covers Windows externals at the API level, presenting practical coverage of all the services Windows programmers need, and emphasizing how Windows functions actually behave and interact in real-world applications. Hart begins with features used in single-process applications and gradually progresses to more sophisticated functions and multithreaded environments. Topics covered include file systems, memory management, exceptions, processes, threads, synchronization, interprocess communication, Windows services, and security. New coverage in this edition includesLeveraging parallelism and maximizing performance in multicore systemsPromoting source code portability and application interoperability across Windows, Linux, and UNIXUsing 64-bit address spaces and ensuring 64-bit/32-bit portabilityImproving performance and scalability using threads, thread pools, and completion portsTechniques to improve program reliability and performance in all systemsWindows performance-enhancing API features available starting with Windows Vista, such as slim reader/writer locks and condition variablesA companion Web site, jmhartsoftware.com, contains all sample code, Visual Studio projects, additional examples, errata, reader comments, and Windows commentary and discussion.

Contents

Figures xviiTables xixPrograms xxiProgram Runs xxvPreface xxviiAbout the Author xxxvii Chapter 1: Getting Started with Windows 1Operating System Essentials 1Windows Evolution 2Windows Versions 3The Windows Market Role 5Windows, Standards, and Open Systems 6Windows Principles 732-bit and 64-bit Source Code Portability 10The Standard C Library: When to Use It for File Processing 10What You Need to Use This Book 11Example: A Simple Sequential File Copy 13Summary 20Exercises 22 Chapter 2: Using the Windows File System and Character I/O 25The Windows File Systems 26File Naming 27Opening, Reading, Writing, and Closing Files 28Interlude: Unicode and Generic Characters 34Unicode Strategies 37Example: Error Processing 38Standard Devices 39Example: Copying Multiple Files to Standard Output 41Example: Simple File Encryption 43File and Directory Management 46Console I/O 51Example: Printing and Prompting 53Example: Printing the Current Directory 55Summary 56Exercises 57 Chapter 3: Advanced File and Directory Processing, and the Registry 59The 64-Bit File System 59File Pointers 60Getting the File Size 64Example: Random Record Updates 65File Attributes and Directory Processing 70Example: Listing File Attributes 75Example: Setting File Times 78File Processing Strategies 80File Locking 81The Registry 86Registry Management 88Example: Listing Registry Keys and Contents 92Summary 96Exercises 97 Chapter 4: Exception Handling 101Exceptions and Their Handlers 101Floating-Point Exceptions 108Errors and Exceptions 110Example: Treating Errors as Exceptions 112Termination Handlers 113Example: Using Termination Handlers to Improve Program Quality 117Example: Using a Filter Function 120Console Control Handlers 124Example: A Console Control Handler 126Vectored Exception Handling 128Summary 129Exercises 130 Chapter 5: Memory Management, Memory-Mapped Files, and DLLs 131Windows Memory Management Architecture 132Heaps 134Managing Heap Memory 137Example: Sorting Files with a Binary Search Tree 143Memory-Mapped Files 149Example: Sequential File Processing with Mapped Files 156Example: Sorting a Memory-Mapped File 158Example: Using Based Pointers 162Dynamic Link Libraries 167Example: Explicitly Linking a File Conversion Function 172The DLL Entry Point 174DLL Version Management 175Summary 177Exercises 178 Chapter 6: Process Management 181Windows Processes and Threads 181Process Creation 183Process Identities 190Duplicating Handles 191Exiting and Terminating a Process 192Waiting for a Process to Terminate 194Environment Blocks and Strings 195Example: Parallel Pattern Searching 197Processes in a Multiprocessor Environment 201Process Execution Times 202Example: Process Execution Times 202Generating Console Control Events 204Example: Simple Job Management 205Example: Using Job Objects 215Summary 219Exercises 220 Chapter 7: Threads and Scheduling 223Thread Overview 223Thread Basics 225Thread Management 226Using the C Library in Threads 231Example: Multithreaded Pattern Searching 232Performance Impact 235The Boss/Worker and Other Threading Models 236Example: Merge-Sort-Exploiting Multiple Processors 237Introduction to Program Parallelism 244Thread Local Storage 245Process and Thread Priority and Scheduling 246Thread States 249Pitfalls and Common Mistakes 251Timed Waits 252Fibers 253Summary 256Exercises 256 Chapter 8: Thread Synchronization 259The Need for Thread Synchronization 259Thread Synchronization Objects 268CRITICAL_SECTION Objects 269A CRITICAL_SECTION for Protecting Shared Variables 271Example: A Simple Producer/Consumer System 273Mutexes 279Semaphores 284Events 287Example: A Producer/Consumer System 289More Mutex and CRITICAL_SECTION Guidelines 294More Interlocked Functions 296Memory Management Performance Considerations 297Summary 298Exercises 298 Chapter 9: Locking, Performance, and NT6 Enhancements 301Synchronization Performance Impact 302A Model Program for Performance Experimentation 307Tuning Multiprocessor Performance with CS Spin Counts 307NT6 Slim Reader/Writer Locks 309Thread Pools to Reduce Thread Contention 312I/O Completion Ports 316NT6 Thread Pools 316Summary: Locking Performance 324Parallelism Revisited 325Processor Affinity 329Performance Guidelines and Pitfalls 331Summary 332Exercises 333 Chapter 10: Advanced Thread Synchronization 335The Condition Variable Model and Safety Properties 336Using SignalObjectAndWait 342Example: A Threshold Barrier Object 344A Queue Object 348Example: Using Queues in a Multistage Pipeline 352Windows NT6 Condition Variables 362Asynchronous Procedure Calls 366Queuing Asynchronous Procedure Calls 367Alertable Wait States 368Safe Thread Cancellation 371Pthreads for Application Portability 372Thread Stacks and the Number of Threads 372Hints for Designing, Debugging, and Testing 372Beyond the Windows API 375Summary 375Exercises 376 Chapter 11: Interprocess Communication 379Anonymous Pipes 380Example: I/O Redirection Using an Anonymous Pipe 380Named Pipes 384Named Pipe Transaction Functions 390Example: A Client/Server Command Line Processor 393Comments on the Client/Server Command Line Processor 399Mailslots 401Pipe and Mailslot Creation, Connection, and Naming 405Example: A Server That Clients Can Locate 406Summary 408Exercises 408 Chapter 12: Network Programming with Windows Sockets 411Windows Sockets 412Socket Server Functions 414Socket Client Functions 419Comparing Named Pipes and Sockets 421Example: A Socket Message Receive Function 422Example: A Socket-Based Client 423Example: A Socket-Based Server with New Features 426In-Process Servers 434Line-Oriented Messages, DLL Entry Points, and TLS 436Example: A Thread-Safe DLL for Socket Messages 437Example: An Alternative Thread-Safe DLL Strategy 442Datagrams 445Berkeley Sockets versus Windows Sockets 447Overlapped I/O with Windows Sockets 447Windows Sockets Additional Features 448Summary 448Exercises 449 Chapter 13: Windows Services 453Writing Windows Services-Overview 454The main() Function 454ServiceMain() Functions 455The Service Control Handler 460Event Logging 461Example: A Service "Wrapper" 461Managing Windows Services 467Summary: Service Operation and Management 471Example: A Service Control Shell 472Sharing Kernel Objects with a Service 476Notes on Debugging a Service 477Summary 478Exercises 478 Chapter 14: Asynchronous Input/Output and Completion Ports 481Overview of Windows Asynchronous I/O 482Overlapped I/O 483Example: Synchronizing on a File Handle 487Example: File Conversion with Overlapped I/O and Multiple Buffers 487Extended I/O with Completion Routines 492Example: File Conversion with Extended I/O 496Asynchronous I/O with Threads 500Waitable Timers 501Example: Using a Waitable Timer 503I/O Completion Ports 505Example: A Server Using I/O Completion Ports 509Summary 516Exercises 517 Chapter 15: Securing Windows Objects 519Security Attributes 519Security Overview: The Security Descriptor 520Security Descriptor Control Flags 523Security Identifiers 523Managing ACLs 525Example: UNIX-Style Permission for NTFS Files 527Example: Initializing Security Attributes 531Reading and Changing Security Descriptors 535Example: Reading File Permissions 537Example: Changing File Permissions 538Securing Kernel and Communication Objects 539Example: Securing a Process and Its Threads 541Overview of Additional Security Features 542Summary 544Exercises 544 Appendix A: Using the Sample Programs 547Examples File Organization 548 Appendix B: Source Code Portability: Windows, UNIX, and Linux 549Source Code Portability Strategies 550Windows Services for UNIX 550Source Code Portability for Windows Functionality 551Chapters 2 and 3: File and Directory Management 556Chapter 4: Exception Handling 561Chapter 5: Memory Management, Memory-Mapped Files, and DLLs 562Chapter 6: Process Management 563Chapter 7: Threads and Scheduling 565Chapters 8-10: Thread Synchronization 567Chapter 11: Interprocess Communication 569Chapter 14: Asynchronous I/O 571Chapter 15: Securing Windows Objects 572 Appendix C: Performance Results 575Test Configurations 575Performance Measurements 577Running the Tests 591 Bibliography 593 Index 597

最近チェックした商品