ReactOS 0.4.16-dev-401-g45b008d
FxDevice Class Reference

#include <fxdevice.hpp>

Inheritance diagram for FxDevice:
Collaboration diagram for FxDevice:

Public Member Functions

 FxDevice (__in FxDriver *ArgDriver)
 
 ~FxDevice (VOID)
 
_Must_inspect_result_ NTSTATUS DeleteDeviceFromFailedCreate (__in NTSTATUS FailedStatus, __in BOOLEAN UseStateMachine)
 
__inline FxPackageGetDispatchPackage (__in UCHAR MajorFunction)
 
MdRemoveLock GetRemoveLock (VOID)
 
MdDeviceObject __inline GetSafePhysicalDevice (VOID)
 
VOID SetInterruptThreadpool (_In_ FxInterruptThreadpool *Pool)
 
FxInterruptThreadpoolGetInterruptThreadpool (VOID)
 
_Must_inspect_result_ NTSTATUS DispatchPreprocessedIrp (__in MdIrp Irp, __in PVOID DispatchContext)
 
__inline WDF_DEVICE_IO_TYPE GetIoType (VOID)
 
__inline WDF_DEVICE_IO_TYPE GetIoTypeForReadWriteBufferAccess (VOID)
 
__inline CHAR GetDefaultPriorityBoost (VOID)
 
__inline WDF_FILEOBJECT_CLASS GetFileObjectClass (VOID)
 
__inline VOID SetFileObjectClass (__in WDF_FILEOBJECT_CLASS FileObjectClass)
 
VOID InstallPackage (__inout FxPackage *Package)
 
__inline WDF_DEVICE_PNP_STATE GetDevicePnpState ()
 
__inline WDF_DEVICE_POWER_STATE GetDevicePowerState ()
 
__inline WDF_DEVICE_POWER_POLICY_STATE GetDevicePowerPolicyState ()
 
__inline VOID SetDevicePnpState (__in WDF_DEVICE_PNP_STATE DeviceState)
 
__inline VOID SetDevicePowerState (__in WDF_DEVICE_POWER_STATE DeviceState)
 
__inline VOID SetDevicePowerPolicyState (__in WDF_DEVICE_POWER_POLICY_STATE DeviceState)
 
__inline BOOLEAN IsPnp (VOID)
 
__inline BOOLEAN IsLegacy (VOID)
 
__inline BOOLEAN IsExclusive (VOID)
 
__inline BOOLEAN IsFdo (VOID)
 
__inline FxPkgFdoGetFdoPkg (VOID)
 
__inline BOOLEAN IsPdo (VOID)
 
__inline FxPkgPdoGetPdoPkg (VOID)
 
_Must_inspect_result_ NTSTATUS CreateDevice (__in PWDFDEVICE_INIT DeviceInit)
 
__inline VOID SetParentWaitingOnRemoval (VOID)
 
VOID FinishInitializing (VOID)
 
VOID Destroy (VOID)
 
virtual VOID DeleteObject (VOID)
 
virtual BOOLEAN Dispose (VOID)
 
__inline PWDF_OBJECT_ATTRIBUTES GetRequestAttributes (VOID)
 
PVOID AllocateRequestMemory (__in_opt PWDF_OBJECT_ATTRIBUTES Attributes)
 
VOID FreeRequestMemory (__in FxRequest *Request)
 
virtual _Must_inspect_result_ NTSTATUS AddIoTarget (__inout FxIoTarget *IoTarget)
 
virtual VOID RemoveIoTarget (__inout FxIoTarget *IoTarget)
 
virtual _Must_inspect_result_ NTSTATUS AllocateEnumInfo (VOID)
 
virtual VOID AddChildList (__inout FxChildList *List)
 
virtual VOID RemoveChildList (__inout FxChildList *List)
 
virtual _Must_inspect_result_ NTSTATUS AllocateDmaEnablerList (VOID)
 
virtual VOID AddDmaEnabler (__inout FxDmaEnabler *Enabler)
 
virtual VOID RemoveDmaEnabler (__inout FxDmaEnabler *Enabler)
 
virtual FxIoTargetGetDefaultIoTarget (VOID)
 
FxIoTargetSelfGetSelfIoTarget (VOID)
 
virtual _Must_inspect_result_ NTSTATUS QueryInterface (__inout FxQueryInterfaceParams *Params)
 
__inline BOOLEAN IsFilter ()
 
_Must_inspect_result_ NTSTATUS SetFilter (__in BOOLEAN Value)
 
__inline BOOLEAN IsPowerPageableCapable (VOID)
 
_Must_inspect_result_ NTSTATUS Initialize (__in PWDFDEVICE_INIT DeviceInit, __in_opt PWDF_OBJECT_ATTRIBUTES DeviceAttributes)
 
VOID ConfigureAutoForwardCleanupClose (__in PWDFDEVICE_INIT DeviceInit)
 
_Must_inspect_result_ NTSTATUS PostInitialize (VOID)
 
_Must_inspect_result_ NTSTATUS PdoInitialize (__in PWDFDEVICE_INIT DeviceInit)
 
_Must_inspect_result_ NTSTATUS FdoInitialize (__in PWDFDEVICE_INIT DeviceInit)
 
_Must_inspect_result_ NTSTATUS ControlDeviceInitialize (__in PWDFDEVICE_INIT DeviceInit)
 
VOID ControlDeviceDelete (VOID)
 
_Must_inspect_result_ NTSTATUS OpenSettingsKey (__out HANDLE *Key, __in ACCESS_MASK DesiredAccess=STANDARD_RIGHTS_ALL)
 
VOID DeleteSymbolicLink (VOID)
 
__inline BYTE GetCallbackFlagsLocked (VOID)
 
__inline BYTE GetCallbackFlags (VOID)
 
__inline VOID SetCallbackFlagsLocked (__in BYTE Flags)
 
__inline VOID SetCallbackFlags (__in BYTE Flags)
 
__inline VOID ClearCallbackFlagsLocked (__in BYTE Flags)
 
__inline VOID ClearCallbackFlags (__in BYTE Flags)
 
FxCxDeviceInfoGetCxDeviceInfo (__in FxDriver *CxDriver)
 
__inline BOOLEAN IsCxDriverInIoPath (__in FxDriver *CxDriver)
 
__inline BOOLEAN IsCxInIoPath (VOID)
 
__inline FxDriverGetCxDriver (__in FxCxDeviceInfo *CxDeviceInfo)
 
BOOLEAN IsRemoveLockEnabledForIo (VOID)
 
VOID FxLogDeviceStartTelemetryEvent (VOID)
 
virtual VOID SetDeviceTelemetryInfoFlags (_In_ FxDeviceInfoFlags Flag)
 
USHORT GetDeviceTelemetryInfoFlags (VOID)
 
__inline CHAR GetStackSize (VOID)
 
__inline VOID SetStackSize (_In_ CHAR Size)
 
NTSTATUS UpdateInterruptThreadpoolLimits (VOID)
 
FxCmResListGetTranslatedResources ()
 
VOID DetachDevice (VOID)
 
VOID InvalidateDeviceState (VOID)
 
NTSTATUS CreateSymbolicLink (_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ PCUNICODE_STRING SymbolicLinkName)
 
VOID SetCleanupFromFailedCreate (BOOLEAN Value)
 
BOOLEAN IsInterfaceRegistered (_In_ const GUID *InterfaceClassGUID, _In_opt_ PCUNICODE_STRING RefString)
 
_Must_inspect_result_ NTSTATUS OpenDevicemapKeyWorker (_In_ PFX_DRIVER_GLOBALS pFxDriverGlobals, _In_ PCUNICODE_STRING KeyName, _In_ ACCESS_MASK DesiredAccess, _In_ FxRegKey *pKey)
 
_Must_inspect_result_ NTSTATUS AssignProperty (_In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ DEVPROPTYPE Type, _In_ ULONG BufferLength, _In_opt_ PVOID PropertyBuffer)
 
_Must_inspect_result_ NTSTATUS FxValidateInterfacePropertyData (_In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData)
 
VOID GetDeviceStackIoType (_Out_ WDF_DEVICE_IO_TYPE *ReadWriteIoType, _Out_ WDF_DEVICE_IO_TYPE *IoControlIoType)
 
__inline UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL GetRetrievalMode (VOID)
 
__inline WDF_DEVICE_IO_TYPE GetPreferredRWTransferMode (VOID)
 
__inline WDF_DEVICE_IO_TYPE GetPreferredIoctlTransferMode (VOID)
 
__inline ULONG GetDirectTransferThreshold (VOID)
 
NTSTATUS ProcessWmiPowerQueryOrSetData (_In_ RdWmiPowerAction Action, _Out_ BOOLEAN *QueryResult)
 
NTSTATUS NtStatusFromHr (_In_ HRESULT Hr)
 
IWudfDeviceStack * GetDeviceStack (VOID)
 
IWudfDeviceStack2 * GetDeviceStack2 (VOID)
 
VOID RetrieveDeviceRegistrySettings (VOID)
 
BOOLEAN IsDirectHardwareAccessAllowed ()
 
BOOLEAN IsInterruptAccessAllowed (VOID)
 
BOOLEAN AreRegistersMappedToUsermode (VOID)
 
PVOID GetPseudoAddressFromSystemAddress (__in PVOID SystemAddress)
 
PVOID GetSystemAddressFromPseudoAddress (__in PVOID PseudoAddress)
 
BOOL IsRegister (__in WDF_DEVICE_HWACCESS_TARGET_TYPE Type)
 
BOOL IsPort (__in WDF_DEVICE_HWACCESS_TARGET_TYPE Type)
 
BOOL IsBufferType (__in WDF_DEVICE_HWACCESS_TARGET_TYPE Type)
 
SIZE_T ReadRegister (__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register)
 
VOID ReadRegisterBuffer (__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __out_ecount_full(Count) PVOID Buffer, __in ULONG Count)
 
VOID WriteRegister (__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __in SIZE_T Value)
 
VOID WriteRegisterBuffer (__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __in_ecount(Count) PVOID Buffer, __in ULONG Count)
 
VOID RetrieveDeviceInfoRegistrySettings (_Out_ PCWSTR *GroupId, _Out_ PUMDF_DRIVER_REGSITRY_INFO DeviceRegInfo)
 
- Public Member Functions inherited from FxDeviceBase
NTSTATUS ConfigureConstraints (__in_opt PWDF_OBJECT_ATTRIBUTES ObjectAttributes)
 
VOID GetConstraints (__out_opt WDF_EXECUTION_LEVEL *ExecutionLevel, __out_opt WDF_SYNCHRONIZATION_SCOPE *SynchronizationScope)
 
FxCallbackLockGetCallbackLockPtr (__out_opt FxObject **LockObject)
 
__inline FxDriverGetDriver (VOID)
 
MdDeviceObject __inline GetDeviceObject (VOID)
 
__inline MxDeviceObjectGetMxDeviceObject (VOID)
 
ULONG __inline GetDeviceObjectFlags (VOID)
 
VOID __inline SetDeviceObjectFlags (_In_ ULONG Flags)
 
MdDeviceObject __inline GetAttachedDevice (VOID)
 
ULONG __inline GetAttachedDeviceObjectFlags (VOID)
 
MdDeviceObject __inline GetPhysicalDevice (VOID)
 
WDFDEVICE __inline GetHandle (VOID)
 
virtual _Must_inspect_result_ NTSTATUS AddIoTarget (__inout FxIoTarget *IoTarget)
 
virtual VOID RemoveIoTarget (__inout FxIoTarget *IoTarget)
 
virtual _Must_inspect_result_ NTSTATUS AllocateEnumInfo (VOID)
 
virtual VOID AddChildList (__inout FxChildList *List)
 
virtual VOID RemoveChildList (__inout FxChildList *List)
 
virtual _Must_inspect_result_ NTSTATUS AllocateDmaEnablerList (VOID)
 
virtual VOID AddDmaEnabler (__inout FxDmaEnabler *Enabler)
 
virtual VOID RemoveDmaEnabler (__inout FxDmaEnabler *Enabler)
 
virtual VOID SetDeviceTelemetryInfoFlags (_In_ FxDeviceInfoFlags Flag)
 
__inline _Must_inspect_result_ NTSTATUS AcquireDmaPacketTransaction (VOID)
 
__inline VOID ReleaseDmaPacketTransaction (VOID)
 
VOID AddToDisposeList (__inout FxObject *Object)
 
_Must_inspect_result_ NTSTATUS QueryInterface (__inout FxQueryInterfaceParams *Params)
 
_Must_inspect_result_ NTSTATUS QueryForInterface (__in const GUID *InterfaceType, __out PINTERFACE Interface, __in USHORT Size, __in USHORT Version, __in PVOID InterfaceSpecificData, __in_opt MdDeviceObject TargetDevice=NULL)
 
__inline MdDeviceObject GetAttachedDeviceReference (VOID)
 
virtual FxIoTargetGetDefaultIoTarget (VOID)
 
_Must_inspect_result_ NTSTATUS AllocateTarget (_Out_ FxIoTarget **Target, _In_ BOOLEAN SelfTarget)
 
- Public Member Functions inherited from FxNonPagedObject
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
virtual ~FxNonPagedObject (VOID)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_maxIRQL(DISPATCH_LEVEL) __drv_setsIRQL(DISPATCH_LEVEL) VOID Lock(__out __drv_deref(__drv_savesIRQL) PKIRQL PreviousIrql)
 
 _Releases_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID Unlock(__in __drv_restoresIRQL KIRQL PreviousIrql)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) VOID LockAtDispatch(VOID)
 
 _Requires_lock_held_ (this->m_NPLock.m_Lock) _Releases_lock_(this -> m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID UnlockFromDispatch(VOID)
 
- Public Member Functions inherited from FxObject
PVOID GetCOMWrapper ()
 
void SetCOMWrapper (__drv_aliasesMem PVOID Wrapper)
 
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
virtual ~FxObject (VOID)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType Type)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in USHORT ExtraSize=0)
 
VOID operator delete (__in PVOID Memory)
 
VOID SetNoContextHeader (VOID)
 
PVOID __inline GetObjectHandle (VOID)
 
__inline FxContextHeaderGetContextHeader (VOID)
 
__inline PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)
 
WDFTYPE GetType (VOID)
 
USHORT GetObjectSize (VOID)
 
LONG GetRefCnt (VOID)
 
FxTagTrackerGetTagTracker (VOID)
 
CfxDeviceGetDevice (VOID)
 
CfxDeviceBaseGetDeviceBase (VOID)
 
VOID SetDeviceBase (__in CfxDeviceBase *DeviceBase)
 
__inline VOID CallCleanup (VOID)
 
