Developing drivers with the windows driver foundation pdf

Developing drivers with the windows driver foundation pdf

Windows Driver Foundation. Разработка драйверов.

Авторы — Пенни Орвик, Гай Смит

Модель Windows Driver Foundation (WDF) позволяет разработчику создавать простой, но работоспособный драйвер, при этом большая часть обработки событий выполняется механизмом WDF. Книга Пенни Орвика и Гая Смита «Windows Driver Foundation: Разработка драйверов» содержит описания принципов и методик, примеры программирования и подсказки для эффективной разработки драйверов.

Прочитав данную книгу вы научитесь: использовать WDF для разработки драйверов пользовательского режима и режима ядра; создавать простые и работоспособные драйверы, поддерживающие Plug and Play и управление энергопотреблением; эффективно управлять синхронизацией и параллельностью в коде драйвера; разрабатывать код для надежной обработки ввода-вывода; создавать драйверы пользовательского режима для протокольных устройств и устройств на основе последовательной шины; использовать возможности USB-инфраструктур при разработке драйверов для USB-устройств; разрабатывать драйверы режима ядра для устройств прямого доступа к памяти (DMA); диагностировать и устранять возможные проблемы созданных драйверов с помощью инструментов для статического анализа и верификации исходного кода; применять оптимальные методики тестирования, отладки и установки драйверов.

Книга предназначена для разработчиков аппаратного обеспечения и программистов, в том числе не имеющих опыта разработки драйверов.

Developing Drivers with the Windows Driver Foundation

Скачать книгу в формате:

Аннотация

Start developing robust drivers with expert guidance from the teams who developed Windows Driver Foundation. This comprehensive book gets you up to speed quickly and goes beyond the fundamentals to help you extend your Windows development skills. You get best practices, technical guidance, and extensive code samples to help you master the intricacies of the next-generation driver modeland simplify driver development. Discover how to: Use the Windows Driver Foundation to develop kernel-mode or user-mode drivers Create drivers that support Plug and Play and power managementwith minimal code Implement robust I/O handling code Effectively manage synchronization and concurrency in driver code Develop user-mode drivers for protocol-based and serial-bus-based devices Use USB-specific features of the frameworks to quickly develop drivers for USB devices Design and implement kernel-mode drivers for DMA devices Evaluate your drivers with source code analysis and static verification tools Apply best practices to test, debug, and install drivers PLUSGet driver code samples on the Web

Отзывы

Популярные книги

Сильвия Дэй ОБНАЖЕННАЯ ДЛЯ ТЕБЯ Посвящается доктору Дэвиду Алену Гудвину с безграничной любовь.

Обнаженная для тебя

Глория уже полностью забыла свое прошлое. Она готова к переменам и к новой жизни. Она даже слышит.

50 дней после моего самоубийства

В бизнесе (да и в жизни в целом) постоянно приходится покидать зону комфорта: выступать публично, ве.

Уверенность в себе. Книга для работы над собой

Изучаем Python, 4-е издание.

Лиз Бурбо Пять травм, которые мешают быть самим собой Благодарности От всей души благодарю всех.

Пять травм, которые мешают быть самим собой

Привет тебе, любитель чтения. Не советуем тебе открывать «Developing Drivers with the Windows Driver Foundation» Orwick Penny (EN) утром перед выходом на работу, можешь существенно опоздать. В ходе истории наблюдается заметное внутреннее изменение главного героя, от импульсивности и эмоциональности в сторону взвешенности и рассудительности. Одну из важнейших ролей в описании окружающего мира играет цвет, он ощутимо изменяется во время смены сюжетов. Что ни говори, а все-таки есть некая изюминка, которая выделяет данный masterpiece среди множества подобного рода и жанра. Произведение пронизано тонким юмором, и этот юмор, будучи одной из форм, способствует лучшему пониманию и восприятию происходящего. Создатель не спешит преждевременно раскрыть идею произведения, но через действия при помощи намеков в диалогах постепенно подводит к ней читателя. Не часто встретишь, столь глубоко и проницательно раскрыты, трудности человеческих взаимосвязей, стоящих на повестке дня во все века. С первых строк понимаешь, что ответ на загадку кроется в деталях, но лишь на последних страницах завеса поднимается и все становится на свои места. Гармоничное взаимодоплонение конфликтных эпизодов с внешней окружающей реальностью, лишний раз подтверждают талант и мастерство литературного гения. Умеренное уделение внимания мелочам, создало довольно четкую картину, но и не лишило читателя места для его личного воображения. В процессе чтения появляются отдельные домыслы и догадки, но связать все воедино невозможно, и лишь в конце все становится и на свои места. «Developing Drivers with the Windows Driver Foundation» Orwick Penny (EN) читать бесплатно онлайн можно с восхищением, можно с негодованием, но невозможно с равнодушием.

  • Понравилось: 0
  • В библиотеках: 0

