Example: Osrusbfx2.h with Annotations

Example 23-36 shows an example of a header file that is annotated with the PREfast _drv_requiresIRQL, __in, and _ _out annotations.

This header file also shows KMDF callback role type annotations, such as EVT_WDF_DRIVER_DEVICE_ADD, which Static Driver Verifier can interpret. See Chapter 24 for details.

Example 23-36. Osrusbfx2.h with annotations

#pragma warning(disable:4200) // nameless struct/union #pragma warning(disable:4201) // nameless struct/union #pragma warning(disable:4214) // bit field types other than int #include <initguid.h> #include <ntddk.h> #include "usbdi.h" #include "usbdlib.h" #include "public.h" #include "driverspecs.h" #pragma warning(default:4200) #pragma warning(default:4201) #pragma warning(default:4214) ...

Get Developing Drivers with the Windows® Driver Foundation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.