12#define VF_FX_DYNAMICS_GENERATE_TABLE 1
18#define EVTLOG_DDI_COUNT_ERROR_MAX_LEN (53 + MAX_PATH)
22#include "fxlibrarycommon.h"
24#include "wdfversionlog.h"
51 WDF_01_TRIAGE_INFO_MAJOR_VERSION,
52 WDF_01_TRIAGE_INFO_MINOR_VERSION,
176 "\n\n************************* \n"
177 "* DDI function table mismatch detected in KMDF driver. The \n"
178 "* driver will not load until it is re-compiled using a \n"
179 "* newer version of the Windows Driver Kit (WDK). \n"
183 "* Service name : %wZ\n"
184 "* Actual function table count : %d \n"
185 "* Expected function table count: %d \n"
186 "*************************** \n\n",
189 ExpectedFunctionCount
198 L"Service:%wZ Count:Actual %d Expected %d",
201 ExpectedFunctionCount);
204 WDFVER_CLIENT_INVALID_DDI_COUNT,
214 TraceLoggingWrite(g_TelemetryProvider,
215 "KmdfClientFunctionCountMismatch",
217 TraceLoggingUnicodeString(
ServiceName,
"ServiceName"),
218 TraceLoggingUInt32(ActualFunctionCount,
"FunctionCount"),
219 TraceLoggingUInt32(ExpectedFunctionCount,
"ExpectedCount"));
257 __Print((
"Failed to initialize tracing for WDF\n"));
275 if (pRtlGetVersion !=
NULL) {
312 EventUnregisterMicrosoft_Windows_DriverFrameworks_KernelMode_Performance();
345 ": NULL parameter -- %s\n",
348 (
Info->FuncTable ==
NULL) ?
"PWDF_BIND_INFO->FuncTable" :
366 ": version mismatch detected in function table count: client"
367 "has 0x%x, library has 0x%x\n",
377 switch (
Info->FuncCount) {
391 ": Function table count 0x%x doesn't match any previously "
392 "released framework version table size\n",
460 if (isFunctinTableHookingOn ==
FALSE && isPerformanceAnalysisOn ==
FALSE) {
481 ": Enhanced Verification is ON \n"));
485 if (Microsoft_Windows_DriverFrameworks_KernelMode_PerformanceHandle ==
NULL) {
486 EventRegisterMicrosoft_Windows_DriverFrameworks_KernelMode_Performance();
497 &VfWdfVersion.Functions,
512 ": WdfFunctions %p\n",
Info->FuncTable));
517 ": exit: status %X\n",
status));
577 ": exit: status %X\n",
status));
599 ": Invalid ClientInfo received from wdfldr \n"));
619 status = FxRegKey::_QueryULong(
664 size_t errorLogEntrySize;
665 size_t errorInsertionStringByteSize = 0;
667 if (ErrorInsertionString) {
668 errorInsertionStringByteSize =
wcslen(ErrorInsertionString) *
sizeof(
WCHAR);
672 errorLogEntrySize =
sizeof(
IO_ERROR_LOG_PACKET) + RawDataLen + errorInsertionStringByteSize;
680#pragma prefast(suppress:__WARNING_CONST_CONST_COMP, "If ErrorInsertionString is not null then this is not a constant")
684 (
UCHAR)errorLogEntrySize);
686 if (errorLogEntry !=
NULL) {
706 if (ErrorInsertionString) {
708 ErrorInsertionString,
709 errorInsertionStringByteSize);
#define DPFLTR_ERROR_LEVEL
static WCHAR ServiceName[]
virtual VOID DeleteObject(VOID)
#define NT_SUCCESS(StatCode)
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T ContextSize
PFX_DRIVER_GLOBALS pFxDriverGlobals
PFX_DRIVER_GLOBALS fxDriverGlobals
VOID FxLibraryGlobalsDecommission(VOID)
_Must_inspect_result_ NTSTATUS FxLibraryGlobalsCommission(VOID)
VOID LockVerifierSection(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ PCUNICODE_STRING RegistryPath)
VOID UnlockVerifierSection(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
VOID FxDestroy(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
#define FX_IRP_QUEUE_CSQ_CONTEXT_ENTRY
#define WDF_LIBRARY_COMMISSION
#define WDF_LIBRARY_UNREGISTER_CLIENT
#define WDF_LIBRARY_DECOMMISSION
#define WDF_LIBRARY_REGISTER_CLIENT
VOID FxFreeDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
_Must_inspect_result_ PWDF_DRIVER_GLOBALS FxAllocateDriverGlobals(VOID)
VOID RegisterTelemetryProvider(VOID)
VOID UnregisterTelemetryProvider(VOID)
VOID GetNameFromPath(_In_ PCUNICODE_STRING Path, _Out_ PUNICODE_STRING Name)
#define WDF_TELEMETRY_EVT_KEYWORDS
__inline BOOLEAN IsFxPerformanceAnalysis(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
__inline BOOLEAN IsFxVerifierFunctionTableHooking(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI void WINAPI DbgBreakPoint(void)
#define DbgPrintEx(cmpid, lvl, fmt,...)
#define WDF_ENHANCED_VERIFIER_OPTIONS_VALUE_NAME
RTL_OSVERSIONINFOW gOsVersion
NTSTATUS(* PFN_RTL_GET_VERSION)(__out PRTL_OSVERSIONINFOW VersionInformation)
_Must_inspect_result_ NTSTATUS FxLibraryCommonRegisterClient(__inout PWDF_BIND_INFO Info, __deref_out PWDF_DRIVER_GLOBALS *WdfDriverGlobals, __in_opt PCLIENT_INFO ClientInfo)
BOOLEAN IsClientInfoValid(_In_ PCLIENT_INFO ClientInfo)
_Must_inspect_result_ NTSTATUS FxLibraryCommonDecommission(VOID)
static WDFIRPQUEUE_TRIAGE_INFO _WdfIrpQueueTriageInfo
VOID LibraryLogEvent(__in PDRIVER_OBJECT DriverObject, __in NTSTATUS ErrorCode, __in NTSTATUS FinalStatus, __in PWSTR ErrorInsertionString, __in_bcount(RawDataLen) PVOID RawDataBuf, __in USHORT RawDataLen)
static WDFCONTEXT_TRIAGE_INFO _WdfContextTriageInfo
_Must_inspect_result_ NTSTATUS FxLibraryCommonCommission(VOID)
WDF_TRIAGE_INFO g_WdfTriageInfo
static WDFDEVICE_TRIAGE_INFO _WdfDeviceTriageInfo
static WDFCONTEXTTYPE_TRIAGE_INFO _WdfContextTypeTriageInfo
static WDFREQUEST_TRIAGE_INFO _WdfRequestTriageInfo
static WDFOBJECT_TRIAGE_INFO _WdfObjectTriageInfo
VOID ReportDdiFunctionCountMismatch(_In_ PCUNICODE_STRING ServiceName, _In_ ULONG ActualFunctionCount, _In_ ULONG ExpectedFunctionCount)
_Must_inspect_result_ NTSTATUS FxLibraryCommonUnregisterClient(__in PWDF_BIND_INFO Info, __in PWDF_DRIVER_GLOBALS WdfDriverGlobals)
VOID GetEnhancedVerifierOptions(__in PCLIENT_INFO ClientInfo, __out PULONG Options)
static WDFFWDPROGRESS_TRIAGE_INFO _WdfFwdProgressTriageInfo
static WDFIRP_TRIAGE_INFO _WdfIrpTriageInfo
#define EVTLOG_DDI_COUNT_ERROR_MAX_LEN
static WDFQUEUE_TRIAGE_INFO _WdfQueueTriageInfo
_In_ NDIS_ERROR_CODE ErrorCode
#define _Must_inspect_result_
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
VOID NTAPI IoWriteErrorLogEntry(IN PVOID ElEntry)
PVOID NTAPI IoAllocateErrorLogEntry(IN PVOID IoObject, IN UCHAR EntrySize)
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
FxLibraryGlobalsType FxLibraryGlobals
PDRIVER_OBJECT DriverObject
BOOLEAN InternalTracingInitialized
ULONG FxEnhancedVerifierOptions
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
VOID TraceUninitialize(VOID)
VOID FxIFRStop(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
_Must_inspect_result_ NTSTATUS FxTraceInitialize(VOID)
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
@ WdfFunctionTableNumEntries_V1_0
@ WdfFunctionTableNumEntries_V1_11
@ WdfFunctionTableNumEntries_V1_13
@ WdfFunctionTableNumEntries_V1_15
@ WdfFunctionTableNumEntries_V1_1
@ WdfFunctionTableNumEntries_V1_5
@ WdfFunctionTableNumEntries_V1_9
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
PWDF_DRIVER_GLOBALS WdfDriverGlobals
@ WdfFunctionTableNumEntries
struct _WDF_OBJECT_CONTEXT_TYPE_INFO WDF_OBJECT_CONTEXT_TYPE_INFO
#define ERROR_LOG_MAXIMUM_SIZE
struct _IO_ERROR_LOG_PACKET * PIO_ERROR_LOG_PACKET
struct _IO_ERROR_LOG_PACKET IO_ERROR_LOG_PACKET
#define KD_DEBUGGER_ENABLED
#define KD_DEBUGGER_NOT_PRESENT