Новинки

Братьев Титовых знает весь университет: они красивы, богаты, обаятельны. С ними мечтают завязать зна.

В поисках Винни-Пуха

Братьев Титовых знает весь университет: они красивы, богаты, обаятельны. С ними мечтают завязать зна.

Вторая часть! Все думают, что Бьянка мертва. И ей это на руку. Она должна вернуться в логово враг.

Omega. Побочный эффект

Вторая часть! Все думают, что Бьянка мертва. И ей это на руку. Она должна вернуться в логово враг.

Developing Drivers with the Windows» Driver Foundation. Microsoft

1 Developing Drivers with the Windows» Driver Foundation Microsoft

2 Table of Contents Foreword. xxiii Acknowledgments xxvii Part i Getting Started with WDF 1 Introduction to WDF 3 About This Book 4 Who Should Read This Book 4 About Part 1: Getting Started with WDF 5 About Part 2: Exploring the Frameworks 6 About Part 3: Applying WDF Fundamentals 6 About Part 4: Digging Deeper: More Topics for WDF Drivers 8 About Part 5: Building, Installing, and Testing a WDF Driver 9 Conventions Used in This Book 10 Getting Started with Driver Development 11 System Requirements for Driver Development 12 How to Obtain and Install the WDK 13 WDK Libraries 14 WDK Documentation 14 WDK Tools 15 WDK Samples 16 How to Obtain Checked Builds of Windows 17 How to Obtain Debugging Tools 18 How to Obtain OSR Learning Devices 19 Key Information Sources 20 Key References 22 / % iat do you think of this book? We want to hear from you! I Microsoft is interested in hearing your feedback so we can continually improve our books and learning 1 I resources for you. To participate in a brief online survey, please visit: I

3 Table of Contents Windows Driver Fundamentals 23 What Is a Driver? 24 Core Windows Architecture 25 Driver Architecture 27 Kernel Objects and Data Structures 31 The Windows I/O Model 31 I/O Requests 32 How a Device Stack Handles IRPs 33 Data Buffers and I/O Transfer Types 34 How to Transfer Data to or from a Device 35 About Plug and Play and Power Management 36 Basic Kernel-Mode Programming 36 Interrupts and IRQLs 37 Concurrency and Synchronization 39 Memory 42 Tips for Programming in Kernel Mode 44 A Basic Vocabulary 47 WDF Fundamentals 51 WDF and WDM 51 What Is WDF? 52 WDF Object Model 53 Programming Interface 54 Object Hierarchy 54 Concurrency and Synchronization 55 I/O Model 55 I/O Request Cancellation 56 I/O Targets 57 How to Handle Nonfatal Errors 58 Plug and Play and Power Management 59 Security 61 SafeiDefaults 62 Parameter Validation 62 WDF Verification, Tracing, and Debugging Support 63 Serviceability and Versioning 63

Читайте также:  Как сделать разрешение 1920x1080 если его нету linux

4 Part 2 Exploring the Frameworks 4 Overview of the Driver Frameworks 67 The Frameworks: An Overview i 67 UMDF Overview 68 UMDF Framework Objects 69 UMDF Callback Objects 70 KMDF Overview 71 KMDF Objects 71 KMDF Callback Functions 72 WDF-Architecture 73 UMDF Infrastructure 76 UMDF Infrastructure Components 77 Fatal Errors in UMDF Drivers 80 A Typical UMDF I/O Request 80 KMDF Infrastructure 81 KMDF Infrastructure Components 82 Fatal Errors in KMDF Drivers 83 A Typical KMDF I/O Request 84 Device and Driver Support in WDF 84 Devices Supported by UMDF 85 Devices Supported by KMDF 88 Choosing the Right Framework 89 5 WDF Object Model 91 Overview of the Object Model 92 About Methods, Properties, and Events 92 About Event Callbacks 93 About Object Attributes 94 About Object Hierarchy and Lifetime 94 About Object Context 95.^ UMDF Object Model Implementation 95 UMDF Naming Conventions 95 UMDF Framework Objects and Interfaces 97 UMDF Driver Callback Objects and Interfaces 99 UMDF Example: Objects and Callback Interfaces 101

5 viii Table of Contents KMDF Object Model Implementation 102 KMDF Object Types 102 KMDF Naming Conventions 104 Object Creation 106 UMDF Object Creation 106 KMDF Object Creation 107 Object Hierarchy and Lifetime 110 UMDF Object Hierarchy 112 KMDF Object Hierarchy 114 Object Deletion 115 Object Context Areas 122 UMDF Object Context Data 122 KMDF Object Context Area 126 Driver Structure and Initialization 129 Required Driver Components 129 UMDF Driver Structure and Requirements 130 KMDF Driver Structure and Requirements 133 Driver Object 135 UMDF Driver Callback Object Creation 135 KMDF Driver Object Creation 137 Device Objects 140 Types of Device Objects 140 WDF Drivers, Driver Types, and Device Object Types 144 Device Properties 145 Device Object Initialization 146 Queues and Other Support Objects 147 Device Interfaces 148 UMDF Device Object Creation and Initialization 149 » Device Callback Object Creation 149 Framework Device Object Creation and Initialization 150 ^lumdf Example: Device Interface 152 KMDF Device Object Creation and Initialization 152 KMDF Device Initialization Structure 153 Device Object Context Area 154 KMDF Device Object Creation 155 Additional EvtDriverDeviceAdd Tasks 155 KMDF Example: EvtDriverDeviceAdd Callback Function 155

6 Table of Contents ix Child Device Enumeration (KMDF PDOs Only) 157 Static and Dynamic Enumeration in Bus Drivers 157 PDO-Specific Initialization 158 Device Naming Techniques for KMDF Drivers 159 Named Device Objects 160 Security Descriptors 160 Part 3 Applying WDF Fundamentals 7 Plug and Play and Power Management 165 Introduction to Plug and Play and Power Management 166 About Plug and Play 167 About Power States 168 About Power Policy 169 Plug and Play and Power Management Support in WDF 170 Plug and Play and Power Management Defaults 170 I/O Queues and Power Management 171 Plug and Play and Power Event Callbacks 171 Idle and Wake Support (KMDF Only) 174 Power-Pageable and Non-Power-Pageable Drivers 174 Callback Sequences for Plug and Play and Power Management 176 Device Enumeration and Startup 180 Device Power-Down and Removal 184 Surprise Removal 187 How to Implement Plug and Play and Power Management in WDF Drivers 189 Plug and Play and Power Management in Software-Only Drivers 190 UMDF Example: Plug and Play in a Software-Only Filter Driver 191 KMDF Example: Plug and Play in a Software-Only Filter Driver 192 Framework Actions for Software-Only Drivers 194 Plug and Play and Power Management in Simple Hardware Drivers 194 Device Power-Up Initialization and Power-Down Teardown 195 -‘»h Power Management for Queues in Hardware Function Drivers 196 UMDF Example: Plug and Play and Power Code in a Protocol Function Driver 197 KMDF Example: Plug and Play and Power Code in a Simple Hardware Function Driver 202 Framework Actions for a Simple Hardware Function Driver 205 Advanced Power Management for KMDF Drivers 207

7 Table of Contents Device Power-Down Idle Support for KMDF Drivers 208 Device Wake Support for KMDF Drivers 212 KMDF Example: Support for Device Idle and Wake 217 Framework Actions Supporting Device Idle 220 Framework Actions Supporting Device Wake I/O Flow and Dispatching 223 Common I/O Request Types 224 Create Requests 224 Cleanup and Close Requests 224 Read and Write Requests 225 Device I/O Control Requests 225 Summary of I/O Request Types 227 I/O Transfer Types 228 Buffered I/O 229 Direct I/O 230 Neither Buffered nor Direct I/O 230 I/O Request Flow 231 I/O Request Path through the UMDF Device Stack 234 I/O Request Path through a KMDF Driver 236 I/O Completion Processing 238 I/O Request Flow within the Frameworks 239 Processing in the I/O Request Handler 242 I/O Request Objects 243 I/O Buffers and Memory Objects 244 Request, Memory, and Buffer Pointer Lifetimes 252 I/O Queues 253 Queue Configuration and Request Types 254 Queues and Power Management 257 *» Dispatch Type 259 Queue Control 260 UMDF Example: Creating I/O Queues 261 KMDF Example: Creating I/O Queues 265 Retrieving Requests from a Manual Queue 267 I/O Event Callbacks 271 File Objects for I/O 271 Automatic Forwarding of Create, Cleanup, and Close 272

8 Table of Contents xi I/O Event Callbacks for Create Requests 273 I/O Event Callbacks for Cleanup and Close 280 I/O Event Callbacks for Read, Write, and Device I/O Control Requests 282 Completing I/O Requests 291 Canceled and Suspended Requests 293 Request Cancellation 293 Request Suspension 296 Adaptive Time-outs in UMDF 297 Self-Managed I/O 297 Self-Managed I/O during Device Startup and Restart 300 Self-Managed I/O during Device Power-Down and Removal 300 KMDF Example: Implementing a Watchdog Timer 301 I/O Targets 307 About I/O»fargets 308 Default I/O Targets 308 Remote I/O Targets in KMDF Drivers 309 General and Specialized I/O Targets 309 UMDF I/O Target Implementation 310 I/O Target Creation and Management 313 Default I/O Target Retrieval 313 Remote I/O Target Creation in KMDF Drivers 314 I/O Target State Management 318 I/O Request Creation 322 UMDF Example: Create a WDF I/O Request Object 322 KMDF Example: Create a WDF I/O Request Object 323 Memory Objects and Buffers for Driver-Created I/O Requests 323 Memory Object and Buffer Allocation for I/O Requests 325 UMDF Example: Create a New Memory Object with an Existing Buffer KMDF Example: Create a New Memory Object and a New Buffer 330 I/O Request Formatting 330 «*; How to Format an Unchanged Request for the Default I/O Target 331 How to Format Changed or Driver-Created Requests 331 I/O Completion Callbacks 334 How to Send an I/O Request 337 Options for Sending Requests 338 UMDF Example: Send a Request to the Default I/O Target 341

Читайте также:  Данный диск имеет стиль разделов gpt как исправить установка windows

9 xii Table of Contents KMDF Example: Send and Forget 343 KMDF Example: Format and Send an I/O Request to an I/O Target 345 How to Split an I/O Request into Smaller Requests 346 KMDF Example: Reuse an I/O Request Object 348 How to Cancel a Sent Request 351 File Handle I/O Targets in UMDF Drivers 353 USB I/O Targets 355 About USB Devices 355 Specialized USB I/O Targets in WDF 359 How to Configure a USB I/O Target 361 How to Se’nd an I/O Request to a USB I/O Target 369 USB Continuous Reader in KMDF 375 Guidelines for Sending I/O Requests Synchronization 379 When Synchronization Is Required 380 Synchronized Access to Shared Data: An Example 381 Synchronization Requirements for WDF Drivers 383 WDF Synchronization Features 384 Reference Counts and the Hierarchical Object Model 384 Serialization of Plug and Play and Power Callbacks 385 Flow Control for I/O Queues 385 Object Presentation Lock 386 Synchronization Scope and I/O Callback Serialization 387 Device Scope and Queue Dispatch Methods 388 Synchronization Scope in UMDF Drivers 390 Synchronization Scope in KMDF Drivers 391 KMDF Wait Locks and Spin Locks 398 Wait Locks 398 Spin Locks 399 Synchronization of I/O Request Cancellation in KMDF Drivers 401 Synchronized Cancellation by Using Synchronization Scope 402 Synchronized Cancellation by Tracking State in the Request Context 403 Synchronized Cancellation of Incoming Request with Driver-Created Subrequests 408 Summary and General Tips for Synchronization 409

