26#if ((FX_CORE_MODE)==(FX_CORE_USER_MODE))
27#define FX_IS_USER_MODE (TRUE)
28#define FX_IS_KERNEL_MODE (FALSE)
29#elif ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
30#define FX_IS_USER_MODE (FALSE)
31#define FX_IS_KERNEL_MODE (TRUE)
123 if (fileObjInfo ==
NULL) {
127 "Couldn't create object FileObjectInfo, "
137 DeviceInit->FileObject.AutoForwardCleanupClose;
140 DeviceInit->FileObject.Callbacks.EvtDeviceFileCreate;
143 DeviceInit->FileObject.Callbacks.EvtFileCleanup;
146 DeviceInit->FileObject.Callbacks.EvtFileClose;
173 if (fileObjInfo ==
NULL) {
177 "Couldn't create object FileObjectInfo, "
263 BOOLEAN automaticLockingRequired;
269 automaticLockingRequired =
FALSE;
309 for (
next = FileObjInfoList->Blink;
310 next != FileObjInfoList;
327 execLevel = parentExecLevel;
342 synchScope = parentSynchScope;
353 "Driver 0x%p - Device 0x%p - synchronization scope: "
354 "%!WDF_SYNCHRONIZATION_SCOPE! should be"
355 "WdfSynchronizationScopeNone, %!STATUS!",
378 "WdfSynchronizationScopeQueue is not allowed on "
379 "FileObject, %!STATUS!",
415 "WdfSynchronizationScopeDevice or "
416 "WdfSynchronizationScopeInheritFromParent "
417 "allowed only if the parent WDFDEVICE 0x%p, "
418 "ExecutionLevel is passive, %!STATUS!",
424 automaticLockingRequired =
TRUE;
430 if (automaticLockingRequired) {
495 previousCxInfo =
NULL;
502 for (
next = FileObjInfoList->Blink;
503 next != FileObjInfoList;
542 "Driver 0x%p - WdfFileObjectCanBeOptional (%d) is not "
543 "compatible with wdf extension "
544 "Driver 0x%p - WdfFileObjectCanBeOptional (%d), %!STATUS!",
569 "Converting file object class for Driver 0x%p - Device 0x%p, "
620#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
621 if (
Init->Control.Flags != 0) {
684 "Unable to create an internal queue for creates for WDFDEVICE "
723 "Must have EvtIoDefault registered to receive "
724 "WdfRequestTypeCreate requests for WDFQUEUE 0x%p, "
725 "%!STATUS!", TargetQueue->GetObjectHandle(),
status);
737 "Another WDFQUEUE 0x%p is already configured for auto dispatching "
738 "create request, %!STATUS!",
779 "WDFDEVICE 0x%p !devobj 0x%p %!IRPMJ! IRP 0x%p",
849 WDFFILEOBJECT hwdfFO;
863 inCriticalRegion =
FALSE;
864 inDefaultQueue =
FALSE;
881 "Exclusive WDFDEVICE 0x%p, only one open handle is allowed",
936 "Could not create WDFFILEOBJECT for WDFDEVICE 0x%p, failing "
958 if (0 == attributes.
Size) {
976 "Couldn't allocate file object context 0x%p for "
977 "device 0x%p - driver 0x%p, %!STATUS!",
1068 "Could not create request for WDFDEVICE 0x%p, %!STATUS!",
1092 if (0 == attributes.
Size) {
1112 "Couldn't allocate request context for "
1113 "device 0x%p - driver 0x%p, %!STATUS!",
1128 Mx::MxEnterCriticalRegion();
1129 inCriticalRegion =
TRUE;
1152 "WDFDEVICE 0x%p cannot handle create request at or above "
1153 "dispatch-level, fail the Irp: 0x%p, %!STATUS!",
1169 "Couldn't forward request to the WDFQUEUE 0x%p, %!STATUS!",
1188 inDefaultQueue =
TRUE;
1251 if (inDefaultQueue) {
1261 "Couldn't forward request to the WDFQUEUE 0x%p, %!STATUS!",
1281 "Couldn't forward request to the WDFQUEUE 0x%p, %!STATUS!",
1375 if (inCriticalRegion) {
1376 Mx::MxLeaveCriticalRegion();
1392 Irp->CopyCurrentIrpStackLocationToNext();
1438 Irp->GetFileObject()
1576 WDFFILEOBJECT hwdfFO =
NULL;
1710 WDFFILEOBJECT hwdfFO =
NULL;
1733 isStreamFileObject =
TRUE;
1820#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1828 if (isStreamFileObject ==
FALSE) {
1842 if (acquiredRemLock) {
1880 lockAcquired =
FALSE;
1905 lockAcquired =
TRUE;
1925 "Unable to acquire remove lock while handling the close IRP"
1935 return lockAcquired;
2024 if (ExecutionLevel !=
NULL) {
2028 if (SynchronizationScope !=
NULL) {
#define InterlockedIncrement
#define InterlockedDecrement
BOOLEAN Invoke(__in WDFDEVICE Device, __in WDFREQUEST Request, __in_opt WDFFILEOBJECT FileObject)
PFN_WDFCX_DEVICE_FILE_CREATE Method
WDFDEVICE __inline GetHandle(VOID)
MdDeviceObject __inline GetAttachedDevice(VOID)
FxCallbackLock * GetCallbackLockPtr(__out_opt FxObject **LockObject)
VOID GetConstraints(__out_opt WDF_EXECUTION_LEVEL *ExecutionLevel, __out_opt WDF_SYNCHRONIZATION_SCOPE *SynchronizationScope)
MdDeviceObject __inline GetDeviceObject(VOID)
__inline BOOLEAN IsPnp(VOID)
__inline BOOLEAN IsExclusive(VOID)
__inline PWDF_OBJECT_ATTRIBUTES GetRequestAttributes(VOID)
__inline FxDriver * GetCxDriver(__in FxCxDeviceInfo *CxDeviceInfo)
static FxWdmDeviceExtension * _GetFxWdmExtension(__in MdDeviceObject DeviceObject)
MdRemoveLock GetRemoveLock(VOID)
__inline BOOLEAN IsLegacy(VOID)
__inline BOOLEAN IsCxInIoPath(VOID)
__inline BOOLEAN IsFilter()
__inline VOID SetFileObjectClass(__in WDF_FILEOBJECT_CLASS FileObjectClass)
__inline WDF_FILEOBJECT_CLASS GetFileObjectClass(VOID)
VOID ControlDeviceDelete(VOID)
BOOLEAN m_AutoForwardCleanupClose
__inline WDFDRIVER GetHandle(VOID)
PFN_WDF_FILE_CLEANUP Method
void Invoke(__in_opt WDFFILEOBJECT FileObject)
void Invoke(__in_opt WDFFILEOBJECT FileObject)
PFN_WDF_FILE_CLOSE Method
VOID Invoke(__in WDFDEVICE Device, __in WDFREQUEST Request, __in_opt WDFFILEOBJECT FileObject)
PFN_WDF_DEVICE_FILE_CREATE Method
static _Must_inspect_result_ NTSTATUS _CreateFileObject(__in FxDevice *pDevice, __in MdIrp Irp, __in WDF_FILEOBJECT_CLASS FileObjectClass, __in_opt PWDF_OBJECT_ATTRIBUTES pObjectAttributes, __in_opt MdFileObject pWdmFileObject, __deref_out_opt FxFileObject **ppFxFileObject)
__inline VOID SetPkgCleanupCloseContext(PVOID Context)
VOID DeleteFileObjectFromFailedCreate(VOID)
__inline PVOID GetPkgCleanupCloseContext(VOID)
static _Must_inspect_result_ NTSTATUS _GetFileObjectFromWdm(__in FxDevice *pDevice, __in WDF_FILEOBJECT_CLASS FileObjectClass, __in_opt MdFileObject pWdmFileObject, __deref_out_opt FxFileObject **ppFxFileObject)
static VOID _DestroyFileObject(__in FxDevice *pDevice, __in WDF_FILEOBJECT_CLASS FileObjectClass, __in_opt MdFileObject pWdmFileObject)
__inline WDFFILEOBJECT GetHandle(VOID)
_Must_inspect_result_ NTSTATUS ForwardRequest(__in FxIoQueue *pDestQueue, __in FxRequest *pRequest)
_Must_inspect_result_ NTSTATUS QueueRequest(__in FxRequest *pRequest)
_Must_inspect_result_ NTSTATUS GetRequest(__in_opt MdFileObject FileObject, __in_opt FxRequest *TagRequest, __deref_out FxRequest **pOutRequest)
UCHAR GetMajorFunction(VOID)
VOID CompleteRequest(__in_opt CCHAR PriorityBoost=IO_NO_INCREMENT)
MdFileObject GetFileObject(VOID)
VOID SkipCurrentIrpStackLocation(VOID)
VOID PropagatePendingReturned(VOID)
VOID SetStatus(__in NTSTATUS Status)
VOID SetInformation(__in ULONG_PTR Information)
NTSTATUS CallDriver(__in MdDeviceObject DeviceObject)
void SetCallbackLockPtr(FxCallbackLock *Lock)
PVOID __inline GetObjectHandle(VOID)
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
VOID DeleteFromFailedCreate(VOID)
VOID MarkPassiveCallbacks(__in FxObjectLockState State=ObjectLock)
FxObject * m_CallbackLockObjectPtr
_Must_inspect_result_ NTSTATUS OnCleanup(__inout FxIrp *FxIrp)
_Must_inspect_result_ NTSTATUS ConfigureForwarding(__in FxIoQueue *FxQueue)
BOOLEAN CanDestroyControlDevice(VOID)
FxShutDown m_EvtDeviceShutdown
virtual _Must_inspect_result_ NTSTATUS Dispatch(__inout MdIrp Irp)
BOOLEAN AcquireRemoveLockForClose(__inout FxIrp *FxIrp)
VOID CreateCompleted(__in FxIrp *Irp)
_Must_inspect_result_ NTSTATUS ConfigureFileObjectClass(__in PLIST_ENTRY FileObjInfoList)
WDF_EXECUTION_LEVEL m_ExecutionLevel
FxCallbackLock * m_CallbackLockPtr
FxCallbackLock * GetCallbackLockPtrHelper(__deref_out_opt FxObject **LockObject)
_Must_inspect_result_ NTSTATUS Initialize(__in PWDFDEVICE_INIT DeviceInit)
_Must_inspect_result_ NTSTATUS ConfigureConstraints(__in PLIST_ENTRY FileObjInfoList)
static MdCompletionRoutineType _CreateCompletionRoutine
_Must_inspect_result_ NTSTATUS PostCreateDeviceInitialize(__in PWDFDEVICE_INIT Init)
VOID GetConstraintsHelper(__out_opt WDF_EXECUTION_LEVEL *ExecutionLevel, __out_opt WDF_SYNCHRONIZATION_SCOPE *SynchronizationScope)
VOID DecrementOpenHandleCount(VOID)
_Must_inspect_result_ NTSTATUS ForwardCreateRequest(__in FxIrp *FxIrp, __in MdCompletionRoutine CompletionRoutine, __in PVOID Context)
FxIoQueue * m_DefaultQueueForCreates
_Must_inspect_result_ NTSTATUS OnShutdown(__inout FxIrp *FxIrp)
LIST_ENTRY m_FileObjectInfoHeadList
WDF_SYNCHRONIZATION_SCOPE m_SynchronizationScope
static MdCompletionRoutineType _CreateCompletionRoutine2
FxPkgGeneral(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in CfxDevice *Device)
_Must_inspect_result_ NTSTATUS OnClose(__inout FxIrp *FxIrp)
FxIoQueue * m_DriverCreatedQueue
_Must_inspect_result_ NTSTATUS OnCreate(__inout FxIrp *FxIrp)
_Must_inspect_result_ NTSTATUS CreateQueue(__in PWDF_IO_QUEUE_CONFIG Config, __in PWDF_OBJECT_ATTRIBUTES QueueAttributes, __in_opt FxDriver *Caller, __deref_out FxIoQueue **ppQueue)
_Must_inspect_result_ NTSTATUS FlushAllQueuesByFileObject(__in MdFileObject FileObject)
__inline NTSTATUS Complete(__in NTSTATUS Status)
static _Must_inspect_result_ NTSTATUS _CreateForPackage(__in CfxDevice *Device, __in PWDF_OBJECT_ATTRIBUTES RequestAttributes, __in MdIrp Irp, __deref_out FxRequest **Request)
VOID Invoke(__in WDFDEVICE Device)
PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION m_Method
__inline VOID SetFileObject(_In_ MdFileObject FileObject)
static __inline NTSTATUS MxAcquireRemoveLock(__in MdRemoveLock RemoveLock, __in_opt PVOID Tag)
static __inline VOID MxReleaseRemoveLock(__in MdRemoveLock RemoveLock, __in PVOID Tag)
static __inline KIRQL MxGetCurrentIrql()
_In_ PTRANSFER_PACKET _In_ ULONG _In_ PIRP OriginalIrp
#define STATUS_NOT_SUPPORTED
#define NT_SUCCESS(StatCode)
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
PFX_DRIVER_GLOBALS fxDriverGlobals
BOOLEAN __inline FxIsFileObjectOptional(__in WDF_FILEOBJECT_CLASS FileObjectClass)
FX_TRACK_DRIVER(fxDriverGlobals)
FxVerifierDbgBreakPoint(pFxDriverGlobals)
_Must_inspect_result_ NTSTATUS FxObjectAllocateContext(__in FxObject *Object, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in BOOLEAN AllowCallbacksOnly, __deref_opt_out PVOID *Context)
#define FX_PKG_GENERAL_FLAG_CLIENT_INFO
#define FX_PKG_GENERAL_FLAG_CX_INFO
#define FX_PKG_GENERAL_FLAG_CLIENT_CREATE
#define FX_PKG_GENERAL_FLAG_CX_CREATE
#define FX_PKG_GENERAL_FLAG_CREATE
@ FX_TYPE_PACKAGE_GENERAL
GLuint GLuint GLsizei count
#define _Must_inspect_result_
PFILE_OBJECT MdFileObject
WUDF_IO_COMPLETION_ROUTINE * MdCompletionRoutine
#define UNREFERENCED_PARAMETER(P)
NTSTATUS NTAPI IoRegisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI IoRegisterLastChanceShutdownNotification(IN PDEVICE_OBJECT DeviceObject)
VOID NTAPI IoUnregisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
#define STATUS_NO_MORE_ENTRIES
static unsigned __int64 next
#define STATUS_MORE_PROCESSING_REQUIRED
#define TRACE_LEVEL_VERBOSE
#define TRACE_LEVEL_ERROR
#define TRACE_LEVEL_INFORMATION
WDFCX_FILEOBJECT_CONFIG Callbacks
WDF_TRI_STATE AutoForwardCleanupClose
WDF_FILEOBJECT_CLASS Class
WDF_OBJECT_ATTRIBUTES Attributes
WDF_OBJECT_ATTRIBUTES RequestAttributes
FxFileObjectFileCreate EvtFileCreate
WDF_FILEOBJECT_CLASS FileObjectClass
FxFileObjectFileClose EvtFileClose
FxFileObjectFileCleanup EvtFileCleanup
WDF_TRI_STATE AutoForwardCleanupClose
WDF_OBJECT_ATTRIBUTES Attributes
FxCxFileObjectFileCreate EvtCxFileCreate
FxCxDeviceInfo * CxDeviceInfo
ULONG RemoveLockOptionFlags
CxFileObjectInit FileObject
FxCxDeviceInfo * CxDeviceInfo
_Must_inspect_result_ BOOLEAN IsVersionGreaterThanOrEqualTo(__in ULONG Major, __in ULONG Minor)
_Must_inspect_result_ BOOLEAN IsVerificationEnabled(__in ULONG Major, __in ULONG Minor, __in FxVerifierDownlevelOption DownLevel)
struct _LIST_ENTRY * Blink
PFN_WDF_FILE_CLEANUP EvtFileCleanup
PFN_WDFCX_DEVICE_FILE_CREATE EvtCxDeviceFileCreate
PFN_WDF_FILE_CLOSE EvtFileClose
WDF_TRI_STATE PowerManaged
WDF_EXECUTION_LEVEL ExecutionLevel
WDF_SYNCHRONIZATION_SCOPE SynchronizationScope
#define LockObject(Object)
struct _LIST_ENTRY * PLIST_ENTRY
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFDEVICE Device
@ WdfDeviceLastChanceShutdown
_In_ PWDFDEVICE_INIT DeviceInit
_In_ PDEVICE_OBJECT DeviceObject
enum _WDF_FILEOBJECT_CLASS WDF_FILEOBJECT_CLASS
@ WDF_REMOVE_LOCK_OPTION_ACQUIRE_FOR_IO
@ WdfFileObjectNotRequired
@ WdfFileObjectWdfCannotUseFsContexts
@ WdfFileObjectCanBeOptional
FORCEINLINE VOID WDF_IO_QUEUE_CONFIG_INIT(_Out_ PWDF_IO_QUEUE_CONFIG Config, _In_ WDF_IO_QUEUE_DISPATCH_TYPE DispatchType)
@ WdfIoQueueDispatchManual
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
@ WdfSynchronizationScopeInheritFromParent
@ WdfSynchronizationScopeQueue
@ WdfSynchronizationScopeNone
@ WdfSynchronizationScopeDevice
@ WdfExecutionLevelPassive
@ WdfExecutionLevelDispatch
@ WdfExecutionLevelInheritFromParent
WDF_EXTERN_C_START enum _WDF_EXECUTION_LEVEL WDF_EXECUTION_LEVEL
enum _WDF_SYNCHRONIZATION_SCOPE WDF_SYNCHRONIZATION_SCOPE
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock