1 // 2 // Copyright (C) Microsoft. All rights reserved. 3 // 4 #ifndef __FX_LIBRARY_COMMON_H__ 5 #define __FX_LIBRARY_COMMON_H__ 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif // __cplusplus 10 11 extern ULONG WdfLdrDbgPrintOn; 12 extern PCHAR WdfLdrType; 13 14 extern WDFVERSION WdfVersion; 15 16 extern RTL_OSVERSIONINFOW gOsVersion; 17 18 #define _LIT_(a) # a 19 #define LITERAL(a) _LIT_(a) 20 21 #define __PrintUnfiltered(...) \ 22 DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_ERROR_LEVEL, __VA_ARGS__); 23 24 #define __Print(_x_) \ 25 { \ 26 if (WdfLdrDbgPrintOn) { \ 27 DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_ERROR_LEVEL, "%s: ", WdfLdrType); \ 28 __PrintUnfiltered _x_ \ 29 } \ 30 } 31 32 #define WDF_ENHANCED_VERIFIER_OPTIONS_VALUE_NAME L"EnhancedVerifierOptions" 33 34 typedef 35 NTSTATUS 36 (*PFN_RTL_GET_VERSION)( 37 __out PRTL_OSVERSIONINFOW VersionInformation 38 ); 39 40 _Must_inspect_result_ 41 NTSTATUS 42 FxLibraryCommonCommission( 43 VOID 44 ); 45 46 _Must_inspect_result_ 47 NTSTATUS 48 FxLibraryCommonDecommission( 49 VOID 50 ); 51 52 _Must_inspect_result_ 53 NTSTATUS 54 FxLibraryCommonRegisterClient( 55 __inout PWDF_BIND_INFO Info, 56 __deref_out PWDF_DRIVER_GLOBALS * WdfDriverGlobals, 57 __in_opt PCLIENT_INFO ClientInfo 58 ); 59 60 _Must_inspect_result_ 61 NTSTATUS 62 FxLibraryCommonUnregisterClient( 63 __in PWDF_BIND_INFO Info, 64 __in PWDF_DRIVER_GLOBALS WdfDriverGlobals 65 ); 66 67 VOID 68 GetEnhancedVerifierOptions( 69 __in PCLIENT_INFO ClientInfo, 70 __out PULONG Options 71 ); 72 73 VOID 74 LibraryLogEvent( 75 __in PDRIVER_OBJECT DriverObject, 76 __in NTSTATUS ErrorCode, 77 __in NTSTATUS FinalStatus, 78 __in PWSTR ErrorInsertionString, 79 __in_bcount(RawDataLen) PVOID RawDataBuf, 80 __in USHORT RawDataLen 81 ); 82 83 #ifdef __cplusplus 84 } // extern "C" 85 #endif // __cplusplus 86 87 #endif // __FX_LIBRARY_COMMON_H__ 88