ULONG __inline AddRef (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG Release (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG AddRefOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG ReleaseOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual _Must_inspect_result_ NTSTATUS QueryInterface (__in FxQueryInterfaceParams *Params)
 
VOID MarkTraceState (VOID)
 
BOOLEAN __inline IsTraceState (VOID)
 
VOID __inline TraceDroppedEvent (__in FxObjectDroppedEvent Event)
 
VOID MarkPassiveDispose (__in FxObjectLockState State=ObjectLock)
 
VOID MarkPassiveCallbacks (__in FxObjectLockState State=ObjectLock)
 
VOID MarkForceDisposeThread (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsPassiveCallbacks (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsPassiveDispose (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsForceDisposeThread (__in BOOLEAN AcquireLock=TRUE)
 
VOID MarkCommitted (VOID)
 
BOOLEAN IsCommitted (VOID)
 
VOID MarkDisposeOverride (__in FxObjectLockState State=ObjectLock)
 
VOID MarkNoDeleteDDI (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsNoDeleteDDI (VOID)
 
_Must_inspect_result_ NTSTATUS Commit (__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
 
VOID DeleteFromFailedCreate (VOID)
 
VOID ClearEvtCallbacks (VOID)
 
BOOLEAN EarlyDispose (VOID)
 
virtual VOID DeleteObject (VOID)
 
virtual BOOLEAN Dispose (VOID)
 
_Must_inspect_result_ NTSTATUS AssignParentObject (__in FxObject *ParentObject)
 
_Must_inspect_result_ NTSTATUS AddContext (__in FxContextHeader *Header, __in PVOID *Context, __in PWDF_OBJECT_ATTRIBUTES Attributes)
 
_Must_inspect_result_ NTSTATUS RemoveParentAssignment (VOID)
 
_Must_inspect_result_ FxObjectGetParentObjectReferenced (__in PVOID Tag)
 
BOOLEAN IsDisposed (VOID)
 
- Public Member Functions inherited from IFxHasCallbacks
virtual VOID GetConstraints (__out WDF_EXECUTION_LEVEL *ExecutionLevel, __out WDF_SYNCHRONIZATION_SCOPE *SynchronizationScope)=0
 
virtual _Must_inspect_result_ FxCallbackLockGetCallbackLockPtr (__out_opt FxObject **LockObject)=0
 

Static Public Member Functions

static _Must_inspect_result_ NTSTATUS _Create (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDFDEVICE_INIT *DeviceInit, __in_opt PWDF_OBJECT_ATTRIBUTES DeviceAttributes, __out FxDevice **Device)
 
static FxDeviceRemLockAction __inline _RequiresRemLock (__in UCHAR MajorCode, __in UCHAR MinorCode)
 
static FxDeviceGetFxDevice (__in MdDeviceObject DeviceObject)
 
static _Must_inspect_result_ NTSTATUS STDCALL Dispatch (__in MdDeviceObject DeviceObject, __in MdIrp OriginalIrp)
 
static VOID DispatchUm (_In_ MdDeviceObject DeviceObject, _In_ MdIrp Irp, _In_opt_ IUnknown *Context)
 
static VOID DispatchWithLockUm (_In_ MdDeviceObject DeviceObject, _In_ MdIrp Irp, _In_opt_ IUnknown *Context)
 
static _Must_inspect_result_ NTSTATUS STDCALL DispatchWithLock (__in MdDeviceObject DeviceObject, __in MdIrp OriginalIrp)
 
static __inline CCHAR GetCxDriverIndex (__in FxCxDeviceInfo *CxDeviceInfo)
 
static __inline NTSTATUS _OpenDeviceRegistryKey (_In_ MdDeviceObject DeviceObject, _In_ ULONG DevInstKeyType, _In_ ACCESS_MASK DesiredAccess, _Out_ PHANDLE DevInstRegKey)
 
static __inline NTSTATUS _GetDeviceProperty (_In_ MdDeviceObject DeviceObject, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ ULONG BufferLength, _Out_opt_ PVOID PropertyBuffer, _Out_ PULONG ResultLength)
 
static _Must_inspect_result_ NTSTATUS _ValidateOpenKeyParams (_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device)
 
static _Must_inspect_result_ NTSTATUS _OpenKey (_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ ULONG DeviceInstanceKeyType, _In_ ACCESS_MASK DesiredAccess, _In_opt_ PWDF_OBJECT_ATTRIBUTES KeyAttributes, _Out_ WDFKEY *Key)
 
static _Must_inspect_result_ NTSTATUS _AllocAndQueryProperty (_In_ PFX_DRIVER_GLOBALS Globals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_opt_ MdDeviceObject RemotePdo, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ POOL_TYPE PoolType, _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes, _Out_ WDFMEMORY *PropertyMemory)
 
static _Must_inspect_result_ NTSTATUS _QueryProperty (_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_opt_ MdDeviceObject RemotePdo, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ ULONG BufferLength, _Out_opt_ PVOID PropertyBuffer, _Out_opt_ PULONG ResultLength)
 
static VOID STDCALL _InterfaceReferenceNoOp (__in_opt PVOID Context)
 
static VOID STDCALL _InterfaceDereferenceNoOp (__in_opt PVOID Context)
 
static FxWdmDeviceExtension_GetFxWdmExtension (__in MdDeviceObject DeviceObject)
 
static _Must_inspect_result_ NTSTATUS _AllocAndQueryPropertyEx (_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ POOL_TYPE PoolType, _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes, _Out_ WDFMEMORY *PropertyMemory, _Out_ PDEVPROPTYPE PropertyType)
 
static _Must_inspect_result_ NTSTATUS _QueryPropertyEx (_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ ULONG BufferLength, _Out_ PVOID PropertyBuffer, _Out_ PULONG ResultLength, _Out_ PDEVPROPTYPE PropertyType)
 
static VOID GetPreferredTransferMode (_In_ MdDeviceObject DeviceObject, _Out_ UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL *RetrievalMode, _Out_ WDF_DEVICE_IO_TYPE *RWPreference, _Out_ WDF_DEVICE_IO_TYPE *IoctlPreference)
 
static WUDF_INTERFACE_CONTEXT RemoteInterfaceArrival (_In_ IWudfDevice *DeviceObject, _In_ LPCGUID DeviceInterfaceGuid, _In_ PCWSTR SymbolicLink)
 
static void RemoteInterfaceRemoval (_In_ IWudfDevice *DeviceObject, _In_ WUDF_INTERFACE_CONTEXT RemoteInterfaceID)
 
static void PoFxDevicePowerRequired (_In_ MdDeviceObject DeviceObject)
 
static void PoFxDevicePowerNotRequired (_In_ MdDeviceObject DeviceObject)
 
static BOOL TransportQueryId (_In_ IWudfDevice *DeviceObject, _In_ DWORD Id, _In_ PVOID DataBuffer, _In_ SIZE_T cbDataBufferSize)
 
static NTSTATUS NtStatusFromHr (_In_ IWudfDeviceStack *DevStack, _In_ HRESULT Hr)
 
static ULONG __inline GetLength (__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size)
 
- Static Public Member Functions inherited from FxDeviceBase
static FxDeviceBase_SearchForDevice (__in FxObject *Object, __out_opt IFxHasCallbacks **Callbacks)
 
static FxDeviceBase_SearchForDevice (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes)
 
- Static Public Member Functions inherited from FxObject
static FxObject_FromDisposeEntry (__in PSINGLE_LIST_ENTRY Entry)
 
static FxObject_GetObjectFromHandle (__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
 
static PVOID __inline _ToHandle (__in FxObject *Object)
 
static VOID __inline _ReferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static VOID __inline _DereferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static PVOID _GetDebugBase (__in FxObject *Object)
 
static PFX_POOL_HEADER _CleanupPointer (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Object)
 
static _Must_inspect_result_ NTSTATUS _GetEffectiveLock (__in FxObject *Object, __in_opt IFxHasCallbacks *Callbacks, __in BOOLEAN AutomaticLocking, __in BOOLEAN PassiveCallbacks, __out FxCallbackLock **CallbackLock, __out_opt FxObject **CallbackLockObject)
 
static _Must_inspect_result_ NTSTATUS _ObjectQuery (_In_ FxObject *Object, _In_ CONST GUID *Guid, _In_ ULONG QueryBufferLength, _Out_writes_bytes_(QueryBufferLength) PVOID QueryBuffer)
 

Public Attributes

CfxDevicem_ParentDevice
 
UNICODE_STRING m_DeviceName
 
UNICODE_STRING m_SymbolicLinkName
 
UNICODE_STRING m_MofResourceName
 
BOOLEAN m_PdoKnown
 
BOOLEAN m_AutoForwardCleanupClose
 
BOOLEAN m_SelfIoTargetNeeded
 
WDF_FILEOBJECT_CLASS m_FileObjectClass
 
FxSpinLockTransactionedList m_IoTargetsList
 
LIST_ENTRY m_PreprocessInfoListHead
 
LIST_ENTRY m_CxDeviceInfoListHead
 
FxPkgIom_PkgIo
 
FxPkgPnpm_PkgPnp
 
FxPkgGeneralm_PkgGeneral
 
FxWmiIrpHandlerm_PkgWmi
 
FxDefaultIrpHandlerm_PkgDefault
 
BOOLEAN m_CleanupFromFailedCreate
 
FxMessageDispatchm_Dispatcher
 
IWudfDeviceStack * m_DevStack
 
HKEY m_PdoDevKey
 
PWSTR m_DeviceKeyPath
 
PWSTR m_KernelDeviceName
 
PWSTR m_DeviceInstanceId
 
UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL m_RetrievalMode
 
WDF_DEVICE_IO_TYPE m_IoctlIoType
 
ULONG m_DirectTransferThreshold
 
WDF_DIRECT_HARDWARE_ACCESS_TYPE m_DirectHardwareAccess
 
WDF_REGISTER_ACCESS_MODE_TYPE m_RegisterAccessMode
 
WDF_FILE_OBJECT_POLICY_TYPE m_FileObjectPolicy
 
WDF_FS_CONTEXT_USE_POLICY_TYPE m_FsContextUsePolicy
 
FxInterruptThreadpoolm_InteruptThreadpool
 
- Public Attributes inherited from FxDeviceBase
FxDisposeListm_DisposeList
 

Protected Attributes

LIST_ENTRY m_FileObjectListHead
 
NPAGED_LOOKASIDE_LIST m_RequestLookasideList
 
size_t m_RequestLookasideListElementSize
 
WDF_OBJECT_ATTRIBUTES m_RequestAttributes
 
- Protected Attributes inherited from FxDeviceBase
FxDriverm_Driver
 
MxDeviceObject m_DeviceObject
 
MxDeviceObject m_AttachedDevice
 
MxDeviceObject m_PhysicalDevice
 
FxCallbackLockm_CallbackLockPtr
 
FxObjectm_CallbackLockObjectPtr
 
WDF_EXECUTION_LEVEL m_ExecutionLevel
 
WDF_SYNCHRONIZATION_SCOPE m_SynchronizationScope
 
LONG m_DmaPacketTransactionStatus
 
- Protected Attributes inherited from FxObject
union {
   CfxDeviceBase *   m_DeviceBase
 
   CfxDevice *   m_Device
 
}; 
 

Private Member Functions

VOID SetInitialState (VOID)
 
_Must_inspect_result_ NTSTATUS PreprocessIrp (__in MdIrp Irp)
 
_Must_inspect_result_ NTSTATUS DeleteDeviceFromFailedCreateNoDelete (__in NTSTATUS FailedStatus, __in BOOLEAN UseStateMachine)
 
VOID SetFilterIoType (VOID)
 
VOID DestructorInternal (VOID)
 
NTSTATUS WmiPkgRegister (VOID)
 
VOID WmiPkgDeregister (VOID)
 
VOID WmiPkgCleanup (VOID)
 

Static Private Member Functions

static _Must_inspect_result_ NTSTATUS _AcquireOptinRemoveLock (__in MdDeviceObject DeviceObject, __in MdIrp Irp)
 

Private Attributes

WDF_DEVICE_PNP_STATE m_CurrentPnpState
 
WDF_DEVICE_POWER_STATE m_CurrentPowerState
 
WDF_DEVICE_POWER_POLICY_STATE m_CurrentPowerPolicyState
 
WDF_DEVICE_IO_TYPE m_ReadWriteIoType
 
BYTE m_CallbackFlags
 
BOOLEAN m_Filter
 
BOOLEAN m_PowerPageableCapable
 
BOOLEAN m_ParentWaitingOnChild
 
BOOLEAN m_Exclusive
 
BOOLEAN m_Legacy
 
BOOLEAN m_DeviceObjectDeleted
 
CHAR m_DefaultPriorityBoost
 
USHORT m_DeviceTelemetryInfoFlags
 

Static Private Attributes

static const CHAR m_PriorityBoosts []
 
static MdCompletionRoutineType _CompletionRoutineForRemlockMaintenance
 

Friends

class FxDriver
 
class FxIrp
 
class FxFileObject
 
class FxPkgPnp
 
VOID GetTriageInfo (VOID)
 

Additional Inherited Members

- Protected Member Functions inherited from FxDeviceBase
 FxDeviceBase (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxDriver *Driver, __in WDFTYPE Type, __in USHORT Size)
 
 ~FxDeviceBase (VOID)
 
VOID Init (__in MdDeviceObject DeviceObject, __in MdDeviceObject AttachedDevice, __in MdDeviceObject PhysicalDevice)
 
- Protected Member Functions inherited from FxObject
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
FxObjectDebugExtensionGetDebugExtension (VOID)
 
BOOLEAN IsDebug (VOID)
 
VOID AllocateTagTracker (__in WDFTYPE Type)
 
virtual VOID SelfDestruct (VOID)
 
PVOID __inline GetObjectHandleUnchecked (VOID)
 
VOID __inline DestroyChildren (VOID)
 
VOID DeleteEarlyDisposedObject (VOID)
 
- Static Protected Member Functions inherited from FxObject
static PVOID _GetBase (__in FxObject *Object)
 

Detailed Description

Definition at line 487 of file fxdevice.hpp.

Constructor & Destructor Documentation

◆ FxDevice()

FxDevice::FxDevice ( __in FxDriver ArgDriver)

Definition at line 143 of file fxdevice.cpp.

145 :
146 FxDeviceBase(ArgDriver->GetDriverGlobals(), ArgDriver, FX_TYPE_DEVICE, sizeof(FxDevice)),
148{
150}
CfxDevice * m_ParentDevice
Definition: fxdevice.hpp:569
VOID SetInitialState(VOID)
Definition: fxdevice.cpp:153
#define NULL
Definition: types.h:112
@ FX_TYPE_DEVICE
Definition: fxtypes.h:47

◆ ~FxDevice()

FxDevice::~FxDevice ( VOID  )

Definition at line 239 of file fxdevice.cpp.

240{
242
243 // Make it always present right now even on free builds
244 if (IsDisposed() == FALSE) {
247 "FxDevice 0x%p not disposed: this maybe a driver reference count "
248 "problem with WDFDEVICE %p", this, GetObjectHandleUnchecked());
249
253 (ULONG_PTR) this);
254 }
255
256 //
257 // Execute mode-specific destructor. Noop for KMDF, but does
258 // does detach and delete of UM device object for UMDF. Therefore
259 // can be done before other cleanup.
260 //
262
263 //
264 // If the device has been initialized but hasn't yet been
265 // destroyed, destroy it now.
266 //
267
268
269
270
271
272
273
275
277
278#if FX_CORE_MODE == FX_CORE_KERNEL_MODE
279 //
280 // Assert only applicable to KM because FxDevice can get destroyed in UMDF
281 // without going through normal pnp remove path, for example, when an
282 // AddDevice failure is done in reflector, after all um drivers have
283 // succeeded AddDevice. KMDF and host use fake remove irp to handle
284 // AddDevice failure in KMDF and host respectively, but reflector does not
285 // do that for AddDevice failure that happens in reflector.
286 // Note that symbolicName buffer will anyway be deleted in this destructor
287 // later on so the symbolic link buffer doesn't leak out.
288 //
290#endif
291
293
294 if (m_PkgIo != NULL) {
295 m_PkgIo->RELEASE(NULL);
296 m_PkgIo = NULL;
297 }
298
299 if (m_PkgPnp != NULL) {
300 m_PkgPnp->RELEASE(NULL);
301 m_PkgPnp = NULL;
302 }
303
304 if (m_PkgGeneral != NULL) {
305 m_PkgGeneral->RELEASE(NULL);
307 }
308
309 if (m_PkgWmi != NULL) {
310 m_PkgWmi->RELEASE(NULL);
311 m_PkgWmi = NULL;
312 }
313
314 if (m_PkgDefault != NULL) {
315 m_PkgDefault->RELEASE(NULL);
317 }
318
324 delete info;
325 }
326
332 delete info;
333 }
334
335 //
336 // Clean up any referenced objects
337 //
338 if (m_DeviceName.Buffer != NULL) {
341 }
342
344
348 }
349
350 //
351 // m_RequestLookasideListElementSize will be set to non zero if we have
352 // initialized the request lookaside list.
353 //
357 }
358
359 if (m_ParentDevice != NULL) {
360 m_ParentDevice->RELEASE(this);
361 }
362}
MxDeviceObject m_DeviceObject
Definition: fxdevice.hpp:471
size_t m_RequestLookasideListElementSize
Definition: fxdevice.hpp:653
FxWmiIrpHandler * m_PkgWmi
Definition: fxdevice.hpp:672
UNICODE_STRING m_DeviceName
Definition: fxdevice.hpp:578
VOID DeleteSymbolicLink(VOID)
VOID DestructorInternal(VOID)
Definition: fxdevicekm.cpp:390
FxDefaultIrpHandler * m_PkgDefault
Definition: fxdevice.hpp:673
NPAGED_LOOKASIDE_LIST m_RequestLookasideList
Definition: fxdevice.hpp:648
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
UNICODE_STRING m_MofResourceName
Definition: fxdevice.hpp:585
FxPkgGeneral * m_PkgGeneral
Definition: fxdevice.hpp:671
LIST_ENTRY m_PreprocessInfoListHead
Definition: fxdevice.hpp:630
FxPkgIo * m_PkgIo
Definition: fxdevice.hpp:669
UNICODE_STRING m_SymbolicLinkName
Definition: fxdevice.hpp:580
LIST_ENTRY m_CxDeviceInfoListHead
Definition: fxdevice.hpp:635
BOOLEAN IsDisposed(VOID)
Definition: fxobject.hpp:1241
PVOID __inline GetObjectHandleUnchecked(VOID)
Definition: fxobject.hpp:446
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
__inline MdDeviceObject GetObject(VOID)
static __inline VOID MxDeleteNPagedLookasideList(_In_ PNPAGED_LOOKASIDE_LIST LookasideList)
Definition: mxgeneralkm.h:433
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define FALSE
Definition: types.h:117
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition: wdfpool.cpp:361
#define FxVerifierBugCheck(FxDriverGlobals, Error,...)
Definition: fxverifier.h:58
#define ASSERT(a)
Definition: mode.c:44
static unsigned __int64 next
Definition: rand_nt.c:6
#define TRACE_LEVEL_FATAL
Definition: storswtr.h:26
Definition: typedefs.h:120
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
@ WDF_OBJECT_ERROR
Definition: wdfbugcodes.h:64

Member Function Documentation

◆ _AcquireOptinRemoveLock()

_Must_inspect_result_ NTSTATUS FxDevice::_AcquireOptinRemoveLock ( __in MdDeviceObject  DeviceObject,
__in MdIrp  Irp 
)
staticprivate

Definition at line 1296 of file fxdevice.cpp.

1300{
1302 FxIrp irp(Irp);
1303
1304 FxWdmDeviceExtension * wdmDeviceExtension =
1306
1307 if (wdmDeviceExtension->RemoveLockOptionFlags &
1309
1310 status = Mx::MxAcquireRemoveLock(&(wdmDeviceExtension->IoRemoveLock), Irp);
1311
1312 if (!NT_SUCCESS(status)) {
1313 return status;
1314 }
1315
1317
1322 TRUE,
1323 TRUE,
1324 TRUE
1325 );
1326
1328 }
1329
1330 return STATUS_SUCCESS;
1331}
LONG NTSTATUS
Definition: precomp.h:26
static MdCompletionRoutineType _CompletionRoutineForRemlockMaintenance
Definition: fxdevice.hpp:831
static FxWdmDeviceExtension * _GetFxWdmExtension(__in MdDeviceObject DeviceObject)
Definition: fxdevicekm.hpp:30
Definition: fxirp.hpp:28
VOID SetCompletionRoutineEx(__in MdDeviceObject DeviceObject, __in MdCompletionRoutine CompletionRoutine, __in PVOID Context, __in BOOLEAN InvokeOnSuccess=TRUE, __in BOOLEAN InvokeOnError=TRUE, __in BOOLEAN InvokeOnCancel=TRUE)
Definition: fxirpum.cpp:104
VOID SetNextIrpStackLocation(VOID)
Definition: fxirpum.cpp:1235
VOID CopyCurrentIrpStackLocationToNext(VOID)
Definition: fxirpum.cpp:209
static __inline NTSTATUS MxAcquireRemoveLock(__in MdRemoveLock RemoveLock, __in_opt PVOID Tag)
Definition: mxgeneralkm.h:268
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
FxIrp * irp
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG RemoveLockOptionFlags
Definition: fxdevice.hpp:38
WUDF_IO_REMOVE_LOCK IoRemoveLock
Definition: fxdevice.hpp:34
Definition: ps.c:97
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
@ WDF_REMOVE_LOCK_OPTION_ACQUIRE_FOR_IO
Definition: wdfdevice.h:1639

Referenced by DispatchWithLock().

◆ _AllocAndQueryProperty()

_Must_inspect_result_ NTSTATUS FxDevice::_AllocAndQueryProperty ( _In_ PFX_DRIVER_GLOBALS  Globals,
_In_opt_ PWDFDEVICE_INIT  DeviceInit,
_In_opt_ FxDevice Device,
_In_opt_ MdDeviceObject  RemotePdo,
_In_ DEVICE_REGISTRY_PROPERTY  DeviceProperty,
_In_ POOL_TYPE  PoolType,
_In_opt_ PWDF_OBJECT_ATTRIBUTES  PropertyMemoryAttributes,
_Out_ WDFMEMORY *  PropertyMemory 
)
static

Definition at line 1988 of file fxdevice.cpp.

1998{
2001 ULONG length = 0;
2002
2004 DeviceInit,
2005 Device,
2006 RemotePdo,
2008 0,
2009 NULL,
2010 &length);
2013 "Could not retrieve property %d length, %!STATUS!",
2016 return status;
2017 }
2018
2021 PoolType,
2022 Globals->Tag,
2023 length,
2024 &pMemory);
2025 if (!NT_SUCCESS(status)) {
2027 "Could not allocate WDFMEMORY, %!STATUS!", status);
2028 return status;
2029 }
2030
2032 DeviceInit,
2033 Device,
2034 RemotePdo,
2036 length,
2037 pMemory->GetBuffer(),
2038 &length);
2039 if (!NT_SUCCESS(status)) {
2041 "Could not query for full buffer, size %d, for "
2042 "property %d, %!STATUS!",
2045 return status;
2046 }
2047
2050
2051 if (!NT_SUCCESS(status)) {
2053 "Could not commit memory object, %!STATUS!",
2054 status);
2056 }
2057
2058 return status;
2059}
static _Must_inspect_result_ NTSTATUS _QueryProperty(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_opt_ MdDeviceObject RemotePdo, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ ULONG BufferLength, _Out_opt_ PVOID PropertyBuffer, _Out_opt_ PULONG ResultLength)
Definition: fxdevicekm.cpp:939
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS DriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in POOL_TYPE PoolType, __in ULONG PoolTag, __in size_t BufferSize, __out FxMemoryObject **Object)
virtual VOID DeleteObject(VOID)
_Must_inspect_result_ NTSTATUS Commit(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
Definition: fxobject.cpp:904
virtual PVOID GetBuffer(VOID)=0
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
FxMemoryObject * pMemory
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define _Analysis_assume_
Definition: no_sal2.h:388
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes
Definition: wdfdevice.h:3817
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFMEMORY * PropertyMemory
Definition: wdfdevice.h:3820
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
Definition: wdfdevice.h:3769

◆ _AllocAndQueryPropertyEx()

_Must_inspect_result_ NTSTATUS FxDevice::_AllocAndQueryPropertyEx ( _In_ PFX_DRIVER_GLOBALS  DriverGlobals,
_In_opt_ PWDFDEVICE_INIT  DeviceInit,
_In_opt_ FxDevice Device,
_In_ PVOID  PropertyData,
_In_ FxPropertyType FxPropertyType  ,
_In_ POOL_TYPE  PoolType,
_In_opt_ PWDF_OBJECT_ATTRIBUTES  PropertyMemoryAttributes,
_Out_ WDFMEMORY *  PropertyMemory,
_Out_ PDEVPROPTYPE  PropertyType 
)
static

Definition at line 2063 of file fxdevice.cpp.

2074{
2077 ULONG length = 0;
2078 DEVPROPTYPE propType;
2079 ULONG requiredLength;
2080
2082 DeviceInit,
2083 Device,
2086 0,
2087 NULL,
2088 &requiredLength,
2089 &propType);
2092 "Could not retrieve property, %!STATUS!",
2093 status);
2095 return status;
2096 }
2097
2099 *PropertyType = 0;
2100
2101 length = requiredLength;
2104 PoolType,
2105 DriverGlobals->Tag,
2106 length,
2107 &pMemory);
2108 if (!NT_SUCCESS(status)) {
2110 "Could not allocate WDFMEMORY, %!STATUS!", status);
2111 return status;
2112 }
2113
2115 DeviceInit,
2116 Device,
2119 length,
2120 pMemory->GetBuffer(),
2121 &requiredLength,
2122 &propType);
2123 if (!NT_SUCCESS(status)) {
2125 "Could not query for full buffer, size %d, for "
2126 "property, %!STATUS!",
2127 length, status);
2129 return status;
2130 }
2131
2134
2135 if (!NT_SUCCESS(status)) {
2137 "Could not commit memory object, %!STATUS!",
2138 status);
2140 }
2141 else {
2143 *PropertyType = propType;
2144 }
2145
2146 return status;
2147}
static _Must_inspect_result_ NTSTATUS _QueryPropertyEx(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ ULONG BufferLength, _Out_ PVOID PropertyBuffer, _Out_ PULONG ResultLength, _Out_ PDEVPROPTYPE PropertyType)
Definition: fxdevicekm.cpp:859
virtual WDFMEMORY GetHandle(VOID)
#define TRACINGPNP
Definition: dbgtrace.h:67
ULONG DEVPROPTYPE
Definition: devpropdef.h:24
FxPropertyType
Definition: fxdevice.hpp:85
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG _Out_ PDEVPROPTYPE PropertyType
DriverGlobals

◆ _Create()

_Must_inspect_result_ NTSTATUS FxDevice::_Create ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in PWDFDEVICE_INIT DeviceInit,
__in_opt PWDF_OBJECT_ATTRIBUTES  DeviceAttributes,
__out FxDevice **  Device 
)
static

Definition at line 366 of file fxdevice.cpp.

372{
377 PLIST_ENTRY pNext;
378 PWDFCXDEVICE_INIT pCxInit;
379 FxWdmDeviceExtension* wdmDeviceExtension;
380
381 *Device = NULL;
382 pInit = *DeviceInit;
383
384 pDevice = new (FxDriverGlobals, DeviceAttributes)
386
387 if (pDevice == NULL) {
389 goto Done;
390 }
391
393 if (!NT_SUCCESS(status)) {
394 goto Done;
395 }
396
397 switch (pInit->InitType) {
400 break;
401
404 break;
405
408 break;
409
410 default:
411 //
412 // Should not drop here
413 //
414 ASSERT(FALSE);
415 break;
416 }
417 if (!NT_SUCCESS(status)) {
418 goto Done;
419 }
420
421 //
422 // Ok, we have created the device. Now lets create a handle for it.
423 //
425 if (!NT_SUCCESS(status)) {
426 goto Done;
427 }
428
429 //
430 // Can't use the PDO's FxDevice m_Parent as the object hierarchy parent
431 // because the Fx object hierarchy lifetime rules do not match the
432 // rules for a pnp PDO lifetime vs its FDO.
433 //
435 &object,
436 pDevice->GetDriver());
437 if (!NT_SUCCESS(status)) {
438 goto Done;
439 }
440
441 //
442 // NOTE: ---> DO NOT FAIL FROM HERE FORWARD <---
443 //
444
445 //
446 // Up until now we have not reassigned any of the allocations in pInit
447 // and assigned them to the underlying objects. We are now at the point
448 // of "no return", ie we cannot fail. If we reassigned the allocations
449 // before this point and the driver retried to create the device (let's
450 // say with a different name), we would have freed those allocations
451 // and the driver writer would have thought that particular settings
452 // we valid, but were not b/c we freed them on error. So, to avoid a
453 // huge tracking mess, we only grab the allocations once we know for
454 // *sure* we are going to return success.
455 //
456 if (pInit->DeviceName != NULL) {
458 }
459
460 //
461 // Check for driver preprocess requirements.
462 //
463 if (pInit->PreprocessInfo != NULL) {
469
470 //
471 // If the driver is preprocessing requests on this device, they need
472 // their own stack location so that they can set their own completion
473 // routine.
474 //
476 }
477
478#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
479 wdmDeviceExtension = _GetFxWdmExtension(pDevice->GetDeviceObject());
480 if (wdmDeviceExtension->RemoveLockOptionFlags &
482 //
483 // We will use a completion routine for remlock maintenance
484 //
486 }
487
488 //
489 // Note: In case of UMDF StackSize is incremented prior to attaching
490 // the device to stack. See the comment in FxDeviceUm.cpp
491 //
494 }
495
496#else
497 UNREFERENCED_PARAMETER(wdmDeviceExtension);
498#endif
499
500 //
501 // Check for any class-extensions' preprocess requirements.
502 //
503 for (pNext = pInit->CxDeviceInitListHead.Flink;
504 pNext != &pInit->CxDeviceInitListHead;
505 pNext = pNext->Flink) {
506
507 pCxInit = CONTAINING_RECORD(pNext, WDFCXDEVICE_INIT, ListEntry);
508
509 if (pCxInit->PreprocessInfo != NULL) {
512 &pCxInit->PreprocessInfo->ListEntry);
513 pCxInit->PreprocessInfo = NULL;
514
515 //
516 // If the class extension is preprocessing requests on this
517 // device, it needs its own stack location so that it can
518 // set its own completion routine.
519 //
521 }
522 }
523
524 if (pDevice->IsPnp()) {
525 //
526 // Take all of the allocations out of pInit related to pnp. This
527 // will also transition the pnp state machine into the added state.
528 //
530 }
531
533
534 //
535 // Clear out the pointer, we freed it on behalf of the caller
536 //
537 *DeviceInit = NULL;
538
539 if (pInit->CreatedOnStack == FALSE) {
540 delete pInit;
541 }
542
543Done:
544 if (!NT_SUCCESS(status) && pDevice != NULL) {
545 //
546 // We want to propagate the original error code
547 //
549 pDevice = NULL;
550 }
551
552 *Device = pDevice;
553
554 return status;
555}
__inline FxDriver * GetDriver(VOID)
Definition: fxdevice.hpp:164
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174
__inline BOOLEAN IsPnp(VOID)
Definition: fxdevice.hpp:1200
__inline CHAR GetStackSize(VOID)
Definition: fxdevice.hpp:1824
_Must_inspect_result_ NTSTATUS Initialize(__in PWDFDEVICE_INIT DeviceInit, __in_opt PWDF_OBJECT_ATTRIBUTES DeviceAttributes)
Definition: fxdevice.cpp:663
_Must_inspect_result_ NTSTATUS PdoInitialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevicekm.cpp:221
_Must_inspect_result_ NTSTATUS PostInitialize(VOID)
Definition: fxdevice.cpp:940
BOOLEAN m_SelfIoTargetNeeded
Definition: fxdevice.hpp:611
_Must_inspect_result_ NTSTATUS FdoInitialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevicekm.cpp:33
__inline VOID SetStackSize(_In_ CHAR Size)
Definition: fxdevice.hpp:1833
_Must_inspect_result_ NTSTATUS DeleteDeviceFromFailedCreate(__in NTSTATUS FailedStatus, __in BOOLEAN UseStateMachine)
Definition: fxdevice.cpp:644
_Must_inspect_result_ NTSTATUS ControlDeviceInitialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevicekm.cpp:399
virtual VOID FinishInitialize(__inout PWDFDEVICE_INIT DeviceInit)
Definition: fxpkgpnp.cpp:1240
VOID __inline ReleaseString(__out PUNICODE_STRING ReleaseTo)
Definition: fxstring.hpp:47
#define InsertTailList(ListHead, Entry)
FxDevice * pDevice
@ FxDeviceInitTypeControlDevice
@ FxDeviceInitTypeFdo
@ FxDeviceInitTypePdo
PWDFDEVICE_INIT pInit
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
FxIrpPreprocessInfo * PreprocessInfo
FxString * DeviceName
FxDeviceInitType InitType
LIST_ENTRY CxDeviceInitListHead
FxDriver * Driver
BOOLEAN CreatedOnStack
FxIrpPreprocessInfo * PreprocessInfo
FxDevice * CreatedDevice
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _Inout_ PWDFDEVICE_INIT _In_opt_ PWDF_OBJECT_ATTRIBUTES DeviceAttributes
Definition: wdfdevice.h:3563

◆ _GetDeviceProperty()

__inline NTSTATUS FxDevice::_GetDeviceProperty ( _In_ MdDeviceObject  DeviceObject,
_In_ DEVICE_REGISTRY_PROPERTY  DeviceProperty,
_In_ ULONG  BufferLength,
_Out_opt_ PVOID  PropertyBuffer,
_Out_ PULONG  ResultLength 
)
static

Definition at line 1093 of file fxdeviceum.cpp.

1100{
1101 HRESULT hr;
1103
1104 DEVPROPTYPE propType;
1105 const DEVPROPKEY *propKey = NULL;
1106
1107 //
1108 // {cccccccc-cccc-cccc-cccc-cccccccccccc}
1109 // 2 brackets + 4 dashes + 32 characters + UNICODE_NULL
1110 //
1111 GUID guidBuffer = {0};
1112 ULONG guidChLen = 2 + 4 + 32 + 1;
1113 ULONG guidCbLen = guidChLen * sizeof(WCHAR);
1114 BOOLEAN convertGuidToString = FALSE;
1115
1117 ULONG bufferLen = BufferLength;
1118 ULONG resultLen = 0;
1119
1120 UMINT::WDF_PROPERTY_STORE_ROOT rootSpecifier;
1121 rootSpecifier.LengthCb = sizeof(UMINT::WDF_PROPERTY_STORE_ROOT);
1122 rootSpecifier.RootClass = UMINT::WdfPropertyStoreRootClassHardwareKey;
1123 rootSpecifier.Qualifier.HardwareKey.ServiceName = NULL;
1124
1125 //
1126 // Map DEVICE_REGISTRY_PROPERTY enums to DEVPROPKEYs
1127 //
1128 switch (DeviceProperty)
1129 {
1131 propKey = &DEVPKEY_Device_DeviceDesc;
1132 break;
1134 propKey = &DEVPKEY_Device_HardwareIds;
1135 break;
1137 propKey = &DEVPKEY_Device_CompatibleIds;
1138 break;
1140 ASSERTMSG("Not available in UMDF\n", FALSE);
1141 break;
1143 ASSERTMSG("Not available in UMDF\n", FALSE);
1144 break;
1146 propKey = &DEVPKEY_Device_Class;
1147 break;
1149 propKey = &DEVPKEY_Device_ClassGuid;
1150 convertGuidToString = TRUE;
1151 break;
1153 propKey = &DEVPKEY_NAME;
1154 break;
1156 propKey = &DEVPKEY_Device_Manufacturer;
1157 break;
1159 propKey = &DEVPKEY_Device_FriendlyName;
1160 break;
1162 propKey = &DEVPKEY_Device_LocationInfo;
1163 break;
1165 propKey = &DEVPKEY_Device_PDOName;
1166 break;
1168 propKey = &DEVPKEY_Device_BusTypeGuid;
1169 break;
1171 propKey = &DEVPKEY_Device_LegacyBusType;
1172 break;
1174 propKey = &DEVPKEY_Device_BusNumber;
1175 break;
1177 propKey = &DEVPKEY_Device_EnumeratorName;
1178 break;
1180 propKey = &DEVPKEY_Device_Address;
1181 break;
1183 propKey = &DEVPKEY_Device_UINumber;
1184 break;
1186 propKey = &DEVPKEY_Device_InstallState;
1187 break;
1189 propKey = &DEVPKEY_Device_RemovalPolicy;
1190 break;
1192 ASSERTMSG("Not available in UMDF\n", FALSE);
1193 break;
1195 ASSERTMSG("Not available in UMDF\n", FALSE);
1196 break;
1198 propKey = &DEVPKEY_Device_ContainerId;
1199 convertGuidToString = TRUE;
1200 break;
1201 }
1202
1203 FX_VERIFY(DRIVER(BadArgument, TODO), CHECK_NOT_NULL(propKey));
1204
1205 if (convertGuidToString)
1206 {
1207 buffer = &guidBuffer;
1208 bufferLen = sizeof(GUID);
1209 }
1210
1211 hr = ((IWudfDeviceStack*)DeviceStack)->GetUnifiedPropertyData(&rootSpecifier,
1212 propKey,
1213 0,
1214 0,
1215 bufferLen,
1216 &propType,
1217 &resultLen,
1218 buffer);
1219 if (S_OK == hr)
1220 {
1222
1223 //
1224 // Some DEVICE_REGISTRY_PROPERTY values are GUID strings,
1225 // while their DEVPROPKEY equivalents are GUID structs. To preserve
1226 // KMDF-UMDF DDI parity, we convert select GUID structs to wchar strings.
1227 //
1228 if (convertGuidToString)
1229 {
1230 if (PropertyBuffer == NULL || BufferLength < guidCbLen)
1231 {
1233 }
1234 else
1235 {
1237 guidChLen,
1238 L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
1239 guidBuffer.Data1, guidBuffer.Data2, guidBuffer.Data3,
1240 guidBuffer.Data4[0], guidBuffer.Data4[1],
1241 guidBuffer.Data4[2], guidBuffer.Data4[3],
1242 guidBuffer.Data4[4], guidBuffer.Data4[5],
1243 guidBuffer.Data4[6], guidBuffer.Data4[7]);
1244 if (hr != S_OK)
1245 {
1247 }
1248 }
1249 }
1250 }
1252 {
1254 }
1255 else
1256 {
1258 }
1259
1260 if (ResultLength)
1261 {
1262 *ResultLength = convertGuidToString ? guidCbLen : resultLen;
1263 }
1264
1265 return status;
1266}
unsigned char BOOLEAN
#define TODO
Definition: SAX2.c:44
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
FX_VERIFY(INTERNAL, CHECK_NOT_NULL(LoaderInterface->pIWudfHost))
GLuint buffer
Definition: glext.h:5915
#define S_OK
Definition: intsafe.h:52
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define L(x)
Definition: ntvdm.h:50
HRESULT hr
Definition: shlfolder.c:183
#define StringCchPrintf
Definition: strsafe.h:517
uint16_t * PWSTR
Definition: typedefs.h:56
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
Definition: wdfdevice.h:4437
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
@ DevicePropertyCompatibleIDs
Definition: iotypes.h:1197
@ DevicePropertyAddress
Definition: iotypes.h:1211
@ DevicePropertyEnumeratorName
Definition: iotypes.h:1210
@ DevicePropertyBootConfiguration
Definition: iotypes.h:1198
@ DevicePropertyResourceRequirements
Definition: iotypes.h:1215
@ DevicePropertyDriverKeyName
Definition: iotypes.h:1202
@ DevicePropertyInstallState
Definition: iotypes.h:1213
@ DevicePropertyClassGuid
Definition: iotypes.h:1201
@ DevicePropertyUINumber
Definition: iotypes.h:1212
@ DevicePropertyBusNumber
Definition: iotypes.h:1209
@ DevicePropertyBootConfigurationTranslated
Definition: iotypes.h:1199
@ DevicePropertyRemovalPolicy
Definition: iotypes.h:1214
@ DevicePropertyPhysicalDeviceObjectName
Definition: iotypes.h:1206
@ DevicePropertyLegacyBusType
Definition: iotypes.h:1208
@ DevicePropertyAllocatedResources
Definition: iotypes.h:1216
@ DevicePropertyManufacturer
Definition: iotypes.h:1203
@ DevicePropertyClassName
Definition: iotypes.h:1200
@ DevicePropertyFriendlyName
Definition: iotypes.h:1204
@ DevicePropertyContainerID
Definition: iotypes.h:1217
@ DevicePropertyLocationInformation
Definition: iotypes.h:1205
@ DevicePropertyHardwareID
Definition: iotypes.h:1196
@ DevicePropertyBusTypeGuid
Definition: iotypes.h:1207
@ DevicePropertyDeviceDescription
Definition: iotypes.h:1195
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by __deref_out_range(), _QueryProperty(), CreateSymbolicLink(), and FxGetDevicePropertyString().

◆ _GetFxWdmExtension()

__inline FxWdmDeviceExtension * FxDevice::_GetFxWdmExtension ( __in MdDeviceObject  DeviceObject)
static

Definition at line 30 of file fxdevicekm.hpp.

33{
34 //
35 // DeviceObject->DeviceExtension points to our FxDevice allocation. We
36 // get the underlying DeviceExtension allocated as part of the
37 // PDEVICE_OBJECT by adding the sizeof(DEVICE_OBJECT) to get the start
38 // of the DeviceExtension. This is documented behavior on how the
39 // DeviceExtension can be found.
40 //
42 sizeof(*DeviceObject));
43}
#define WDF_PTR_ADD_OFFSET(_ptr, _offset)
Definition: wdfcore.h:144

Referenced by _AcquireOptinRemoveLock(), _Create(), FxPkgGeneral::AcquireRemoveLockForClose(), CreateDevice(), FxWmiIrpHandler::Dispatch(), DispatchWithLock(), GetRemoveLock(), and IsRemoveLockEnabledForIo().

◆ _InterfaceDereferenceNoOp()

static VOID STDCALL FxDevice::_InterfaceDereferenceNoOp ( __in_opt PVOID  Context)
inlinestatic

Definition at line 1778 of file fxdevice.hpp.

1781 {
1782 // NoOp dereference stub for query interface
1784 }

Referenced by FxPkgPdo::HandleQueryInterfaceForReenumerate().

◆ _InterfaceReferenceNoOp()

static VOID STDCALL FxDevice::_InterfaceReferenceNoOp ( __in_opt PVOID  Context)
inlinestatic

Definition at line 1767 of file fxdevice.hpp.

1770 {
1771 // NoOp reference stub for query interface
1773 }

Referenced by FxPkgPdo::HandleQueryInterfaceForReenumerate().

◆ _OpenDeviceRegistryKey()

__inline NTSTATUS FxDevice::_OpenDeviceRegistryKey ( _In_ MdDeviceObject  DeviceObject,
_In_ ULONG  DevInstKeyType,
_In_ ACCESS_MASK  DesiredAccess,
_Out_ PHANDLE  DevInstRegKey 
)
static

Definition at line 1012 of file fxdeviceum.cpp.

1020{
1022 HRESULT hr;
1023
1024 UMINT::WDF_PROPERTY_STORE_ROOT root;
1025 UMINT::WDF_PROPERTY_STORE_RETRIEVE_FLAGS flags = UMINT::WdfPropertyStoreNormal;
1026 PWSTR subpath = NULL;
1027
1028
1029
1030
1031 #define WDF_REGKEY_DEVICE_SUBKEY 256
1032 #define WDF_REGKEY_DRIVER_SUBKEY 256
1033
1034 root.LengthCb = sizeof(UMINT::WDF_PROPERTY_STORE_ROOT);
1035
1037 {
1038 ASSERTMSG("Not available in UMDF\n", FALSE);
1039 }
1041 {
1042 root.RootClass = UMINT::WdfPropertyStoreRootClassHardwareKey;
1043
1045 {
1046 root.Qualifier.HardwareKey.ServiceName = DriverName;
1047 flags = UMINT::WdfPropertyStoreCreateIfMissing;
1048 }
1049 else
1050 {
1051 root.Qualifier.HardwareKey.ServiceName = WDF_PROPERTY_STORE_HARDWARE_KEY_ROOT;
1052 }
1053 }
1055 {
1056 root.RootClass = UMINT::WdfPropertyStoreRootClassSoftwareKey;
1057
1059 {
1060 subpath = DriverName;
1061 flags = UMINT::WdfPropertyStoreCreateIfMissing;
1062 }
1063 else
1064 {
1065 subpath = L"\\";
1066 }
1067 }
1069 {
1070 root.RootClass = UMINT::WdfPropertyStoreRootClassLegacyHardwareKey;
1071
1072 //
1073 // Legacy keys must always be opened volatile for UMDF
1074 //
1075 flags = UMINT::WdfPropertyStoreCreateVolatile;
1076
1077 subpath = NULL;
1078 root.Qualifier.LegacyHardwareKey.LegacyMapName = DriverName;
1079 }
1080
1081 hr = ((IWudfDeviceStack*)DeviceStack)->CreateRegistryEntry(&root,
1082 flags,
1084 subpath,
1086 NULL);
1087 status = FxDevice::NtStatusFromHr(DeviceStack, hr);
1088
1089 return status;
1090}
struct _root root
static NTSTATUS NtStatusFromHr(_In_ IWudfDeviceStack *DevStack, _In_ HRESULT Hr)
Definition: fxdeviceum.cpp:826
GLbitfield flags
Definition: glext.h:7161
#define FX_PLUGPLAY_REGKEY_DEVICEMAP
Definition: mxum.h:48
#define PLUGPLAY_REGKEY_DRIVER
Definition: usbd.c:42
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658
#define WDF_REGKEY_DRIVER_SUBKEY
Definition: wdfregistry.h:51
#define WDF_REGKEY_DEVICE_SUBKEY
Definition: wdfregistry.h:50
#define PLUGPLAY_REGKEY_CURRENT_HWPROFILE
Definition: iofuncs.h:2788
_In_ ULONG _In_ ACCESS_MASK _Out_ PHANDLE DevInstRegKey
Definition: iofuncs.h:1127
_In_ ULONG DevInstKeyType
Definition: iofuncs.h:1125
#define PLUGPLAY_REGKEY_DEVICE
Definition: iofuncs.h:2786

Referenced by _OpenKey(), and OpenSettingsKey().

◆ _OpenKey()

_Must_inspect_result_ NTSTATUS FxDevice::_OpenKey ( _In_ PFX_DRIVER_GLOBALS  FxDriverGlobals,
_In_opt_ PWDFDEVICE_INIT  DeviceInit,
_In_opt_ FxDevice Device,
_In_ ULONG  DeviceInstanceKeyType,
_In_ ACCESS_MASK  DesiredAccess,
_In_opt_ PWDF_OBJECT_ATTRIBUTES  KeyAttributes,
_Out_ WDFKEY *  Key 
)
static

Definition at line 731 of file fxdevicekm.cpp.

740{
741 FxRegKey* pKey;
742 WDFKEY keyHandle;
743 HANDLE hKey = NULL;
745 MdDeviceObject pdo;
746
748 if (!NT_SUCCESS(status)) {
749 return status;
750 }
751
753 if (!NT_SUCCESS(status)) {
754 return status;
755 }
756
757 status = _ValidateOpenKeyParams(FxDriverGlobals, DeviceInit, Device);
758 if (!NT_SUCCESS(status)) {
759 return status;
760 }
761
763
764 if (DeviceInit != NULL) {
765 pdo = DeviceInit->Fdo.PhysicalDevice;
766 }
767 else {
768 pdo = Device->GetSafePhysicalDevice();
769 if (pdo == NULL) {
770 //
771 // Pnp doesn't know about the PDO yet.
772 //
775 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
776 "WDFDEVICE %p is not yet known to PnP manager, cannot open "
777 "PNP registry keys in this state, %!STATUS!", Device->GetHandle(), status);
778 return status;
779 }
780 }
781
782 pKey = new(FxDriverGlobals, KeyAttributes) FxRegKey(FxDriverGlobals);
783
784 if (pKey == NULL) {
786 }
787
788 if (Device != NULL) {
790 }
791
793
794 if (NT_SUCCESS(status)) {
798 &hKey);
799 if (NT_SUCCESS(status)) {
801 *Key = keyHandle;
802 }
803 }
804
805 if (!NT_SUCCESS(status)) {
806 //
807 // No object is being returned, make sure the destroy callback will not
808 // be called.
809 //
811 }
812
813 return status;
814}
static _Must_inspect_result_ NTSTATUS _ValidateOpenKeyParams(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device)
Definition: fxdevice.cpp:2151
static __inline NTSTATUS _OpenDeviceRegistryKey(_In_ MdDeviceObject DeviceObject, _In_ ULONG DevInstKeyType, _In_ ACCESS_MASK DesiredAccess, _Out_ PHANDLE DevInstRegKey)
VOID SetDeviceBase(__in CfxDeviceBase *DeviceBase)
Definition: fxobject.hpp:797
VOID DeleteFromFailedCreate(VOID)
Definition: fxobject.cpp:391
__inline VOID SetHandle(__in HANDLE Key)
Definition: fxregkey.hpp:94
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
FxRegKey * pKey
WDFKEY keyHandle
FxAutoRegKey hKey
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK _In_opt_ PWDF_OBJECT_ATTRIBUTES KeyAttributes
Definition: wdfdevice.h:2660
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG DeviceInstanceKeyType
Definition: wdfdevice.h:2656

◆ _QueryProperty()

_Must_inspect_result_ NTSTATUS FxDevice::_QueryProperty ( _In_ PFX_DRIVER_GLOBALS  FxDriverGlobals,
_In_opt_ PWDFDEVICE_INIT  DeviceInit,
_In_opt_ FxDevice Device,
_In_opt_ MdDeviceObject  RemotePdo,
_In_ DEVICE_REGISTRY_PROPERTY  DeviceProperty,
_In_ ULONG  BufferLength,
_Out_opt_ PVOID  PropertyBuffer,
_Out_opt_ PULONG  ResultLength 
)
static

Definition at line 939 of file fxdevicekm.cpp.

949{
951 MdDeviceObject pdo;
952
953 ASSERT(DeviceInit != NULL || Device != NULL || RemotePdo != NULL);
954
955 if (RemotePdo != NULL) {
956 pdo = RemotePdo;
957 }
958 else {
961 Device);
962 if (!NT_SUCCESS(status)) {
963 return status;
964 }
965
966 if (DeviceInit != NULL) {
967 pdo = DeviceInit->Fdo.PhysicalDevice;
968 }
969 else {
970 pdo = Device->GetSafePhysicalDevice();
971 if (pdo == NULL) {
972 //
973 // Pnp doesn't know about the PDO yet.
974 //
977 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
978 "WDFDEVICE %p is not yet known to PnP manager, cannot query "
979 "device properties in this state, %!STATUS!", Device->GetHandle(), status);
980 return status;
981 }
982 }
983 }
984
990 return status;
991}
static __inline NTSTATUS _GetDeviceProperty(_In_ MdDeviceObject DeviceObject, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ ULONG BufferLength, _Out_opt_ PVOID PropertyBuffer, _Out_ PULONG ResultLength)

Referenced by _AllocAndQueryProperty().

◆ _QueryPropertyEx()

_Must_inspect_result_ NTSTATUS FxDevice::_QueryPropertyEx ( _In_ PFX_DRIVER_GLOBALS  DriverGlobals,
_In_opt_ PWDFDEVICE_INIT  DeviceInit,
_In_opt_ FxDevice Device,
_In_ PVOID  PropertyData,
_In_ FxPropertyType FxPropertyType  ,
_In_ ULONG  BufferLength,
_Out_ PVOID  PropertyBuffer,
_Out_ PULONG  ResultLength,
_Out_ PDEVPROPTYPE  PropertyType 
)
static

Definition at line 859 of file fxdevicekm.cpp.

870{
872 DEVPROPTYPE propType;
873 ULONG requiredLength = 0;
874 const DEVPROPKEY * propertyKey;
875 LCID lcid;
876 PWDF_DEVICE_PROPERTY_DATA deviceData;
877 MdDeviceObject pdo;
878
881
882 *ResultLength = 0;
883 *PropertyType = 0;
884
887 Device);
888 if (!NT_SUCCESS(status)) {
889 return status;
890 }
891
893
894 if (DeviceInit != NULL) {
895 pdo = DeviceInit->Fdo.PhysicalDevice;
896 }
897 else {
898 pdo = Device->GetSafePhysicalDevice();
899 if (pdo == NULL) {
900 //
901 // Pnp doesn't know about the PDO yet.
902 //
906 "WDFDEVICE %p is not yet known to PnP manager, cannot query "
907 "device properties in this state, %!STATUS!", Device->GetHandle(), status);
908 return status;
909 }
910 }
911
913 propertyKey = deviceData->PropertyKey;
914 lcid = deviceData->Lcid;
915
916 status = IoGetDevicePropertyData(pdo,
917 propertyKey,
918 lcid,
919 0,
922 &requiredLength,
923 &propType);
925 *ResultLength = requiredLength;
926 *PropertyType = propType;
927 }
928 else {
930 "Query for property buffer failed, %!STATUS!",
931 status);
932 }
933
934 return status;
935}
@ FxDeviceProperty
Definition: fxdevice.hpp:86
DWORD LCID
Definition: nls.h:13
_In_ const DEVPROPKEY * PropertyKey
Definition: wdfdevice.h:1912
struct _WDF_DEVICE_PROPERTY_DATA * PWDF_DEVICE_PROPERTY_DATA

Referenced by _AllocAndQueryPropertyEx().

◆ _RequiresRemLock()

static FxDeviceRemLockAction __inline FxDevice::_RequiresRemLock ( __in UCHAR  MajorCode,
__in UCHAR  MinorCode 
)
inlinestatic

Definition at line 933 of file fxdevice.hpp.

937 {
938 switch (MajorCode) {
939 //
940 // We require remove locks for power irps because they can show
941 // up after the device has been removed if the Power subysystem has
942 // taken a reference on the device object that raced with the
943 // remove irp (or if we are attached above the power policy owner
944 // and the power policy owner requests a power irp during remove
945 // processing.
946 //
947 // What it boils down to is that we do it for power because
948 // that is the only valid irp which can be sent with an outstanding
949 // reference w/out coordination to the device's pnp state. We
950 // assume that for all other irps, the sender has synchronized with
951 // the pnp state of the device.
952 //
953 // We also acquire the remove lock for WMI IRPs because they can
954 // come into the stack while we are processing a remove. For
955 // instance, a WMI irp can come into the stack to the attached
956 // device before it has a change to process the remove device and
957 // unregister with WMI.
958 //
959 // PNP irps can come in at any time as well. For instance, query
960 // device relations for removal or ejection relations can be sent
961 // at any time (and there are pnp stress tests which send them
962 // during remove).
963 //
964 case IRP_MJ_PNP:
965 //
966 // We special case remove device and only acquire the remove lock
967 // in the minor code handler itself. If handled remove device in
968 // the normal way and there was a preprocess routine for it, then
969 // we could deadlock if the irp was dispatched back to KMDF in the
970 // preprocess routine with an extra outstandling remlock acquire
971 // (which won't be released until the preprocess routine returns,
972 // which will be too late).
973 //
974 if (MinorCode == IRP_MN_REMOVE_DEVICE) {
976 }
977 case IRP_MJ_POWER:
980
981 default:
982#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
984#else
985 //
986 // There is no forseeable scenario where a UMDF driver would need to
987 // need to support remove lock for IO IRPs. While this ifdef can be safely
988 // removed and UMDF can also return FxDeviceRemLockOptIn, that is
989 // being avoided here so that the caller does not need to test the
990 // remove lock flags for IO which would never be set.
991 //
993#endif
994 }
995 }
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
@ FxDeviceRemLockRequired
Definition: fxdevice.hpp:80
@ FxDeviceRemLockTestValid
Definition: fxdevice.hpp:81
@ FxDeviceRemLockNotRequired
Definition: fxdevice.hpp:79
@ FxDeviceRemLockOptIn
Definition: fxdevice.hpp:82
#define IRP_MN_REMOVE_DEVICE
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MJ_POWER

Referenced by FxDefaultIrpHandler::Dispatch(), DispatchPreprocessedIrp(), DispatchWithLock(), FxDriver::Initialize(), and PreprocessIrp().

◆ _ValidateOpenKeyParams()

_Must_inspect_result_ NTSTATUS FxDevice::_ValidateOpenKeyParams ( _In_ PFX_DRIVER_GLOBALS  FxDriverGlobals,
_In_opt_ PWDFDEVICE_INIT  DeviceInit,
_In_opt_ FxDevice Device 
)
static

Definition at line 2151 of file fxdevice.cpp.

2156{
2158
2159 //
2160 // This function should be called with exactly one valid WDFDEVICE_INIT
2161 // or one valid FxDevice object. Supplying neither or both is an error.
2162 //
2163 if ((DeviceInit == NULL && Device == NULL) ||
2164 (DeviceInit != NULL && Device != NULL)) {
2165
2168 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
2169 "Device OpenKey/QueryProperty was called with invalid "
2170 "DeviceInit and Device parameters, %!STATUS!", status);
2171 FxVerifierDbgBreakPoint(FxDriverGlobals);
2172 }
2173
2174 return status;
2175}
FxVerifierDbgBreakPoint(pFxDriverGlobals)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

Referenced by _OpenKey(), _QueryProperty(), and _QueryPropertyEx().

◆ AddChildList()

VOID FxDevice::AddChildList ( __inout FxChildList List)
virtual

Reimplemented from FxDeviceBase.

Definition at line 431 of file fxdevicekm.cpp.

434{
435 if (IsPnp()) {
437 }
438}
VOID AddChildList(__in FxChildList *List)
Definition: fxpkgpnp.cpp:4970
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550

Referenced by FxChildList::Initialize().

◆ AddDmaEnabler()

VOID FxDevice::AddDmaEnabler ( __inout FxDmaEnabler Enabler)
virtual

Reimplemented from FxDeviceBase.

Definition at line 465 of file fxdevicekm.cpp.

468{
469 if (IsPnp()) {
470 m_PkgPnp->AddDmaEnabler(Enabler);
471 }
472}
VOID AddDmaEnabler(__in FxDmaEnabler *Enabler)
Definition: fxpkgpnpkm.cpp:277

◆ AddIoTarget()

_Must_inspect_result_ NTSTATUS FxDevice::AddIoTarget ( __inout FxIoTarget IoTarget)
virtual

Reimplemented from FxDeviceBase.

Definition at line 1772 of file fxdevice.cpp.

1775{
1777
1779 &IoTarget->m_TransactionedEntry);
1780
1781 if (NT_SUCCESS(status)) {
1782 IoTarget->m_AddedToDeviceList = TRUE;
1783 IoTarget->ADDREF(this);
1784 }
1785
1786 return status;
1787}
FxSpinLockTransactionedList m_IoTargetsList
Definition: fxdevice.hpp:623
NTSTATUS Add(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxTransactionedEntry *Entry)
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIOTARGET * IoTarget
Definition: wdfiotarget.h:368

◆ AllocateDmaEnablerList()

_Must_inspect_result_ NTSTATUS FxDevice::AllocateDmaEnablerList ( VOID  )
virtual

Reimplemented from FxDeviceBase.

Definition at line 452 of file fxdevicekm.cpp.

455{
456 if (IsPnp()) {
458 }
459 else {
460 return STATUS_SUCCESS;
461 }
462}
_Must_inspect_result_ NTSTATUS AllocateDmaEnablerList(VOID)
Definition: fxpkgpnpkm.cpp:241

◆ AllocateEnumInfo()

_Must_inspect_result_ NTSTATUS FxDevice::AllocateEnumInfo ( VOID  )
virtual

Reimplemented from FxDeviceBase.

Definition at line 1805 of file fxdevice.cpp.

1808{
1809 if (IsPnp()) {
1810 return m_PkgPnp->AllocateEnumInfo();
1811 }
1812 else {
1813 return STATUS_SUCCESS;
1814 }
1815}
_Must_inspect_result_ NTSTATUS AllocateEnumInfo(VOID)
Definition: fxpkgpnp.cpp:4920

◆ AllocateRequestMemory()

PVOID FxDevice::AllocateRequestMemory ( __in_opt PWDF_OBJECT_ATTRIBUTES  Attributes)

Definition at line 1630 of file fxdevice.cpp.

1659{
1661 PFX_POOL_TRACKER pTracker;
1663 PVOID ptr, pTrueBase;
1664
1666 ptr = NULL;
1667
1668 if (IsPdo() && GetPdoPkg()->IsForwardRequestToParentEnabled()) {
1670 }
1671 else {
1674 }
1675
1676 if (pTrueBase != NULL) {
1677 if (pGlobals->IsPoolTrackingOn()) {
1678 pTracker = (PFX_POOL_TRACKER) pTrueBase;
1679 pHeader = WDF_PTR_ADD_OFFSET_TYPE(pTrueBase,
1680 sizeof(FX_POOL_TRACKER),
1682
1683 //
1684 // Format and insert the Tracker in the NonPagedHeader list.
1685 //
1687 pTracker,
1689 pGlobals->Tag,
1690 _ReturnAddress());
1691 }
1692 else {
1693 pHeader = (PFX_POOL_HEADER) pTrueBase;
1694 }
1695
1696 //
1697 // Common init
1698 //
1699 pHeader->Base = pTrueBase;
1700 pHeader->FxDriverGlobals = pGlobals;
1701
1702 ptr = &pHeader->AllocationStart[0];
1703
1704 if (RequestAttributes == NULL) {
1706 }
1707
1709 pGlobals,
1710 ptr,
1711 COMPUTE_OBJECT_SIZE(sizeof(FxRequest), 0),
1714 );
1715
1716#if FX_VERBOSE_TRACE
1718 "Allocating FxRequest* %p, WDFREQUEST %p",
1719 ptr, _ToHandle((FxObject*) ptr));
1720#endif
1721 return ptr;
1722 }
1723
1724 return NULL;
1725}
WDF_OBJECT_ATTRIBUTES m_RequestAttributes
Definition: fxdevice.hpp:659
__inline BOOLEAN IsPdo(VOID)
Definition: fxdevice.hpp:1245
__inline FxPkgPdo * GetPdoPkg(VOID)
Definition: fxdevice.hpp:1254
static PVOID __inline _ToHandle(__in FxObject *Object)
Definition: fxobject.hpp:659
#define TRACINGREQUEST
Definition: dbgtrace.h:65
__inline PVOID FxAllocateFromNPagedLookasideList(_In_ PNPAGED_LOOKASIDE_LIST Lookaside, _In_opt_ size_t ElementSize=0)
Definition: fxglobalskm.h:565
_Must_inspect_result_ __inline PVOID FxAllocateFromNPagedLookasideListNoTracking(__in PNPAGED_LOOKASIDE_LIST Lookaside)
Definition: fxglobalskm.h:487
PVOID FxObjectAndHandleHeaderInit(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PVOID AllocationStart, __in USHORT ObjectSize, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in FxObjectType ObjectType)
Definition: handleapi.cpp:292
#define COMPUTE_OBJECT_SIZE(_rawObjectSize, _extraSize)
Definition: fxhandle.h:107
PFX_DRIVER_GLOBALS pGlobals
@ FxObjectTypeExternal
Definition: fxobject.hpp:120
FX_POOL_TRACKER * PFX_POOL_TRACKER
Definition: fxpool.h:109
FX_POOL_HEADER * PFX_POOL_HEADER
Definition: fxpool.h:51
VOID __inline FxPoolInsertNonPagedAllocateTracker(__in PFX_POOL Pool, __in PFX_POOL_TRACKER Tracker, __in SIZE_T Size, __in ULONG Tag, __in PVOID Caller)
FxContextHeader * pHeader
Definition: handleapi.cpp:604
#define _ReturnAddress()
Definition: intrin_arm.h:35
static PVOID ptr
Definition: dispmode.c:27
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
FX_POOL FxPoolFrameworks
Definition: fxglobals.h:388
BOOLEAN IsPoolTrackingOn(VOID)
Definition: fxglobals.h:215
#define WDF_PTR_ADD_OFFSET_TYPE(_ptr, _offset, _type)
Definition: wdfcore.h:141
_In_ PWDFDEVICE_INIT _In_ PWDF_OBJECT_ATTRIBUTES RequestAttributes
Definition: wdfdevice.h:3431

◆ AreRegistersMappedToUsermode()

BOOLEAN FxDevice::AreRegistersMappedToUsermode ( VOID  )
inline

Definition at line 2092 of file fxdevice.hpp.

2095 {
2096 return (m_RegisterAccessMode == WdfRegisterAccessUsingUserModeMapping);
2097 }
WDF_REGISTER_ACCESS_MODE_TYPE m_RegisterAccessMode
Definition: fxdevice.hpp:783

◆ AssignProperty()

NTSTATUS FxDevice::AssignProperty ( _In_ PVOID  PropertyData,
_In_ FxPropertyType FxPropertyType  ,
_In_ DEVPROPTYPE  Type,
_In_ ULONG  BufferLength,
_In_opt_ PVOID  PropertyBuffer 
)

Definition at line 668 of file fxdevicekm.cpp.

675{
677 const DEVPROPKEY * propertyKey;
678 LCID lcid;
679 ULONG flags;
680 PWDF_DEVICE_PROPERTY_DATA deviceData;
681 PDEVICE_OBJECT pdo;
682
684
686
688
689 propertyKey = deviceData->PropertyKey;
690 lcid = deviceData->Lcid;
691 flags = deviceData->Flags;
692
693 pdo = GetSafePhysicalDevice();
694
695 if (pdo == NULL) {
696 //
697 // Pnp doesn't know about the PDO yet.
698 //
702 "WDFDEVICE %p is not yet known to PnP manager, cannot call "
703 "WdfDeviceAssignPropertyEx in this state, %!STATUS!",
704 GetHandle(), status);
705
706 return status;
707 }
708
709 status = IoSetDevicePropertyData(
710 pdo,
711 propertyKey,
712 lcid,
713 flags,
714 Type,
717 );
718
719 if (!NT_SUCCESS(status)) {
722 "WDFDEVICE %p failed to assign device property, %!STATUS!",
723 GetHandle(), status);
724 }
725
726 return status;
727}
Type
Definition: Type.h:7
MdDeviceObject __inline GetSafePhysicalDevice(VOID)
Definition: fxdevice.hpp:1005
#define GetHandle(h)
Definition: treelist.c:116

◆ ClearCallbackFlags()

__inline VOID FxDevice::ClearCallbackFlags ( __in BYTE  Flags)
inline

Definition at line 1548 of file fxdevice.hpp.

1551 {
1552 KIRQL irql;
1553
1554 Lock(&irql);
1556 Unlock(irql);
1557 }
__inline VOID ClearCallbackFlagsLocked(__in BYTE Flags)
Definition: fxdevice.hpp:1539
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
Definition: fxobject.hpp:1474
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by __drv_when().

◆ ClearCallbackFlagsLocked()

__inline VOID FxDevice::ClearCallbackFlagsLocked ( __in BYTE  Flags)
inline

Definition at line 1539 of file fxdevice.hpp.

1542 {
1544 }
BYTE m_CallbackFlags
Definition: fxdevice.hpp:519

Referenced by ClearCallbackFlags().

◆ ConfigureAutoForwardCleanupClose()

VOID FxDevice::ConfigureAutoForwardCleanupClose ( __in PWDFDEVICE_INIT  DeviceInit)

Definition at line 864 of file fxdevice.cpp.

867{
868 WDF_TRI_STATE autoForwardCleanupClose;
870 BOOLEAN checkClientDriver;
871
872 autoForwardCleanupClose = WdfUseDefault;
873 checkClientDriver = TRUE;
874
875 //
876 // Device-wide configuration for auto forwarding cleanup and close requests:
877 // . Use WdfFalse if one of the devices in the chain use this setting with a create
878 // callback (this means it will complete all create IRPs).
879 // . Else use lowest driver's setting in the chain (order of cx chain: lower to higher).
880 // . If no settings are present, use default.
881 //
882 for (next = DeviceInit->CxDeviceInitListHead.Blink;
883 next != &DeviceInit->CxDeviceInitListHead;
884 next = next->Blink) {
885
886 PWDFCXDEVICE_INIT cxInit;
887
888 cxInit = CONTAINING_RECORD(next, WDFCXDEVICE_INIT, ListEntry);
889
890 if (cxInit->FileObject.Set) {
891 autoForwardCleanupClose = cxInit->FileObject.AutoForwardCleanupClose;
892
893 if (autoForwardCleanupClose == WdfFalse &&
895
896 checkClientDriver = FALSE;
897 break;
898 }
899 }
900 }
901
902 if (checkClientDriver && DeviceInit->FileObject.Set) {
903 autoForwardCleanupClose = DeviceInit->FileObject.AutoForwardCleanupClose;
904 }
905
906 switch (autoForwardCleanupClose) {
907 case WdfTrue:
908
910 //
911 // If the device is legacy then set it to false because you can't forward
912 // requests.
913 //
914 if(m_Legacy) {
916 }
917 break;
918
919 case WdfFalse:
921 break;
922
923 case WdfUseDefault:
924 //
925 // For filters (which must be FDOs), we default to TRUE. All other
926 // device roles (FDO, PDO, control) default to FALSE. We cannot check
927 // m_Filter yet because it is set in FdoInitialize which occurs later.
928 //
929 if (DeviceInit->IsFdoInit() && DeviceInit->Fdo.Filter) {
931 }
932 else {
934 }
935 }
936}
BOOLEAN m_Legacy
Definition: fxdevice.hpp:547
BOOLEAN m_AutoForwardCleanupClose
Definition: fxdevice.hpp:605
WDFCX_FILEOBJECT_CONFIG Callbacks
WDF_TRI_STATE AutoForwardCleanupClose
CxFileObjectInit FileObject
PFN_WDFCX_DEVICE_FILE_CREATE EvtCxDeviceFileCreate
Definition: wdfcx.h:28
@ WdfTrue
Definition: wdftypes.h:88
@ WdfUseDefault
Definition: wdftypes.h:89
@ WdfFalse
Definition: wdftypes.h:87
enum _WDF_TRI_STATE WDF_TRI_STATE

Referenced by Initialize().

◆ ControlDeviceDelete()

VOID FxDevice::ControlDeviceDelete ( VOID  )
inline

Definition at line 1465 of file fxdevice.hpp.

1468 {
1469 //
1470 // FxDevice::DeleteObject() has already run, so we must call the super
1471 // class's version of DeleteObject();
1472 //
1474
1475 FxDeviceBase::DeleteObject(); // __super call
1476 }
BOOLEAN m_DeviceObjectDeleted
Definition: fxdevice.hpp:553

Referenced by FxPkgGeneral::DecrementOpenHandleCount().

◆ ControlDeviceInitialize()

_Must_inspect_result_ NTSTATUS FxDevice::ControlDeviceInitialize ( __in PWDFDEVICE_INIT  DeviceInit)

Definition at line 399 of file fxdevicekm.cpp.

402{
404
405 m_Legacy = TRUE;
406
408
409 if (!NT_SUCCESS(status)) {
410 return status;
411 }
412
413 // status = m_PkgWmi->PostCreateDeviceInitialize(); __REACTOS__
414 // if (!NT_SUCCESS(status)) {
415 // return status;
416 // }
417
419 if (!NT_SUCCESS(status)) {
420 return status;
421 }
422
423 //
424 // NOTE: The driver writer must clear the DO_DEVICE_INITIALIZING bit
425 // via WdfControlFinishInitializing
426 //
427 return status;
428}
_Must_inspect_result_ NTSTATUS CreateDevice(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevice.cpp:964
_Must_inspect_result_ NTSTATUS PostCreateDeviceInitialize(__in PWDFDEVICE_INIT Init)

Referenced by _Create().

◆ CreateDevice()

_Must_inspect_result_ NTSTATUS FxDevice::CreateDevice ( __in PWDFDEVICE_INIT  DeviceInit)

Definition at line 964 of file fxdevice.cpp.

967{
968 MdDeviceObject pNewDeviceObject;
969 ULONG characteristics;
971 DEVICE_TYPE devType;
972
974 if (!NT_SUCCESS(status)) {
975 return status;
976 }
977
978 devType = DeviceInit->DeviceType;
979 if (devType < ARRAY_SIZE(m_PriorityBoosts)) {
981 }
982
983 characteristics = DeviceInit->Characteristics;
984
985 //
986 // You can only create secure device objects which have a name. All other
987 // device objects rely on the PDO's security
988 //
989 if (DeviceInit->ShouldCreateSecure()) {
990 PUNICODE_STRING pName, pSddl;
991 LPGUID pGuid;
992
993 if (DeviceInit->DeviceName != NULL) {
994 pName = DeviceInit->DeviceName->GetUnicodeString();
995 }
996 else {
997 pName = NULL;
998 }
999
1000 if (DeviceInit->Security.DeviceClassSet) {
1001 pGuid = &DeviceInit->Security.DeviceClass;
1002 }
1003 else {
1004 pGuid = NULL;
1005 }
1006
1007 if (DeviceInit->Security.Sddl != NULL) {
1008 pSddl = DeviceInit->Security.Sddl->GetUnicodeString();
1009 }
1010 else {
1011 //
1012 // Always provide an SDDL if one is not supplied.
1013 //
1014 // SDDL_DEVOBJ_SYS_ALL_ADM_ALL = "D:P(A;;GA;;;SY)(A;;GA;;;BA)"
1015 //
1016 // SDDL_DEVOBJ_SYS_ALL_ADM_ALL allows the kernel, system, and
1017 // administrator complete control over the device. No other users
1018 // may access the device.
1019 //
1020 // pSddl = (PUNICODE_STRING) &SDDL_DEVOBJ_SYS_ALL_ADM_ALL;
1021 pSddl = NULL; // __REACTOS__ : wdmsec.lib is not supported
1022 }
1023
1026 sizeof(FxWdmDeviceExtension),
1027 pName,
1028 devType,
1029 characteristics,
1031 pSddl,
1032 pGuid,
1033 &pNewDeviceObject);
1034 }
1035 else {
1038 sizeof(FxWdmDeviceExtension),
1039 NULL,
1040 devType,
1041 characteristics,
1043 &pNewDeviceObject);
1044 }
1045
1046 if (NT_SUCCESS(status)) {
1047 FxWdmDeviceExtension* pWdmExt;
1048
1049 pWdmExt = _GetFxWdmExtension(pNewDeviceObject);
1050
1051 //
1052 // We reassign DeviceExtension below and then use the knowledge that
1053 // we can always retrieve DeviceExtension by adding sizeof(DEVICE_OBJECT)
1054 // to pNewDeviceObject. ASSERT that this assumption is correct.
1055 //
1056 MxDeviceObject newDeviceObject(pNewDeviceObject);
1057 ASSERT(pWdmExt == newDeviceObject.GetDeviceExtension());
1058
1061 0, // max min
1062 0 // highwater mark
1063 );
1064
1065 //
1066 // Option for remove lock is stored in device extension
1067 // since this option may be examined after FxDevice is destroyed
1068 // (if an Irp is sent after removal of device).
1069 // We combine the flags from DeviceInit with what's set through registry
1070 //
1071 pWdmExt->RemoveLockOptionFlags = DeviceInit->RemoveLockOptionFlags |
1073
1074 //
1075 // We assign the first context assigned to this object as the
1076 // DeviceExtension for compatibility reasons. This allows existing
1077 // WDM extensions to work as well as any stack which exports a known
1078 // structure for the extension (ie the FDO knows the extension of its
1079 // PDO and casts it and accesses it directly).
1080 //
1081 newDeviceObject.SetDeviceExtension(&GetContextHeader()->Context[0]);
1082 m_DeviceObject.SetObject(pNewDeviceObject);
1083
1084 //
1085 // Set some device object flags based on properties of DeviceInit.
1086 //
1087 // If we are a filter, we will set these flags later
1088 // (in FxDevice::FdoInitialize) based on the device we are attached to.
1089 //
1090 if (m_Filter == FALSE) {
1091 if (DeviceInit->ReadWriteIoType == WdfDeviceIoBuffered) {
1093 }
1094 else if (DeviceInit->ReadWriteIoType == WdfDeviceIoDirect) {
1096 }
1097
1098 m_ReadWriteIoType = DeviceInit->ReadWriteIoType;
1099 m_PowerPageableCapable = DeviceInit->PowerPageable;
1100 }
1101 }
1102
1103 return status;
1104}
#define ARRAY_SIZE(A)
Definition: main.h:20
FxDriver * m_Driver
Definition: fxdevice.hpp:469
BOOLEAN m_Exclusive
Definition: fxdevice.hpp:540
CHAR m_DefaultPriorityBoost
Definition: fxdevice.hpp:561
WDF_DEVICE_IO_TYPE m_ReadWriteIoType
Definition: fxdevice.hpp:514
BOOLEAN m_Filter
Definition: fxdevice.hpp:522
BOOLEAN m_PowerPageableCapable
Definition: fxdevice.hpp:530
static const CHAR m_PriorityBoosts[]
Definition: fxdevice.hpp:563
MxDriverObject m_DriverObject
Definition: fxdriver.hpp:62
__inline FxContextHeader * GetContextHeader(VOID)
Definition: fxobject.hpp:720
_Must_inspect_result_ NTSTATUS Initialize(__in PWDFDEVICE_INIT DeviceInit)
__inline VOID SetObject(__in_opt MdDeviceObject DeviceObject)
ULONG GetFlags(VOID)
VOID SetFlags(ULONG Flags)
__inline MdDriverObject GetObject(VOID)
static __inline VOID MxInitializeRemoveLock(__in MdRemoveLock Lock, __in ULONG AllocateTag, __in ULONG MaxLockedMinutes, __in ULONG HighWatermark)
Definition: mxgeneralkm.h:256
static __inline NTSTATUS MxCreateDevice(_In_ MdDriverObject DriverObject, _In_ ULONG DeviceExtensionSize, _In_opt_ PUNICODE_STRING DeviceName, _In_ DEVICE_TYPE DeviceType, _In_ ULONG DeviceCharacteristics, _In_ BOOLEAN Exclusive, _Out_ MdDeviceObject *DeviceObject)
Definition: mxgeneralkm.h:557
static __inline NTSTATUS MxCreateDeviceSecure(_In_ MdDriverObject DriverObject, _In_ ULONG DeviceExtensionSize, _In_opt_ PUNICODE_STRING DeviceName, _In_ DEVICE_TYPE DeviceType, _In_ ULONG DeviceCharacteristics, _In_ BOOLEAN Exclusive, _In_ PCUNICODE_STRING DefaultSDDLString, _In_opt_ LPCGUID DeviceClassGuid, _Out_ MdDeviceObject *DeviceObject)
Definition: mxgeneralkm.h:521
#define DEVICE_TYPE
Definition: guid.c:10
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
static LPSTR pName
Definition: security.c:75
ULONG RemoveLockOptionFlags
Definition: fxglobals.h:494
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
@ WdfDeviceIoBuffered
Definition: wdfdevice.h:452
@ WdfDeviceIoDirect
Definition: wdfdevice.h:453

Referenced by ControlDeviceInitialize(), FdoInitialize(), and PdoInitialize().

◆ CreateSymbolicLink()

NTSTATUS FxDevice::CreateSymbolicLink ( _In_ PFX_DRIVER_GLOBALS  FxDriverGlobals,
_In_ PCUNICODE_STRING  SymbolicLinkName 
)

Definition at line 513 of file fxdevicekm.cpp.

517{
521
522 //
523 // Ensure m_DeviceName has been set or we can get the PDO's name
524 //
525 if (m_DeviceName.Buffer == NULL) {
529
530 if (IsLegacy()) {
531 //
532 // No PDO on a legacy stack, can't call IoGetDeviceProperty
533 //
535
537 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
538 "WDFDEVICE %p has no device name (use WdfDeviceInitAssignName), "
539 "%!STATUS!", GetHandle(), status);
540
541 return status;
542 }
543
545 if (pPdo == NULL) {
546 //
547 // No PDO yet for this device, pnp doesn't know about it.
548 //
550
552 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
553 "WDFDEVICE %p has not yet been reported to pnp, cannot call "
554 "IoGetDeviceProperty in this state, %!STATUS!", GetHandle(), status);
555
556 return status;
557 }
558
559 length = 0;
560
563 0,
564 NULL,
565 &length);
566
569 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
570 "WDFDEVICE %p IoGetDeviceProperty failed %!STATUS!",
571 GetHandle(), status);
572 return status;
573 }
574 else if (length > USHORT_MAX) {
576
578 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
579 "WDFDEVICE %p PDO name too long (%d, max is %d), %!STATUS!",
581
582 return status;
583 }
584 else if (length == 0) {
585 //
586 // We can get zero back if the PDO is being deleted.
587 //
589
591 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
592 "WDFDEVICE %p PDO name length is zero, %!STATUS!",
593 GetHandle(), status);
594
595 return status;
596 }
597
598 pBuffer = (PWSTR) FxPoolAllocate(FxDriverGlobals, PagedPool, length);
599 if (pBuffer == NULL) {
601
603 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
604 "WDFDEVICE %p could not allocate buffer for PDO name, %!STATUS!",
605 GetHandle(), status);
606
607 return status;
608 }
609
610 //
611 // pdoName will free pBuffer when it is destructed
612 //
614
617 length,
618 pBuffer,
619 &length);
620
621 if (!NT_SUCCESS(status)) {
623 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
624 "WDFDEVICE %p IoGetDeviceProperty failed second time, %!STATUS!",
625 GetHandle(), status);
626 return status;
627 }
628
631
633 }
634 else {
636 }
637
638 status = FxDuplicateUnicodeString(FxDriverGlobals,
641
642 if (!NT_SUCCESS(status)) {
644 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
645 "WDFDEVICE %p allocate buffer for symbolic name failed, %!STATUS!",
646 GetHandle(), status);
647
648 return status;
649 }
650
652
653 if (!NT_SUCCESS(status)) {
655
657 sizeof(m_SymbolicLinkName));
658
660 "WDFDEVICE %p create sybolic link failed, %!STATUS!",
661 GetHandle(), status);
662 }
663
664 return status;
665}
__inline BOOLEAN IsLegacy(VOID)
Definition: fxdevice.hpp:1209
static __inline NTSTATUS MxCreateSymbolicLink(_In_ PUNICODE_STRING SymbolicLinkName, _In_ PUNICODE_STRING DeviceName)
Definition: mxgeneralkm.h:579
#define PagedPool
Definition: env_spec_w32.h:308
FxAutoString pdoName
FxDevice * pPdo
#define USHORT_MAX
Definition: intsafe.h:147
#define UNICODE_NULL
#define STATUS_INTEGER_OVERFLOW
Definition: ntstatus.h:385
unsigned short USHORT
Definition: pedump.c:61
PVOID pBuffer
_Must_inspect_result_ NTSTATUS FxDuplicateUnicodeString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in const UNICODE_STRING *Source, __out PUNICODE_STRING Destination)
Definition: stringutil.cpp:180
UNICODE_STRING m_UnicodeString
USHORT MaximumLength
Definition: env_spec_w32.h:370
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING SymbolicLinkName
Definition: wdfdevice.h:3739

◆ DeleteDeviceFromFailedCreate()

_Must_inspect_result_ NTSTATUS FxDevice::DeleteDeviceFromFailedCreate ( __in NTSTATUS  FailedStatus,
__in BOOLEAN  UseStateMachine 
)

Definition at line 644 of file fxdevice.cpp.

648{
650
651 status = DeleteDeviceFromFailedCreateNoDelete(FailedStatus, UseStateMachine);
652
653 //
654 // Delete the Fx object now
655 //
656 DeleteObject();
657
658 return status;
659}
_Must_inspect_result_ NTSTATUS DeleteDeviceFromFailedCreateNoDelete(__in NTSTATUS FailedStatus, __in BOOLEAN UseStateMachine)
Definition: fxdevice.cpp:559
pKey DeleteObject()

Referenced by _Create().

◆ DeleteDeviceFromFailedCreateNoDelete()

_Must_inspect_result_ NTSTATUS FxDevice::DeleteDeviceFromFailedCreateNoDelete ( __in NTSTATUS  FailedStatus,
__in BOOLEAN  UseStateMachine 
)
private

Definition at line 559 of file fxdevice.cpp.

563{
564 //
565 // Cleanup the device, the driver may have allocated resources
566 // associated with the WDFDEVICE
567 //
570 "WDFDEVICE %p !devobj %p created, but EvtDriverDeviceAdd returned "
571 "status %!STATUS! or failure in creation",
572 GetObjectHandleUnchecked(), GetDeviceObject(), FailedStatus);
573
574 //
575 // We do not let filters affect the building of the rest of the stack.
576 // If they return error, we convert it to STATUS_SUCCESS, remove the
577 // attached device from the stack, and cleanup.
578 //
579 if (IsFilter()) {
582 "WDFDEVICE %p, !devobj %p is a filter, converting %!STATUS! to"
583 " STATUS_SUCCESS", GetObjectHandleUnchecked(), GetDeviceObject(),
584 FailedStatus);
585 FailedStatus = STATUS_SUCCESS;
586 }
587
588 if (UseStateMachine) {
589 MxEvent waitEvent;
590
591 //
592 // See comments for m_CleanupFromFailedCreate in class definition file
593 // for use of this statement.
594 //
596
597
598
599
600
603 }
604 else {
605 //
606 // Upon certain types of failure, like STATUS_OBJECT_NAME_COLLISION, we
607 // could keep the pDevice around and the caller retry after changing
608 // a property, but the simpler route for now is to just recreate
609 // everything from scratch on the retry.
610 //
611 // Usually the pnp state machine will do this and the FxDevice destructor
612 // relies on it running b/c it does some cleanup.
613 //
614 EarlyDispose();
616
617 //
618 // Wait for all children to drain out and cleanup.
619 //
620 if (m_DisposeList != NULL) {
622 }
623
624 //
625 // We keep a reference on m_PkgPnp which is released in the destructor
626 // so we can safely touch m_PkgPnp after destroying all of the child
627 // objects.
628 //
629 if (m_PkgPnp != NULL) {
631 }
632 }
633
634 //
635 // This will detach and delete the device object
636 //
637 Destroy();
638
639 return FailedStatus;
640}
FxDisposeList * m_DisposeList
Definition: fxdevice.hpp:466
VOID Destroy(VOID)
Definition: fxdevicekm.cpp:329
VOID SetCleanupFromFailedCreate(BOOLEAN Value)
Definition: fxdevice.hpp:1877
__inline BOOLEAN IsFilter()
Definition: fxdevice.hpp:1408
VOID WaitForEmpty(VOID)
VOID __inline DestroyChildren(VOID)
Definition: fxobject.hpp:464
BOOLEAN EarlyDispose(VOID)
VOID CleanupStateMachines(__in BOOLEAN ClenaupPnp)
Definition: fxpkgpnp.cpp:2066
VOID CleanupDeviceFromFailedCreate(__in MxEvent *WaitEvent)
Definition: fxpkgpnp.cpp:2190
CHECK_RETURN_IF_USER_MODE __inline NTSTATUS Initialize(__in EVENT_TYPE Type, __in BOOLEAN InitialState)
Definition: mxeventkm.h:55
MxEvent * GetSelfPointer(VOID)
Definition: mxevent.h:110
return pDevice GetDeviceObject()
@ SynchronizationEvent
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29

Referenced by DeleteDeviceFromFailedCreate(), and DeleteObject().

◆ DeleteObject()

VOID FxDevice::DeleteObject ( VOID  )
virtual

Reimplemented from FxObject.

Definition at line 1135 of file fxdevice.cpp.

1152{
1153 if (IsPnp() && IsPdo()) {
1155 KIRQL irql;
1157
1158 remove = FALSE;
1159
1160 pPkgPdo = GetPdoPkg();
1161
1162 pPkgPdo->Lock(&irql);
1163
1165 //
1166 // Since no pnp action has been taken since the child was created, we
1167 // should be in the initial state.
1168 //
1170 //
1171 // A PDO in this state should be deletable
1172 //
1174
1175 remove = TRUE;
1176 }
1177 else {
1178 //
1179 // If we are not in the init state, we should be in the created
1180 // state. This means we are failing from FxDevice::CreateDevice.
1181 //
1183 }
1184 }
1185
1187
1188 if (remove) {
1189 //
1190 // Cleanup the device and then let the super class delete the object.
1191 //
1194 }
1195 }
1196 else if (IsLegacy() && m_PkgGeneral != NULL && m_DeviceObject.GetObject() != NULL) {
1197 //
1198 // We allow tracing devices to go through a normal DeleteObject() path
1199 // where we do not prematurely delete the device object.
1200 //
1202
1204
1205 //
1206 // This reference will be released in Destroy().
1207 //
1209
1210 if (m_PkgWmi != NULL) {
1211 //
1212 // Since a legacy NT4 driver does not have an explicit WMI
1213 // deregistration DDI, we do it for them on deletion.
1214 //
1215 // This is done in DeleteObject because we need to deregister before
1216 // we delete the device object, otherwise we can bugcheck when
1217 // running under driver verifier.
1218 //
1219 // m_PkgWmi->Deregister(); __REACTOS__
1220 }
1221
1222 //
1223 // By deleting the device object now, we prevent any new creates from
1224 // being sent to the device (the io manager enforces this).
1225 //
1227
1229 //
1230 // Delay the actual destruction of the device until the last open
1231 // handle has been closed. ControlDeviceDelete() will perform the
1232 // destruction later.
1233 //
1234 return;
1235 }
1236 }
1237
1238 FxDeviceBase::DeleteObject(); // __super call
1239}
WDF_DEVICE_PNP_STATE m_CurrentPnpState
Definition: fxdevice.hpp:507
BOOLEAN IsNoDeleteDDI(VOID)
Definition: fxobject.hpp:1135
BOOLEAN CanDestroyControlDevice(VOID)
BOOLEAN m_AddedToStaticList
Definition: fxpkgpdo.hpp:63
BOOLEAN m_Static
Definition: fxpkgpdo.hpp:61
static __inline VOID MxDeleteDevice(_In_ MdDeviceObject Device)
Definition: mxgeneralkm.h:493
static __inline VOID MxReferenceObject(__in PVOID Object)
Definition: mxgeneralkm.h:238
FxPkgPdo * pPkgPdo
int remove
Definition: msacm.c:1366
@ WdfDevStatePnpInit
Definition: wdfdevice.h:69
@ WdfDevStatePnpObjectCreated
Definition: wdfdevice.h:64

Referenced by FxPkgPnp::DeleteDevice().

◆ DeleteSymbolicLink()

VOID __inline FxDevice::DeleteSymbolicLink ( VOID  )

Definition at line 1342 of file fxdeviceum.cpp.

1345{
1347 //
1348 // There is no IoDeleteSymbolicLink equivalent exposed by UMDF host.
1349 // Reflector takes care of deleteing the symbolic link on removal.
1350 // So just free the string now.
1351 //
1354 }
1355}

Referenced by FxPkgFdo::DeleteSymbolicLinkOverload(), FxPkgPdo::DeleteSymbolicLinkOverload(), Destroy(), FxPkgPdo::PnpEventPdoRemovedOverload(), and ~FxDevice().

◆ Destroy()

VOID FxDevice::Destroy ( VOID  )

Definition at line 329 of file fxdevicekm.cpp.

332{
333 //
334 // We must be at passive for IoDeleteDevice
335 //
337
338 if (m_DeviceObject.GetObject() != NULL) {
339 //
340 // The device object may not go away right away if there are pending
341 // references on it. But we can't look up our FxDevice anymore, so
342 // lets clear the DeviceExtension pointer.
343 //
345 }
346
347 //
348 // Since this can be called in the context of the destructor when the ref
349 // count is zero, use GetObjectHandleUnchecked() to get the handle value.
350 //
353 "Deleting !devobj %p, WDFDEVICE %p, attached to !devobj %p",
355
356 DetachDevice();
357
358 if (m_DeviceObject.GetObject() != NULL) {
360
362 //
363 // The device already deleted previously, release the reference we
364 // took at the time of delete.
365 //
367 }
368 else {
370 }
371
373 }
374
375 //
376 // Clean up any referenced objects
377 //
378 if (m_DeviceName.Buffer != NULL) {
381 }
382
386 }
387}
MxDeviceObject m_AttachedDevice
Definition: fxdevice.hpp:472
VOID DetachDevice(VOID)
VOID SetDeviceExtension(PVOID Value)
static __inline VOID MxDereferenceObject(__in PVOID Object)
Definition: mxgeneralkm.h:247
static __inline KIRQL MxGetCurrentIrql()
Definition: mxgeneralkm.h:86

Referenced by FxPkgPnp::DeleteDevice(), DeleteDeviceFromFailedCreateNoDelete(), and Dispose().

◆ DestructorInternal()

VOID FxDevice::DestructorInternal ( VOID  )
private

Definition at line 390 of file fxdevicekm.cpp.

393{
394 // NOTHING TO DO
395}

Referenced by ~FxDevice().

◆ DetachDevice()

__inline VOID FxDevice::DetachDevice ( VOID  )

Definition at line 1269 of file fxdeviceum.cpp.

1272{
1273 //
1274 // Note that UMDF host's DetachDevice has a different interface than
1275 // IoDetachDevice. DetachDevice takes the current device object as parameter
1276 // instead of target device.
1277 //
1278 if (m_DevStack != NULL && m_DeviceObject.GetObject() != NULL) {
1281
1282 //
1283 // This was a weak ref. Set it to NULL. m_DeviceObject (IWudfDevice)'s
1284 // lifetime is managed by host through a ref taken during Attach.
1285 //
1287 }
1288}
IWudfDeviceStack * m_DevStack
Definition: fxdevice.hpp:743
static VOID MxDetachDevice(_Inout_ MdDeviceObject Device)
Definition: mxgeneralkm.h:502

Referenced by Destroy().

◆ Dispatch()

_Must_inspect_result_ NTSTATUS STDCALL FxDevice::Dispatch ( __in MdDeviceObject  DeviceObject,
__in MdIrp  OriginalIrp 
)
static

Definition at line 1551 of file fxdevice.cpp.

1555{
1557 return DispatchWorker(device,
1558 Irp,
1559 device->m_PreprocessInfoListHead.Flink);
1560}
static FxDevice * GetFxDevice(__in MdDeviceObject DeviceObject)
Definition: fxdeviceum.cpp:60
_Must_inspect_result_ __inline NTSTATUS DispatchWorker(__in FxDevice *Device, __in MdIrp Irp, __in WDFCONTEXT DispatchContext)
Definition: fxdevice.cpp:1507
Definition: devices.h:37

Referenced by FxDriver::Initialize().

◆ DispatchPreprocessedIrp()

_Must_inspect_result_ NTSTATUS FxDevice::DispatchPreprocessedIrp ( __in MdIrp  Irp,
__in PVOID  DispatchContext 
)

Definition at line 1564 of file fxdevice.cpp.

1568{
1570 UCHAR major, minor;
1571 FxIrp irp(Irp);
1572
1573 //
1574 // The contract for this DDI is just like IoCallDriver. The caller sets up
1575 // their stack location and then the DDI advances to the next stack location.
1576 // This means that the caller either has to call IoSkipCurrentIrpStackLocation
1577 // or IoCopyCurrentIrpStackLocationToNext before calling this DDI.
1578 //
1580
1583
1584 //
1585 // FxPkgPnp and FxWmiIrpHandler expect that there will be a remove lock
1586 // acquired for all power irps. We release the remlock when we called
1587 // Evt(Ext)DevicePreprocessIrp.
1588 //
1591 GetRemoveLock(),
1592 Irp
1593 );
1594
1595 if (!NT_SUCCESS(status)) {
1596 goto Done;
1597 }
1598 }
1599
1600 return DispatchWorker(this, Irp, DispatchContext);
1601
1602Done:
1606
1607 return status;
1608}
static FxDeviceRemLockAction __inline _RequiresRemLock(__in UCHAR MajorCode, __in UCHAR MinorCode)
Definition: fxdevice.hpp:933
MdRemoveLock GetRemoveLock(VOID)
Definition: fxdevicekm.hpp:47
UCHAR GetMajorFunction(VOID)
Definition: fxirpum.cpp:217
VOID CompleteRequest(__in_opt CCHAR PriorityBoost=IO_NO_INCREMENT)
Definition: fxirpum.cpp:24
VOID SetStatus(__in NTSTATUS Status)
Definition: fxirpum.cpp:457
VOID SetInformation(__in ULONG_PTR Information)
Definition: fxirpum.cpp:504
UCHAR GetMinorFunction(VOID)
Definition: fxirpum.cpp:297
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928
_In_ UCHAR _In_ UCHAR _In_ ULONG _In_ WDFCONTEXT _Inout_ PIRP _In_ WDFCONTEXT DispatchContext
Definition: wdfdevice.h:1708
#define IO_NO_INCREMENT
Definition: iotypes.h:598
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ DispatchUm()

VOID FxDevice::DispatchUm ( _In_ MdDeviceObject  DeviceObject,
_In_ MdIrp  Irp,
_In_opt_ IUnknown Context 
)
static

Definition at line 32 of file fxdeviceum.cpp.

37{
39
40
41
42
43
45}
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH * Dispatch
Definition: wsk.h:188

Referenced by FxDriver::Initialize().

◆ DispatchWithLock()

_Must_inspect_result_ NTSTATUS STDCALL FxDevice::DispatchWithLock ( __in MdDeviceObject  DeviceObject,
__in MdIrp  OriginalIrp 
)
static

Definition at line 1336 of file fxdevice.cpp.

1340{
1342 FxIrp irp(Irp);
1343
1345 irp.GetMinorFunction())) {
1346
1349 &_GetFxWdmExtension(DeviceObject)->IoRemoveLock,
1350 Irp
1351 );
1352
1353 if (!NT_SUCCESS(status)) {
1356
1357 return status;
1358 }
1359
1360 break;
1361
1365 Irp
1366 );
1367
1368 if (!NT_SUCCESS(status)) {
1371
1372 return status;
1373 }
1374
1375 break;
1376
1378 //
1379 // Try to Acquire and Release the RemLock. If acquiring the lock
1380 // fails then it is not safe to process the IRP and the IRP should
1381 // be completed immediately.
1382 //
1384 &_GetFxWdmExtension(DeviceObject)->IoRemoveLock,
1385 Irp
1386 );
1387
1388 if (!NT_SUCCESS(status)) {
1391
1392 return status;
1393 }
1394
1396 &_GetFxWdmExtension(DeviceObject)->IoRemoveLock,
1397 Irp
1398 );
1399 break;
1400 }
1401
1402 return Dispatch(DeviceObject, Irp);
1403}
static _Must_inspect_result_ NTSTATUS _AcquireOptinRemoveLock(__in MdDeviceObject DeviceObject, __in MdIrp Irp)
Definition: fxdevice.cpp:1296
static __inline VOID MxReleaseRemoveLock(__in MdRemoveLock RemoveLock, __in PVOID Tag)
Definition: mxgeneralkm.h:278

Referenced by DispatchWithLockUm(), and FxDriver::Initialize().

◆ DispatchWithLockUm()

VOID FxDevice::DispatchWithLockUm ( _In_ MdDeviceObject  DeviceObject,
_In_ MdIrp  Irp,
_In_opt_ IUnknown Context 
)
static

Definition at line 48 of file fxdeviceum.cpp.

53{
55
57}
static _Must_inspect_result_ NTSTATUS STDCALL DispatchWithLock(__in MdDeviceObject DeviceObject, __in MdIrp OriginalIrp)
Definition: fxdevice.cpp:1336

Referenced by FxDriver::Initialize().

◆ Dispose()

BOOLEAN FxDevice::Dispose ( VOID  )
virtual

Reimplemented from FxObject.

Definition at line 1242 of file fxdevice.cpp.

1245{
1247
1248 if (m_Legacy) {
1249 if (m_PkgWmi != NULL) {
1250 //
1251 // We deregister in Dispose() (as well as DeleteObject()) for
1252 // control devices which are implicitly destroyed when the driver
1253 // unloads and FxDriver is being deleted.
1254 //
1255 // Since a legacy NT4 driver does not have an explicit WMI
1256 // deregistration DDI, we do it for them on destruction.
1257 //
1258 // This is done in Dispose because we are guaranteed to be at
1259 // passive level here. Even though m_PkgWmi was already
1260 // Dispose()'ed (because it is a child of this object), it is still
1261 // valid to reference the pointer because there is an explicit
1262 // reference on the object that was taken when we created this object.
1263 //
1264 // m_PkgWmi->Deregister(); __REACTOS__
1265 }
1266
1267 //
1268 // Important that the cleanup routine be called while the PDEVICE_OBJECT
1269 // is valid!
1270 //
1271 CallCleanup();
1272
1273 //
1274 // Manually destroy the children now so that by the time we wait on the
1275 // dispose empty out, all of the children will have been added to it.
1276 //
1278
1279 if (m_DisposeList != NULL) {
1281 }
1282
1283 //
1284 // Now delete the device object
1285 //
1286 Destroy();
1287
1288 return FALSE;
1289 }
1290
1291 return FxDeviceBase::Dispose(); // __super call
1292}
virtual BOOLEAN Dispose(VOID)
__inline VOID CallCleanup(VOID)
Definition: fxobject.hpp:815

◆ FdoInitialize()

_Must_inspect_result_ NTSTATUS FxDevice::FdoInitialize ( __in PWDFDEVICE_INIT  DeviceInit)

Definition at line 33 of file fxdevicekm.cpp.

36{
39 FxPkgFdo * pkgFdo;
40
42
43 if (DeviceInit->Fdo.EventCallbacks.EvtDeviceFilterAddResourceRequirements != NULL &&
44 DeviceInit->Fdo.EventCallbacks.EvtDeviceRemoveAddedResources == NULL) {
45 //
46 // Not allowed to add resources without filtering them out later
47 //
50 "Must set EvtDeviceRemoveAddedResources if "
51 "EvtDeviceFilterAddResourceRequirements (%p) is set",
52 DeviceInit->Fdo.EventCallbacks.EvtDeviceFilterAddResourceRequirements);
53
55
57 }
58
59 //
60 // All FDOs cannot be deleted through the driver calling WdfObjectDelete
61 //
63
65
66 //
67 // The PDO is known because it was used to bring up this FDO.
68 //
70
71 //
72 // Try to create and install the default packages that an FDO contains.
73 //
74
75 // PnP
76 status = FxPkgFdo::_Create(pGlobals, (CfxDevice*)this, &pkgFdo);
77
78 if (!NT_SUCCESS(status)) {
79 return status;
80 }
81 else {
82 m_PkgPnp = pkgFdo;
83 }
84
86
87 status = SetFilter(DeviceInit->Fdo.Filter);
88 if (!NT_SUCCESS(status)) {
89 return status;
90 }
91
93 if (!NT_SUCCESS(status)) {
94 return status;
95 }
96
97
98 //
99 // Should be done after invoking Initialize so that FxPkgFdo::m_EnumInfo is
100 // already allocated.
101 //
102 if (DeviceInit->Fdo.ListConfig.Size > 0) {
104 &DeviceInit->Fdo.ListConfig,
105 DeviceInit->Fdo.ListConfigAttributes.Size > 0
106 ? &DeviceInit->Fdo.ListConfigAttributes
107 : NULL);
108
109 if (!NT_SUCCESS(status)) {
110 return status;
111 }
112
114 }
115
116 //
117 // If the Size is zero then the driver writer never set any callbacks so we
118 // can skip this call.
119 //
120 if (DeviceInit->Fdo.EventCallbacks.Size != 0) {
121 status = GetFdoPkg()->RegisterCallbacks(&DeviceInit->Fdo.EventCallbacks);
122 if (!NT_SUCCESS(status)) {
123 return status;
124 }
125 }
126
128 if (NT_SUCCESS(status)) {
129 //
130 // If this is an FDO then the PhysicalDevice field will be initialized,
131 // and we need to attach to the device stack.
132 //
135
137 //
138 // We couldn't attach the device for some reason.
139 //
142
144 }
145 else {
146 //
147 // If we are a filter device, inherit some state from the
148 // attached device.
149 //
150 if (m_Filter) {
151 //
152 // Set the IO type and power pageable status on our device based
153 // on the attached device's settings.
154 //
156
159
162
163 //
164 // For devices other then filters, m_PowerPageableCapable gets
165 // set in CreateDevice, but since this is determined for filters
166 // by the device they have attached to, we must set this value
167 // later as a special case only for filters.
168 //
171 }
172 }
173 else {
174 //
175 // We are not a filter, we dictate our own DO flags
176 //
177
178 //
179 // Power pageable and inrush are mutually exclusive
180 //
181 if (DeviceInit->PowerPageable) {
183 }
184 else if (DeviceInit->Inrush) {
186 }
187 }
188 }
189 }
190
191 if (!NT_SUCCESS(status)) {
192 return status;
193 }
194
195 // status = m_PkgWmi->PostCreateDeviceInitialize(); __REACTOS__
196 // if (!NT_SUCCESS(status)) {
197 // return status;
198 // }
199
201 if (!NT_SUCCESS(status)) {
202 return status;
203 }
204
206
207 if (NT_SUCCESS(status)) {
208 //
209 // Do not clear the DO_DEVICE_INITIALIZING bit here. Instead, either
210 // let the caller do it in their AddDevice or do it after the AddDevice
211 // callback returns.
212 //
213 // FinishInitializing();
214 }
215
216 return status;
217}
MxDeviceObject m_PhysicalDevice
Definition: fxdevice.hpp:473
BOOLEAN m_PdoKnown
Definition: fxdevice.hpp:599
_Must_inspect_result_ NTSTATUS SetFilter(__in BOOLEAN Value)
Definition: fxdevice.cpp:1851
__inline FxPkgFdo * GetFdoPkg(VOID)
Definition: fxdevice.hpp:1236
VOID InstallPackage(__inout FxPackage *Package)
Definition: fxdevice.cpp:1611
VOID SetFilterIoType(VOID)
Definition: fxdevice.cpp:1873
virtual VOID SetDeviceTelemetryInfoFlags(_In_ FxDeviceInfoFlags Flag)
Definition: fxdevice.hpp:1807
VOID MarkNoDeleteDDI(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1118
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS pGlobals, __in CfxDevice *Device, __deref_out FxPkgFdo **PkgFdo)
Definition: fxpkgfdo.cpp:195
virtual _Must_inspect_result_ NTSTATUS Initialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxpkgfdokm.cpp:361
_Must_inspect_result_ NTSTATUS CreateDefaultDeviceList(__in PWDF_CHILD_LIST_CONFIG ListConfig, __in PWDF_OBJECT_ATTRIBUTES ListAttributes)
Definition: fxpkgfdo.cpp:816
_Must_inspect_result_ NTSTATUS RegisterCallbacks(__in PWDF_FDO_EVENT_CALLBACKS DispatchTable)
Definition: fxpkgfdo.cpp:796
_Must_inspect_result_ NTSTATUS PostCreateDeviceInitialize(VOID)
Definition: fxpkgfdo.cpp:1524
VOID SetDeviceType(DEVICE_TYPE Value)
VOID SetCharacteristics(ULONG Characteristics)
DEVICE_TYPE GetDeviceType(VOID)
ULONG GetCharacteristics(VOID)
static __inline MdDeviceObject MxAttachDeviceToDeviceStack(_In_ MdDeviceObject SourceDevice, _In_ MdDeviceObject TargetDevice)
Definition: mxgeneralkm.h:511
@ DeviceInfoHasDynamicChildren
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define DO_POWER_PAGABLE
#define DO_POWER_INRUSH

Referenced by _Create().

◆ FinishInitializing()

VOID FxDevice::FinishInitializing ( VOID  )

Definition at line 1109 of file fxdevice.cpp.

1129{
1130
1132}
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399

Referenced by PdoInitialize().

◆ FreeRequestMemory()

VOID FxDevice::FreeRequestMemory ( __in FxRequest Request)

Definition at line 1728 of file fxdevice.cpp.

1731{
1733
1734#if FX_VERBOSE_TRACE
1736 "Free FxRequest* %p memory", Request);
1737#endif
1738
1739 //
1740 // Remove the request from the list of outstanding requests against this
1741 // driver.
1742 //
1744 if (IsPdo() && GetPdoPkg()->IsForwardRequestToParentEnabled()) {
1746 }
1747 else {
1749 }
1750}
static PFX_POOL_HEADER _CleanupPointer(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Object)
Definition: fxobject.hpp:1273
__inline VOID FxFreeToNPagedLookasideList(__in PNPAGED_LOOKASIDE_LIST Lookaside, __in PVOID Entry)
Definition: fxglobalskm.h:611
__inline VOID FxFreeToNPagedLookasideListNoTracking(__in PNPAGED_LOOKASIDE_LIST Lookaside, __in PVOID Entry)
Definition: fxglobalskm.h:528
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547

Referenced by FxRequestFromLookaside::SelfDestruct().

◆ FxLogDeviceStartTelemetryEvent()

VOID FxDevice::FxLogDeviceStartTelemetryEvent ( VOID  )
inline

Definition at line 1798 of file fxdevice.hpp.

1801 {
1802 // LogDeviceStartTelemetryEvent(GetDriverGlobals(), this); __REACTOS__ : no-op
1803 }

◆ FxValidateInterfacePropertyData()

_Must_inspect_result_ NTSTATUS FxDevice::FxValidateInterfacePropertyData ( _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA  PropertyData)

Definition at line 1693 of file fxdeviceum.cpp.

1696{
1699
1700 if (PropertyData->Size != sizeof(WDF_DEVICE_INTERFACE_PROPERTY_DATA)) {
1703 "PropertyData size (%d) incorrect, expected %d, %!STATUS!",
1704 PropertyData->Size,
1705 sizeof(WDF_DEVICE_INTERFACE_PROPERTY_DATA), status);
1706 return status;
1707 }
1708
1709 FxPointerNotNull(pFxDriverGlobals, PropertyData->InterfaceClassGUID);
1710
1712 if (!NT_SUCCESS(status)) {
1714 return status;
1715 }
1716
1717 if (PropertyData->ReferenceString != NULL) {
1719 PropertyData->ReferenceString);
1720 if (!NT_SUCCESS(status)) {
1722 return status;
1723 }
1724 }
1725
1726 //
1727 // check if the interface has been registered with WDF
1728 //
1729 if (IsInterfaceRegistered(PropertyData->InterfaceClassGUID,
1730 PropertyData->ReferenceString) == FALSE) {
1734 "WDFDEVICE %p cannot assign interface property for an interface not"
1735 " yet registered with WDF, %!STATUS!",
1736 GetHandle(), status);
1737 return status;
1738 }
1739
1740 return status;
1741}
BOOLEAN IsInterfaceRegistered(_In_ const GUID *InterfaceClassGUID, _In_opt_ PCUNICODE_STRING RefString)
Definition: fxdevice.cpp:1926
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define FxPointerNotNull(FxDriverGlobals, Ptr)
Definition: fxmacros.hpp:253
_Must_inspect_result_ NTSTATUS __inline FxValidateUnicodeString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PCUNICODE_STRING String)
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133

◆ GetCallbackFlags()

__inline BYTE FxDevice::GetCallbackFlags ( VOID  )
inline

Definition at line 1501 of file fxdevice.hpp.

1504 {
1505 BYTE flags;
1506 KIRQL irql;
1507
1508 Lock(&irql);
1510 Unlock(irql);
1511
1512 return flags;
1513 }
__inline BYTE GetCallbackFlagsLocked(VOID)
Definition: fxdevice.hpp:1492
unsigned char BYTE
Definition: xxhash.c:193

◆ GetCallbackFlagsLocked()

__inline BYTE FxDevice::GetCallbackFlagsLocked ( VOID  )
inline

Definition at line 1492 of file fxdevice.hpp.

1495 {
1496 return m_CallbackFlags;
1497 }

Referenced by GetCallbackFlags().

◆ GetCxDeviceInfo()

FxCxDeviceInfo * FxDevice::GetCxDeviceInfo ( __in FxDriver CxDriver)
inline

Definition at line 1560 of file fxdevice.hpp.

1563 {
1564 FxCxDeviceInfo* cxDeviceInfo;
1566
1567 //
1568 // Check if we are using I/O class extensions.
1569 //
1572 next = next->Flink) {
1573
1574 cxDeviceInfo = CONTAINING_RECORD(next, FxCxDeviceInfo, ListEntry);
1575 if (cxDeviceInfo->Driver == CxDriver) {
1576 return cxDeviceInfo;
1577 }
1578 }
1579
1580 return NULL;
1581 }
FxDriver * Driver

Referenced by FxPkgIo::CreateQueue(), if(), and IsCxDriverInIoPath().

◆ GetCxDriver()

__inline FxDriver * FxDevice::GetCxDriver ( __in FxCxDeviceInfo CxDeviceInfo)
inline

Definition at line 1654 of file fxdevice.hpp.

1657 {
1658 if (CxDeviceInfo != NULL) {
1659 return CxDeviceInfo->Driver;
1660 }
1661 else {
1662 return GetDriver();
1663 }
1664 }
return pDevice GetDriver() -> GetHandle()

Referenced by FxPkgGeneral::ConfigureConstraints(), FxPkgGeneral::ConfigureFileObjectClass(), and FxPkgGeneral::OnCreate().

◆ GetCxDriverIndex()

static __inline CCHAR FxDevice::GetCxDriverIndex ( __in FxCxDeviceInfo CxDeviceInfo)
inlinestatic

Definition at line 1640 of file fxdevice.hpp.

1643 {
1644 if (CxDeviceInfo != NULL) {
1645 return CxDeviceInfo->Index;
1646 }
1647 else {
1648 return 0;
1649 }
1650 }

Referenced by FxPkgIo::AddIoQueue(), and FxPkgIo::ConfigureDynamicDispatching().

◆ GetDefaultIoTarget()

FxIoTarget * FxDevice::GetDefaultIoTarget ( VOID  )
virtual

Reimplemented from FxDeviceBase.

Definition at line 1818 of file fxdevice.cpp.

1821{
1822 if (IsPnp() && IsFdo()) {
1823 return GetFdoPkg()->m_DefaultTarget;
1824 }
1825 else {
1826 return NULL;
1827 }
1828}
FxIoTarget * m_DefaultTarget
Definition: fxpkgfdo.hpp:47
_In_z_ PCCHAR _In_ PDEVICE_OBJECT _In_ BOOLEAN IsFdo
Definition: classpnp.h:984

◆ GetDefaultPriorityBoost()

__inline CHAR FxDevice::GetDefaultPriorityBoost ( VOID  )
inline

Definition at line 1111 of file fxdevice.hpp.

1114 {
1116 }

Referenced by FxRequest::Complete().

◆ GetDevicePnpState()

◆ GetDevicePowerPolicyState()

__inline WDF_DEVICE_POWER_POLICY_STATE FxDevice::GetDevicePowerPolicyState ( )
inline

◆ GetDevicePowerState()

__inline WDF_DEVICE_POWER_STATE FxDevice::GetDevicePowerState ( )
inline

Definition at line 1157 of file fxdevice.hpp.

1159 {
1160 return m_CurrentPowerState;
1161 }
WDF_DEVICE_POWER_STATE m_CurrentPowerState
Definition: fxdevice.hpp:508

Referenced by __drv_maxIRQL(), FxPkgPnp::PowerEnterNewState(), FxPkgPnp::PowerProcessEvent(), and FxPkgPnp::PowerProcessEventInner().

◆ GetDeviceStack()

__inline IWudfDeviceStack * FxDevice::GetDeviceStack ( VOID  )

◆ GetDeviceStack2()

__inline IWudfDeviceStack2 * FxDevice::GetDeviceStack2 ( VOID  )

Definition at line 444 of file fxdeviceum.hpp.

446{
447 IWudfDeviceStack2 *pDeviceStack2;
449
450 hrQI = m_DevStack->QueryInterface(IID_IWudfDeviceStack2,
451 (PVOID*)&pDeviceStack2);
452 FX_VERIFY(INTERNAL, CHECK_QI(hrQI, pDeviceStack2));
453
454 m_DevStack->Release();
455
456 return pDeviceStack2;
457}
HRESULT hrQI
Definition: framework.cpp:106

Referenced by FxPoxInterface::PowerNotRequiredCallbackInvoked().

◆ GetDeviceStackIoType()

VOID FxDevice::GetDeviceStackIoType ( _Out_ WDF_DEVICE_IO_TYPE ReadWriteIoType,
_Out_ WDF_DEVICE_IO_TYPE IoControlIoType 
)

Definition at line 1744 of file fxdeviceum.cpp.

1748{
1749 UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL retrievalMode;
1750
1751 GetDeviceStack()->GetDeviceStackPreferredTransferMode(
1752 &retrievalMode,
1753 (UMINT::WDF_DEVICE_IO_TYPE*)ReadWriteIoType,
1754 (UMINT::WDF_DEVICE_IO_TYPE*)IoControlIoType
1755 );
1756}
IWudfDeviceStack * GetDeviceStack(VOID)
Definition: fxdeviceum.hpp:435
_In_ WDFDEVICE _Out_ WDF_DEVICE_IO_TYPE _Out_ WDF_DEVICE_IO_TYPE * IoControlIoType
ioTypeConfig ReadWriteIoType

◆ GetDeviceTelemetryInfoFlags()

USHORT FxDevice::GetDeviceTelemetryInfoFlags ( VOID  )
inline

Definition at line 1815 of file fxdevice.hpp.

1818 {
1820 }
USHORT m_DeviceTelemetryInfoFlags
Definition: fxdevice.hpp:617

◆ GetDirectTransferThreshold()

__inline ULONG FxDevice::GetDirectTransferThreshold ( VOID  )
inline

Definition at line 1986 of file fxdevice.hpp.

1989 {
1991 }
ULONG m_DirectTransferThreshold
Definition: fxdevice.hpp:772

Referenced by FxMessageDispatch::GetDirectTransferThreshold().

◆ GetDispatchPackage()

__inline FxPackage * FxDevice::GetDispatchPackage ( __in UCHAR  MajorFunction)
inline

Definition at line 890 of file fxdevice.hpp.

893 {
894 switch (MajorFunction) {
895 case IRP_MJ_CREATE:
896 case IRP_MJ_CLOSE:
897 case IRP_MJ_CLEANUP:
898 case IRP_MJ_SHUTDOWN:
899 return (FxPackage*) m_PkgGeneral;
900
901 case IRP_MJ_READ:
902 case IRP_MJ_WRITE:
905 return (FxPackage*) m_PkgIo;
906
908 return (FxPackage*) m_PkgWmi;
909
910 case IRP_MJ_PNP:
911 case IRP_MJ_POWER:
912 if (m_PkgPnp != NULL) {
913 return (FxPackage*) m_PkgPnp;
914 }
915 else {
916 return (FxPackage*) m_PkgDefault;
917 }
918 break;
919
920 default:
921 return (FxPackage*) m_PkgDefault;
922 }
923 }
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
_In_ UCHAR MajorFunction
Definition: wdfdevice.h:1697
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
#define IRP_MJ_SHUTDOWN
#define IRP_MJ_CLEANUP

Referenced by FxIoTargetSelf::Send().

◆ GetFdoPkg()

__inline FxPkgFdo * FxDevice::GetFdoPkg ( VOID  )
inline

Definition at line 1236 of file fxdevice.hpp.

1239 {
1240 return (FxPkgFdo*) m_PkgPnp;
1241 }

Referenced by FdoInitialize(), GetDefaultIoTarget(), GetSelfIoTarget(), FxPkgPdo::Initialize(), and SetFilter().

◆ GetFileObjectClass()

__inline WDF_FILEOBJECT_CLASS FxDevice::GetFileObjectClass ( VOID  )
inline

Definition at line 1123 of file fxdevice.hpp.

1126 {
1127 return m_FileObjectClass;
1128 }
WDF_FILEOBJECT_CLASS m_FileObjectClass
Definition: fxdevice.hpp:621

Referenced by FxPkgGeneral::CreateCompleted(), FxRequest::GetFileObject(), FxPkgGeneral::OnCleanup(), FxPkgGeneral::OnClose(), and FxPkgGeneral::OnCreate().

◆ GetFxDevice()

__inline FxDevice * FxDevice::GetFxDevice ( __in MdDeviceObject  DeviceObject)
static

Definition at line 60 of file fxdeviceum.cpp.

63{
64 IWudfDevice2* device2;
65
66
67
68
69 device2 = static_cast<IWudfDevice2*> (DeviceObject);
70
71 return (FxDevice *)device2->GetContext();
72}

Referenced by FxPkgPdo::_QueryCapsWorkItem(), Dispatch(), FxRequestSystemBuffer::GetBuffer(), FxRequestSystemBuffer::GetMdl(), GetPreferredTransferMode(), PoFxDevicePowerNotRequired(), and PoFxDevicePowerRequired().

◆ GetInterruptThreadpool()

FxInterruptThreadpool * FxDevice::GetInterruptThreadpool ( VOID  )
inline

Definition at line 1057 of file fxdevice.hpp.

1060 {
1061 return m_InteruptThreadpool;
1062 }
FxInterruptThreadpool * m_InteruptThreadpool
Definition: fxdevice.hpp:798

◆ GetIoType()

__inline WDF_DEVICE_IO_TYPE FxDevice::GetIoType ( VOID  )
inline

Definition at line 1084 of file fxdevice.hpp.

1087 {
1088 return m_ReadWriteIoType;
1089 }

Referenced by FxRequestSystemBuffer::GetBuffer(), and FxRequestSystemBuffer::GetMdl().

◆ GetIoTypeForReadWriteBufferAccess()

__inline WDF_DEVICE_IO_TYPE FxDevice::GetIoTypeForReadWriteBufferAccess ( VOID  )
inline

Definition at line 1093 of file fxdevice.hpp.

1096 {
1097#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1098 return m_ReadWriteIoType;
1099#else
1100 //
1101 // For UM, both buffer-copy and direct-access i/o buffer access types
1102 // follow the same storage and retrieval model in internal structures
1103 // as in buffered I/O so always return WdfDeviceIoBuffered.
1104 //
1105 return WdfDeviceIoBuffered;
1106#endif
1107 }

◆ GetLength()

static ULONG __inline FxDevice::GetLength ( __in WDF_DEVICE_HWACCESS_TARGET_SIZE  Size)
inlinestatic

Definition at line 2118 of file fxdevice.hpp.

2121 {
2122 ULONG length = 0;
2123
2124 switch(Size) {
2125 case WdfDeviceHwAccessTargetSizeUchar:
2126 length = sizeof(UCHAR);
2127 break;
2128 case WdfDeviceHwAccessTargetSizeUshort:
2129 length = sizeof(USHORT);
2130 break;
2131 case WdfDeviceHwAccessTargetSizeUlong:
2132 length = sizeof(ULONG);
2133 break;
2134 case WdfDeviceHwAccessTargetSizeUlong64:
2135 length = sizeof(ULONG64);
2136 break;
2137 default:
2138 ASSERT(FALSE);
2139 }
2140
2141 return length;
2142 }
unsigned __int64 ULONG64
Definition: imports.h:198
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

◆ GetPdoPkg()

◆ GetPreferredIoctlTransferMode()

__inline WDF_DEVICE_IO_TYPE FxDevice::GetPreferredIoctlTransferMode ( VOID  )
inline

Definition at line 1977 of file fxdevice.hpp.

1980 {
1981 return m_IoctlIoType;
1982 }
WDF_DEVICE_IO_TYPE m_IoctlIoType
Definition: fxdevice.hpp:771

◆ GetPreferredRWTransferMode()

__inline WDF_DEVICE_IO_TYPE FxDevice::GetPreferredRWTransferMode ( VOID  )
inline

Definition at line 1968 of file fxdevice.hpp.

1971 {
1972 return m_ReadWriteIoType;
1973 }

◆ GetPreferredTransferMode()

VOID FxDevice::GetPreferredTransferMode ( _In_ MdDeviceObject  DeviceObject,
_Out_ UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL *  RetrievalMode,
_Out_ WDF_DEVICE_IO_TYPE RWPreference,
_Out_ WDF_DEVICE_IO_TYPE IoctlPreference 
)
static

Definition at line 593 of file fxdeviceum.cpp.

619{
621
623
624 *RetrievalMode = device->GetRetrievalMode();
625 *RWPreference = device->GetPreferredRWTransferMode();
626 *IoctlPreference = device->GetPreferredIoctlTransferMode();
627}

Referenced by FxMessageDispatch::GetPreferredTransferMode().

◆ GetPseudoAddressFromSystemAddress()

PVOID FxDevice::GetPseudoAddressFromSystemAddress ( __in PVOID  SystemAddress)
inline

Definition at line 2100 of file fxdevice.hpp.

2103 {
2104 return SystemAddress;
2105 }

◆ GetRemoveLock()

◆ GetRequestAttributes()

__inline PWDF_OBJECT_ATTRIBUTES FxDevice::GetRequestAttributes ( VOID  )
inline

Definition at line 1315 of file fxdevice.hpp.

1318 {
1319 return &m_RequestAttributes;
1320 }

Referenced by FxIoQueue::AllocateReservedRequest(), FxPkgIo::DispatchStep2(), and FxPkgGeneral::OnCreate().

◆ GetRetrievalMode()

__inline UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL FxDevice::GetRetrievalMode ( VOID  )
inline

Definition at line 1959 of file fxdevice.hpp.

1962 {
1963 return m_RetrievalMode;
1964 }
UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL m_RetrievalMode
Definition: fxdevice.hpp:770

◆ GetSafePhysicalDevice()

MdDeviceObject __inline FxDevice::GetSafePhysicalDevice ( VOID  )
inline

Definition at line 1005 of file fxdevice.hpp.

1008 {
1009 //
1010 // Makes sure that the PDO we think we have is
1011 // 1) reported to pnp (m_PdoKnown check)
1012 // 2) actually there (m_PhysicalDevice != NULL check)
1013 //
1015 return m_PhysicalDevice.GetObject();
1016 }
1017 else {
1018 return NULL;
1019 }
1020 }

Referenced by AssignProperty(), CreateSymbolicLink(), FxChildList::EndScan(), OpenSettingsKey(), FxChildList::ProcessModificationsLocked(), and FxPkgPnp::SetDeviceFailed().

◆ GetSelfIoTarget()

FxIoTargetSelf * FxDevice::GetSelfIoTarget ( VOID  )

Definition at line 1831 of file fxdevice.cpp.

1840{
1841 if (IsPnp() && IsFdo()) {
1842 return GetFdoPkg()->m_SelfTarget;
1843 }
1844 else {
1845 return NULL;
1846 }
1847}
FxIoTargetSelf * m_SelfTarget
Definition: fxpkgfdo.hpp:53

◆ GetStackSize()

__inline CHAR FxDevice::GetStackSize ( VOID  )
inline

Definition at line 1824 of file fxdevice.hpp.

1827 {
1829 }
CCHAR GetStackSize(VOID)

Referenced by _Create().

◆ GetSystemAddressFromPseudoAddress()

PVOID FxDevice::GetSystemAddressFromPseudoAddress ( __in PVOID  PseudoAddress)
inline

Definition at line 2108 of file fxdevice.hpp.

2111 {
2112 return PseudoAddress;
2113 }

◆ GetTranslatedResources()

FxCmResList * FxDevice::GetTranslatedResources ( )
inline

Definition at line 1854 of file fxdevice.hpp.

1856 {
1858 }
FxCmResList * GetTranslatedResourceList(VOID)
Definition: fxpkgpnp.hpp:3796

Referenced by IsInterruptAccessAllowed().

◆ Initialize()

_Must_inspect_result_ NTSTATUS FxDevice::Initialize ( __in PWDFDEVICE_INIT  DeviceInit,
__in_opt PWDF_OBJECT_ATTRIBUTES  DeviceAttributes 
)

Definition at line 663 of file fxdevice.cpp.

680{
684 size_t reqCtxSize;
685 PWDFCXDEVICE_INIT cxInit;
686 CCHAR cxIndex;
687 FxCxDeviceInfo* cxDeviceInfo;
688
690 m_Exclusive = DeviceInit->Exclusive;
691 cxIndex = 0;
692
694
695 //
696 // Configure device constraints.
697 //
699 if (!NT_SUCCESS(status)) {
700 return status;
701 }
702
703 //
704 // Generic catch all
705 //
707 if (m_PkgDefault == NULL) {
709 }
710
712
713 if (DeviceInit->InitType == FxDeviceInitTypeControlDevice) {
714 m_Legacy = TRUE;
715 }
716
717 //
718 // Size will be set to a non zero if the driver wants request attributes
719 // associated with each created request.
720 //
721 if (DeviceInit->RequestAttributes.Size != 0) {
722 ASSERT(DeviceInit->RequestAttributes.Size == sizeof(WDF_OBJECT_ATTRIBUTES));
724 &DeviceInit->RequestAttributes,
725 sizeof(DeviceInit->RequestAttributes));
726 }
727
729
730 //
731 // If present, setup a I/O class extensions info chain.
732 //
733 for (next = DeviceInit->CxDeviceInitListHead.Flink;
734 next != &DeviceInit->CxDeviceInitListHead;
735 next = next->Flink) {
736
737 cxInit = CONTAINING_RECORD(next, WDFCXDEVICE_INIT, ListEntry);
738
739 cxDeviceInfo = new(pGlobals) FxCxDeviceInfo(pGlobals);
740 if (NULL == cxDeviceInfo) {
742 }
743
744 cxDeviceInfo->Index = ++cxIndex; // 1-based.
745 cxDeviceInfo->Driver = cxInit->CxDriverGlobals->Driver;
746 cxDeviceInfo->IoInCallerContextCallback.m_Method =
748 cxDeviceInfo->RequestAttributes = cxInit->RequestAttributes;
749
751
752 //
753 // Set weak ref to this run-time cx struct to help file-object logic later on.
754 //
755 cxInit->CxDeviceInfo = cxDeviceInfo;
756
757 //
758 // Find the max size for the request context. Used below.
759 //
760 ASSERT(cxInit->RequestAttributes.Size == 0 ||
761 cxInit->RequestAttributes.Size == sizeof(WDF_OBJECT_ATTRIBUTES));
762
763 reqCtxSize = MAX(FxGetContextSize(&cxInit->RequestAttributes),
764 reqCtxSize);
765 }
766
767 //
768 // Memory layout for memory backing FxRequest which is allocated from the
769 // lookaside list:
770 //
771 // If we are tracking memory, the allocation layout is
772 // 0x0 - FX_POOL_TRACKER
773 // 0x0 + sizeof(FX_POOL_TRACKER) - FX_POOL_HEADER
774 // 0x0 + sizeof(FX_POOL_TRACKER) + FX_POOL_HEADER_SIZE - start of FxRequest
775 //
776 // if no tracking is occuring, the allocation layout is
777 // 0x0 - FX_POOL_HEADER
778 // 0x0 + FX_POOL_HEADER_SIZE - start of FxRequest
779 //
780 // NOTE: If the computation of m_RequestLookasideListElementSize changes,
781 // FxDevice::AllocateRequestMemory and FxDevice::FreeRequestMemory will also
782 // need to be updated to reflect the changes made.
783 //
785 sizeof(FxRequest),
786 0,
787 reqCtxSize,
789 if (!NT_SUCCESS(status)) {
790 return status;
791 }
792
796
797 if (!NT_SUCCESS(status)) {
798 //
799 // FxPoolAddHeaderSize will log to the IFR on error
800 //
801 return status;
802 }
803
805 NULL,
806 NULL,
807 0,
809 pGlobals->Tag,
810 0);
811 //
812 // Init device's auto_forward_cleanup_close.
813 //
815
816 //
817 // Create, close, cleanup, shutdown
818 //
820 if (m_PkgGeneral == NULL) {
822 }
823
825
826#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
827
828
829
830
831
832
833 // m_PkgWmi = new(pGlobals) FxWmiIrpHandler(pGlobals, this); __REACTOS__
834 // if (m_PkgWmi == NULL) {
835 // return STATUS_INSUFFICIENT_RESOURCES;
836 // }
837 // InstallPackage(m_PkgWmi);
838#endif
839
840 //
841 // IO package handles reads, writes, internal and external IOCTLs
842 //
843 m_PkgIo = new(pGlobals) FxPkgIo(pGlobals, (CfxDevice*) this);
844
845 if (m_PkgIo == NULL) {
847 }
848
850
851 //
852 // Configure I/O package.
853 //
854 m_PkgIo->SetIoInCallerContextCallback(DeviceInit->IoInCallerContextCallback);
855
856 if (DeviceInit->RequiresSelfIoTarget) {
858 }
859
860 return STATUS_SUCCESS;
861}
#define MAX(x, y)
Definition: rdesktop.h:175
NTSTATUS ConfigureConstraints(__in_opt PWDF_OBJECT_ATTRIBUTES ObjectAttributes)
VOID ConfigureAutoForwardCleanupClose(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevice.cpp:864
PFN_WDF_IO_IN_CALLER_CONTEXT m_Method
VOID MarkDisposeOverride(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1101
__inline VOID SetIoInCallerContextCallback(__inout PFN_WDF_IO_IN_CALLER_CONTEXT EvtIoInCallerContext)
Definition: fxpkgio.hpp:193
static __inline VOID MxInitializeNPagedLookasideList(_Out_ PNPAGED_LOOKASIDE_LIST Lookaside, _In_opt_ PALLOCATE_FUNCTION Allocate, _In_opt_ PFREE_FUNCTION Free, _In_ ULONG Flags, _In_ SIZE_T Size, _In_ ULONG Tag, _In_ USHORT Depth)
Definition: mxgeneralkm.h:451
size_t FxGetContextSize(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: handleapi.cpp:38
_Must_inspect_result_ NTSTATUS FxCalculateObjectTotalSize2(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT RawObjectSize, __in USHORT ExtraSize, __in size_t ContextSize, __out size_t *Total)
Definition: handleapi.cpp:73
@ ObjectDoNotLock
Definition: fxobject.hpp:128
_Must_inspect_result_ NTSTATUS __inline FxPoolAddHeaderSize(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in size_t AllocationSize, __out size_t *NewSize)
LIST_ENTRY ListEntry
FxIoInCallerContext IoInCallerContextCallback
WDF_OBJECT_ATTRIBUTES RequestAttributes
PFN_WDF_IO_IN_CALLER_CONTEXT IoInCallerContextCallback
WDF_OBJECT_ATTRIBUTES RequestAttributes
FxCxDeviceInfo * CxDeviceInfo
PFX_DRIVER_GLOBALS CxDriverGlobals
FxDriver * Driver
Definition: fxglobals.h:374
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
char CCHAR
Definition: typedefs.h:51

Referenced by _Create().

◆ InstallPackage()

VOID FxDevice::InstallPackage ( __inout FxPackage Package)

Definition at line 1611 of file fxdevice.cpp.

1615{
1616 //
1617 // Add this package as an association on FxDevice
1618 // so its children get Dispose notifications.
1619 //
1620 // Note: This assumes a transfer of the controlling reference
1621 // count which it will dereference on FxDevice teardown.
1622 // We need to add an extra one here since packages have
1623 // an existing reference count model.
1624 //
1625 Package->AddRef();
1626 Package->AssignParentObject(this);
1627}

Referenced by FdoInitialize(), Initialize(), and PdoInitialize().

◆ InvalidateDeviceState()

__inline VOID FxDevice::InvalidateDeviceState ( VOID  )

Definition at line 1291 of file fxdeviceum.cpp.

1294{
1296}
__inline MxDeviceObject * GetMxDeviceObject(VOID)
Definition: fxdevice.hpp:183
VOID InvalidateDeviceState(__in MdDeviceObject Fdo)

◆ IsBufferType()

BOOL FxDevice::IsBufferType ( __in WDF_DEVICE_HWACCESS_TARGET_TYPE  Type)
inline

Definition at line 2171 of file fxdevice.hpp.

2174 {
2175 if (Type == WdfDeviceHwAccessTargetTypeRegisterBuffer ||
2176 Type == WdfDeviceHwAccessTargetTypePortBuffer) {
2177 return TRUE;
2178 }
2179
2180 return FALSE;
2181 }

Referenced by if().

◆ IsCxDriverInIoPath()

__inline BOOLEAN FxDevice::IsCxDriverInIoPath ( __in FxDriver CxDriver)
inline

Definition at line 1585 of file fxdevice.hpp.

1588 {
1589 return (GetCxDeviceInfo(CxDriver) != NULL) ? TRUE : FALSE;
1590 }
FxCxDeviceInfo * GetCxDeviceInfo(__in FxDriver *CxDriver)
Definition: fxdevice.hpp:1560

◆ IsCxInIoPath()

__inline BOOLEAN FxDevice::IsCxInIoPath ( VOID  )
inline

Definition at line 1594 of file fxdevice.hpp.

1597 {
1599 }

Referenced by FxPkgIo::GetIoQueueListLocked(), and FxPkgGeneral::OnCreate().

◆ IsDirectHardwareAccessAllowed()

BOOLEAN FxDevice::IsDirectHardwareAccessAllowed ( )
inline

Definition at line 2072 of file fxdevice.hpp.

2074 {
2075 return (m_DirectHardwareAccess == WdfAllowDirectHardwareAccess);
2076 }
WDF_DIRECT_HARDWARE_ACCESS_TYPE m_DirectHardwareAccess
Definition: fxdevice.hpp:777

Referenced by IsInterruptAccessAllowed().

◆ IsExclusive()

__inline BOOLEAN FxDevice::IsExclusive ( VOID  )
inline

Definition at line 1218 of file fxdevice.hpp.

1221 {
1222 return m_Exclusive;
1223 }

Referenced by FxFileObject::_CreateFileObject(), FxFileObject::_GetFileObjectFromWdm(), and FxPkgGeneral::OnCreate().

◆ IsFdo()

__inline BOOLEAN FxDevice::IsFdo ( VOID  )
inline

Definition at line 1227 of file fxdevice.hpp.

1230 {
1232 }
WDFTYPE GetType(VOID)
Definition: fxobject.hpp:742
@ FX_TYPE_PACKAGE_FDO
Definition: fxtypes.h:93

Referenced by FxPkgPnp::DispatchWaitWake(), if(), and FxPkgPdo::Initialize().

◆ IsFilter()

◆ IsInterfaceRegistered()

BOOLEAN FxDevice::IsInterfaceRegistered ( _In_ const GUID InterfaceClassGUID,
_In_opt_ PCUNICODE_STRING  RefString 
)

Definition at line 1926 of file fxdevice.cpp.

1930{
1932 BOOLEAN found = FALSE;
1933
1935
1936 //
1937 // Iterate over the interfaces and see if we have a match
1938 //
1940 FxDeviceInterface *pDI;
1941
1943
1945 if (RefString != NULL) {
1946 if ((RefString->Length == pDI->m_ReferenceString.Length)
1947 &&
1948 (RtlCompareMemory(RefString->Buffer,
1950 RefString->Length) == RefString->Length)) {
1951 //
1952 // They match, carry on
1953 //
1954 DO_NOTHING();
1955 }
1956 else {
1957 //
1958 // The ref strings do not match, continue on in the search
1959 // of the collection.
1960 //
1961 continue;
1962 }
1963 }
1964 else if (pDI->m_ReferenceString.Length > 0) {
1965 //
1966 // Caller didn't specify a ref string but this interface has
1967 // one, continue on in the search through the collection.
1968 //
1969 continue;
1970 }
1971
1972 //
1973 // Set the state and break out of the loop because we found our
1974 // interface.
1975 //
1976 found = TRUE;
1977 break;
1978 }
1979 }
1980
1982
1983 return found;
1984}
static FxDeviceInterface * _FromEntry(__in PSINGLE_LIST_ENTRY Entry)
UNICODE_STRING m_ReferenceString
SINGLE_LIST_ENTRY m_DeviceInterfaceHead
Definition: fxpkgpnp.hpp:4126
FxWaitLockInternal m_DeviceInterfaceLock
Definition: fxpkgpnp.hpp:4124
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
__in WDFDEVICE __in CONST GUID __in_opt PCUNICODE_STRING RefString
PSINGLE_LIST_ENTRY ple
_Must_inspect_result_ BOOLEAN __inline FxIsEqualGuid(__in CONST GUID *Lhs, __in CONST GUID *Rhs)
Definition: fxglobals.h:977
#define DO_NOTHING()
Definition: mxgeneral.h:32
Definition: ntbasedef.h:636
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:637
_Must_inspect_result_ _In_ WDFDEVICE _In_ CONST GUID * InterfaceClassGUID
Definition: wdfdevice.h:3627

Referenced by FxValidateInterfacePropertyData().

◆ IsInterruptAccessAllowed()

BOOLEAN FxDevice::IsInterruptAccessAllowed ( VOID  )
inline

Definition at line 2079 of file fxdevice.hpp.

2082 {
2083 //
2084 // Allow access to interrupts if the device has any connection resources,
2085 // regardless of the UmdfDirectHardwareAccess INF directive.
2086 //
2089 }
BOOLEAN HasConnectionResources(VOID)
Definition: fxresource.hpp:615
FxCmResList * GetTranslatedResources()
Definition: fxdevice.hpp:1854
BOOLEAN IsDirectHardwareAccessAllowed()
Definition: fxdevice.hpp:2072

◆ IsLegacy()

__inline BOOLEAN FxDevice::IsLegacy ( VOID  )
inline

◆ IsPdo()

__inline BOOLEAN FxDevice::IsPdo ( VOID  )
inline

◆ IsPnp()

◆ IsPort()

BOOL FxDevice::IsPort ( __in WDF_DEVICE_HWACCESS_TARGET_TYPE  Type)
inline

Definition at line 2158 of file fxdevice.hpp.

2161 {
2162 if (Type == WdfDeviceHwAccessTargetTypePort ||
2163 Type == WdfDeviceHwAccessTargetTypePortBuffer) {
2164 return TRUE;
2165 }
2166
2167 return FALSE;
2168 }

◆ IsPowerPageableCapable()

__inline BOOLEAN FxDevice::IsPowerPageableCapable ( VOID  )
inline

Definition at line 1421 of file fxdevice.hpp.

1424 {
1426 }

Referenced by FxPkgPnp::SetUsageNotificationFlags().

◆ IsRegister()

BOOL FxDevice::IsRegister ( __in WDF_DEVICE_HWACCESS_TARGET_TYPE  Type)
inline

Definition at line 2145 of file fxdevice.hpp.

2148 {
2149 if (Type == WdfDeviceHwAccessTargetTypeRegister ||
2150 Type == WdfDeviceHwAccessTargetTypeRegisterBuffer) {
2151 return TRUE;
2152 }
2153
2154 return FALSE;
2155 }

◆ IsRemoveLockEnabledForIo()

__inline BOOLEAN FxDevice::IsRemoveLockEnabledForIo ( VOID  )

Definition at line 57 of file fxdevicekm.hpp.

◆ NtStatusFromHr() [1/2]

NTSTATUS FxDevice::NtStatusFromHr ( _In_ HRESULT  Hr)

Definition at line 843 of file fxdeviceum.cpp.

846{
848}

◆ NtStatusFromHr() [2/2]

NTSTATUS FxDevice::NtStatusFromHr ( _In_ IWudfDeviceStack *  DevStack,
_In_ HRESULT  Hr 
)
static

Definition at line 826 of file fxdeviceum.cpp.

830{
831 PUMDF_VERSION_DATA driverVersion = DevStack->GetMinDriverVersion();
832 BOOL preserveCompat =
833 DevStack->ShouldPreserveIrpCompletionStatusCompatibility();
834
835 return CHostFxUtil::NtStatusFromHr(Hr,
836 driverVersion->MajorNumber,
837 driverVersion->MinorNumber,
838 preserveCompat
839 );
840}
unsigned int BOOL
Definition: ntddk_ex.h:94

Referenced by _OpenDeviceRegistryKey(), if(), and NtStatusFromHr().

◆ OpenDevicemapKeyWorker()

_Must_inspect_result_ NTSTATUS FxDevice::OpenDevicemapKeyWorker ( _In_ PFX_DRIVER_GLOBALS  pFxDriverGlobals,
_In_ PCUNICODE_STRING  KeyName,
_In_ ACCESS_MASK  DesiredAccess,
_In_ FxRegKey pKey 
)

Definition at line 995 of file fxdevicekm.cpp.

1001{
1002
1004 UNICODE_STRING registryKeyPath;
1005 wchar_t baseStringBuffer[256] = FX_DEVICEMAP_PATH;
1006
1007 //
1008 // Unlike UMDF, KMDF can open any DEVICEMAP key directly. Create a fully qualified
1009 // DEVICEMAP path from the provided subkey and pass it to FxRegKey::_OpenKey
1010 //
1011 registryKeyPath.Buffer = baseStringBuffer;
1012 registryKeyPath.MaximumLength = sizeof(baseStringBuffer);
1013 registryKeyPath.Length = sizeof(FX_DEVICEMAP_PATH) - sizeof(UNICODE_NULL);
1014
1015 status = RtlAppendUnicodeStringToString(&registryKeyPath, KeyName);
1016
1017 if (!NT_SUCCESS(status)) {
1019 "Unable to create a DEVICEMAP registry path for subkey %S, %!STATUS!",
1020 KeyName->Buffer, status);
1021 } else {
1022
1023 status = pKey->Create(NULL,
1024 &registryKeyPath,
1027 NULL);
1028
1029 if (!NT_SUCCESS(status)) {
1032 "WDFKEY open failed, %!STATUS!", status);
1033 }
1034 }
1035
1036 return status;
1037}
#define TRACINGERROR
Definition: dbgtrace.h:63
#define FX_DEVICEMAP_PATH
Definition: mxkm.h:37
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699

Referenced by if().

◆ OpenSettingsKey()

_Must_inspect_result_ NTSTATUS FxDevice::OpenSettingsKey ( __out HANDLE Key,
__in ACCESS_MASK  DesiredAccess = STANDARD_RIGHTS_ALL 
)

Definition at line 818 of file fxdevicekm.cpp.

822{
825 MdDeviceObject pdo;
826
827 //
828 // We need a PDO to open this reg key. in the case of failure to create
829 // a static PDO, we will go down this path in the pnp state machine, so we
830 // must check for validity always.
831 //
832 pdo = GetSafePhysicalDevice();
833
834 if (pdo == NULL) {
836 }
837
841 &parent.m_Key);
842 if (NT_SUCCESS(status)) {
844
845 //
846 // Create the key if it does not already exist
847 //
848 status = FxRegKey::_Create(parent.m_Key,
849 &wdf,
850 Key,
852 }
853
854 return status;
855}
r parent
Definition: btrfs.c:3010
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
Definition: wdfcore.h:161

Referenced by FxPkgPnp::PnpCheckAndIncrementRestartCount(), FxPkgPnp::ReadRegistryS0Idle(), FxPkgPnp::ReadRegistrySxWake(), and FxPkgPnp::SaveState().

◆ PdoInitialize()

_Must_inspect_result_ NTSTATUS FxDevice::PdoInitialize ( __in PWDFDEVICE_INIT  DeviceInit)

Definition at line 221 of file fxdevicekm.cpp.

224{
228
230
231 //
232 // If the child is static, the driver has the ability to delete the child
233 // device handle in between WdfDeviceCreate succeededing and then adding
234 // the child to the list of static children.
235 //
236 if (DeviceInit->Pdo.Static == FALSE) {
238 }
239
240 //
241 // Double check to make sure that the PDO has a name
242 //
243 if (DeviceInit->HasName() == FALSE) {
245 }
246
247 m_ParentDevice = DeviceInit->Pdo.Parent;
248
249 //
250 // This reference will be removed when this object is destroyed
251 //
252 m_ParentDevice->ADDREF(this);
253
255
257 if (m_PkgPnp == NULL) {
259 }
261
263 if (!NT_SUCCESS(status)) {
264 return status;
265 }
266
267 //
268 // If the Size is zero then the driver writer never set any callbacks so we
269 // can skip this call.
270 //
271 if (DeviceInit->Pdo.EventCallbacks.Size != 0) {
272 pPkgPdo->RegisterCallbacks(&DeviceInit->Pdo.EventCallbacks);
273 }
274
276
277 if (NT_SUCCESS(status)) {
278
279 //
280 // We are initializing the PDO, stash away the PDO's device object
281 // under m_PhysicalDevice as well so that we don't have to check
282 // for device type later.
283 //
285
286 if (DeviceInit->Pdo.Raw) {
288 }
289
290 //
291 // Power pageable and inrush are mutually exclusive
292 //
293 if (DeviceInit->PowerPageable) {
295 }
296 else if (DeviceInit->Inrush) {
298 }
299
300 if (DeviceInit->Pdo.ForwardRequestToParent) {
301 m_DeviceObject.SetStackSize(m_DeviceObject.GetStackSize() + DeviceInit->Pdo.Parent->GetDeviceObject()->StackSize);
303 }
304
305 // status = m_PkgWmi->PostCreateDeviceInitialize(); __REACTOS__
306 // if (!NT_SUCCESS(status)) {
307 // return status;
308 // }
309
311 if (!NT_SUCCESS(status)) {
312 return status;
313 }
314
316
317 if (NT_SUCCESS(status)) {
318 //
319 // Clear the DO_DEVICE_INITIALIZING bit.
320 //
322 }
323 }
324
325 return status;
326}
VOID FinishInitializing(VOID)
Definition: fxdevice.cpp:1109
BOOLEAN m_AllowForwardRequestToParent
Definition: fxpkgpdo.hpp:69
VOID RegisterCallbacks(__in PWDF_PDO_EVENT_CALLBACKS DispatchTable)
Definition: fxpkgpdo.cpp:1576
BOOLEAN m_RawOK
Definition: fxpkgpdo.hpp:59
virtual _Must_inspect_result_ NTSTATUS Initialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxpkgpnp.cpp:349
_Must_inspect_result_ NTSTATUS PostCreateDeviceInitialize(VOID)
Definition: fxpkgpnp.cpp:1187
VOID SetStackSize(_In_ CCHAR Size)
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148

Referenced by _Create().

◆ PoFxDevicePowerNotRequired()

void FxDevice::PoFxDevicePowerNotRequired ( _In_ MdDeviceObject  DeviceObject)
static

Definition at line 817 of file fxdeviceum.cpp.

820{
822 m_PoxInterface.PowerNotRequiredCallbackInvoked();
823}
FxPowerPolicyMachine m_PowerPolicyMachine
Definition: fxpkgpnp.hpp:4153
FxPowerPolicyOwnerSettings * m_Owner

Referenced by FxMessageDispatch::PoFxDevicePowerNotRequired().

◆ PoFxDevicePowerRequired()

void FxDevice::PoFxDevicePowerRequired ( _In_ MdDeviceObject  DeviceObject)
static

Definition at line 808 of file fxdeviceum.cpp.

811{
813 m_PoxInterface.PowerRequiredCallbackInvoked();
814}

Referenced by FxMessageDispatch::PoFxDevicePowerRequired().

◆ PostInitialize()

_Must_inspect_result_ NTSTATUS FxDevice::PostInitialize ( VOID  )

Definition at line 940 of file fxdevice.cpp.

943{
945
949
950 return status;
951}
static NTSTATUS _Create(PFX_DRIVER_GLOBALS FxDriverGlobals, PVOID WdmObject, FxDisposeList **pObject)

Referenced by _Create().

◆ PreprocessIrp()

_Must_inspect_result_ NTSTATUS FxDevice::PreprocessIrp ( __in MdIrp  Irp)
private

◆ ProcessWmiPowerQueryOrSetData()

NTSTATUS FxDevice::ProcessWmiPowerQueryOrSetData ( _In_ RdWmiPowerAction  Action,
_Out_ BOOLEAN QueryResult 
)

Definition at line 699 of file fxdeviceum.cpp.

724{
725 if (Action == ActionInvalid) {
727 }
728
729 if ((Action == QueryS0Idle || Action == QuerySxWake) && QueryResult == NULL) {
731 }
732
733 switch(Action)
734 {
735 case SetS0IdleEnable:
737 break;
738 case SetS0IdleDisable:
740 break;
741 case SetSxWakeEnable:
743 break;
744 case SetSxWakeDisable:
746 break;
747 case QueryS0Idle:
749 break;
750 case QuerySxWake:
752 break;
753 default:
754 ASSERT(FALSE);
755 break;
756 }
757
758 return STATUS_SUCCESS;
759}
VOID PowerPolicySetSxWakeState(__in BOOLEAN State)
Definition: fxpkgpnp.cpp:3720
VOID PowerPolicySetS0IdleState(__in BOOLEAN State)
Definition: fxpkgpnp.cpp:3710
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510

Referenced by FxMessageDispatch::ProcessWmiPowerQueryOrSetData().

◆ QueryInterface()

_Must_inspect_result_ NTSTATUS FxDevice::QueryInterface ( __inout FxQueryInterfaceParams Params)
virtual

Definition at line 1754 of file fxdevice.cpp.

1757{
1758 switch (Params->Type) {
1759 case FX_TYPE_DEVICE:
1760 *Params->Object = (FxDevice*) this;
1761 break;
1762
1763 default:
1764 return FxDeviceBase::QueryInterface(Params); // __super call
1765 }
1766
1767 return STATUS_SUCCESS;
1768}
_Must_inspect_result_ NTSTATUS QueryInterface(__inout FxQueryInterfaceParams *Params)
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:308

◆ ReadRegister()

__inline SIZE_T FxDevice::ReadRegister ( __in WDF_DEVICE_HWACCESS_TARGET_SIZE  Size,
__in PVOID  Register 
)

Definition at line 186 of file fxdeviceum.hpp.

190{
191 SIZE_T value = 0;
192
193 //
194 // ETW start event for perf measurement
195 //
196 EventWriteEVENT_UMDF_FX_READ_FROM_HARDWARE_START(
197 WdfDeviceHwAccessTargetTypeRegister, Size, 0);
198
199 switch(Size) {
200 case WdfDeviceHwAccessTargetSizeUchar:
202 break;
203 case WdfDeviceHwAccessTargetSizeUshort:
205 break;
206 case WdfDeviceHwAccessTargetSizeUlong:
208 break;
209 case WdfDeviceHwAccessTargetSizeUlong64:
210#if defined(_WIN64)
211 value = READ_REGISTER_ULONG64((PULONG64)Register);
212#else
213 FX_VERIFY(DRIVER(BadArgument, TODO), CHECK("Invalid call to ULONG64 "
214 "hardware access function", FALSE));
215#endif
216 break;
217 default:
218 FX_VERIFY(INTERNAL, TRAPMSG("Unexpected"));
219 break;
220 }
221
222 //
223 // ETW end event for perf measurement
224 //
225 EventWriteEVENT_UMDF_FX_READ_FROM_HARDWARE_END(
226 WdfDeviceHwAccessTargetTypeRegister, Size, 0);
227
228 return value;
229}
#define CHECK(hwndTarget)
#define READ_REGISTER_USHORT(r)
Definition: arm.h:29
#define READ_REGISTER_ULONG(r)
Definition: arm.h:26
unsigned __int64 * PULONG64
Definition: imports.h:198
uint32_t * PULONG
Definition: typedefs.h:59
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint16_t * PUSHORT
Definition: typedefs.h:56
unsigned char * PUCHAR
Definition: typedefs.h:53
Definition: pdh_main.c:94
NTKERNELAPI UCHAR NTAPI READ_REGISTER_UCHAR(IN PUCHAR Register)

Referenced by if().

◆ ReadRegisterBuffer()

__inline VOID FxDevice::ReadRegisterBuffer ( __in WDF_DEVICE_HWACCESS_TARGET_SIZE  Size,
__in PVOID  Register,
__out_ecount_full(Count) PVOID  Buffer,
__in ULONG  Count 
)

Definition at line 233 of file fxdeviceum.hpp.

239{
240 //
241 // ETW start event for perf measurement
242 //
243 EventWriteEVENT_UMDF_FX_READ_FROM_HARDWARE_START(
244 WdfDeviceHwAccessTargetTypeRegisterBuffer, Size, Count);
245
246 switch(Size) {
247 case WdfDeviceHwAccessTargetSizeUchar:
249 break;
250 case WdfDeviceHwAccessTargetSizeUshort:
251#pragma prefast(suppress:26000, "The Size parameter dictates the buffer size")
253 break;
254 case WdfDeviceHwAccessTargetSizeUlong:
256 break;
257 case WdfDeviceHwAccessTargetSizeUlong64:
258#if defined(_WIN64)
259 READ_REGISTER_BUFFER_ULONG64(((PULONG64)Register), (PULONG64)Buffer, Count );
260#else
261 FX_VERIFY(DRIVER(BadArgument, TODO), CHECK("Invalid call to ULONG64 "
262 "hardware access function", FALSE));
263#endif
264 break;
265 default:
266 FX_VERIFY(INTERNAL, TRAPMSG("Unexpected"));
267 break;
268 }
269
270 //
271 // ETW start event for perf measurement
272 //
273 EventWriteEVENT_UMDF_FX_READ_FROM_HARDWARE_END(
274 WdfDeviceHwAccessTargetTypeRegisterBuffer, Size, Count);
275}
Definition: bufpool.h:45
int Count
Definition: noreturn.cpp:7
NTKERNELAPI VOID NTAPI READ_REGISTER_BUFFER_UCHAR(IN PUCHAR Register, IN PUCHAR Buffer, IN ULONG Count)
NTKERNELAPI VOID NTAPI READ_REGISTER_BUFFER_USHORT(IN PUSHORT Register, IN PUSHORT Buffer, IN ULONG Count)
NTKERNELAPI VOID NTAPI READ_REGISTER_BUFFER_ULONG(IN PULONG Register, IN PULONG Buffer, IN ULONG Count)

Referenced by if().

◆ RemoteInterfaceArrival()

WUDF_INTERFACE_CONTEXT FxDevice::RemoteInterfaceArrival ( _In_ IWudfDevice *  DeviceObject,
_In_ LPCGUID  DeviceInterfaceGuid,
_In_ PCWSTR  SymbolicLink 
)
static

Definition at line 762 of file fxdeviceum.cpp.

767{
769 UNREFERENCED_PARAMETER(DeviceInterfaceGuid);
771
772 ASSERTMSG("Not implemented for UMDF\n", FALSE);
773
774 return NULL;
775}
static const WCHAR SymbolicLink[]
Definition: interface.c:31

Referenced by FxMessageDispatch::RemoteInterfaceArrival().

◆ RemoteInterfaceRemoval()

void FxDevice::RemoteInterfaceRemoval ( _In_ IWudfDevice *  DeviceObject,
_In_ WUDF_INTERFACE_CONTEXT  RemoteInterfaceID 
)
static

Definition at line 778 of file fxdeviceum.cpp.

782{
784 UNREFERENCED_PARAMETER(RemoteInterfaceID);
785
786 ASSERTMSG("Not implemented for UMDF\n", FALSE);
787}

Referenced by FxMessageDispatch::RemoteInterfaceRemoval().

◆ RemoveChildList()

VOID FxDevice::RemoveChildList ( __inout FxChildList List)
virtual

Reimplemented from FxDeviceBase.

Definition at line 441 of file fxdevicekm.cpp.

444{
445 if (IsPnp()) {
447 }
448}
VOID RemoveChildList(__in FxChildList *List)
Definition: fxpkgpnp.cpp:4983

Referenced by FxChildList::Dispose().

◆ RemoveDmaEnabler()

VOID FxDevice::RemoveDmaEnabler ( __inout FxDmaEnabler Enabler)
virtual

Reimplemented from FxDeviceBase.

Definition at line 475 of file fxdevicekm.cpp.

478{
479 if (IsPnp()) {
480 m_PkgPnp->RemoveDmaEnabler(Enabler);
481 }
482}
VOID RemoveDmaEnabler(__in FxDmaEnabler *Enabler)
Definition: fxpkgpnpkm.cpp:289

◆ RemoveIoTarget()

VOID FxDevice::RemoveIoTarget ( __inout FxIoTarget IoTarget)
virtual

Reimplemented from FxDeviceBase.

Definition at line 1790 of file fxdevice.cpp.

1793{
1795 &IoTarget->m_TransactionedEntry);
1796
1797 //
1798 // Assumes that the caller has its own reference on the IoTarget
1799 //
1800 IoTarget->RELEASE(this);
1801}
VOID Remove(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxTransactionedEntry *Entry)

◆ RetrieveDeviceInfoRegistrySettings()

VOID FxDevice::RetrieveDeviceInfoRegistrySettings ( _Out_ PCWSTR GroupId,
_Out_ PUMDF_DRIVER_REGSITRY_INFO  DeviceRegInfo 
)

Definition at line 1759 of file fxdeviceum.cpp.

1763{
1764 DWORD Err;
1765 DWORD Data;
1766 HKEY wudfKey = NULL;
1768 DWORD type;
1769 PWSTR buffer;
1771
1772 ASSERT(GroupId != NULL);
1773 ASSERT(DeviceRegInfo != NULL);
1774
1775 ZeroMemory(DeviceRegInfo, sizeof(UMDF_DRIVER_REGSITRY_INFO));
1776 type = REG_NONE;
1777
1778 if (m_PdoDevKey == NULL) {
1780 "Handle to hardware key not yet available");
1781 return;
1782 }
1783
1786 0,
1787 KEY_READ,
1788 &wudfKey);
1789 if (ERROR_SUCCESS != Err) {
1791 "Failed to open hw registry key to read hw access settings");
1792 goto clean0;
1793 }
1794
1795 //
1796 // Read WDF_KERNEL_MODE_CLIENT_POLICY value
1797 //
1798 DataSize = sizeof(Data);
1799 Data = 0;
1800 Err = RegQueryValueEx(wudfKey,
1802 NULL,
1803 NULL,
1804 (BYTE*) &Data,
1805 &DataSize);
1806
1807 if (ERROR_SUCCESS == Err) {
1808 if (((WDF_KERNEL_MODE_CLIENT_POLICY_TYPE)Data) == WdfAllowKernelModeClients) {
1809 DeviceRegInfo->IsKernelModeClientAllowed = TRUE;
1810 }
1811 }
1812 else if (ERROR_FILE_NOT_FOUND != Err) {
1814 "Failed to read kernel mode client policy value in registry");
1815 }
1816
1817 //
1818 // Read WDF_FILE_OBJECT_POLICY value
1819 //
1820 DataSize = sizeof(Data);
1821 Data = 0;
1822 Err = RegQueryValueEx(wudfKey,
1824 NULL,
1825 NULL,
1826 (BYTE*) &Data,
1827 &DataSize);
1828 if (ERROR_SUCCESS == Err) {
1829 if (((WDF_FILE_OBJECT_POLICY_TYPE)Data) == WdfAllowNullAndUnknownFileObjects) {
1830 DeviceRegInfo->IsNullFileObjectAllowed = TRUE;
1831 }
1832 }
1833 else if (ERROR_FILE_NOT_FOUND != Err) {
1835 "Failed to read file object policy value in registry");
1836 }
1837
1838 //
1839 // Read WDF_METHOD_NEITHER_ACTION value
1840 //
1841 DataSize = sizeof(Data);
1842 Data = 0;
1843 Err = RegQueryValueEx(wudfKey,
1845 NULL,
1846 NULL,
1847 (BYTE*) &Data,
1848 &DataSize);
1849 if (ERROR_SUCCESS == Err) {
1850 if (((WDF_METHOD_NEITHER_ACTION_TYPE)Data) == WdfMethodNeitherAction_Copy) {
1851 DeviceRegInfo->IsMethodNeitherActionCopy = TRUE;
1852 }
1853 }
1854 else if (ERROR_FILE_NOT_FOUND != Err) {
1856 "Failed to read method neither action value in registry");
1857 }
1858
1859 //
1860 // Read WDF_PROCESS_SHARING_ENABLED value
1861 //
1862 DataSize = sizeof(Data);
1863 Data = 0;
1864 Err = RegQueryValueEx(wudfKey,
1866 NULL,
1867 NULL,
1868 (BYTE*) &Data,
1869 &DataSize);
1870 if (ERROR_SUCCESS == Err) {
1871 if (((WDF_PROCESS_SHARING_TYPE)Data) == WdfProcessSharingDisabled) {
1872 DeviceRegInfo->IsHostProcessSharingDisabled = TRUE;
1873 }
1874 }
1875 else if (ERROR_FILE_NOT_FOUND != Err) {
1877 "Failed to read method neither action value in registry");
1878 }
1879
1880 //
1881 // Read Group ID
1882 //
1883 buffer = NULL;
1884 bufferSize = 0;
1885 *GroupId = NULL;
1886
1887 Err = RegQueryValueEx(wudfKey,
1889 0,
1890 &type,
1891 (LPBYTE) buffer,
1892 &bufferSize);
1893 if (ERROR_MORE_DATA == Err) {
1894
1895 buffer = new WCHAR[bufferSize/sizeof(buffer[0])];
1896 if (buffer == NULL) {
1899 "Failed to allocate memory for string buffer");
1900 }
1901 else {
1902
1903 buffer[0] = L'\0';
1904 Err = RegQueryValueEx(wudfKey,
1906 0,
1907 &type,
1908 (LPBYTE) buffer,
1909 &bufferSize);
1910 if (Err == ERROR_SUCCESS) {
1911 if (type != REG_SZ) {
1913 }
1914 else {
1915 //
1916 // according to the string data returned by RegQueryValueEx()
1917 // is not always null terminated.
1918 //
1919 buffer[bufferSize/sizeof(buffer[0]) - 1] = L'\0';
1920 }
1921 }
1922
1923 if (Err == ERROR_SUCCESS) {
1924 *GroupId = buffer;
1925 }
1926 else {
1927 delete [] buffer;
1928 buffer = NULL;
1929 }
1930 }
1931 }
1932 else if (ERROR_FILE_NOT_FOUND != Err) {
1934 "Failed to read Group id value in registry");
1935 }
1936
1937
1938clean0:
1939
1940 if (NULL != wudfKey) {
1941 RegCloseKey(wudfKey);
1942 }
1943
1944 return;
1945}
#define RegCloseKey(hKey)
Definition: registry.h:49
HKEY m_PdoDevKey
Definition: fxdevice.hpp:748
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FX_FILE_OBJECT_POLICY
Definition: fxdeviceum.hpp:48
#define FX_METHOD_NEITHER_ACTION
Definition: fxdeviceum.hpp:45
#define FX_PROCESS_SHARING_ENABLED
Definition: fxdeviceum.hpp:46
#define WUDF_SUB_KEY
Definition: fxdeviceum.hpp:29
#define FX_KERNEL_MODE_CLIENT_POLICY
Definition: fxdeviceum.hpp:44
#define FX_DEVICE_GROUP_ID
Definition: fxdeviceum.hpp:47
size_t bufferSize
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_SZ
Definition: layer.c:22
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
#define KEY_READ
Definition: nt_native.h:1023
#define REG_NONE
Definition: nt_native.h:1492
unsigned char * LPBYTE
Definition: typedefs.h:53
#define ZeroMemory
Definition: winbase.h:1737
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegQueryValueEx
Definition: winreg.h:524

◆ RetrieveDeviceRegistrySettings()

VOID FxDevice::RetrieveDeviceRegistrySettings ( VOID  )

Definition at line 851 of file fxdeviceum.cpp.

854{
855 DWORD err;
856 HKEY wudfKey = NULL;
857 DWORD data;
859
862 0,
863 KEY_READ,
864 &wudfKey);
865 if (ERROR_SUCCESS != err) {
867 "Failed to open hw registry key to read hw access settings");
868 goto clean0;
869 }
870
871 //
872 // Read FX_DIRECT_HARDWARE_ACCESS value
873 //
874 dataSize = sizeof(data);
875 data = 0;
876 err = RegQueryValueEx(wudfKey,
878 NULL,
879 NULL,
880 (BYTE*) &data,
881 &dataSize);
882
883 if (ERROR_SUCCESS == err) {
884 if (((WDF_DIRECT_HARDWARE_ACCESS_TYPE)data) < WdfDirectHardwareAccessMax) {
885 //
886 // save the setting only if it is valid
887 //
888 m_DirectHardwareAccess = (WDF_DIRECT_HARDWARE_ACCESS_TYPE)data;
889 }
890 else {
892 "invalid direct hardware access value in registry %u",
893 (WDF_DIRECT_HARDWARE_ACCESS_TYPE)data);
894 }
895 }
896 else if (ERROR_FILE_NOT_FOUND != err) {
898 "Failed to read direct hardware access value in registry");
899 }
900
902 "DirectHardwareAccess = %u", m_DirectHardwareAccess);
903
904
905 //
906 // Read FX_REGISTER_ACCESS_MODE value
907 //
908 dataSize = sizeof(data);
909 data = 0;
910 err = RegQueryValueEx(wudfKey,
912 NULL,
913 NULL,
914 (BYTE*) &data,
915 &dataSize);
916 if (ERROR_SUCCESS == err) {
917 if (((WDF_REGISTER_ACCESS_MODE_TYPE)data) < WdfRegisterAccessMax) {
918 //
919 // save the setting only if it is valid
920 //
921 m_RegisterAccessMode = (WDF_REGISTER_ACCESS_MODE_TYPE)data;
922 }
923 else {
925 "Invalid Register Access mode value in registry %u",
926 (WDF_REGISTER_ACCESS_MODE_TYPE)data);
927 }
928 }
929 else if (ERROR_FILE_NOT_FOUND != err) {
931 "Failed to read Register Access mode value in registry");
932 }
933
935 "RegisterAccessMode = %u", m_RegisterAccessMode);
936
937 //
938 // Read FX_FILE_OBJECT_POLICY
939 //
940 dataSize = sizeof(data);
941 data = 0;
942 err = RegQueryValueEx(wudfKey,
944 NULL,
945 NULL,
946 (BYTE*) &data,
947 &dataSize);
948 if (ERROR_SUCCESS == err) {
949 if (((WDF_FILE_OBJECT_POLICY_TYPE)data) < WdfFileObjectPolicyMax) {
950 //
951 // save the setting only if it is valid
952 //
953 m_FileObjectPolicy = (WDF_FILE_OBJECT_POLICY_TYPE)data;
954 }
955 else {
957 "Invalid File object Policy value in registry %u",
958 (WDF_FILE_OBJECT_POLICY_TYPE)data);
959 }
960 }
961 else if (ERROR_FILE_NOT_FOUND != err) {
963 "Failed to read File Object Policy value in registry");
964 }
965
967 "FileObjectPolicy = %u", m_FileObjectPolicy);
968
969 //
970 // Read FX_FS_CONTEXT_USE_POLICY
971 //
972 dataSize = sizeof(data);
973 data = 0;
974 err = RegQueryValueEx(wudfKey,
976 NULL,
977 NULL,
978 (BYTE*) &data,
979 &dataSize);
980 if (ERROR_SUCCESS == err) {
981 if (((WDF_FS_CONTEXT_USE_POLICY_TYPE)data) < WdfFsContextUsePolicyMax) {
982 //
983 // save the setting only if it is valid
984 //
985 m_FsContextUsePolicy = (WDF_FS_CONTEXT_USE_POLICY_TYPE)data;
986 }
987 else {
989 "Invalid Fs Context Use Policy value in registry %u",
990 (WDF_FILE_OBJECT_POLICY_TYPE)data);
991 }
992 }
993 else if (ERROR_FILE_NOT_FOUND != err) {
995 "Failed to read Fs Context Use Policy value in registry");
996 }
997
999 "FsContextUsePolicy = %u", m_FsContextUsePolicy);
1000
1001
1002clean0:
1003
1004 if (NULL != wudfKey) {
1005 RegCloseKey(wudfKey);
1006 }
1007
1008 return;
1009}
WDF_FILE_OBJECT_POLICY_TYPE m_FileObjectPolicy
Definition: fxdevice.hpp:788
WDF_FS_CONTEXT_USE_POLICY_TYPE m_FsContextUsePolicy
Definition: fxdevice.hpp:793
#define FX_FS_CONTEXT_USE_POLICY
Definition: fxdeviceum.hpp:41
#define FX_REGISTER_ACCESS_MODE
Definition: fxdeviceum.hpp:35
#define FX_DIRECT_HARDWARE_ACCESS
Definition: fxdeviceum.hpp:32
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLsizei dataSize
Definition: glext.h:11123
#define err(...)

◆ SetCallbackFlags()

__inline VOID FxDevice::SetCallbackFlags ( __in BYTE  Flags)
inline

Definition at line 1526 of file fxdevice.hpp.

1529 {
1530 KIRQL irql;
1531
1532 Lock(&irql);
1534 Unlock(irql);
1535 }
__inline VOID SetCallbackFlagsLocked(__in BYTE Flags)
Definition: fxdevice.hpp:1517

Referenced by __drv_when().

◆ SetCallbackFlagsLocked()

__inline VOID FxDevice::SetCallbackFlagsLocked ( __in BYTE  Flags)
inline

Definition at line 1517 of file fxdevice.hpp.

1520 {
1522 }

Referenced by SetCallbackFlags().

◆ SetCleanupFromFailedCreate()

VOID FxDevice::SetCleanupFromFailedCreate ( BOOLEAN  Value)
inline

Definition at line 1877 of file fxdevice.hpp.

1880 {
1881#if (FX_CORE_MODE == FX_CORE_USER_MODE)
1883#else
1885#endif
1886 }
BOOLEAN m_CleanupFromFailedCreate
Definition: fxdevice.hpp:732
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by DeleteDeviceFromFailedCreateNoDelete().

◆ SetDevicePnpState()

__inline VOID FxDevice::SetDevicePnpState ( __in WDF_DEVICE_PNP_STATE  DeviceState)
inline

Definition at line 1173 of file fxdevice.hpp.

1176 {
1178 }
_In_ WDFDEVICE _Out_ PWDF_DEVICE_STATE DeviceState
Definition: wdfdevice.h:1999

Referenced by FxPkgPnp::PnpEnterNewState().

◆ SetDevicePowerPolicyState()

__inline VOID FxDevice::SetDevicePowerPolicyState ( __in WDF_DEVICE_POWER_POLICY_STATE  DeviceState)
inline

◆ SetDevicePowerState()

__inline VOID FxDevice::SetDevicePowerState ( __in WDF_DEVICE_POWER_STATE  DeviceState)
inline

Definition at line 1182 of file fxdevice.hpp.

1185 {
1187 }

Referenced by FxPkgPnp::PowerEnterNewState().

◆ SetDeviceTelemetryInfoFlags()

virtual VOID FxDevice::SetDeviceTelemetryInfoFlags ( _In_ FxDeviceInfoFlags  Flag)
inlinevirtual

Reimplemented from FxDeviceBase.

Definition at line 1807 of file fxdevice.hpp.

1810 {
1812 }
Definition: xml2sdb.h:80

Referenced by FxInterrupt::AssignResources(), FdoInitialize(), and if().

◆ SetFileObjectClass()

__inline VOID FxDevice::SetFileObjectClass ( __in WDF_FILEOBJECT_CLASS  FileObjectClass)
inline

Definition at line 1135 of file fxdevice.hpp.

1138 {
1139 m_FileObjectClass = FileObjectClass;
1140 }

Referenced by FxPkgGeneral::ConfigureFileObjectClass().

◆ SetFilter()

_Must_inspect_result_ NTSTATUS FxDevice::SetFilter ( __in BOOLEAN  Value)

Definition at line 1851 of file fxdevice.cpp.

1854{
1856
1857 ASSERT(IsFdo());
1858
1860
1861 if (NT_SUCCESS(status) && m_PkgPnp != NULL) {
1863 }
1864
1865 if (NT_SUCCESS(status)) {
1866 m_Filter = Value;
1867 }
1868
1869 return status;
1870}
_Must_inspect_result_ NTSTATUS SetFilter(__in BOOLEAN Value)
Definition: fxpkgfdo.cpp:892
_Must_inspect_result_ NTSTATUS SetFilter(__in BOOLEAN Value)
Definition: fxpkgio.cpp:1120

Referenced by FdoInitialize().

◆ SetFilterIoType()

VOID FxDevice::SetFilterIoType ( VOID  )
private

Definition at line 1873 of file fxdevice.cpp.

1876{
1877 FxIoTarget * ioTarget;
1878 FxTransactionedEntry * targetsList = NULL;
1879
1880 ASSERT(IsFilter());
1881
1883
1884 //
1885 // m_AttachedDevice can be NULL for UMDF, so check for NULL
1886 //
1887 if (m_AttachedDevice.GetObject() != NULL) {
1890 }
1891
1894 }
1895 else if (m_DeviceObject.GetFlags() & DO_DIRECT_IO) {
1897 }
1898 else {
1900 }
1901
1902 //
1903 // We also need to propagate these settings to any io targets that
1904 // have already been created
1905 //
1906
1908
1909 targetsList = m_IoTargetsList.GetNextEntry(targetsList);
1910
1911 while (targetsList != NULL) {
1912
1913 ioTarget = (FxIoTarget *) targetsList->GetTransactionedObject();
1914
1915 if (ioTarget->GetTargetPDO() == GetPhysicalDevice()) {
1916 ioTarget->UpdateTargetIoType();
1917 }
1918
1919 targetsList = m_IoTargetsList.GetNextEntry(targetsList);
1920 }
1921
1923}
VOID UpdateTargetIoType(VOID)
__inline MdDeviceObject GetTargetPDO(VOID)
Definition: fxiotarget.hpp:281
_Must_inspect_result_ FxTransactionedEntry * GetNextEntry(__in_opt FxTransactionedEntry *Entry)
VOID UnlockFromEnum(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
VOID LockForEnum(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
return pDevice GetPhysicalDevice()
FxObject * GetTransactionedObject(VOID)
@ WdfDeviceIoNeither
Definition: wdfdevice.h:451

Referenced by FdoInitialize(), and FxPkgPnp::PnpMatchResources().

◆ SetInitialState()

VOID FxDevice::SetInitialState ( VOID  )
private

Definition at line 153 of file fxdevice.cpp.

156{
157 //
158 // Set the initial device state
159 //
163
164 //
165 // Set the default IO type to "buffered"
166 //
168
172
173 m_Filter = FALSE;
177 m_Legacy = FALSE;
180 m_Legacy = FALSE;
184
185 //
186 // Clear all packages by default
187 //
188
189 m_PkgIo = NULL;
190 m_PkgPnp = NULL;
192 m_PkgWmi = NULL;
194
197
198#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
200#else // UMDF
201 //
202 // In UMDF file object is always required. So indicate that now.
203 //
205#endif
206
208
210
214
215#if (FX_CORE_MODE == FX_CORE_USER_MODE)
216 //
217 // Init UMDF specific members
218 //
226
227 m_RetrievalMode = UMINT::WdfDeviceIoBufferRetrievalDeferred;
230
236#endif
237}
FxMessageDispatch * m_Dispatcher
Definition: fxdevice.hpp:738
PWSTR m_KernelDeviceName
Definition: fxdevice.hpp:758
BOOLEAN m_ParentWaitingOnChild
Definition: fxdevice.hpp:535
LIST_ENTRY m_FileObjectListHead
Definition: fxdevice.hpp:643
PWSTR m_DeviceKeyPath
Definition: fxdevice.hpp:753
PWSTR m_DeviceInstanceId
Definition: fxdevice.hpp:763
#define FX_FILE_OBJECT_POLICY_DEFAULT
Definition: fxdeviceum.hpp:39
#define FX_FS_CONTEXT_USE_POLICY_DEFAULT
Definition: fxdeviceum.hpp:42
#define FX_REGISTER_ACCESS_MODE_DEFAULT
Definition: fxdeviceum.hpp:36
#define FX_DIRECT_HARDWARE_ACCESS_DEFAULT
Definition: fxdeviceum.hpp:33
@ WdfFileObjectNotRequired
Definition: wdfdevice.h:460
@ WdfFileObjectWdfCannotUseFsContexts
Definition: wdfdevice.h:463
@ WdfDevStatePwrPolObjectCreated
Definition: wdfdevice.h:232
@ WdfDevStatePowerObjectCreated
Definition: wdfdevice.h:130

Referenced by FxDevice().

◆ SetInterruptThreadpool()

VOID FxDevice::SetInterruptThreadpool ( _In_ FxInterruptThreadpool Pool)
inline

Definition at line 1049 of file fxdevice.hpp.

1052 {
1054 }
Definition: bufpool.h:50

◆ SetParentWaitingOnRemoval()

__inline VOID FxDevice::SetParentWaitingOnRemoval ( VOID  )
inline

Definition at line 1269 of file fxdevice.hpp.

1272 {
1274 }

◆ SetStackSize()

__inline VOID FxDevice::SetStackSize ( _In_ CHAR  Size)
inline

Definition at line 1833 of file fxdevice.hpp.

1836 {
1838 }

Referenced by _Create().

◆ TransportQueryId()

BOOL FxDevice::TransportQueryId ( _In_ IWudfDevice *  DeviceObject,
_In_ DWORD  Id,
_In_ PVOID  DataBuffer,
_In_ SIZE_T  cbDataBufferSize 
)
static

Definition at line 790 of file fxdeviceum.cpp.

796{
799 UNREFERENCED_PARAMETER(DataBuffer);
800 UNREFERENCED_PARAMETER(cbDataBufferSize);
801
802 ASSERTMSG("Not implemented for UMDF\n", FALSE);
803
804 return FALSE;
805}
DWORD Id

Referenced by FxMessageDispatch::TransportQueryID().

◆ UpdateInterruptThreadpoolLimits()

NTSTATUS FxDevice::UpdateInterruptThreadpoolLimits ( VOID  )
inline

Definition at line 1841 of file fxdevice.hpp.

1844 {
1845
1846
1847
1848
1849
1850 return STATUS_SUCCESS;
1851 }

◆ WmiPkgCleanup()

__inline VOID FxDevice::WmiPkgCleanup ( VOID  )
private

Definition at line 505 of file fxdevicekm.cpp.

508{
509 // m_PkgWmi->Cleanup(); __REACTOS__
510}

Referenced by FxPkgPnp::PnpEventRemovedCommonCode().

◆ WmiPkgDeregister()

__inline VOID FxDevice::WmiPkgDeregister ( VOID  )
private

Definition at line 497 of file fxdevicekm.cpp.

500{
501 // m_PkgWmi->Deregister(); __REACTOS__
502}

Referenced by FxPkgPnp::PnpCleanupForRemove().

◆ WmiPkgRegister()

__inline NTSTATUS FxDevice::WmiPkgRegister ( VOID  )
private

Definition at line 488 of file fxdevicekm.cpp.

491{
492 // return m_PkgWmi->Register(); __REACTOS__
493 return STATUS_SUCCESS;
494}

Referenced by FxPkgPnp::PnpEnableInterfacesAndRegisterWmi().

◆ WriteRegister()

__inline VOID FxDevice::WriteRegister ( __in WDF_DEVICE_HWACCESS_TARGET_SIZE  Size,
__in PVOID  Register,
__in SIZE_T  Value 
)

Definition at line 279 of file fxdeviceum.hpp.

284{
285 //
286 // ETW start event for perf measurement
287 //
288 EventWriteEVENT_UMDF_FX_WRITE_TO_HARDWARE_START(
289 WdfDeviceHwAccessTargetTypeRegister, Size, 0);
290
291 switch(Size) {
292 case WdfDeviceHwAccessTargetSizeUchar:
294 break;
295 case WdfDeviceHwAccessTargetSizeUshort:
297 break;
298 case WdfDeviceHwAccessTargetSizeUlong:
300 break;
301 case WdfDeviceHwAccessTargetSizeUlong64:
302#if defined(_WIN64)
303 WRITE_REGISTER_ULONG64((PULONG64)Register, (ULONG64)Value);
304#else
305 FX_VERIFY(DRIVER(BadArgument, TODO), CHECK("Invalid call to ULONG64 "
306 "hardware access function", FALSE));
307#endif
308 break;
309 default:
310 FX_VERIFY(INTERNAL, TRAPMSG("Unexpected"));
311 break;
312 }
313
314 //
315 // ETW start event for perf measurement
316 //
317 EventWriteEVENT_UMDF_FX_WRITE_TO_HARDWARE_END(
318 WdfDeviceHwAccessTargetTypeRegister, Size, 0);
319}
#define WRITE_REGISTER_USHORT(r, v)
Definition: arm.h:30
#define WRITE_REGISTER_ULONG(r, v)
Definition: arm.h:27
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)

◆ WriteRegisterBuffer()

__inline VOID FxDevice::WriteRegisterBuffer ( __in WDF_DEVICE_HWACCESS_TARGET_SIZE  Size,
__in PVOID  Register,
__in_ecount(Count) PVOID  Buffer,
__in ULONG  Count 
)

Definition at line 323 of file fxdeviceum.hpp.

329{
330 //
331 // ETW start event for perf measurement
332 //
333 EventWriteEVENT_UMDF_FX_WRITE_TO_HARDWARE_START(
334 WdfDeviceHwAccessTargetTypeRegisterBuffer, Size, Count);
335
336 switch(Size) {
337 case WdfDeviceHwAccessTargetSizeUchar:
339 break;
340 case WdfDeviceHwAccessTargetSizeUshort:
341#pragma prefast(suppress:26000, "The Size parameter dictates the buffer size")
343 break;
344 case WdfDeviceHwAccessTargetSizeUlong:
346 break;
347 case WdfDeviceHwAccessTargetSizeUlong64:
348#if defined(_WIN64)
349 WRITE_REGISTER_BUFFER_ULONG64(((PULONG64)Register), (PULONG64)Buffer, Count);
350#else
351 FX_VERIFY(DRIVER(BadArgument, TODO), CHECK("Invalid call to ULONG64 "
352 "hardware access function", FALSE));
353#endif
354 break;
355 default:
356 FX_VERIFY(INTERNAL, TRAPMSG("Unexpected"));
357 break;
358 }
359
360 //
361 // ETW start event for perf measurement
362 //
363 EventWriteEVENT_UMDF_FX_WRITE_TO_HARDWARE_END(
364 WdfDeviceHwAccessTargetTypeRegisterBuffer, Size, Count);
365}
NTKERNELAPI VOID NTAPI WRITE_REGISTER_BUFFER_UCHAR(IN PUCHAR Register, IN PUCHAR Buffer, IN ULONG Count)
NTKERNELAPI VOID NTAPI WRITE_REGISTER_BUFFER_ULONG(IN PULONG Register, IN PULONG Buffer, IN ULONG Count)
NTKERNELAPI VOID NTAPI WRITE_REGISTER_BUFFER_USHORT(IN PUSHORT Register, IN PUSHORT Buffer, IN ULONG Count)

Friends And Related Function Documentation

◆ FxDriver

friend class FxDriver
friend

Definition at line 489 of file fxdevice.hpp.

◆ FxFileObject

friend class FxFileObject
friend

Definition at line 491 of file fxdevice.hpp.

◆ FxIrp

friend class FxIrp
friend

Definition at line 490 of file fxdevice.hpp.

◆ FxPkgPnp

friend class FxPkgPnp
friend

Definition at line 492 of file fxdevice.hpp.

◆ GetTriageInfo

VOID GetTriageInfo ( VOID  )
friend

Definition at line 75 of file fxlibrarycommon.cpp.

78{
79 // Object
80 _WdfObjectTriageInfo.RawObjectSize = sizeof(FxObject);
87
88 // Context Triage Info
89 _WdfContextTriageInfo.HeaderSize = sizeof(FxContextHeader);
90 _WdfContextTriageInfo.NextHeader = FIELD_OFFSET(FxContextHeader, NextHeader);
92 _WdfContextTriageInfo.TypeInfoPtr = FIELD_OFFSET(FxContextHeader, ContextTypeInfo);
94
95 // Context type Triage info
99
100 // WdfRequest Queue
101 _WdfQueueTriageInfo.QueueSize = sizeof(FxIoQueue);
102 _WdfQueueTriageInfo.IrpQueue1 = FIELD_OFFSET(FxIoQueue, m_Queue);
103 _WdfQueueTriageInfo.IrpQueue2 = FIELD_OFFSET(FxIoQueue, m_DriverCancelable);
104 _WdfQueueTriageInfo.RequestList1 = FIELD_OFFSET(FxIoQueue, m_Cancelled);
105 _WdfQueueTriageInfo.RequestList2 = FIELD_OFFSET(FxIoQueue, m_CanceledOnQueueList);
106 _WdfQueueTriageInfo.FwdProgressContext = FIELD_OFFSET(FxIoQueue, m_FwdProgContext);
108
109 // Forward Progress
110 _WdfFwdProgressTriageInfo.ReservedRequestList =
111 FIELD_OFFSET(FXIO_FORWARD_PROGRESS_CONTEXT, m_ReservedRequestList);
112 _WdfFwdProgressTriageInfo.ReservedRequestInUseList =
113 FIELD_OFFSET(FXIO_FORWARD_PROGRESS_CONTEXT, m_ReservedRequestInUseList);
114 _WdfFwdProgressTriageInfo.PendedIrpList =
116
117 // Irp Queue
118 _WdfIrpQueueTriageInfo.IrpQueueSize = sizeof(FxIrpQueue);
119 _WdfIrpQueueTriageInfo.IrpListHeader = FIELD_OFFSET(FxIrpQueue, m_Queue);
120 _WdfIrpQueueTriageInfo.IrpListEntry = FIELD_OFFSET(IRP, Tail.Overlay.ListEntry);
122 Tail.Overlay.DriverContext[FX_IRP_QUEUE_CSQ_CONTEXT_ENTRY]);
123
124 // WdfRequest
125 _WdfRequestTriageInfo.RequestSize = sizeof(FxRequest);
126 _WdfRequestTriageInfo.CsqContext = FIELD_OFFSET(FxRequest, m_CsqContext);
128 _WdfRequestTriageInfo.ListEntryQueueOwned =
129 FIELD_OFFSET(FxRequest, m_OwnerListEntry);
130 _WdfRequestTriageInfo.ListEntryQueueOwned2 =
131 FIELD_OFFSET(FxRequest, m_OwnerListEntry2);
132 _WdfRequestTriageInfo.RequestListEntry =
133 FIELD_OFFSET(FxRequest, m_ListEntry);
134 _WdfRequestTriageInfo.FwdProgressList =
135 FIELD_OFFSET(FxRequest, m_ForwardProgressList);
136
137 // WdfDevice
138 _WdfDeviceTriageInfo.DeviceInitSize = sizeof(WDFDEVICE_INIT);
140
141 // FxIrp
142 _WdfIrpTriageInfo.FxIrpSize = sizeof(FxIrp);
143 _WdfIrpTriageInfo.IrpPtr = FIELD_OFFSET(FxIrp, m_Irp);
144}
friend class FxIrp
Definition: fxdevice.hpp:490
WDFTYPE m_Type
Definition: fxobject.hpp:247
USHORT m_ObjectSize
Definition: fxobject.hpp:254
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259
LIST_ENTRY m_ChildListHead
Definition: fxobject.hpp:293
FxObject * m_ParentObject
Definition: fxobject.hpp:303
LIST_ENTRY m_ChildEntry
Definition: fxobject.hpp:311
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T ContextSize
Definition: fltkernel.h:1444
#define FX_IRP_QUEUE_CSQ_CONTEXT_ENTRY
Definition: fxirpqueue.hpp:47
static WDFIRPQUEUE_TRIAGE_INFO _WdfIrpQueueTriageInfo
static WDFCONTEXT_TRIAGE_INFO _WdfContextTriageInfo
static WDFDEVICE_TRIAGE_INFO _WdfDeviceTriageInfo
static WDFCONTEXTTYPE_TRIAGE_INFO _WdfContextTypeTriageInfo
static WDFREQUEST_TRIAGE_INFO _WdfRequestTriageInfo
static WDFOBJECT_TRIAGE_INFO _WdfObjectTriageInfo
static WDFFWDPROGRESS_TRIAGE_INFO _WdfFwdProgressTriageInfo
static WDFIRP_TRIAGE_INFO _WdfIrpTriageInfo
static WDFQUEUE_TRIAGE_INFO _WdfQueueTriageInfo
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
struct _WDF_OBJECT_CONTEXT_TYPE_INFO WDF_OBJECT_CONTEXT_TYPE_INFO

Member Data Documentation

◆ _CompletionRoutineForRemlockMaintenance

NTSTATUS FxDevice::_CompletionRoutineForRemlockMaintenance
staticprivate

Definition at line 831 of file fxdevice.hpp.

Referenced by _AcquireOptinRemoveLock().

◆ m_AutoForwardCleanupClose

◆ m_CallbackFlags

BYTE FxDevice::m_CallbackFlags
private

◆ m_CleanupFromFailedCreate

BOOLEAN FxDevice::m_CleanupFromFailedCreate

Definition at line 732 of file fxdevice.hpp.

Referenced by SetCleanupFromFailedCreate(), and SetInitialState().

◆ m_CurrentPnpState

WDF_DEVICE_PNP_STATE FxDevice::m_CurrentPnpState
private

Definition at line 507 of file fxdevice.hpp.

Referenced by DeleteObject(), GetDevicePnpState(), SetDevicePnpState(), and SetInitialState().

◆ m_CurrentPowerPolicyState

WDF_DEVICE_POWER_POLICY_STATE FxDevice::m_CurrentPowerPolicyState
private

◆ m_CurrentPowerState

WDF_DEVICE_POWER_STATE FxDevice::m_CurrentPowerState
private

Definition at line 508 of file fxdevice.hpp.

Referenced by GetDevicePowerState(), SetDevicePowerState(), and SetInitialState().

◆ m_CxDeviceInfoListHead

LIST_ENTRY FxDevice::m_CxDeviceInfoListHead

Definition at line 635 of file fxdevice.hpp.

Referenced by GetCxDeviceInfo(), Initialize(), IsCxInIoPath(), SetInitialState(), and ~FxDevice().

◆ m_DefaultPriorityBoost

CHAR FxDevice::m_DefaultPriorityBoost
private

Definition at line 561 of file fxdevice.hpp.

Referenced by CreateDevice(), GetDefaultPriorityBoost(), and SetInitialState().

◆ m_DeviceInstanceId

PWSTR FxDevice::m_DeviceInstanceId

Definition at line 763 of file fxdevice.hpp.

Referenced by SetInitialState().

◆ m_DeviceKeyPath

PWSTR FxDevice::m_DeviceKeyPath

Definition at line 753 of file fxdevice.hpp.

Referenced by SetInitialState().

◆ m_DeviceName

UNICODE_STRING FxDevice::m_DeviceName

Definition at line 578 of file fxdevice.hpp.

Referenced by _Create(), CreateSymbolicLink(), Destroy(), if(), SetInitialState(), and ~FxDevice().

◆ m_DeviceObjectDeleted

BOOLEAN FxDevice::m_DeviceObjectDeleted
private

Definition at line 553 of file fxdevice.hpp.

Referenced by ControlDeviceDelete(), DeleteObject(), Destroy(), and SetInitialState().

◆ m_DeviceTelemetryInfoFlags

USHORT FxDevice::m_DeviceTelemetryInfoFlags
private

◆ m_DevStack

IWudfDeviceStack* FxDevice::m_DevStack

Definition at line 743 of file fxdevice.hpp.

Referenced by DetachDevice(), GetDeviceStack(), GetDeviceStack2(), and SetInitialState().

◆ m_DirectHardwareAccess

WDF_DIRECT_HARDWARE_ACCESS_TYPE FxDevice::m_DirectHardwareAccess

◆ m_DirectTransferThreshold

ULONG FxDevice::m_DirectTransferThreshold

Definition at line 772 of file fxdevice.hpp.

Referenced by GetDirectTransferThreshold(), and SetInitialState().

◆ m_Dispatcher

FxMessageDispatch* FxDevice::m_Dispatcher

Definition at line 738 of file fxdevice.hpp.

Referenced by SetInitialState().

◆ m_Exclusive

BOOLEAN FxDevice::m_Exclusive
private

Definition at line 540 of file fxdevice.hpp.

Referenced by CreateDevice(), Initialize(), IsExclusive(), and SetInitialState().

◆ m_FileObjectClass

WDF_FILEOBJECT_CLASS FxDevice::m_FileObjectClass

Definition at line 621 of file fxdevice.hpp.

Referenced by GetFileObjectClass(), SetFileObjectClass(), and SetInitialState().

◆ m_FileObjectListHead

LIST_ENTRY FxDevice::m_FileObjectListHead
protected

◆ m_FileObjectPolicy

WDF_FILE_OBJECT_POLICY_TYPE FxDevice::m_FileObjectPolicy

Definition at line 788 of file fxdevice.hpp.

Referenced by RetrieveDeviceRegistrySettings(), and SetInitialState().

◆ m_Filter

BOOLEAN FxDevice::m_Filter
private

Definition at line 522 of file fxdevice.hpp.

Referenced by CreateDevice(), FdoInitialize(), IsFilter(), SetFilter(), and SetInitialState().

◆ m_FsContextUsePolicy

WDF_FS_CONTEXT_USE_POLICY_TYPE FxDevice::m_FsContextUsePolicy

Definition at line 793 of file fxdevice.hpp.

Referenced by RetrieveDeviceRegistrySettings(), and SetInitialState().

◆ m_InteruptThreadpool

FxInterruptThreadpool* FxDevice::m_InteruptThreadpool

Definition at line 798 of file fxdevice.hpp.

Referenced by GetInterruptThreadpool(), SetInitialState(), and SetInterruptThreadpool().

◆ m_IoctlIoType

WDF_DEVICE_IO_TYPE FxDevice::m_IoctlIoType

Definition at line 771 of file fxdevice.hpp.

Referenced by GetPreferredIoctlTransferMode(), and SetInitialState().

◆ m_IoTargetsList

FxSpinLockTransactionedList FxDevice::m_IoTargetsList

Definition at line 623 of file fxdevice.hpp.

Referenced by AddIoTarget(), RemoveIoTarget(), and SetFilterIoType().

◆ m_KernelDeviceName

PWSTR FxDevice::m_KernelDeviceName

Definition at line 758 of file fxdevice.hpp.

Referenced by SetInitialState().

◆ m_Legacy

BOOLEAN FxDevice::m_Legacy
private

◆ m_MofResourceName

UNICODE_STRING FxDevice::m_MofResourceName

Definition at line 585 of file fxdevice.hpp.

Referenced by FxWmiIrpHandler::_RegInfo(), Destroy(), SetInitialState(), and ~FxDevice().

◆ m_ParentDevice

◆ m_ParentWaitingOnChild

BOOLEAN FxDevice::m_ParentWaitingOnChild
private

Definition at line 535 of file fxdevice.hpp.

Referenced by SetInitialState(), and SetParentWaitingOnRemoval().

◆ m_PdoDevKey

HKEY FxDevice::m_PdoDevKey

◆ m_PdoKnown

BOOLEAN FxDevice::m_PdoKnown

◆ m_PkgDefault

FxDefaultIrpHandler* FxDevice::m_PkgDefault

Definition at line 673 of file fxdevice.hpp.

Referenced by GetDispatchPackage(), Initialize(), SetInitialState(), and ~FxDevice().

◆ m_PkgGeneral

◆ m_PkgIo

◆ m_PkgPnp

◆ m_PkgWmi

◆ m_PowerPageableCapable

BOOLEAN FxDevice::m_PowerPageableCapable
private

Definition at line 530 of file fxdevice.hpp.

Referenced by CreateDevice(), FdoInitialize(), IsPowerPageableCapable(), and SetInitialState().

◆ m_PreprocessInfoListHead

LIST_ENTRY FxDevice::m_PreprocessInfoListHead

Definition at line 630 of file fxdevice.hpp.

Referenced by _Create(), SetInitialState(), and ~FxDevice().

◆ m_PriorityBoosts

const CHAR FxDevice::m_PriorityBoosts
staticprivate

Definition at line 563 of file fxdevice.hpp.

Referenced by CreateDevice().

◆ m_ReadWriteIoType

◆ m_RegisterAccessMode

WDF_REGISTER_ACCESS_MODE_TYPE FxDevice::m_RegisterAccessMode

◆ m_RequestAttributes

WDF_OBJECT_ATTRIBUTES FxDevice::m_RequestAttributes
protected

◆ m_RequestLookasideList

NPAGED_LOOKASIDE_LIST FxDevice::m_RequestLookasideList
protected

◆ m_RequestLookasideListElementSize

size_t FxDevice::m_RequestLookasideListElementSize
protected

Definition at line 653 of file fxdevice.hpp.

Referenced by AllocateRequestMemory(), Initialize(), SetInitialState(), and ~FxDevice().

◆ m_RetrievalMode

UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL FxDevice::m_RetrievalMode

Definition at line 770 of file fxdevice.hpp.

Referenced by GetRetrievalMode(), and SetInitialState().

◆ m_SelfIoTargetNeeded

BOOLEAN FxDevice::m_SelfIoTargetNeeded

◆ m_SymbolicLinkName

UNICODE_STRING FxDevice::m_SymbolicLinkName

Definition at line 580 of file fxdevice.hpp.

Referenced by CreateSymbolicLink(), DeleteSymbolicLink(), SetInitialState(), and ~FxDevice().


The documentation for this class was generated from the following files: