ReactOS  0.4.15-dev-2701-g34593d9
fxglobalskm.h File Reference
#include "fxglobals.h"
Include dependency graph for fxglobalskm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FxMdlDebugInfo
 
struct  FxAllocatedMdls
 
struct  _FX_DRIVER_TRACKER_CACHE_AWARE
 
struct  _FX_DRIVER_TRACKER_CACHE_AWARE::_FX_DRIVER_TRACKER_ENTRY
 

Macros

#define WDF_LDR_STATIC_TYPE_STR   "WdfStatic"
 
#define NUM_MDLS_IN_INFO   (16)
 
#define DDI_ENTRY_IMPERSONATION_OK()
 
#define DDI_ENTRY()
 

Typedefs

typedef struct _FX_DRIVER_GLOBALSPFX_DRIVER_GLOBALS
 
typedef struct _FX_DUMP_DRIVER_INFO_ENTRYPFX_DUMP_DRIVER_INFO_ENTRY
 
typedef BOOLEAN(STDCALLPFN_KD_REFRESH) ()
 
typedef VOID(STDCALLPFN_KE_FLUSH_QUEUED_DPCS) (VOID)
 
typedef NTSTATUS(STDCALLPFN_IO_SET_COMPLETION_ROUTINE_EX) (__in PDEVICE_OBJECT DeviceObject, __in PIRP Irp, __in PIO_COMPLETION_ROUTINE CompletionRoutine, __in PVOID Context, __in BOOLEAN InvokeOnSuccess, __in BOOLEAN InvokeOnError, __in BOOLEAN InvokeOnCancel)
 
typedef BOOLEAN(STDCALLPFN_KE_REGISTER_BUGCHECK_REASON_CALLBACK) (__in PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecord, __in PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine, __in KBUGCHECK_CALLBACK_REASON Reason, __in PUCHAR Component)
 
typedef BOOLEAN(STDCALLPFN_KE_DEREGISTER_BUGCHECK_REASON_CALLBACK) (__in PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecords)
 
typedef NTSTATUS(STDCALLPFN_IO_CONNECT_INTERRUPT_EX) (__inout PIO_CONNECT_INTERRUPT_PARAMETERS Parameters)
 
typedef NTSTATUS(STDCALLPFN_IO_DISCONNECT_INTERRUPT_EX) (__in PIO_DISCONNECT_INTERRUPT_PARAMETERS Parameters)
 
typedef NTSTATUS(STDCALLPFN_IO_CONNECT_INTERRUPT) (__out PKINTERRUPT *InterruptObject, __in PKSERVICE_ROUTINE ServiceRoutine, __in_opt PVOID ServiceContext, __in_opt PKSPIN_LOCK SpinLock, __in ULONG Vector, __in KIRQL Irql, __in KIRQL SynchronizeIrql, __in KINTERRUPT_MODE InterruptMode, __in BOOLEAN ShareVector, __in KAFFINITY ProcessorEnableMask, __in BOOLEAN FloatingSave)
 
typedef VOID(STDCALLPFN_IO_DISCONNECT_INTERRUPT) (__in PKINTERRUPT InterruptObject)
 
typedef KIRQL(FASTCALLPFN_KF_RAISE_IRQL) (__in KIRQL NewIrql)
 
typedef VOID(FASTCALLPFN_KF_LOWER_IRQL) (__in KIRQL NewIrql)
 
typedef PSLIST_ENTRY(FASTCALLPFN_INTERLOCKED_POP_ENTRY_SLIST) (__inout PSLIST_HEADER ListHead)
 
typedef PSLIST_ENTRY(FASTCALLPFN_INTERLOCKED_PUSH_ENTRY_SLIST) (__inout PSLIST_HEADER ListHead, __inout PSLIST_ENTRY ListEntry)
 
typedef BOOLEAN(STDCALLPFN_PO_GET_SYSTEM_WAKE) (__in PIRP Irp)
 
typedef VOID(STDCALLPFN_PO_SET_SYSTEM_WAKE) (__inout PIRP Irp)
 
typedef KAFFINITY(STDCALLPFN_KE_QUERY_ACTIVE_PROCESSORS) (VOID)
 
typedef VOID(STDCALLPFN_KE_SET_TARGET_PROCESSOR_DPC) (__in PRKDPC Dpc, __in CCHAR Number)
 
typedef BOOLEAN(STDCALLPFN_KE_SET_COALESCABLE_TIMER) (__inout PKTIMER Timer, __in LARGE_INTEGER DueTime, __in ULONG Period, __in ULONG TolerableDelay, __in_opt PKDPC Dpc)
 
typedef ULONG(STDCALLPFN_KE_GET_CURRENT_PROCESSOR_NUMBER) (VOID)
 
typedef ULONG(STDCALLPFN_KE_GET_CURRENT_PROCESSOR_NUMBER_EX) (__out_opt PPROCESSOR_NUMBER ProcNumber)
 
typedef ULONG(STDCALLPFN_KE_QUERY_MAXIMUM_PROCESSOR_COUNT_EX) (__in USHORT GroupNumber)
 
typedef ULONG(STDCALLPFN_KE_QUERY_MAXIMUM_PROCESSOR_COUNT) (VOID)
 
typedef BOOLEAN(STDCALLPFN_KE_ARE_APCS_DISABLED) (VOID)
 
typedef ULONG(STDCALLPFN_KE_GET_RECOMMENDED_SHARED_DATA_ALIGNMENT) (VOID)
 
typedef NTSTATUS(STDCALLPFN_IO_UNREGISTER_PLUGPLAY_NOTIFICATION_EX) (__in PVOID NotificationEntry)
 
typedef NTSTATUS(STDCALLPFN_POX_REGISTER_DEVICE) (__in MdDeviceObject Pdo, __in PPO_FX_DEVICE PoxDevice, __out POHANDLE *Handle)
 
typedef VOID(STDCALLPFN_POX_START_DEVICE_POWER_MANAGEMENT) (__in POHANDLE Handle)
 
typedef VOID(STDCALLPFN_POX_UNREGISTER_DEVICE) (__in POHANDLE Handle)
 
typedef VOID(STDCALLPFN_POX_ACTIVATE_COMPONENT) (__in POHANDLE Handle, __in ULONG Component, __in ULONG Flags)
 
typedef VOID(STDCALLPFN_POX_IDLE_COMPONENT) (__in POHANDLE Handle, __in ULONG Component, __in ULONG Flags)
 
typedef VOID(STDCALLPFN_POX_REPORT_DEVICE_POWERED_ON) (__in POHANDLE Handle)
 
typedef VOID(STDCALLPFN_POX_COMPLETE_IDLE_STATE) (__in POHANDLE Handle, __in ULONG Component)
 
typedef VOID(STDCALLPFN_POX_COMPLETE_IDLE_CONDITION) (__in POHANDLE Handle, __in ULONG Component)
 
typedef VOID(STDCALLPFN_POX_COMPLETE_DEVICE_POWER_NOT_REQUIRED) (__in POHANDLE Handle)
 
typedef VOID(STDCALLPFN_POX_SET_DEVICE_IDLE_TIMEOUT) (__in POHANDLE Handle, __in ULONGLONG IdleTimeout)
 
typedef VOID(STDCALLPFN_IO_REPORT_INTERRUPT_ACTIVE) (_In_ PIO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS Parameters)
 
typedef VOID(STDCALLPFN_IO_REPORT_INTERRUPT_INACTIVE) (_In_ PIO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS Parameters)
 
typedef VOID(STDCALLPFN_VF_CHECK_NX_POOL_TYPE) (_In_ POOL_TYPE PoolType, _In_ PVOID CallingAddress, _In_ ULONG PoolTag)
 
typedef struct _FX_DRIVER_TRACKER_CACHE_AWARE FX_DRIVER_TRACKER_CACHE_AWARE
 
typedef struct _FX_DRIVER_TRACKER_CACHE_AWAREPFX_DRIVER_TRACKER_CACHE_AWARE
 

Functions

VOID FxRegisterBugCheckCallback (__inout PFX_DRIVER_GLOBALS FxDriverGlobals, __in PDRIVER_OBJECT DriverObject)
 
VOID FxUnregisterBugCheckCallback (__inout PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID FxInitializeBugCheckDriverInfo ()
 
VOID FxUninitializeBugCheckDriverInfo ()
 
VOID FxCacheBugCheckDriverInfo (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID FxPurgeBugCheckDriverInfo (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
__inline VOID FX_TRACK_DRIVER (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ __inline PVOID FxAllocateFromNPagedLookasideListNoTracking (__in PNPAGED_LOOKASIDE_LIST Lookaside)
 
__inline VOID FxFreeToNPagedLookasideListNoTracking (__in PNPAGED_LOOKASIDE_LIST Lookaside, __in PVOID Entry)
 
__inline PVOID FxAllocateFromNPagedLookasideList (_In_ PNPAGED_LOOKASIDE_LIST Lookaside, _In_opt_ size_t ElementSize=0)
 
__inline VOID FxFreeToNPagedLookasideList (__in PNPAGED_LOOKASIDE_LIST Lookaside, __in PVOID Entry)
 
_Must_inspect_result_ __inline PVOID FxAllocateFromPagedLookasideList (__in PPAGED_LOOKASIDE_LIST Lookaside)
 
__inline VOID FxFreeToPagedLookasideList (__in PPAGED_LOOKASIDE_LIST Lookaside, __in PVOID Entry)
 
_Must_inspect_result_ __inline BOOLEAN FxIsProcessorGroupSupported (VOID)
 

Variables

PCHAR WdfLdrType
 

Macro Definition Documentation

◆ DDI_ENTRY

#define DDI_ENTRY ( )

Definition at line 56 of file fxglobalskm.h.

◆ DDI_ENTRY_IMPERSONATION_OK

#define DDI_ENTRY_IMPERSONATION_OK ( )

Definition at line 55 of file fxglobalskm.h.

◆ NUM_MDLS_IN_INFO

#define NUM_MDLS_IN_INFO   (16)

Definition at line 47 of file fxglobalskm.h.

◆ WDF_LDR_STATIC_TYPE_STR

#define WDF_LDR_STATIC_TYPE_STR   "WdfStatic"

Definition at line 35 of file fxglobalskm.h.

Typedef Documentation

◆ FX_DRIVER_TRACKER_CACHE_AWARE

◆ PFN_INTERLOCKED_POP_ENTRY_SLIST

typedef PSLIST_ENTRY(FASTCALL * PFN_INTERLOCKED_POP_ENTRY_SLIST) (__inout PSLIST_HEADER ListHead)

Definition at line 144 of file fxglobalskm.h.

◆ PFN_INTERLOCKED_PUSH_ENTRY_SLIST

typedef PSLIST_ENTRY(FASTCALL * PFN_INTERLOCKED_PUSH_ENTRY_SLIST) (__inout PSLIST_HEADER ListHead, __inout PSLIST_ENTRY ListEntry)

Definition at line 150 of file fxglobalskm.h.

◆ PFN_IO_CONNECT_INTERRUPT

◆ PFN_IO_CONNECT_INTERRUPT_EX

typedef NTSTATUS(STDCALL * PFN_IO_CONNECT_INTERRUPT_EX) (__inout PIO_CONNECT_INTERRUPT_PARAMETERS Parameters)

Definition at line 98 of file fxglobalskm.h.

◆ PFN_IO_DISCONNECT_INTERRUPT

typedef VOID(STDCALL * PFN_IO_DISCONNECT_INTERRUPT) (__in PKINTERRUPT InterruptObject)

Definition at line 126 of file fxglobalskm.h.

◆ PFN_IO_DISCONNECT_INTERRUPT_EX

typedef NTSTATUS(STDCALL * PFN_IO_DISCONNECT_INTERRUPT_EX) (__in PIO_DISCONNECT_INTERRUPT_PARAMETERS Parameters)

Definition at line 104 of file fxglobalskm.h.

◆ PFN_IO_REPORT_INTERRUPT_ACTIVE

typedef VOID(STDCALL * PFN_IO_REPORT_INTERRUPT_ACTIVE) (_In_ PIO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS Parameters)

Definition at line 303 of file fxglobalskm.h.

◆ PFN_IO_REPORT_INTERRUPT_INACTIVE

typedef VOID(STDCALL * PFN_IO_REPORT_INTERRUPT_INACTIVE) (_In_ PIO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS Parameters)

Definition at line 309 of file fxglobalskm.h.

◆ PFN_IO_SET_COMPLETION_ROUTINE_EX

◆ PFN_IO_UNREGISTER_PLUGPLAY_NOTIFICATION_EX

typedef NTSTATUS(STDCALL * PFN_IO_UNREGISTER_PLUGPLAY_NOTIFICATION_EX) (__in PVOID NotificationEntry)

Definition at line 228 of file fxglobalskm.h.

◆ PFN_KD_REFRESH

typedef BOOLEAN(STDCALL * PFN_KD_REFRESH) ()

Definition at line 60 of file fxglobalskm.h.

◆ PFN_KE_ARE_APCS_DISABLED

typedef BOOLEAN(STDCALL * PFN_KE_ARE_APCS_DISABLED) (VOID)

Definition at line 216 of file fxglobalskm.h.

◆ PFN_KE_DEREGISTER_BUGCHECK_REASON_CALLBACK

typedef BOOLEAN(STDCALL * PFN_KE_DEREGISTER_BUGCHECK_REASON_CALLBACK) (__in PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecords)

Definition at line 92 of file fxglobalskm.h.

◆ PFN_KE_FLUSH_QUEUED_DPCS

typedef VOID(STDCALL * PFN_KE_FLUSH_QUEUED_DPCS) (VOID)

Definition at line 65 of file fxglobalskm.h.

◆ PFN_KE_GET_CURRENT_PROCESSOR_NUMBER

typedef ULONG(STDCALL * PFN_KE_GET_CURRENT_PROCESSOR_NUMBER) (VOID)

Definition at line 192 of file fxglobalskm.h.

◆ PFN_KE_GET_CURRENT_PROCESSOR_NUMBER_EX

typedef ULONG(STDCALL * PFN_KE_GET_CURRENT_PROCESSOR_NUMBER_EX) (__out_opt PPROCESSOR_NUMBER ProcNumber)

Definition at line 198 of file fxglobalskm.h.

◆ PFN_KE_GET_RECOMMENDED_SHARED_DATA_ALIGNMENT

typedef ULONG(STDCALL * PFN_KE_GET_RECOMMENDED_SHARED_DATA_ALIGNMENT) (VOID)

Definition at line 222 of file fxglobalskm.h.

◆ PFN_KE_QUERY_ACTIVE_PROCESSORS

typedef KAFFINITY(STDCALL * PFN_KE_QUERY_ACTIVE_PROCESSORS) (VOID)

Definition at line 169 of file fxglobalskm.h.

◆ PFN_KE_QUERY_MAXIMUM_PROCESSOR_COUNT

typedef ULONG(STDCALL * PFN_KE_QUERY_MAXIMUM_PROCESSOR_COUNT) (VOID)

Definition at line 210 of file fxglobalskm.h.

◆ PFN_KE_QUERY_MAXIMUM_PROCESSOR_COUNT_EX

typedef ULONG(STDCALL * PFN_KE_QUERY_MAXIMUM_PROCESSOR_COUNT_EX) (__in USHORT GroupNumber)

Definition at line 204 of file fxglobalskm.h.

◆ PFN_KE_REGISTER_BUGCHECK_REASON_CALLBACK

◆ PFN_KE_SET_COALESCABLE_TIMER

Definition at line 182 of file fxglobalskm.h.

◆ PFN_KE_SET_TARGET_PROCESSOR_DPC

typedef VOID(STDCALL * PFN_KE_SET_TARGET_PROCESSOR_DPC) (__in PRKDPC Dpc, __in CCHAR Number)

Definition at line 175 of file fxglobalskm.h.

◆ PFN_KF_LOWER_IRQL

typedef VOID(FASTCALL * PFN_KF_LOWER_IRQL) (__in KIRQL NewIrql)

Definition at line 138 of file fxglobalskm.h.

◆ PFN_KF_RAISE_IRQL

typedef KIRQL(FASTCALL * PFN_KF_RAISE_IRQL) (__in KIRQL NewIrql)

Definition at line 132 of file fxglobalskm.h.

◆ PFN_PO_GET_SYSTEM_WAKE

typedef BOOLEAN(STDCALL * PFN_PO_GET_SYSTEM_WAKE) (__in PIRP Irp)

Definition at line 157 of file fxglobalskm.h.

◆ PFN_PO_SET_SYSTEM_WAKE

typedef VOID(STDCALL * PFN_PO_SET_SYSTEM_WAKE) (__inout PIRP Irp)

Definition at line 163 of file fxglobalskm.h.

◆ PFN_POX_ACTIVATE_COMPONENT

typedef VOID(STDCALL * PFN_POX_ACTIVATE_COMPONENT) (__in POHANDLE Handle, __in ULONG Component, __in ULONG Flags)

Definition at line 254 of file fxglobalskm.h.

◆ PFN_POX_COMPLETE_DEVICE_POWER_NOT_REQUIRED

typedef VOID(STDCALL * PFN_POX_COMPLETE_DEVICE_POWER_NOT_REQUIRED) (__in POHANDLE Handle)

Definition at line 290 of file fxglobalskm.h.

◆ PFN_POX_COMPLETE_IDLE_CONDITION

typedef VOID(STDCALL * PFN_POX_COMPLETE_IDLE_CONDITION) (__in POHANDLE Handle, __in ULONG Component)

Definition at line 283 of file fxglobalskm.h.

◆ PFN_POX_COMPLETE_IDLE_STATE

typedef VOID(STDCALL * PFN_POX_COMPLETE_IDLE_STATE) (__in POHANDLE Handle, __in ULONG Component)

Definition at line 276 of file fxglobalskm.h.

◆ PFN_POX_IDLE_COMPONENT

typedef VOID(STDCALL * PFN_POX_IDLE_COMPONENT) (__in POHANDLE Handle, __in ULONG Component, __in ULONG Flags)

Definition at line 262 of file fxglobalskm.h.

◆ PFN_POX_REGISTER_DEVICE

typedef NTSTATUS(STDCALL * PFN_POX_REGISTER_DEVICE) (__in MdDeviceObject Pdo, __in PPO_FX_DEVICE PoxDevice, __out POHANDLE *Handle)

Definition at line 234 of file fxglobalskm.h.

◆ PFN_POX_REPORT_DEVICE_POWERED_ON

typedef VOID(STDCALL * PFN_POX_REPORT_DEVICE_POWERED_ON) (__in POHANDLE Handle)

Definition at line 270 of file fxglobalskm.h.

◆ PFN_POX_SET_DEVICE_IDLE_TIMEOUT

typedef VOID(STDCALL * PFN_POX_SET_DEVICE_IDLE_TIMEOUT) (__in POHANDLE Handle, __in ULONGLONG IdleTimeout)

Definition at line 296 of file fxglobalskm.h.

◆ PFN_POX_START_DEVICE_POWER_MANAGEMENT

typedef VOID(STDCALL * PFN_POX_START_DEVICE_POWER_MANAGEMENT) (__in POHANDLE Handle)

Definition at line 242 of file fxglobalskm.h.

◆ PFN_POX_UNREGISTER_DEVICE

typedef VOID(STDCALL * PFN_POX_UNREGISTER_DEVICE) (__in POHANDLE Handle)

Definition at line 248 of file fxglobalskm.h.

◆ PFN_VF_CHECK_NX_POOL_TYPE

typedef VOID(STDCALL * PFN_VF_CHECK_NX_POOL_TYPE) (_In_ POOL_TYPE PoolType, _In_ PVOID CallingAddress, _In_ ULONG PoolTag)

Definition at line 315 of file fxglobalskm.h.

◆ PFX_DRIVER_GLOBALS

Definition at line 38 of file fxglobalskm.h.

◆ PFX_DRIVER_TRACKER_CACHE_AWARE

◆ PFX_DUMP_DRIVER_INFO_ENTRY

Function Documentation

◆ FX_TRACK_DRIVER()

__inline VOID FX_TRACK_DRIVER ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 475 of file fxglobalskm.h.

478 {
479  if (FxDriverGlobals->FxTrackDriverForMiniDumpLog) {
480  FxLibraryGlobals.DriverTracker.TrackDriver(FxDriverGlobals);
481  }
482 }
FX_DRIVER_TRACKER_CACHE_AWARE DriverTracker
Definition: fxglobals.h:812
__inline VOID TrackDriver(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: fxglobalskm.h:386
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95

◆ FxAllocateFromNPagedLookasideList()

__inline PVOID FxAllocateFromNPagedLookasideList ( _In_ PNPAGED_LOOKASIDE_LIST  Lookaside,
_In_opt_ size_t  ElementSize = 0 
)

Definition at line 565 of file fxglobalskm.h.

589 {
590 
591  PVOID Entry;
592 
593  UNREFERENCED_PARAMETER(ElementSize);
594 
595  Lookaside->L.TotalAllocates += 1;
596 
597  Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead);
598 
599  if (Entry == NULL) {
600  Lookaside->L.AllocateMisses += 1;
601  Entry = (Lookaside->L.Allocate)(Lookaside->L.Type,
602  Lookaside->L.Size,
603  Lookaside->L.Tag);
604  }
605 
606  return Entry;
607 }
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
Definition: wdfmemory.h:407
struct _Entry Entry
Definition: kefuncs.h:627
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER ListHead)
Definition: interlocked.c:55
#define NULL
Definition: types.h:112
base of all file and directory entries
Definition: entries.h:82

Referenced by FxDmaScatterGatherTransaction::_Create(), FxNPagedLookasideList::Allocate(), FxPagedLookasideListFromPool::Allocate(), FxNPagedLookasideListFromPool::Allocate(), and FxDevice::AllocateRequestMemory().

◆ FxAllocateFromNPagedLookasideListNoTracking()

_Must_inspect_result_ __inline PVOID FxAllocateFromNPagedLookasideListNoTracking ( __in PNPAGED_LOOKASIDE_LIST  Lookaside)

Definition at line 487 of file fxglobalskm.h.

511 {
512 
513  PVOID Entry;
514 
515  Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead);
516 
517  if (Entry == NULL) {
518  Entry = (Lookaside->L.Allocate)(Lookaside->L.Type,
519  Lookaside->L.Size,
520  Lookaside->L.Tag);
521  }
522 
523  return Entry;
524 }
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
Definition: wdfmemory.h:407
struct _Entry Entry
Definition: kefuncs.h:627
PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER ListHead)
Definition: interlocked.c:55
#define NULL
Definition: types.h:112
base of all file and directory entries
Definition: entries.h:82

Referenced by FxDevice::AllocateRequestMemory().

◆ FxAllocateFromPagedLookasideList()

_Must_inspect_result_ __inline PVOID FxAllocateFromPagedLookasideList ( __in PPAGED_LOOKASIDE_LIST  Lookaside)

Definition at line 652 of file fxglobalskm.h.

675 {
676 
677  PVOID Entry;
678 
679  Lookaside->L.TotalAllocates += 1;
680 
681  Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead);
682  if (Entry == NULL) {
683  Lookaside->L.AllocateMisses += 1;
684  Entry = (Lookaside->L.Allocate)(Lookaside->L.Type,
685  Lookaside->L.Size,
686  Lookaside->L.Tag);
687  }
688 
689  return Entry;
690 }
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
Definition: wdfmemory.h:407
struct _Entry Entry
Definition: kefuncs.h:627
PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER ListHead)
Definition: interlocked.c:55
#define NULL
Definition: types.h:112
base of all file and directory entries
Definition: entries.h:82

Referenced by FxPagedLookasideListFromPool::Allocate().

◆ FxCacheBugCheckDriverInfo()

VOID FxCacheBugCheckDriverInfo ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 781 of file fxbugcheckcallback.cpp.

784 {
785  KIRQL irql;
786  PFX_DUMP_DRIVER_INFO_ENTRY driverInfo = NULL;
787  PFX_DUMP_DRIVER_INFO_ENTRY oldDriverInfo = NULL;
788  ULONG newCount = 0;
789 
790  //
791  // Clear driver index (0-based). Drivers do not use index 0.
792  //
793  FxDriverGlobals->BugCheckDriverInfoIndex = 0;
794 
796  return;
797  }
798 
800 
801  //
802  // Make sure we have enough space, else allocate some more memory.
803  //
806 
807  //
808  // Just exit if no more space in dump buffer.
809  //
812  ASSERT(FALSE);
813  goto Done;
814  }
815 
818 
819  //
820  // Allocate new buffer to hold driver info.
821  //
823  NonPagedPool,
824  sizeof(FX_DUMP_DRIVER_INFO_ENTRY)* newCount,
825  FX_TAG);
826 
827  if (NULL == driverInfo) {
828  goto Done;
829  }
830 
831  //
832  // Copy data from old to new buffer.
833  //
834  RtlCopyMemory(driverInfo,
837  sizeof(FX_DUMP_DRIVER_INFO_ENTRY));
838  //
839  // Ok, replace global pointer and its count.
840  //
841  oldDriverInfo = FxLibraryGlobals.BugCheckDriverInfo;
844  driverInfo = NULL; // just in case.
845 
846  //
847  // Free old memory.
848  //
849  MxMemory::MxFreePool(oldDriverInfo);
850  oldDriverInfo = NULL;
851  }
852 
855  //
856  // Compute ptr to free entry.
857  //
858  driverInfo = FxLibraryGlobals.BugCheckDriverInfo +
860  //
861  // Cache some of this driver's info.
862  //
863  driverInfo->FxDriverGlobals = FxDriverGlobals;
864  driverInfo->Version = FxDriverGlobals->WdfBindInfo->Version;
865 
866  C_ASSERT(sizeof(driverInfo->DriverName) ==
867  sizeof(FxDriverGlobals->Public.DriverName));
868  RtlCopyMemory(driverInfo->DriverName,
869  FxDriverGlobals->Public.DriverName,
870  sizeof(driverInfo->DriverName));
871  driverInfo->DriverName[ARRAY_SIZE(driverInfo->DriverName) - 1] = '\0';
872 
873  //
874  // Cache this index for later when the driver is removed.
875  //
876  FxDriverGlobals->BugCheckDriverInfoIndex =
878 
879  //
880  // Update global index.
881  //
883 
884 Done:
885 
887 }
KIRQL irql
Definition: wave.h:1
PFX_DUMP_DRIVER_INFO_ENTRY BugCheckDriverInfo
Definition: fxglobals.h:791
ULONG BugCheckDriverInfoCount
Definition: fxglobals.h:785
Definition: fxbugcheck.h:81
static __inline VOID MxFreePool(__in PVOID Ptr)
Definition: mxmemorykm.h:41
struct _FX_DUMP_DRIVER_INFO_ENTRY * PFX_DUMP_DRIVER_INFO_ENTRY
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
static __inline PVOID MxAllocatePoolWithTag(__in POOL_TYPE PoolType, __in SIZE_T NumberOfBytes, __in ULONG Tag)
Definition: mxmemorykm.h:30
#define FX_TAG
Definition: fxmacros.hpp:155
#define FX_DUMP_DRIVER_INFO_INCREMENT
Definition: fxbugcheck.h:67
#define C_ASSERT(e)
Definition: intsafe.h:71
#define ASSERT(a)
Definition: mode.c:44
CHAR DriverName[WDF_DRIVER_GLOBALS_NAME_LEN]
Definition: fxbugcheck.h:84
WDF_VERSION Version
Definition: fxbugcheck.h:83
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95
ULONG BugCheckDriverInfoIndex
Definition: fxglobals.h:780
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
PFX_DRIVER_GLOBALS FxDriverGlobals
Definition: fxbugcheck.h:82
#define FX_MAX_DUMP_DRIVER_INFO_COUNT
Definition: fxbugcheck.h:73
MxLockNoDynam FxDriverGlobalsListLock
Definition: fxglobals.h:772

Referenced by FxInitialize().

◆ FxFreeToNPagedLookasideList()

__inline VOID FxFreeToNPagedLookasideList ( __in PNPAGED_LOOKASIDE_LIST  Lookaside,
__in PVOID  Entry 
)

Definition at line 611 of file fxglobalskm.h.

635 {
636  Lookaside->L.TotalFrees += 1;
637 
638  if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) {
639  Lookaside->L.FreeMisses += 1;
640  (Lookaside->L.Free)(Entry);
641 
642  }
643  else {
646  }
647 }
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
Definition: wdfmemory.h:407
#define PSLIST_ENTRY
Definition: rtltypes.h:134
FORCEINLINE USHORT ExQueryDepthSList(_In_ PSLIST_HEADER SListHead)
Definition: exfuncs.h:153
NTKERNELAPI PSLIST_ENTRY FASTCALL InterlockedPushEntrySList(IN PSLIST_HEADER ListHead, IN PSLIST_ENTRY ListEntry)
Definition: interlocked.c:82
base of all file and directory entries
Definition: entries.h:82

Referenced by FxLookasideList::_Reclaim(), FxDmaScatterGatherTransaction::Dispose(), FxDevice::FreeRequestMemory(), and FxNPagedLookasideListFromPool::ReclaimPool().

◆ FxFreeToNPagedLookasideListNoTracking()

__inline VOID FxFreeToNPagedLookasideListNoTracking ( __in PNPAGED_LOOKASIDE_LIST  Lookaside,
__in PVOID  Entry 
)

Definition at line 528 of file fxglobalskm.h.

553 {
554  if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) {
555  (Lookaside->L.Free)(Entry);
556  }
557  else {
560  }
561 }
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
Definition: wdfmemory.h:407
#define PSLIST_ENTRY
Definition: rtltypes.h:134
FORCEINLINE USHORT ExQueryDepthSList(_In_ PSLIST_HEADER SListHead)
Definition: exfuncs.h:153
NTKERNELAPI PSLIST_ENTRY FASTCALL InterlockedPushEntrySList(IN PSLIST_HEADER ListHead, IN PSLIST_ENTRY ListEntry)
Definition: interlocked.c:82
base of all file and directory entries
Definition: entries.h:82

Referenced by FxDevice::FreeRequestMemory().

◆ FxFreeToPagedLookasideList()

__inline VOID FxFreeToPagedLookasideList ( __in PPAGED_LOOKASIDE_LIST  Lookaside,
__in PVOID  Entry 
)

Definition at line 694 of file fxglobalskm.h.

718 {
719  Lookaside->L.TotalFrees += 1;
720 
721  if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) {
722  Lookaside->L.FreeMisses += 1;
723  (Lookaside->L.Free)(Entry);
724 
725  } else {
728  }
729 }
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
Definition: wdfmemory.h:407
#define PSLIST_ENTRY
Definition: rtltypes.h:134
FORCEINLINE USHORT ExQueryDepthSList(_In_ PSLIST_HEADER SListHead)
Definition: exfuncs.h:153
NTKERNELAPI PSLIST_ENTRY FASTCALL InterlockedPushEntrySList(IN PSLIST_HEADER ListHead, IN PSLIST_ENTRY ListEntry)
Definition: interlocked.c:82
base of all file and directory entries
Definition: entries.h:82

Referenced by FxPagedLookasideListFromPool::ReclaimPool().

◆ FxInitializeBugCheckDriverInfo()

VOID FxInitializeBugCheckDriverInfo ( )

Definition at line 627 of file fxbugcheckcallback.cpp.

628 {
630  UNICODE_STRING funcName;
631  PKBUGCHECK_REASON_CALLBACK_RECORD callbackRecord;
633  SIZE_T arraySize;
634  ULONG arrayCount;
635 
636 
637  callbackRecord = &FxLibraryGlobals.BugCheckCallbackRecord;
638  RtlZeroMemory(callbackRecord, sizeof(KBUGCHECK_REASON_CALLBACK_RECORD));
639 
643 
644 
645 
646 
647 
648 
649 
650 
651 
652 
653  //
654  // The KeRegisterBugCheckReasonCallback exists for xp sp1 and above. So
655  // check whether this function is defined on the current OS and register
656  // for the bugcheck callback only if this function is defined.
657  //
658  RtlInitUnicodeString(&funcName, L"KeRegisterBugCheckReasonCallback");
660  MmGetSystemRoutineAddress(&funcName);
661 
662  if (NULL == funcPtr) {
663  goto Done;
664  }
665 
667  arrayCount = FX_DUMP_DRIVER_INFO_INCREMENT;
668 
671  NonPagedPool,
672  arraySize,
673  FX_TAG);
674 
676  goto Done;
677  }
678 
680 
681  //
682  // Init first entry for the framework.
683  //
685  FxLibraryGlobals.BugCheckDriverInfo[0].Version.Major = __WDF_MAJOR_VERSION;
686  FxLibraryGlobals.BugCheckDriverInfo[0].Version.Minor = __WDF_MINOR_VERSION;
687  FxLibraryGlobals.BugCheckDriverInfo[0].Version.Build = __WDF_BUILD_NUMBER;
688 
692  WdfLdrType);
693 
694  if (!NT_SUCCESS(status)) {
695  ASSERT(FALSE);
697  }
698 
700 
701  //
702  // Initialize the callback record.
703  //
704  KeInitializeCallbackRecord(callbackRecord);
705 
706  //
707  // Register the bugcheck callback.
708  //
709  funcPtr(callbackRecord,
711  KbCallbackSecondaryDumpData,
712  (PUCHAR)WdfLdrType);
713 
714  ASSERT(callbackRecord->CallbackRoutine != NULL);
715 
716 Done:;
717 }
BOOLEAN(STDCALL * PFN_KE_REGISTER_BUGCHECK_REASON_CALLBACK)(__in PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecord, __in PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine, __in KBUGCHECK_CALLBACK_REASON Reason, __in PUCHAR Component)
Definition: fxglobalskm.h:83
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
#define KeInitializeCallbackRecord(CallbackRecord)
Definition: kefuncs.h:1399
PFX_DUMP_DRIVER_INFO_ENTRY BugCheckDriverInfo
Definition: fxglobals.h:791
ULONG BugCheckDriverInfoCount
Definition: fxglobals.h:785
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:156
struct _FX_DUMP_DRIVER_INFO_ENTRY * PFX_DUMP_DRIVER_INFO_ENTRY
WDF_BUILD_NUMBER Build
Definition: fxldr.h:124
#define FALSE
Definition: types.h:117
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
Definition: sysldr.c:3514
static __inline PVOID MxAllocatePoolWithTag(__in POOL_TYPE PoolType, __in SIZE_T NumberOfBytes, __in ULONG Tag)
Definition: mxmemorykm.h:30
#define FX_TAG
Definition: fxmacros.hpp:155
PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine
Definition: ketypes.h:299
#define FX_DUMP_DRIVER_INFO_INCREMENT
Definition: fxbugcheck.h:67
struct _FX_DUMP_DRIVER_INFO_ENTRY FX_DUMP_DRIVER_INFO_ENTRY
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
CHAR DriverName[WDF_DRIVER_GLOBALS_NAME_LEN]
Definition: fxbugcheck.h:84
WDF_MAJOR_VERSION Major
Definition: fxldr.h:122
static const WCHAR L[]
Definition: oid.c:1250
WDF_VERSION Version
Definition: fxbugcheck.h:83
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95
ULONG BugCheckDriverInfoIndex
Definition: fxglobals.h:780
ULONG_PTR SIZE_T
Definition: typedefs.h:80
KBUGCHECK_REASON_CALLBACK_ROUTINE FxpLibraryBugCheckCallback
#define NULL
Definition: types.h:112
PCHAR WdfLdrType
Definition: version.cpp:108
KBUGCHECK_REASON_CALLBACK_RECORD BugCheckCallbackRecord
Definition: fxglobals.h:796
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PFX_DRIVER_GLOBALS FxDriverGlobals
Definition: fxbugcheck.h:82
static SERVICE_STATUS status
Definition: service.c:31
WDF_MINOR_VERSION Minor
Definition: fxldr.h:123
Definition: ps.c:97

Referenced by FxLibraryGlobalsCommission().

◆ FxIsProcessorGroupSupported()

_Must_inspect_result_ __inline BOOLEAN FxIsProcessorGroupSupported ( VOID  )

Definition at line 734 of file fxglobalskm.h.

737 {
738  //
739  // Groups are supported in Win 7 and forward.
740  //
742 }
BOOLEAN ProcessorGroupSupport
Definition: fxglobals.h:798
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95

Referenced by FxInterrupt::AssignResources(), FxInterrupt::ConnectInternal(), FxInterrupt::DisconnectInternal(), FxInterrupt::ReportActive(), FxInterrupt::ReportInactive(), and FxInterrupt::SetPolicy().

◆ FxPurgeBugCheckDriverInfo()

VOID FxPurgeBugCheckDriverInfo ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 890 of file fxbugcheckcallback.cpp.

893 {
894  KIRQL irql;
895  PFX_DUMP_DRIVER_INFO_ENTRY driverInfo = NULL;
896  ULONG driverIndex = 0;
897  ULONG shiftCount = 0;
898  ULONG i = 0;
899 
901 
902  //
903  // Zero means 'not used'.
904  //
905  driverIndex = FxDriverGlobals->BugCheckDriverInfoIndex;
906  if (0 == driverIndex) {
907  goto Done;
908  }
909 
910  //
911  // Check if feature is not supported.
912  //
914  ASSERT(FALSE); // driverIndex > 0 with NULL array?
915  goto Done;
916  }
917 
918 
921 
922  //
923  // Index boundary validation.
924  //
925  if (driverIndex >= FxLibraryGlobals.BugCheckDriverInfoIndex) {
926  ASSERT(FALSE);
927  goto Done;
928  }
929 
930  //
931  // Compute ptr to driver info.
932  //
933  driverInfo = FxLibraryGlobals.BugCheckDriverInfo + driverIndex;
934 
935  //
936  // Double-check that this is the same driver.
937  //
938  if (driverInfo->FxDriverGlobals != FxDriverGlobals) {
939  ASSERT(FALSE);
940  goto Done;
941  }
942 
943  //
944  // Shift memory to fill hole and update global free index.
945  //
946  shiftCount = FxLibraryGlobals.BugCheckDriverInfoIndex - driverIndex - 1;
947  if (shiftCount > 0) {
948  RtlMoveMemory(driverInfo,
949  driverInfo + 1,
950  shiftCount * sizeof(FX_DUMP_DRIVER_INFO_ENTRY));
951  }
952 
954 
955  //
956  // Update cached index for all 'shifted' drivers.
957  //
958  for (i = driverIndex; i < FxLibraryGlobals.BugCheckDriverInfoIndex; ++i) {
960  BugCheckDriverInfoIndex--;
961  }
962 
963 Done:
964 
966 }
KIRQL irql
Definition: wave.h:1
PFX_DUMP_DRIVER_INFO_ENTRY BugCheckDriverInfo
Definition: fxglobals.h:791
ULONG BugCheckDriverInfoCount
Definition: fxglobals.h:785
Definition: fxbugcheck.h:81
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
#define ASSERT(a)
Definition: mode.c:44
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95
ULONG BugCheckDriverInfoIndex
Definition: fxglobals.h:780
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
PFX_DRIVER_GLOBALS FxDriverGlobals
Definition: fxbugcheck.h:82
MxLockNoDynam FxDriverGlobalsListLock
Definition: fxglobals.h:772

Referenced by FxDestroy().

◆ FxRegisterBugCheckCallback()

VOID FxRegisterBugCheckCallback ( __inout PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in PDRIVER_OBJECT  DriverObject 
)

Definition at line 428 of file fxbugcheckcallback.cpp.

432 {
433  UNICODE_STRING funcName;
434  PKBUGCHECK_REASON_CALLBACK_RECORD callbackRecord;
436  BOOLEAN enableDriverTracking;
437 
438  //
439  // If any problem during this setup, disable driver tracking.
440  //
441  enableDriverTracking = FxDriverGlobals->FxTrackDriverForMiniDumpLog;
442  FxDriverGlobals->FxTrackDriverForMiniDumpLog = FALSE;
443 
444  //
445  // Zero out callback record.
446  //
447  callbackRecord = &FxDriverGlobals->BugCheckCallbackRecord;
448  RtlZeroMemory(callbackRecord, sizeof(KBUGCHECK_REASON_CALLBACK_RECORD));
449 
450  //
451  // Get the Image base address and size before registering the bugcheck
452  // callbacks. If the image base address and size cannot be computed,
453  // then the bugcheck callbacks depend on these values being properly
454  // set.
455  //
456  FxDriverGlobals->ImageAddress = NULL;
457  FxDriverGlobals->ImageSize = 0;
458 
460  &FxDriverGlobals->ImageAddress,
461  &FxDriverGlobals->ImageSize))) {
462  goto Done;
463  }
464 
465 
466 
467 
468 
469 
470 
471 
472 
473 
474  //
475  // The KeRegisterBugCheckReasonCallback exists for xp sp1 and above. So
476  // check whether this function is defined on the current OS and register
477  // for the bugcheck callback only if this function is defined.
478  //
479  RtlInitUnicodeString(&funcName, L"KeRegisterBugCheckReasonCallback");
481  MmGetSystemRoutineAddress(&funcName);
482 
483  if (NULL == funcPtr) {
484  goto Done;
485  }
486 
487  //
488  // Register this driver with driver tracker.
489  //
490  if (enableDriverTracking) {
492  FxDriverGlobals))) {
493  FxDriverGlobals->FxTrackDriverForMiniDumpLog = TRUE;
494  }
495  }
496 
497  //
498  // Initialize the callback record.
499  //
500  KeInitializeCallbackRecord(callbackRecord);
501 
502  //
503  // Register the bugcheck callback.
504  //
505  funcPtr(callbackRecord,
507  KbCallbackSecondaryDumpData,
508  (PUCHAR)FxDriverGlobals->Public.DriverName);
509 
510  ASSERT(callbackRecord->CallbackRoutine != NULL);
511 
512 Done:;
513 }
BOOLEAN(STDCALL * PFN_KE_REGISTER_BUGCHECK_REASON_CALLBACK)(__in PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecord, __in PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine, __in KBUGCHECK_CALLBACK_REASON Reason, __in PUCHAR Component)
Definition: fxglobalskm.h:83
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
#define KeInitializeCallbackRecord(CallbackRecord)
Definition: kefuncs.h:1399
FX_DRIVER_TRACKER_CACHE_AWARE DriverTracker
Definition: fxglobals.h:812
#define FALSE
Definition: types.h:117
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
Definition: sysldr.c:3514
unsigned char BOOLEAN
PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine
Definition: ketypes.h:299
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
KBUGCHECK_REASON_CALLBACK_ROUTINE FxpBugCheckCallback
static const WCHAR L[]
Definition: oid.c:1250
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95
#define NULL
Definition: types.h:112
_Must_inspect_result_ NTSTATUS FxpGetImageBase(__in PDRIVER_OBJECT DriverObject, __out PVOID *ImageBase, __out PULONG ImageSize)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ NTSTATUS Register(__in PFX_DRIVER_GLOBALS FxDriverGlobals)

Referenced by FxInitialize().

◆ FxUninitializeBugCheckDriverInfo()

VOID FxUninitializeBugCheckDriverInfo ( )

Definition at line 720 of file fxbugcheckcallback.cpp.

721 {
722  UNICODE_STRING funcName;
723  PKBUGCHECK_REASON_CALLBACK_RECORD callbackRecord;
725 
726  //
727  // Deregister callback.
728  //
729 
730 
731 
732 
733 
734 
735 
736  callbackRecord = &FxLibraryGlobals.BugCheckCallbackRecord;
737  if (NULL == callbackRecord->CallbackRoutine) {
738  goto Done;
739  }
740 
741  //
742  // The KeDeregisterBugCheckReasonCallback exists for xp sp1 and above. So
743  // check whether this function is defined on the current OS and deregister
744  // from the bugcheck callback only if this function is defined.
745  //
746  RtlInitUnicodeString(&funcName, L"KeDeregisterBugCheckReasonCallback");
748  MmGetSystemRoutineAddress(&funcName);
749 
750  if (NULL == funcPtr) {
751  goto Done;
752  }
753 
754  funcPtr(callbackRecord);
755  callbackRecord->CallbackRoutine = NULL;
756 
757  //
758  // Release memory.
759  //
761  goto Done;
762  }
763 
764  //
765  // Dynamic KMDF framework is unloading, make sure there is only one entry
766  // left in the driver info array; the framework lib was using this entry
767  // to store its version.
768  //
770 
773 
776 
777 Done:;
778 }
PFX_DUMP_DRIVER_INFO_ENTRY BugCheckDriverInfo
Definition: fxglobals.h:791
ULONG BugCheckDriverInfoCount
Definition: fxglobals.h:785
static __inline VOID MxFreePool(__in PVOID Ptr)
Definition: mxmemorykm.h:41
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
Definition: sysldr.c:3514
BOOLEAN(STDCALL * PFN_KE_DEREGISTER_BUGCHECK_REASON_CALLBACK)(__in PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecords)
Definition: fxglobalskm.h:92
PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine
Definition: ketypes.h:299
#define ASSERT(a)
Definition: mode.c:44
static const WCHAR L[]
Definition: oid.c:1250
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95
ULONG BugCheckDriverInfoIndex
Definition: fxglobals.h:780
#define NULL
Definition: types.h:112
KBUGCHECK_REASON_CALLBACK_RECORD BugCheckCallbackRecord
Definition: fxglobals.h:796
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by FxLibraryGlobalsDecommission().

◆ FxUnregisterBugCheckCallback()

VOID FxUnregisterBugCheckCallback ( __inout PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 516 of file fxbugcheckcallback.cpp.

519 {
520  UNICODE_STRING funcName;
521  PKBUGCHECK_REASON_CALLBACK_RECORD callbackRecord;
523 
524  callbackRecord = &FxDriverGlobals->BugCheckCallbackRecord;
525  if (NULL == callbackRecord->CallbackRoutine) {
526  goto Done;
527  }
528 
529  //
530  // The KeDeregisterBugCheckReasonCallback exists for xp sp1 and above. So
531  // check whether this function is defined on the current OS and deregister
532  // from the bugcheck callback only if this function is defined.
533  //
534  RtlInitUnicodeString(&funcName, L"KeDeregisterBugCheckReasonCallback");
536  MmGetSystemRoutineAddress(&funcName);
537 
538  if (NULL == funcPtr) {
539  goto Done;
540  }
541 
542  funcPtr(callbackRecord);
543  callbackRecord->CallbackRoutine = NULL;
544 
545  //
546  // Deregister this driver with driver tracker.
547  //
548  if (FxDriverGlobals->FxTrackDriverForMiniDumpLog) {
549  FxLibraryGlobals.DriverTracker.Deregister(FxDriverGlobals);
550  }
551 
552 Done:;
553 }
VOID Deregister(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
FX_DRIVER_TRACKER_CACHE_AWARE DriverTracker
Definition: fxglobals.h:812
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
Definition: sysldr.c:3514
BOOLEAN(STDCALL * PFN_KE_DEREGISTER_BUGCHECK_REASON_CALLBACK)(__in PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecords)
Definition: fxglobalskm.h:92
PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine
Definition: ketypes.h:299
static const WCHAR L[]
Definition: oid.c:1250
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95
#define NULL
Definition: types.h:112
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by FxDestroy().

Variable Documentation

◆ WdfLdrType

PCHAR WdfLdrType

Definition at line 108 of file version.cpp.