10 Table of Contents xiii 11 Driver Tracing and Diagnosability 411 WPP Software Tracing Basics 412 Advantages of WPP Software Tracing 412 WPP Software Tracing Components 413 WPP and ETW 416 ETW in Windows Vista 416 Trace Message Functions and Macros 417 DoTraceMessage Macro 418 How to Convert Debug Print Statements to ETW 418 -Message Conditions 418 Custom Trace Message Functions 419 How to Support Software Tracing in a Driver 420 Modify Sources to Run the WPP Preprocessor 420 Include the TMH File 424 Define the Control GUID and Trace Flags 425 Initialize and Clean Up Tracing 427 Instrument the Driver Code 431 Tools for Software Tracing 432 How to Run a Software Trace Session 433 Prepare the Sample 434 View a Driver Trace Log by Using TraceView 435 View the Frameworks Trace Log by Using the Core Tracing Tools 437 Best Practices: Design for Diagnosability WDF Support Objects 441 Memory Allocation 442 Local Storage 442 Memory Objects and I/O Buffers 443 Registry Access 447 UMDF Device Property Store 447 KMDF Registry Objects and Methods 450 » ; General Objects 454 UMDF Example: How to Create a General Object 454 KMDF Example: How to Create a General Object 455 KMDF Collection Objects 455 Collection Methods 456 Example: Creating and Using a Collection 457

11 xiv Table of Contents KMDF Timer Objects 459 Timer Object Methods 459 Time Periods 461 EvtTimerFunc Callback Function 461 Example: Using a Timer Object 462 WMI Support in a KMDF Driver 464 About WMI 464 Requirements for WMI Support 465 How to Initialize WMI Support 466 WMI Instance Event Callbacks 470 * 13 UMDF Driver Template 475 A Description of the Skeleton Sample 475 About the Skeleton Sample 476 About the Skeleton Sample Files 476 How to Customize the Skeleton Sample Source Files 478 DLL Infrastructure 478 Basic COM Support 480 Skeleton Sample Driver Callback Object 481 The Skeleton Sample Device Callback Object 484 How to Customize the Skeleton Sample Build and Installation Support Files 486 Sources 486 Make Files 488 Exports 488 Version Resource File 488 INX File 489 Part 4 Additional Topics for KMDF Drivers 14 Beyond the Frameworks 497 How to Use System Services Outside the Frameworks 497 /.- ‘ How to Use the Windows API in UMDF Drivers 497 How to Use Kernel-Mode Driver Support Routines in KMDF Drivers 500 How to Handle Requests that the Frameworks Do Not Support 503 Default Handling of Unsupported Requests 503 How to Process Unsupported Requests in KMDF Drivers 504

12 Table of Contents xv 15 Scheduling, Thread Context, and IRQL 507 About Threads 508 Thread Scheduling ‘. 508 Thread Context Defined 509 Thread Context for KMDF Driver Functions 510 Interrupt Request Levels 511 Processor-specific and Thread-specific IRQLs 512 Guidelines for Running at IRQL DISPATCHJ.EVEL or Higher 517 Calls to Functions that Run at a Lower IRQL 517 Thread Interruption Scenarios : 518 Thread Interruption on a Single-Processor System 518 Thread Interruption on a Multiprocessor System 519 \ Testing for IRQL Problems 521 Work Items and Driver Threads 523 About Work Items 524 KMDF Example: Use a Work Item 525 Best Practices for Managing Thread Context and IRQL in KMDF Drivers Hardware Resources and Interrupts 529 Hardware Resources 529 Hardware Resource Identification and Teardown 530 Resource Lists 532 Example: How to Map Resources 534 Example: How to Unmap Resources 537 Interrupts and Interrupt Handling 537 Interrupt Objects 538 How to Enable and Disable Interrupts 541 Post-interrupt Enable and Pre-interrupt Disable Processing 543 Interrupt Service Routines 544 Deferred Processing for Interrupts 546 Synchronized Processing at DIRQL Direct Memory Access 549 Basic DMA Concepts and Terminology 550 DMA Transactions and DMA Transfers 550 Packet-Based and Common-Buffer DMA 551 Scatter/Gather Support 552

13 DMA-Specific Device Information 552 Device Information and DMA Driver Design 553 What Is Not a Consideration 554 Windows DMA Abstraction 555 DMA Operations and Processor Cache 556 Completion of DMA Transfers by Flushing Caches 557 Map Registers 557 System Scatter/Gather Support 560 DMA Transfer to Any Location in Physical Memory 562 Implementing DMA Drivers 564 Driver DMA Initialization 565 Transaction Initiation 569 Request Processing 572 DMA Completion Processing 575 Testing DMA Drivers 578 DMA-Specific Verification 578 The!dma Debugger Extension 579 KMDF Debugger Extensions for DMA 580 Best Practices: Do’s and Don’ts for DMA Drivers An Introduction to COM 583 Before Starting 584 UMDF Driver Structure 584 A Brief Overview of COM 586 The Contents of a COM Object 587 Objects and Interfaces 588 lunknown 589 Reference Counting 589 Guidelines for AddRef and Release 590 GUIDs 592 VTables 592 HRESULT 593 * Properties and Events 594 Active Template Library 595 Interface Definition Language Files 595 How to Use UMDF COM Objects 597 How to Start Using a COM Object 597 How to Manage a COM Object’s Lifetime 600

14 How to Implement the DLL Infrastructure 600 DIIMain 601 DIIGetClassObject 602 The Class Factory T 603 How to Implement UMDF Callback Objects 606 How to Implement a Class for a COM Object 607 How to Implement lunknown 608 How to Implement UMDF Callback Objects 611 Part 5 Building, Installing, and Testing a WDF Driver 19 How to Build WDF Drivers 617 General Build Considerations for Drivers 618 UMDF Drivers Build Issues 618 KMDF Drivers Build Issues 619 Introduction to Building Drivers 619 Build Environments 619 Build Utility Supporting Files 620 How to Build a Project 622 UMDF Example: Building the Fx2_Driver Sample 625 Sources File for Fx2_Driver 625 Macros Used in the Sources File for Fx2_Driver 626 Makefile and Makefile.inc for Fx2_Driver 629 How to Build Fx2_Driver 629 KMDF Example: Building the Osrusbfx2 Sample 630 Sources File for Osrusbfx2 630 Macros Used in the Sources File for Osrusbfx2 631 Makefile and Makefile.inc for Osrusbfx2 632 How to Build Osrusbfx How to Install WDF Drivers 635 Driver Installation Basics 636 Key Driver Installation Tasks 636 Installation Techniques and Tools 636 WDF Driver Installation Considerations 637 WDF Versioning and Driver Installation 637 How Drivers Bind to the Framework 639 WDF Co-installer Packages 640

Читайте также:  Как поверх windows установить mac

15 WDF Driver Package Components 642 How to Create an INF for a WDF Driver Package 643 Commonly Used INF Sections 644 INF Tools.’ 645 INFs for Different CPU Architectures 645 INFs for WDF Drivers: The Co-installer Sections 646 Examples of WDF INFs 648 UMDF Example: The Fx2_Driver INF 648 KMDF Example: The Osrusbfx2 INF 652 How to Sign and Distribute a Driver Package 653 Signed^Catalog Files 653 How to Specify the Catalog File in the INF 654 How to Sign Boot-Start Drivers 654 How to Distribute the Driver Package 655 How to Install a Driver 655 Considerations for Test Installations 655 Considerations for Release Installations 656 How to Install a Driver by Using the PnP Manager 656 How to Install a Driver by Using DPInst or DIFxApp 657 How to Install a Driver by Using a Custom Installation Application 658 How to Install or Update a Driver by Using DevCon 658 How to Update a Driver by Using Device Manager 659 How to Uninstall a Driver 659 Driver Installation Process 659 Uninstall Actions 660 How to Troubleshoot WDF Driver Installation Problems 663 How to Use WinDbg to Debug Installation Errors 663 Driver Installation Error Logs 664 Common WDF Installation Errors 665 PnP Manager Error Codes Tools for Testing WDF Drivers 667 ‘ Getting Started with Driver Testing 668 Choosing a Test System 668 Tools for Testing WDF Drivers: An Overview 669 About PRE/ast and SDV 670 Other Tools for Testing Drivers 670 Driver Verifier 677

16 When to Use Driver Verifier 677 How Driver Verifier Works 677 How to Run Driver Verifier 679 Driver Verifier Examples 679 How to Use Driver Verifier Information during Debugging 684 KMDF Verifier 687 When to Use KMDF Verifier 687 How KMDF Verifier Works 687 How to Enable KMDF Verifier 688 How to Use KMDF Verifier Information during Debugging 689 UMDF-Verifier 690 UMDF Bug Checks 692 UMDF Error Reporting 692 Application Verifier 693 How Application Verifier Works 693

-^ How to Use Application Verifier to Verify UMDF Drivers 693 Best Practices for Testing WDF Drivers 694 Tips for Building Drivers 694 Tips for Best Use of Tools 695 Tips for Driver Life Cycle Testing How to Debug WDF Drivers 697 About WDF Debugging Tools 698 WinDbg 698 Other Tools 699 WPP Tracing 699 Debugging Macros and Routines 699 WinDbg Basics 699 Checked versus Free Builds 700 User Interface 700 Debugger Commands 702 x. Symbols and Source Code 702 Debugger Extensions 704 How to Prepare for UMDF Debugging 706 How to Enable Debugging of Driver Load and Startup Code 706 How to Start Debugging a UMDF Driver’s Driver Load and Startup Code 707 How to Start Debugging a Running UMDF Driver 708

17 xx Table of Contents How to Track UMDF Objects and Reference Counts 709 How to Start Debugging a UMDF Driver Crash 710 How to Prepare for KMDF Debugging 711 How to Enable Kernel Debugging on the Test Computer 711 How to Prepare the Test Computer for KMDF Debugging 713 How to Start a KMDF Debugging Session 714 How to Start Debugging a KMDF Driver Crash 715 UMDF Walkthrough: Debugging the Fx2_Driver Sample 716 Prepare to Debug Fx2_Driver 716 Start the Debug Session for Fx2_Driver 716 Examine.the OnDeviceAdd Callback Routine for Fx2_Driver 717 Use UMDF Debugger Extensions to Examine the Device Callback Object 719 Use UMDF Debugger Extensions to Examine an I/O Request 720 KMDF Walkthrough: Debugging the Osrusbfx2 Sample 721 Prepare for a Debug Session for Osrusbfx2 721 Start the Debug Session for Osrusbfx2 722 Examine the EvtDriverDeviceAdd Callback Routine 722 Use KMDF Debugger Extensions to Examine the Device Object 723 Use KMDF Debugger Extensions to Examine an I/O Request 724 How to View Trace Messages with WinDbg 725 How to Use WinDbg to View the KMDF Log 726 Getting Log Information after a Bug Check 728 Controlling the Contents of the KMDF Log 728 More Suggestions for Experimenting with WinDbg PREfast for Drivers 731 Introduction to PRE/ast 732 How PRE/ast Works 732 -What PRE/ast Can Detect 733 How to Use PRE/ast 734 How to Specify the PRE/ast Analysis Mode 734 How to Run PRE/ast 734 How to Build the PRE/ast Examples 735 How to Display PRE/ast Results 737 Examples of PRE/ast Results 741 / — Coding Practices that Improve PRE/ast Results 749 Warnings that Indicate Common Causes of Noise and What to Do About Them 750

18 Table of Contents xxi How to Use Pragma Warning Directives to Suppress Noise 751 How to Use Annotations to Eliminate Noise 752 How to Use Annotations 753 How Annotations Improve PRE/ast Results 753 Where to Place Annotations in Code 755 General-Purpose Annotations 761 Input and Output Parameter Annotations 762 Annotation Modifiers 765 Buffer-Size Annotations 767 String Annotations 772 Reserved Parameters 774 Function Return Values 774 Driver Annotations 775 Basic Driver Annotations and Conventions 778 Conditional Annotations 780 Function Result Annotations 785 Type-Matching Annotations 786 Pointer Annotations 788 Constant and Non-Constant Parameter Annotations 789 Format String Annotations 789 Diagnostic Annotations 790 Annotations for Functions in try Statements 791 Memory Annotations 791 Nonmemory Resource Annotations 793 Function Type Class Annotations 800 Floating-Point Annotations 802 IRQL Annotations 803 DO_DEVICE_INITIALIZING Annotation 810 Annotations for Interlocked Operands 810 Examples of Annotated System Functions 811 How to Write and Debug Annotations 814 Examples of Annotation Test Cases 814 Tips for Writing Annotation Test Cases 815 PRE/ast Best Practices 816 Best Practices for Using PRE/ast 816 Best Practices for Using Annotations 817 Example: Osrusbfx2.h with Annotations 819

Оцените статью