ReactOS  0.4.15-dev-1632-g4e289ce
fxdeviceinitapi.cpp File Reference
#include "coreprivshared.hpp"
Include dependency graph for fxdeviceinitapi.cpp:

Go to the source code of this file.

Classes

struct  _WDF_PNPPOWER_EVENT_CALLBACKS_V1_9
 
struct  _WDF_POWER_POLICY_EVENT_CALLBACKS_V1_5
 
struct  _WDF_PDO_EVENT_CALLBACKS_V1_9
 

Typedefs

typedef struct _WDF_PNPPOWER_EVENT_CALLBACKS_V1_9 WDF_PNPPOWER_EVENT_CALLBACKS_V1_9
 
typedef struct _WDF_PNPPOWER_EVENT_CALLBACKS_V1_9PWDF_PNPPOWER_EVENT_CALLBACKS_V1_9
 
typedef struct _WDF_POWER_POLICY_EVENT_CALLBACKS_V1_5 WDF_POWER_POLICY_EVENT_CALLBACKS_V1_5
 
typedef struct _WDF_POWER_POLICY_EVENT_CALLBACKS_V1_5PWDF_POWER_POLICY_EVENT_CALLBACKS_V1_5
 
typedef struct _WDF_PDO_EVENT_CALLBACKS_V1_9 WDF_PDO_EVENT_CALLBACKS_V1_9
 
typedef struct _WDF_PDO_EVENT_CALLBACKS_V1_9PWDF_PDO_EVENT_CALLBACKS_V1_9
 

Functions

 __drv_maxIRQL (DISPATCH_LEVEL) VOID STDCALL WDFEXPORT(WdfDeviceInitFree)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
 FxPointerNotNull (GetFxDriverGlobals(DriverGlobals), DeviceInit)
 
 if (DeviceInit->CreatedOnStack==FALSE)
 
 _IRQL_requires_max_ (PASSIVE_LEVEL) WDFAPI VOID STDCALL WDFEXPORT(WdfDeviceInitSetIoTypeEx)(_In_ PWDF_DRIVER_GLOBALS DriverGlobals
 
 FxPointerNotNull (pFxDriverGlobals, DeviceInit)
 
 if (IoTypeConfig->Size !=sizeof(WDF_IO_TYPE_CONFIG))
 
DeviceInit AssignIoType (IoTypeConfig)
 
_Must_inspect_result_ __drv_maxIRQL (PASSIVE_LEVEL) NTSTATUS STDCALL WDFEXPORT(WdfDeviceInitAssignName)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
 if (!NT_SUCCESS(status))
 
 if (DeviceName !=NULL)
 
 if (DeviceName==NULL)
 
return DeviceInit AssignName (DeviceInit->DriverGlobals, DeviceName)
 
 if (OrInValues)
 
 if ((DeviceCharacteristics &FILE_AUTOGENERATED_DEVICE_NAME) &&DeviceInit->DeviceName !=NULL)
 
 FxPointerNotNull (pFxDriverGlobals, FileObjectConfig)
 
 if (FileObjectConfig->Size !=sizeof(WDF_FILEOBJECT_CONFIG))
 
 switch (FileObjectConfig->AutoForwardCleanupClose)
 
 if (normalizedFileClass==WdfFileObjectInvalid||normalizedFileClass > WdfFileObjectWdfCannotUseFsContexts)
 
 if (pFxDriverGlobals->IsUserModeDriver &&(normalizedFileClass==WdfFileObjectWdfCanUseFsContext||normalizedFileClass==WdfFileObjectWdfCanUseFsContext2))
 
 if (FxIsFileObjectOptional(fileClass))
 
RtlCopyMemoryDeviceInit (DeviceInit->FileObject.Callbacks)
 
 if (FileObjectAttributes !=NULL)
 
 FxPointerNotNull (pFxDriverGlobals, RequestAttributes)
 
RtlCopyMemoryDeviceInit (WDF_OBJECT_ATTRIBUTES)
 
 if (SDDLString==NULL)
 
 if (DeviceInit->Security.Sddl==NULL)
 
return DeviceInit Security Sddl Assign (SDDLString)
 
 FxPointerNotNull (pFxDriverGlobals, DeviceClassGuid)
 
RtlCopyMemoryDeviceInit (GUID)
 
 FxPointerNotNull (pFxDriverGlobals, PnpPowerEventCallbacks)
 
 if (PnpPowerEventCallbacks->Size !=sizeof(WDF_PNPPOWER_EVENT_CALLBACKS) &&PnpPowerEventCallbacks->Size !=sizeof(_WDF_PNPPOWER_EVENT_CALLBACKS_V1_9))
 
 if (PnpPowerEventCallbacks->Size > sizeof(WDF_PNPPOWER_EVENT_CALLBACKS_V1_9) &&PnpPowerEventCallbacks->EvtDeviceUsageNotification !=NULL &&PnpPowerEventCallbacks->EvtDeviceUsageNotificationEx !=NULL)
 
 FxPointerNotNull (pFxDriverGlobals, PowerPolicyEventCallbacks)
 
 if (PowerPolicyEventCallbacks->Size !=sizeof(WDF_POWER_POLICY_EVENT_CALLBACKS) &&PowerPolicyEventCallbacks->Size !=sizeof(WDF_POWER_POLICY_EVENT_CALLBACKS_V1_5))
 
 if (PowerPolicyEventCallbacks->Size > sizeof(WDF_POWER_POLICY_EVENT_CALLBACKS_V1_5) &&PowerPolicyEventCallbacks->EvtDeviceArmWakeFromSx !=NULL &&PowerPolicyEventCallbacks->EvtDeviceArmWakeFromSxWithReason !=NULL)
 
 FxPointerNotNull (pFxDriverGlobals, EvtDevicePnpStateChange)
 
 if (normalizedState< WdfDevStatePnpObjectCreated||normalizedState > WdfDevStatePnpNull)
 
 if ((CallbackTypes &~StateNotificationAllStates) !=0||CallbackTypes==0x0)
 
 if (DeviceInit->PnpPower.PnpStateCallbacks==NULL)
 
 FxPointerNotNull (pFxDriverGlobals, EvtDevicePowerStateChange)
 
 if (normalizedState< WdfDevStatePowerObjectCreated||normalizedState >=WdfDevStatePowerNull)
 
 FxPointerNotNull (pFxDriverGlobals, EvtDevicePowerPolicyStateChange)
 
 if (normalizedState< WdfDevStatePwrPolObjectCreated||normalizedState >=WdfDevStatePwrPolNull)
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PFN_WDFDEVICE_WDM_IRP_PREPROCESS __in UCHAR __drv_when (NumMinorFunctions > 0, __in_bcount(NumMinorFunctions)) __drv_when(NumMinorFunctions
 
 FxPointerNotNull (pFxDriverGlobals, EvtDeviceWdmIrpPreprocess)
 
 if (NumMinorFunctions > 0)
 
 if (MajorFunction >=ARRAY_SIZE(DeviceInit->PreprocessInfo->Dispatch))
 
 FxPointerNotNull (GetFxDriverGlobals(DriverGlobals), EvtIoInCallerContext)
 
 FxPointerNotNull (fxDriverGlobals, DeviceInit)
 
 FxPointerNotNull (fxDriverGlobals, RemoveLockOptions)
 
 if (RemoveLockOptions->Size !=sizeof(WDF_REMOVE_LOCK_OPTIONS))
 
 if ((RemoveLockOptions->Flags &~validFlags) !=0)
 
 if (FxDeviceInitTypeControlDevice==DeviceInit->InitType)
 
 if ((ReleaseHardwareOrderOnFailure==WdfReleaseHardwareOrderOnFailureInvalid)||(ReleaseHardwareOrderOnFailure > WdfReleaseHardwareOrderOnFailureAfterDescendants))
 
 _IRQL_requires_max_ (DISPATCH_LEVEL) VOID STDCALL WDFEXPORT(WdfDeviceInitAllowSelfIoTarget)(_In_ PWDF_DRIVER_GLOBALS DriverGlobals
 
 if (DeviceInit->IsNotFdoInit())
 
return reinterpret_cast< PDEVICE_OBJECT > (DeviceInit->Fdo.PhysicalDevice)
 
 FxPointerNotNull (pFxDriverGlobals, Key)
 
 if (!NT_SUCCESS(FxVerifierCheckIrqlLevel(pFxDriverGlobals, PASSIVE_LEVEL)))
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in DEVICE_REGISTRY_PROPERTY __in ULONG __out_bcount_full_opt (BufferLength) PVOID PropertyBuffer
 
 FxPointerNotNull (pFxDriverGlobals, ResultLength)
 
 if (BufferLength > 0)
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in DEVICE_REGISTRY_PROPERTY __in __drv_strictTypeMatch (__drv_typeExpr) POOL_TYPE PoolType
 
 FxPointerNotNull (pFxDriverGlobals, PropertyMemory)
 
 FxVerifierCheckNxPoolType (pFxDriverGlobals, PoolType, pFxDriverGlobals->Tag)
 
 FxPointerNotNull (pFxDriverGlobals, FdoEventCallbacks)
 
 if (FdoEventCallbacks->Size !=sizeof(WDF_FDO_EVENT_CALLBACKS))
 
 if (FdoEventCallbacks->EvtDeviceFilterAddResourceRequirements !=NULL &&FdoEventCallbacks->EvtDeviceRemoveAddedResources==NULL)
 
RtlCopyMemoryDeviceInit (DeviceInit->Fdo.EventCallbacks)
 
 FxPointerNotNull (pFxDriverGlobals, Config)
 
 if (DefaultDeviceListAttributes !=NULL)
 
RtlCopyMemoryDeviceInit (WDF_CHILD_LIST_CONFIG)
 
 FxPointerNotNull (pFxDriverGlobals, DeviceProperty)
 
 if (DeviceProperty->Size !=sizeof(WDF_DEVICE_PROPERTY_DATA))
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), ParentDevice, FX_TYPE_DEVICE,(PVOID *) &pDevice, &pFxDriverGlobals)
 
 if (pDevice->IsFdo()==FALSE)
 
 if (pInit==NULL)
 
pInit SetPdo (pDevice)
 
 FxPointerNotNull (pFxDriverGlobals, DispatchTable)
 
 if (DispatchTable->Size !=sizeof(WDF_PDO_EVENT_CALLBACKS) &&DispatchTable->Size !=sizeof(WDF_PDO_EVENT_CALLBACKS_V1_9))
 
RtlCopyMemoryDeviceInit (WDF_PDO_EVENT_CALLBACKS)
 
 FxPointerNotNull (pFxDriverGlobals, DeviceID)
 
 if (DeviceInit->Pdo.DeviceID==NULL)
 
 if (pID==NULL)
 
 if (NT_SUCCESS(status))
 
pID Release ()
 
 FxPointerNotNull (pFxDriverGlobals, DeviceLocation)
 
 if (pDeviceText==NULL)
 
 if (pDeviceText->m_Description==NULL)
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), Driver, FX_TYPE_DRIVER,(PVOID *) &pDriver, &pFxDriverGlobals)
 
 FxPointerNotNull (pFxDriverGlobals, SDDLString)
 
 FxPointerNotNull (pFxDriverGlobals, Notification)
 
 if ((Flags &~(WdfDeviceShutdown|WdfDeviceLastChanceShutdown)) !=0)
 

Variables

__in PWDFDEVICE_INIT DeviceInit
 
__in PWDFDEVICE_INIT __in WDF_DEVICE_IO_TYPE IoType
 
WDF_IO_TYPE_CONFIG ioTypeConfig
 
ioTypeConfig ReadWriteIoType = IoType
 
_In_ PWDFDEVICE_INIT _In_ PWDF_IO_TYPE_CONFIG IoTypeConfig
 
NTSTATUS status
 
PFX_DRIVER_GLOBALS pFxDriverGlobals = GetFxDriverGlobals(DriverGlobals)
 
__in PWDFDEVICE_INIT __in BOOLEAN Exclusive
 
__in PWDFDEVICE_INIT __in DEVICE_TYPE DeviceType
 
DeviceInit PowerPageable = FALSE
 
DeviceInit Inrush = TRUE
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in_opt PCUNICODE_STRING DeviceName
 
__in PWDFDEVICE_INIT __in ULONG DeviceCharacteristics
 
__in PWDFDEVICE_INIT __in ULONG __in BOOLEAN OrInValues
 
 else
 
__in PWDFDEVICE_INIT __in PWDF_FILEOBJECT_CONFIG FileObjectConfig
 
__in PWDFDEVICE_INIT __in PWDF_FILEOBJECT_CONFIG __in_opt PWDF_OBJECT_ATTRIBUTES FileObjectAttributes
 
WDF_FILEOBJECT_CLASS normalizedFileClass = FxFileObjectClassNormalize(fileClass)
 
WDF_FILEOBJECT_CLASS fileClass = FileObjectConfig->FileObjectClass
 
DeviceInit FileObject Set = TRUE
 
DeviceInit FileObject AutoForwardCleanupClose
 
DeviceInit FileObject Class = fileClass
 
__in PWDFDEVICE_INIT __in PWDF_OBJECT_ATTRIBUTES RequestAttributes
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in_opt PCUNICODE_STRING SDDLString
 
__in PWDFDEVICE_INIT __in CONST GUIDDeviceClassGuid
 
DeviceInit Security DeviceClassSet = TRUE
 
__in PWDFDEVICE_INIT __in PWDF_PNPPOWER_EVENT_CALLBACKS PnpPowerEventCallbacks
 
__in PWDFDEVICE_INIT __in PWDF_POWER_POLICY_EVENT_CALLBACKS PowerPolicyEventCallbacks
 
__in PWDFDEVICE_INIT __in BOOLEAN IsPowerPolicyOwner
 
DeviceInit PnpPower PowerPolicyOwner = IsPowerPolicyOwner ? WdfTrue : WdfFalse
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in WDF_DEVICE_PNP_STATE PnpState
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in WDF_DEVICE_PNP_STATE __in PFN_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION EvtDevicePnpStateChange
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in WDF_DEVICE_PNP_STATE __in PFN_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION __in ULONG CallbackTypes
 
FxPnpStateCallbackInfopCallback
 
ULONG normalizedState = WdfDevStateNormalize(PnpState)
 
pCallback Callback = EvtDevicePnpStateChange
 
pCallback Types = CallbackTypes
 
return STATUS_SUCCESS
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in WDF_DEVICE_POWER_STATE PowerState
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in WDF_DEVICE_POWER_STATE __in PFN_WDF_DEVICE_POWER_STATE_CHANGE_NOTIFICATION EvtDevicePowerStateChange
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in WDF_DEVICE_POWER_POLICY_STATE PowerPolicyState
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in WDF_DEVICE_POWER_POLICY_STATE __in PFN_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION EvtDevicePowerPolicyStateChange
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PFN_WDFDEVICE_WDM_IRP_PREPROCESS EvtDeviceWdmIrpPreprocess
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PFN_WDFDEVICE_WDM_IRP_PREPROCESS __in UCHAR MajorFunction
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PFN_WDFDEVICE_WDM_IRP_PREPROCESS __in UCHAR __in_opt PUCHAR MinorFunctions
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PFN_WDFDEVICE_WDM_IRP_PREPROCESS __in UCHAR __in_opt PUCHAR __in ULONG NumMinorFunctions
 
DeviceInit PreprocessInfo Dispatch [MajorFunctionEvtDevicePreprocess
 
__in PWDFDEVICE_INIT __in PFN_WDF_IO_IN_CALLER_CONTEXT EvtIoInCallerContext
 
DeviceInit IoInCallerContextCallback = EvtIoInCallerContext
 
 return
 
__in PWDFDEVICE_INIT __in PWDF_REMOVE_LOCK_OPTIONS RemoveLockOptions
 
PFX_DRIVER_GLOBALS fxDriverGlobals = GetFxDriverGlobals(DriverGlobals)
 
ULONG validFlags = WDF_REMOVE_LOCK_OPTION_ACQUIRE_FOR_IO
 
DeviceInit RemoveLockOptionFlags = RemoveLockOptions->Flags
 
Done __pad0__
 
__in PWDFDEVICE_INIT __in WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE ReleaseHardwareOrderOnFailure
 
DeviceInit RequiresSelfIoTarget = TRUE
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in ULONG DeviceInstanceKeyType
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in ULONG __in ACCESS_MASK DesiredAccess
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in ULONG __in ACCESS_MASK __in_opt PWDF_OBJECT_ATTRIBUTES KeyAttributes
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in ULONG __in ACCESS_MASK __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFKEY * Key
 
DeviceInit Fdo Filter = TRUE
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in DEVICE_REGISTRY_PROPERTY DeviceProperty
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in DEVICE_REGISTRY_PROPERTY __in ULONG BufferLength
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in DEVICE_REGISTRY_PROPERTY __in ULONG __out PULONG ResultLength
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in DEVICE_REGISTRY_PROPERTY __in __in_opt PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in DEVICE_REGISTRY_PROPERTY __in __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFMEMORY * PropertyMemory
 
__in PWDFDEVICE_INIT __in PWDF_FDO_EVENT_CALLBACKS FdoEventCallbacks
 
__inout PWDFDEVICE_INIT __in PWDF_CHILD_LIST_CONFIG Config
 
__inout PWDFDEVICE_INIT __in PWDF_CHILD_LIST_CONFIG __in_opt PWDF_OBJECT_ATTRIBUTES DefaultDeviceListAttributes
 
size_t totalDescriptionSize = 0
 
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
 
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG _Out_ PDEVPROPTYPE Type
 
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PWDF_DEVICE_PROPERTY_DATA _In_ _Strict_type_match_ POOL_TYPE PoolType
 
_Must_inspect_result_ __in WDFDEVICE ParentDevice
 
PWDFDEVICE_INIT pInit = new(pFxDriverGlobals) WDFDEVICE_INIT(pDevice->GetDriver())
 
FxDevicepDevice
 
pInit Pdo Static = TRUE
 
__in PWDFDEVICE_INIT __in PWDF_PDO_EVENT_CALLBACKS DispatchTable
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PCUNICODE_STRING DeviceID
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PCUNICODE_STRING InstanceID
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PCUNICODE_STRING HardwareID
 
FxStringpID = new(pFxDriverGlobals, WDF_NO_OBJECT_ATTRIBUTES) FxString(pFxDriverGlobals)
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PCUNICODE_STRING CompatibleID
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PCUNICODE_STRING ContainerID
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PCUNICODE_STRING DeviceDescription
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PCUNICODE_STRING __in PCUNICODE_STRING DeviceLocation
 
_Must_inspect_result_ __in PWDFDEVICE_INIT __in PCUNICODE_STRING __in PCUNICODE_STRING __in LCID LocaleId
 
FxDeviceTextpDeviceText = new(pFxDriverGlobals, PagedPool) FxDeviceText()
 
pDeviceText m_LocaleId = LocaleId
 
pDeviceText m_Description
 
pDeviceText m_LocationInformation
 
*DeviceInit Pdo LastDeviceTextEntry = &pDeviceText->m_Entry
 
Done __pad1__
 
DeviceInit Pdo DefaultLocale = LocaleId
 
DeviceInit Pdo Raw = TRUE
 
DeviceInit Pdo ForwardRequestToParent = TRUE
 
_Must_inspect_result_ __in WDFDRIVER Driver
 
FxDriverpDriver
 
__in PWDFDEVICE_INIT __in PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
 
__in PWDFDEVICE_INIT __in PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION __in UCHAR Flags
 
DeviceInit Control ShutdownNotification = Notification
 

Typedef Documentation

◆ PWDF_PDO_EVENT_CALLBACKS_V1_9

◆ PWDF_PNPPOWER_EVENT_CALLBACKS_V1_9

◆ PWDF_POWER_POLICY_EVENT_CALLBACKS_V1_5

◆ WDF_PDO_EVENT_CALLBACKS_V1_9

◆ WDF_PNPPOWER_EVENT_CALLBACKS_V1_9

◆ WDF_POWER_POLICY_EVENT_CALLBACKS_V1_5

Function Documentation

◆ __drv_maxIRQL() [1/2]

__drv_maxIRQL ( DISPATCH_LEVEL  )

◆ __drv_maxIRQL() [2/2]

_Must_inspect_result_ __drv_maxIRQL ( PASSIVE_LEVEL  )

◆ __drv_strictTypeMatch()

_Must_inspect_result_ __in PWDFDEVICE_INIT __in DEVICE_REGISTRY_PROPERTY __in __drv_strictTypeMatch ( __drv_typeExpr  )

◆ __drv_when()

◆ __out_bcount_full_opt()

◆ _IRQL_requires_max_() [1/2]

_IRQL_requires_max_ ( PASSIVE_LEVEL  )

Definition at line 64 of file Messaging.c.

75 {
76  PFLT_SERVER_PORT_OBJECT PortObject;
78 
79  /* The caller must allow at least one connection */
80  if (MaxConnections == 0)
81  {
83  }
84 
85  /* The request must be for a kernel handle */
86  if (!(ObjectAttributes->Attributes & OBJ_KERNEL_HANDLE))
87  {
89  }
90 
91  /*
92  * Get rundown protection on the target to stop the owner
93  * from unloading whilst this port object is open. It gets
94  * removed in the FltpServerPortClose callback
95  */
97  if (!NT_SUCCESS(Status))
98  {
99  return Status;
100  }
101 
102  /* Create the server port object for this filter */
106  KernelMode,
107  NULL,
108  sizeof(FLT_SERVER_PORT_OBJECT),
109  0,
110  0,
111  (PVOID *)&PortObject);
112  if (NT_SUCCESS(Status))
113  {
114  /* Zero out the struct */
115  RtlZeroMemory(PortObject, sizeof(FLT_SERVER_PORT_OBJECT));
116 
117  /* Increment the ref count on the target filter */
119 
120  /* Setup the filter port object */
121  PortObject->Filter = Filter;
122  PortObject->ConnectNotify = ConnectNotifyCallback;
124  PortObject->MessageNotify = MessageNotifyCallback;
125  PortObject->Cookie = ServerPortCookie;
126  PortObject->MaxConnections = MaxConnections;
127 
128  /* Insert the object */
129  Status = ObInsertObject(PortObject,
130  NULL,
132  0,
133  NULL,
135  if (NT_SUCCESS(Status))
136  {
137  /* Lock the connection list */
139 
140  /* Add the new port object to the connection list and increment the count */
143 
144  /* Unlock the connection list*/
146  }
147  }
148 
149  if (!NT_SUCCESS(Status))
150  {
151  /* Allow the filter to be cleaned up */
153  }
154 
155  return Status;
156 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _Outptr_ PFLT_PORT * ServerPort
Definition: fltkernel.h:1873
PFLT_CONNECT_NOTIFY ConnectNotify
Definition: fltmgrint.h:191
VOID FLTAPI FltObjectDereference(_Inout_ PVOID Object)
Definition: Object.c:53
LONG NTSTATUS
Definition: precomp.h:26
#define InsertTailList(ListHead, Entry)
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
ULONG FltpObjectPointerReference(_In_ PFLT_OBJECT Object)
Definition: Object.c:322
LIST_ENTRY mList
Definition: fltmgrint.h:56
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
#define FILE_READ_DATA
Definition: nt_native.h:628
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
Definition: oblife.c:952
Status
Definition: gdiplustypes.h:24
POBJECT_TYPE ServerPortObjectType
Definition: Messaging.c:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY _In_ PFLT_DISCONNECT_NOTIFY DisconnectNotifyCallback
Definition: fltkernel.h:1873
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:454
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY ConnectNotifyCallback
Definition: fltkernel.h:1873
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
Definition: obhandle.c:2932
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
NTSTATUS FLTAPI FltObjectReference(_Inout_ PVOID Object)
Definition: Object.c:41
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID ServerPortCookie
Definition: fltkernel.h:1873
#define NULL
Definition: types.h:112
FAST_MUTEX mLock
Definition: fltmgrint.h:55
PFLT_MESSAGE_NOTIFY MessageNotify
Definition: fltmgrint.h:193
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY _In_ PFLT_DISCONNECT_NOTIFY _In_opt_ PFLT_MESSAGE_NOTIFY _In_ LONG MaxConnections
Definition: fltkernel.h:1873
PFLT_DISCONNECT_NOTIFY DisconnectNotify
Definition: fltmgrint.h:192
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY _In_ PFLT_DISCONNECT_NOTIFY _In_opt_ PFLT_MESSAGE_NOTIFY MessageNotifyCallback
Definition: fltkernel.h:1873
FLT_MUTEX_LIST_HEAD ConnectionList
Definition: fltmgrint.h:121

◆ _IRQL_requires_max_() [2/2]

_IRQL_requires_max_ ( DISPATCH_LEVEL  )

Definition at line 3557 of file common.c.

3587 {
3588  NTSTATUS status;
3589  BOOLEAN requestSent = FALSE;
3590 
3591  BOOLEAN shouldRetry = TRUE;
3592  PCDB cdb = (PCDB)DeviceExtension->PowerContext.Srb.Cdb;
3593  ULONG timeoutValue = DeviceExtension->TimeOutValue;
3594  ULONG retryCount = 1;
3595 
3596  // reset some fields.
3597  DeviceExtension->PowerContext.RetryIntervalIn100ns = 0;
3598  status = PowerContextReuseRequest(DeviceExtension);
3599  RequestClearSendTime(DeviceExtension->PowerContext.PowerRequest);
3600 
3601  if (!NT_SUCCESS(status))
3602  {
3603  return status;
3604  }
3605 
3606  // set proper timeout value and max retry count.
3607  switch(DeviceExtension->PowerContext.PowerChangeState.PowerDown)
3608  {
3612  break;
3613 
3614  case PowerDownDeviceLocked:
3615  // Case of issuing SYNC CACHE command. Do not use power irp timeout remaining time in this case
3616  // as we want to give best try on SYNC CACHE command.
3617  retryCount = MAXIMUM_RETRIES;
3618  timeoutValue = DeviceExtension->TimeOutValue;
3619  break;
3620 
3622  {
3623  // Case of issuing STOP UNIT command
3624  // As "Imme" bit is set to '1', this command should be completed in short time.
3625  // This command is at low importance, failure of this command has very small impact.
3626  ULONG secondsRemaining = 0;
3627 
3628 #if (WINVER >= 0x0601)
3629  // this API is introduced in Windows7
3630  PoQueryWatchdogTime(DeviceExtension->LowerPdo, &secondsRemaining);
3631 #endif
3632 
3633  if (secondsRemaining == 0)
3634  {
3635  // not able to retrieve remaining time from PoQueryWatchdogTime API, use default values.
3636  retryCount = MAXIMUM_RETRIES;
3637  timeoutValue = SCSI_CDROM_TIMEOUT;
3638  }
3639  else
3640  {
3641  // plan to leave about 30 seconds to lower level drivers if possible.
3642  if (secondsRemaining >= 32)
3643  {
3644  retryCount = (secondsRemaining - 30)/SCSI_CDROM_TIMEOUT + 1;
3645  timeoutValue = SCSI_CDROM_TIMEOUT;
3646 
3647  if (retryCount > MAXIMUM_RETRIES)
3648  {
3649  retryCount = MAXIMUM_RETRIES;
3650  }
3651 
3652  if (retryCount == 1)
3653  {
3654  timeoutValue = secondsRemaining - 30;
3655  }
3656  }
3657  else
3658  {
3659  // issue the command with minimal timeout value and do not retry on it.
3660  retryCount = 1;
3661  timeoutValue = 2;
3662  }
3663  }
3664  }
3665  break;
3666  default:
3667  NT_ASSERT( FALSE );
3669  return status;
3670  }
3671 
3672  DeviceExtension->PowerContext.RetryCount = retryCount;
3673 
3674  // issue command.
3675  while (shouldRetry)
3676  {
3677 
3678  // set SRB fields.
3679  DeviceExtension->PowerContext.Srb.SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER |
3684 
3685  DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_EXECUTE_SCSI;
3686  DeviceExtension->PowerContext.Srb.TimeOutValue = timeoutValue;
3687 
3688  if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceInitial)
3689  {
3690  DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_LOCK_QUEUE;
3691  }
3692  else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceLocked)
3693  {
3694  DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_QUIESCE_DEVICE;
3695  }
3696  else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceQuiesced)
3697  {
3698  // Case of issuing SYNC CACHE command.
3699  DeviceExtension->PowerContext.Srb.CdbLength = 10;
3700  cdb->SYNCHRONIZE_CACHE10.OperationCode = SCSIOP_SYNCHRONIZE_CACHE;
3701  }
3702  else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceFlushed)
3703  {
3704  // Case of issuing STOP UNIT command.
3705  DeviceExtension->PowerContext.Srb.CdbLength = 6;
3706  cdb->START_STOP.OperationCode = SCSIOP_START_STOP_UNIT;
3707  cdb->START_STOP.Start = 0;
3708  cdb->START_STOP.Immediate = 1;
3709  }
3710  else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceStopped)
3711  {
3712  DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_UNLOCK_QUEUE;
3713  }
3714 
3715  // Set up completion routine and context if requested
3716  if (CompletionRoutine)
3717  {
3718  WdfRequestSetCompletionRoutine(DeviceExtension->PowerContext.PowerRequest,
3720  Context);
3721  }
3722 
3723  status = RequestSend(DeviceExtension,
3724  DeviceExtension->PowerContext.PowerRequest,
3725  DeviceExtension->IoTarget,
3727  &requestSent);
3728 
3729  if (requestSent)
3730  {
3731  if ((CompletionRoutine == NULL) &&
3732  (SRB_STATUS(DeviceExtension->PowerContext.Srb.SrbStatus) != SRB_STATUS_SUCCESS))
3733  {
3734  TracePrint((TRACE_LEVEL_ERROR,
3735  TRACE_FLAG_POWER,
3736  "%p\tError occured when issuing %s command to device. Srb %p, Status %x\n",
3737  DeviceExtension->PowerContext.PowerRequest,
3738  (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceQuiesced) ? "SYNC CACHE" : "STOP UNIT",
3739  &DeviceExtension->PowerContext.Srb,
3740  DeviceExtension->PowerContext.Srb.SrbStatus));
3741 
3742  NT_ASSERT(!(TEST_FLAG(DeviceExtension->PowerContext.Srb.SrbStatus, SRB_STATUS_QUEUE_FROZEN)));
3743 
3744  shouldRetry = RequestSenseInfoInterpret(DeviceExtension,
3745  DeviceExtension->PowerContext.PowerRequest,
3746  &(DeviceExtension->PowerContext.Srb),
3747  retryCount - DeviceExtension->PowerContext.RetryCount,
3748  &status,
3749  &(DeviceExtension->PowerContext.RetryIntervalIn100ns));
3750 
3751  if (shouldRetry && (DeviceExtension->PowerContext.RetryCount-- == 0))
3752  {
3753  shouldRetry = FALSE;
3754  }
3755  }
3756  else
3757  {
3758  // succeeded, do not need to retry.
3759  shouldRetry = FALSE;
3760  }
3761 
3762  }
3763  else
3764  {
3765  // request failed to be sent
3766  shouldRetry = FALSE;
3767  }
3768 
3769  if (shouldRetry)
3770  {
3771  LARGE_INTEGER t;
3772  t.QuadPart = -DeviceExtension->PowerContext.RetryIntervalIn100ns;
3774 
3775  status = PowerContextReuseRequest(DeviceExtension);
3776  if (!NT_SUCCESS(status))
3777  {
3778  shouldRetry = FALSE;
3779  }
3780  }
3781  }
3782 
3783  if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceQuiesced)
3784  {
3785  // record SYNC CACHE command completion time stamp.
3786  KeQueryTickCount(&DeviceExtension->PowerContext.Step1CompleteTime);
3787  }
3788 
3789  return status;
3790 }
#define SRB_FUNCTION_UNLOCK_QUEUE
Definition: srb.h:325
#define SCSIOP_SYNCHRONIZE_CACHE
Definition: cdrw_hw.h:918
#define SRB_FUNCTION_QUIESCE_DEVICE
Definition: srb.h:90
#define SRB_FLAGS_NO_QUEUE_FREEZE
Definition: srb.h:396
#define TRUE
Definition: types.h:120
Definition: cdrw_hw.h:28
LONG NTSTATUS
Definition: precomp.h:26
struct _CDB::_SYNCHRONIZE_CACHE10 SYNCHRONIZE_CACHE10
GLdouble GLdouble t
Definition: gl.h:2047
#define SRB_STATUS(Status)
Definition: srb.h:381
VOID RequestClearSendTime(_In_ WDFREQUEST Request)
Definition: common.c:111
#define MAXIMUM_RETRIES
Definition: cdrom.h:124
return STATUS_NOT_IMPLEMENTED
#define SCSI_CDROM_TIMEOUT
Definition: cdrom.c:170
#define FALSE
Definition: types.h:117
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
#define SRB_FLAGS_BYPASS_LOCKED_QUEUE
Definition: srb.h:402
unsigned char BOOLEAN
union _CDB * PCDB
struct _CDB::_START_STOP START_STOP
VOID NTAPI KeQueryTickCount(IN PLARGE_INTEGER TickCount)
Definition: clock.c:165
#define TEST_FLAG(Flags, Bit)
Definition: cdrom.h:1495
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER
Definition: srb.h:389
#define SRB_FLAGS_NO_DATA_TRANSFER
Definition: srb.h:394
BOOLEAN RequestSenseInfoInterpret(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ PSCSI_REQUEST_BLOCK Srb, _In_ ULONG RetriedCount, _Out_ NTSTATUS *Status, _Out_opt_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG *RetryIntervalIn100ns)
Definition: sense.c:2467
#define SRB_STATUS_QUEUE_FROZEN
Definition: srb.h:378
NTSTATUS RequestSend(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ WDFIOTARGET IoTarget, _In_ ULONG Flags, _Out_opt_ PBOOLEAN RequestSent)
Definition: common.c:3793
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
Definition: wdfrequest.h:893
#define NULL
Definition: types.h:112
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:307
unsigned int ULONG
Definition: retypes.h:1
#define SRB_STATUS_SUCCESS
Definition: srb.h:333
#define SRB_FLAGS_D3_PROCESSING
Definition: srb.h:156
static SERVICE_STATUS status
Definition: service.c:31
#define SCSIOP_START_STOP_UNIT
Definition: cdrw_hw.h:897
#define SRB_FUNCTION_LOCK_QUEUE
Definition: srb.h:324
#define NT_ASSERT
Definition: rtlfuncs.h:3312
Definition: ps.c:97

◆ Assign()

return DeviceInit Security Sddl Assign ( SDDLString  )

◆ AssignIoType()

DeviceInit AssignIoType ( IoTypeConfig  )

◆ AssignName()

return DeviceInit AssignName ( DeviceInit->  DriverGlobals,
DeviceName   
)

◆ DeviceInit() [1/6]

RtlCopyMemory& DeviceInit ( DeviceInit->FileObject.  Callbacks)

◆ DeviceInit() [2/6]

◆ DeviceInit() [3/6]

◆ DeviceInit() [4/6]

RtlCopyMemory& DeviceInit ( DeviceInit->Fdo.  EventCallbacks)

◆ DeviceInit() [5/6]

◆ DeviceInit() [6/6]

◆ FxObjectHandleGetPtrAndGlobals() [1/2]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals ,
ParentDevice  ,
FX_TYPE_DEVICE  ,
(PVOID *) &  pDevice,
pFxDriverGlobals 
)

◆ FxObjectHandleGetPtrAndGlobals() [2/2]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals ,
Driver  ,
FX_TYPE_DRIVER  ,
(PVOID *) &  pDriver,
pFxDriverGlobals 
)

◆ FxPointerNotNull() [1/25]

FxPointerNotNull ( GetFxDriverGlobals(DriverGlobals ,
DeviceInit   
)

Referenced by if().

◆ FxPointerNotNull() [2/25]

FxPointerNotNull ( pFxDriverGlobals  ,
DeviceInit   
)

◆ FxPointerNotNull() [3/25]

FxPointerNotNull ( pFxDriverGlobals  ,
FileObjectConfig   
)

◆ FxPointerNotNull() [4/25]

FxPointerNotNull ( pFxDriverGlobals  ,
RequestAttributes   
)

◆ FxPointerNotNull() [5/25]

FxPointerNotNull ( pFxDriverGlobals  ,
DeviceClassGuid   
)

◆ FxPointerNotNull() [6/25]

FxPointerNotNull ( pFxDriverGlobals  ,
PnpPowerEventCallbacks   
)

◆ FxPointerNotNull() [7/25]

FxPointerNotNull ( pFxDriverGlobals  ,
PowerPolicyEventCallbacks   
)

◆ FxPointerNotNull() [8/25]

FxPointerNotNull ( pFxDriverGlobals  ,
EvtDevicePnpStateChange   
)

◆ FxPointerNotNull() [9/25]

FxPointerNotNull ( pFxDriverGlobals  ,
EvtDevicePowerStateChange   
)

◆ FxPointerNotNull() [10/25]

FxPointerNotNull ( pFxDriverGlobals  ,
EvtDevicePowerPolicyStateChange   
)

◆ FxPointerNotNull() [11/25]

FxPointerNotNull ( pFxDriverGlobals  ,
EvtDeviceWdmIrpPreprocess   
)

◆ FxPointerNotNull() [12/25]

FxPointerNotNull ( GetFxDriverGlobals(DriverGlobals ,
EvtIoInCallerContext   
)

◆ FxPointerNotNull() [13/25]

FxPointerNotNull ( fxDriverGlobals  ,
DeviceInit   
)

◆ FxPointerNotNull() [14/25]

FxPointerNotNull ( fxDriverGlobals  ,
RemoveLockOptions   
)

◆ FxPointerNotNull() [15/25]

FxPointerNotNull ( pFxDriverGlobals  ,
Key   
)

◆ FxPointerNotNull() [16/25]

FxPointerNotNull ( pFxDriverGlobals  ,
ResultLength   
)

◆ FxPointerNotNull() [17/25]

FxPointerNotNull ( pFxDriverGlobals  ,
PropertyMemory   
)

◆ FxPointerNotNull() [18/25]

FxPointerNotNull ( pFxDriverGlobals  ,
FdoEventCallbacks   
)

◆ FxPointerNotNull() [19/25]

FxPointerNotNull ( pFxDriverGlobals  ,
Config   
)

◆ FxPointerNotNull() [20/25]

FxPointerNotNull ( pFxDriverGlobals  ,
DeviceProperty   
)

◆ FxPointerNotNull() [21/25]

FxPointerNotNull ( pFxDriverGlobals  ,
DispatchTable   
)

◆ FxPointerNotNull() [22/25]

FxPointerNotNull ( pFxDriverGlobals  ,
DeviceID   
)

◆ FxPointerNotNull() [23/25]

FxPointerNotNull ( pFxDriverGlobals  ,
DeviceLocation   
)

◆ FxPointerNotNull() [24/25]

FxPointerNotNull ( pFxDriverGlobals  ,
SDDLString   
)

◆ FxPointerNotNull() [25/25]

FxPointerNotNull ( pFxDriverGlobals  ,
Notification   
)

◆ FxVerifierCheckNxPoolType()

FxVerifierCheckNxPoolType ( pFxDriverGlobals  ,
PoolType  ,
pFxDriverGlobals->  Tag 
)

◆ if() [1/45]

if ( DeviceInit->  CreatedOnStack = FALSE)

Definition at line 152 of file fxdeviceinitapi.cpp.

152  {
153  delete DeviceInit;
154  }
__in PWDFDEVICE_INIT DeviceInit

◆ if() [2/45]

Definition at line 203 of file fxdeviceinitapi.cpp.

203  {
206  "IoTypeConfig size (%d) incorrect, expected %d, %!STATUS!",
207  IoTypeConfig->Size,
208  sizeof(WDF_IO_TYPE_CONFIG), status);
209  return;
210  }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
PFX_DRIVER_GLOBALS pFxDriverGlobals
_In_ PWDFDEVICE_INIT _In_ PWDF_IO_TYPE_CONFIG IoTypeConfig
Definition: wdfdevice.h:4391
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
Definition: ps.c:97

◆ if() [3/45]

if ( NT_SUCCESSstatus)

Definition at line 329 of file fxdeviceinitapi.cpp.

329  {
330  return status;
331  }
NTSTATUS status

◆ if() [4/45]

if ( DeviceName = NULL)

Definition at line 333 of file fxdeviceinitapi.cpp.

333  {
334  status = FxValidateUnicodeString(DeviceInit->DriverGlobals,
335  DeviceName);
336  if (!NT_SUCCESS(status)) {
337  return status;
338  }
339  }
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS status
_Must_inspect_result_ NTSTATUS __inline FxValidateUnicodeString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PCUNICODE_STRING String)
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
Definition: ps.c:97

◆ if() [5/45]

if ( DeviceName  = NULL)

Definition at line 341 of file fxdeviceinitapi.cpp.

341  {
342  if (DeviceInit->DeviceName != NULL) {
343  DeviceInit->DeviceName->RELEASE(NULL);
344  DeviceInit->DeviceName = NULL;
345  }
346 
347  if (DeviceInit->IsPdoInit()) {
348  //
349  // Make sure a PDO has a name
350  //
351  DeviceInit->Characteristics |= FILE_AUTOGENERATED_DEVICE_NAME;
352  }
353 
354  return STATUS_SUCCESS;
355  }
return STATUS_SUCCESS
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:138
#define NULL
Definition: types.h:112
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113

◆ if() [6/45]

if ( OrInValues  )

Definition at line 379 of file fxdeviceinitapi.cpp.

379  {
381  }
_In_ WDFDEVICE _In_ ULONG DeviceCharacteristics
Definition: wdfdevice.h:2772
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46

◆ if() [7/45]

Definition at line 389 of file fxdeviceinitapi.cpp.

390  {
391  DeviceInit->DeviceName->RELEASE(NULL);
392  DeviceInit->DeviceName = NULL;
393  }
#define NULL
Definition: types.h:112
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113

◆ if() [8/45]

Definition at line 437 of file fxdeviceinitapi.cpp.

437  {
440  "Invalid FileObjectConfig Size %d, expected %d",
441  FileObjectConfig->Size, sizeof(WDF_FILEOBJECT_CONFIG));
442 
444  return;
445  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
_In_ PWDFDEVICE_INIT _In_ PWDF_FILEOBJECT_CONFIG FileObjectConfig
Definition: wdfdevice.h:3395
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [9/45]

Definition at line 491 of file fxdeviceinitapi.cpp.

492  {
495  "Out of range FileObjectConfig->FileObjectClass %d",
496  fileClass);
498  return;
499  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)
WDF_FILEOBJECT_CLASS fileClass

◆ if() [10/45]

if ( pFxDriverGlobals->IsUserModeDriver &&  normalizedFileClass==WdfFileObjectWdfCanUseFsContext|| normalizedFileClass==WdfFileObjectWdfCanUseFsContext2)

Definition at line 505 of file fxdeviceinitapi.cpp.

507  {
508 
509  //
510  // update the FileObjectClass value
511  //
512  BOOLEAN canBeOptional =
514 
516  if (canBeOptional) {
519  }
520 
523  "FileObjectConfig->FileObjectClass value (%d) has been updated"
524  " to a UMDF-supported value %d", normalizedFileClass,
526 
527  //
528  // re-obtain the normalized class
529  //
531  }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
enum _WDF_FILEOBJECT_CLASS WDF_FILEOBJECT_CLASS
unsigned char BOOLEAN
WDF_FILEOBJECT_CLASS normalizedFileClass
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
WDF_FILEOBJECT_CLASS __inline FxFileObjectClassNormalize(__in WDF_FILEOBJECT_CLASS FileObjectClass)
Definition: fxdevice.hpp:103
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
WDF_FILEOBJECT_CLASS fileClass

◆ if() [11/45]

Definition at line 536 of file fxdeviceinitapi.cpp.

536  {
537  switch(normalizedFileClass) {
541  break;
542 
543  default:
546  "Invalid FileObjectConfig->FileObjectClass %d",
547  fileClass);
549  return;
550  break; // just in case static verification tools complain.
551  }
552  }
WDF_FILEOBJECT_CLASS normalizedFileClass
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)
WDF_FILEOBJECT_CLASS fileClass

◆ if() [12/45]

Definition at line 560 of file fxdeviceinitapi.cpp.

560  {
561  RtlCopyMemory(&DeviceInit->FileObject.Attributes,
563  sizeof(DeviceInit->FileObject.Attributes));
564  }
_In_ PWDFDEVICE_INIT _In_ PWDF_FILEOBJECT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES FileObjectAttributes
Definition: wdfdevice.h:3395
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113

◆ if() [13/45]

if ( SDDLString  = NULL)

Definition at line 633 of file fxdeviceinitapi.cpp.

633  {
634  //
635  // Since we require the SDDL on control device creation, you can't
636  // clear it!
637  //
638  if (DeviceInit->IsControlDeviceInit()) {
640  }
641 
642  if (DeviceInit->Security.Sddl != NULL) {
643  DeviceInit->Security.Sddl->RELEASE(NULL);
644  DeviceInit->Security.Sddl = NULL;
645  }
646 
647  return STATUS_SUCCESS;
648  }
return STATUS_SUCCESS
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define NULL
Definition: types.h:112
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113

◆ if() [14/45]

if ( DeviceInit->Security.  Sddl = NULL)

Definition at line 655 of file fxdeviceinitapi.cpp.

655  {
656  DeviceInit->Security.Sddl = new(pFxDriverGlobals,
659 
660  if (DeviceInit->Security.Sddl == NULL) {
663  "Couldn't create Security descriptor"
664  " STATUS_INSUFFICIENT_RESOURCES ");
665 
667  }
668  }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
#define WDF_NO_OBJECT_ATTRIBUTES
Definition: wdftypes.h:105
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113

◆ if() [15/45]

Definition at line 721 of file fxdeviceinitapi.cpp.

722  {
723 
726  "PnpPowerEventCallbacks size %d is invalid, exptected %d",
728  );
729 
731 
732  return;
733  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
_In_ PWDFDEVICE_INIT _In_ PWDF_PNPPOWER_EVENT_CALLBACKS PnpPowerEventCallbacks
Definition: wdfdevice.h:2905
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [16/45]

if ( PnpPowerEventCallbacks->  Size,
sizeof(WDF_PNPPOWER_EVENT_CALLBACKS_V1_9) &&PnpPowerEventCallbacks->EvtDeviceUsageNotification !  = NULL && PnpPowerEventCallbacks->EvtDeviceUsageNotificationEx != NULL 
)

Definition at line 739 of file fxdeviceinitapi.cpp.

741  {
742 
745  "Driver can provide either EvtDeviceUsageNotification or "
746  "EvtDeviceUsageNotificationEx callback but not both");
747 
749 
750  return;
751  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [17/45]

Definition at line 791 of file fxdeviceinitapi.cpp.

792  {
795  "PowerPolicyEventCallbacks size %d is invalid, expected %d",
797  );
798 
800  return;
801  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)
_In_ PWDFDEVICE_INIT _In_ PWDF_POWER_POLICY_EVENT_CALLBACKS PowerPolicyEventCallbacks
Definition: wdfdevice.h:2934

◆ if() [18/45]

if ( PowerPolicyEventCallbacks->  Size,
sizeof(WDF_POWER_POLICY_EVENT_CALLBACKS_V1_5) &&PowerPolicyEventCallbacks->EvtDeviceArmWakeFromSx !  = NULL && PowerPolicyEventCallbacks->EvtDeviceArmWakeFromSxWithReason != NULL 
)

Definition at line 808 of file fxdeviceinitapi.cpp.

810  {
813  "PowerPolicyEventCallbacks can have either EvtDeviceArmWakeFromSx "
814  "or EvtDeviceArmWakeFromSxWithReason callback pointer, but not both"
815  );
816 
818  return;
819  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [19/45]

Definition at line 881 of file fxdeviceinitapi.cpp.

881  {
883 
885  "Pnp State is invalid %!STATUS!", status);
886 
887  return status;
888  }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
NTSTATUS status
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
Definition: ps.c:97

◆ if() [20/45]

if ( (CallbackTypes &~StateNotificationAllStates) !  = 0 || CallbackTypes == 0x0)

Definition at line 890 of file fxdeviceinitapi.cpp.

891  {
893 
895  "CallbackTypes is invalid %!STATUS!", status);
896 
897  return status;
898  }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
NTSTATUS status
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
Definition: ps.c:97

◆ if() [21/45]

if ( DeviceInit->PnpPower.  PnpStateCallbacks = NULL)

Definition at line 900 of file fxdeviceinitapi.cpp.

900  {
901 
902  DeviceInit->PnpPower.PnpStateCallbacks =
904 
905  if (DeviceInit->PnpPower.PnpStateCallbacks == NULL) {
907 
910  "Couldn't create object PnpStateCallbacks %!STATUS!", status);
911 
912  return status;
913  }
914  }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
NTSTATUS status
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
Definition: ps.c:97

◆ if() [22/45]

Definition at line 961 of file fxdeviceinitapi.cpp.

962  {
964 
966  "PowerState State is invalid %!STATUS!", status);
967 
968  return status;
969  }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
NTSTATUS status
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
Definition: ps.c:97

◆ if() [23/45]

Definition at line 1042 of file fxdeviceinitapi.cpp.

1043  {
1045 
1048  "PowerPolicyState State is invalid %!STATUS!", status);
1049 
1050  return status;
1051  }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
NTSTATUS status
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
Definition: ps.c:97

◆ if() [24/45]

if ( NumMinorFunctions  ,
 
)

Definition at line 1117 of file fxdeviceinitapi.cpp.

1117  {
1119  }
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PFN_WDFDEVICE_WDM_IRP_PREPROCESS _In_ UCHAR _In_opt_ PUCHAR MinorFunctions
Definition: wdfdevice.h:3465
PFX_DRIVER_GLOBALS pFxDriverGlobals
FxPointerNotNull(GetFxDriverGlobals(DriverGlobals), DeviceInit)

◆ if() [25/45]

if ( MajorFunction >=  ARRAY_SIZEDeviceInit->PreprocessInfo->Dispatch)

Definition at line 1125 of file fxdeviceinitapi.cpp.

1125  {
1127  "MajorFunction is invalid"
1128  "STATUS_INVALID_PARAMETER"
1129  );
1130 
1131  return STATUS_INVALID_PARAMETER;
1132  }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)

◆ if() [26/45]

Definition at line 1266 of file fxdeviceinitapi.cpp.

1266  {
1267  //
1268  // Size is wrong, bail out
1269  //
1271  "RemoveLockOptions %p Size incorrect, expected %d, "
1272  "got %d",
1274  RemoveLockOptions->Size);
1275 
1277  goto Done;
1278  }
#define TRACINGAPIERROR
Definition: dbgtrace.h:60
__in PWDFDEVICE_INIT __in PWDF_REMOVE_LOCK_OPTIONS RemoveLockOptions
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
PFX_DRIVER_GLOBALS fxDriverGlobals
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [27/45]

if ( (RemoveLockOptions->Flags &~validFlags) !  = 0)

Definition at line 1280 of file fxdeviceinitapi.cpp.

1280  {
1281  //
1282  // Invalid flag
1283  //
1285  "RemoveLockOptions %p Flags 0x%x invalid, "
1286  "valid mask is 0x%x",
1288  validFlags);
1289 
1291  goto Done;
1292  }
#define TRACINGAPIERROR
Definition: dbgtrace.h:60
ULONG validFlags
__in PWDFDEVICE_INIT __in PWDF_REMOVE_LOCK_OPTIONS RemoveLockOptions
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
PFX_DRIVER_GLOBALS fxDriverGlobals
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [28/45]

if ( FxDeviceInitTypeControlDevice  = DeviceInit->InitType)

Definition at line 1294 of file fxdeviceinitapi.cpp.

1294  {
1295  //
1296  // At this time this feature is not supported on control-devices.
1297  //
1299  "WdfDeviceInitSetRemoveLockOptions is not "
1300  "supported on control devices");
1301 
1303  goto Done;
1304  }
#define TRACINGAPIERROR
Definition: dbgtrace.h:60
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
PFX_DRIVER_GLOBALS fxDriverGlobals
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [29/45]

Definition at line 1327 of file fxdeviceinitapi.cpp.

1330  {
1332  DeviceInit->DriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
1333  "Out of range WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE %d",
1335  FxVerifierDbgBreakPoint(DeviceInit->DriverGlobals);
1336  return;
1337  }
_In_ PWDFDEVICE_INIT _In_ WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE ReleaseHardwareOrderOnFailure
Definition: wdfdevice.h:4362
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [30/45]

if ( DeviceInit->  IsNotFdoInit())

Definition at line 1398 of file fxdeviceinitapi.cpp.

1398  {
1400  DeviceInit->DriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
1401  "Not a PWDFDEVICE_INIT for an FDO"
1402  );
1403 
1404  return NULL;
1405  }
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113

◆ if() [31/45]

if ( NT_SUCCESSFxVerifierCheckIrqlLevel(pFxDriverGlobals, PASSIVE_LEVEL))

Definition at line 1480 of file fxdeviceinitapi.cpp.

1481  {
1482  return;
1483  }

◆ if() [32/45]

if ( BufferLength  ,
 
)

Definition at line 1545 of file fxdeviceinitapi.cpp.

1545  {
1547  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
Definition: wdfdevice.h:4431
FxPointerNotNull(GetFxDriverGlobals(DriverGlobals), DeviceInit)

◆ if() [33/45]

Definition at line 1690 of file fxdeviceinitapi.cpp.

1690  {
1693  "FdoEventCallbacks size %d is invalid, expected %d",
1695  );
1697  return;
1698  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
_In_ PWDFDEVICE_INIT _In_ PWDF_FDO_EVENT_CALLBACKS FdoEventCallbacks
Definition: wdffdo.h:373
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [34/45]

if ( FdoEventCallbacks->EvtDeviceFilterAddResourceRequirements !  = NULL && FdoEventCallbacks->EvtDeviceRemoveAddedResources == NULL)

Definition at line 1700 of file fxdeviceinitapi.cpp.

1701  {
1702  //
1703  // Not allowed to add resources without filtering them out later
1704  //
1707  "Must set EvtDeviceRemoveAddedResources if "
1708  "EvtDeviceFilterAddResourceRequirements (%p) is set",
1709  FdoEventCallbacks->EvtDeviceFilterAddResourceRequirements);
1710 
1712  return;
1713  }
DriverGlobals
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
_In_ PWDFDEVICE_INIT _In_ PWDF_FDO_EVENT_CALLBACKS FdoEventCallbacks
Definition: wdffdo.h:373
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [35/45]

Definition at line 1766 of file fxdeviceinitapi.cpp.

1766  {
1770  if (!NT_SUCCESS(status)) {
1772  return;
1773  }
1774 
1775  RtlCopyMemory(&DeviceInit->Fdo.ListConfigAttributes,
1777  sizeof(DeviceInit->Fdo.ListConfigAttributes));
1778  }
__inout PWDFDEVICE_INIT __in PWDF_CHILD_LIST_CONFIG __in_opt PWDF_OBJECT_ATTRIBUTES DefaultDeviceListAttributes
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ if() [36/45]

Definition at line 1864 of file fxdeviceinitapi.cpp.

1864  {
1867  "PropertyData size (%d) incorrect, expected %d, %!STATUS!",
1868  DeviceProperty->Size,
1869  sizeof(WDF_DEVICE_PROPERTY_DATA), status);
1870  return status;
1871  }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
Definition: wdfdevice.h:3767
PFX_DRIVER_GLOBALS pFxDriverGlobals
NTSTATUS status
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
Definition: ps.c:97

◆ if() [37/45]

if ( pDevice->  IsFdo() = FALSE)

Definition at line 2058 of file fxdeviceinitapi.cpp.

2058  {
2061  "Parent device is not a FDO (must use WDFCHILDLIST to use a PDO as a parent)"
2062  );
2063 
2064  return NULL;
2065  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112

◆ if() [38/45]

if ( pInit  = NULL)

Definition at line 2068 of file fxdeviceinitapi.cpp.

2068  {
2070  "Couldn't create WDFDEVICE_INIT object");
2071 
2072  return NULL;
2073  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112

◆ if() [39/45]

Definition at line 2118 of file fxdeviceinitapi.cpp.

2119  {
2121  "DispatchTable size %d is invalid, expected %d",
2122  DispatchTable->Size, sizeof(WDF_PDO_EVENT_CALLBACKS));
2124  return; // STATUS_INFO_LENGTH_MISMATCH;
2125  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:245
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [40/45]

if ( DeviceInit->Pdo.  DeviceID = NULL)

Definition at line 2173 of file fxdeviceinitapi.cpp.

2173  {
2176 
2177  if (DeviceInit->Pdo.DeviceID == NULL) {
2180  "Couldn't allocate DeviceID object, %!STATUS!",
2181  status);
2182  return status;
2183  }
2184  }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
NTSTATUS status
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
#define WDF_NO_OBJECT_ATTRIBUTES
Definition: wdftypes.h:105
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
Definition: ps.c:97

◆ if() [41/45]

if ( pID  = NULL)

Definition at line 2293 of file fxdeviceinitapi.cpp.

2293  {
2297  "Couldn't allocate String object %!STATUS!", status);
2298  return status;
2299  }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
NTSTATUS status
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
Definition: ps.c:97

◆ if() [42/45]

if ( NT_SUCCESS(status )

Definition at line 2302 of file fxdeviceinitapi.cpp.

2302  {
2303  status = (DeviceInit->Pdo.HardwareIDs.Add(pFxDriverGlobals, pID)) ?
2305  }
return STATUS_SUCCESS
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
FxString * pID
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
Definition: ps.c:97

◆ if() [43/45]

if ( pDeviceText  = NULL)

Definition at line 2496 of file fxdeviceinitapi.cpp.

2496  {
2498 
2501  "Couldn't allocate DeviceText object, %!STATUS!", status);
2502 
2503  return status;
2504  }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
NTSTATUS status
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
Definition: ps.c:97

◆ if() [44/45]

if ( pDeviceText->  m_Description = NULL)

Definition at line 2511 of file fxdeviceinitapi.cpp.

2511  {
2513 
2516  "Couldn't allocate DeviceDescription string, %!STATUS!", status);
2517 
2518  goto Done;
2519  }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
Definition: ps.c:97

◆ if() [45/45]

Definition at line 2743 of file fxdeviceinitapi.cpp.

2743  {
2745  "WdfDeviceShutdown Flags 0x%x are invalid", Flags);
2747  return;
2748  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACINGDEVICE
Definition: dbgtrace.h:58
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ reinterpret_cast< PDEVICE_OBJECT >()

◆ Release()

pID Release ( )

◆ SetPdo()

pInit SetPdo ( pDevice  )

◆ switch()

switch ( FileObjectConfig->  AutoForwardCleanupClose)

Definition at line 463 of file fxdeviceinitapi.cpp.

463  {
464  case WdfTrue:
465  case WdfFalse:
466  case WdfUseDefault:
467  break;
468 
469  default:
472  "Invalid FileObjectConfig->AutoForwardCleanupClose value 0x%x, "
473  "expected WDF_TRI_STATE value", FileObjectConfig->AutoForwardCleanupClose);
474 
476  return;
477  }
PFX_DRIVER_GLOBALS pFxDriverGlobals
_In_ PWDFDEVICE_INIT _In_ PWDF_FILEOBJECT_CONFIG FileObjectConfig
Definition: wdfdevice.h:3395
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

Variable Documentation

◆ __pad0__

Done __pad0__

Definition at line 1308 of file fxdeviceinitapi.cpp.

◆ __pad1__

Done __pad1__

Definition at line 2542 of file fxdeviceinitapi.cpp.

◆ AutoForwardCleanupClose

DeviceInit FileObject AutoForwardCleanupClose
Initial value:
=
FileObjectConfig->AutoForwardCleanupClose
_In_ PWDFDEVICE_INIT _In_ PWDF_FILEOBJECT_CONFIG FileObjectConfig
Definition: wdfdevice.h:3395

Definition at line 481 of file fxdeviceinitapi.cpp.

◆ BufferLength

◆ Callback

◆ CallbackTypes

◆ Class

◆ CompatibleID

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 2328 of file fxdeviceinitapi.cpp.

◆ Config

◆ ContainerID

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 2394 of file fxdeviceinitapi.cpp.

◆ DefaultDeviceListAttributes

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 1733 of file fxdeviceinitapi.cpp.

Referenced by if().

◆ DefaultLocale

DeviceInit Pdo DefaultLocale = LocaleId

Definition at line 2580 of file fxdeviceinitapi.cpp.

◆ DesiredAccess

◆ DeviceCharacteristics

◆ DeviceClassGuid

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 684 of file fxdeviceinitapi.cpp.

◆ DeviceClassSet

DeviceInit Security DeviceClassSet = TRUE

Definition at line 694 of file fxdeviceinitapi.cpp.

◆ DeviceDescription

◆ DeviceID

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 2144 of file fxdeviceinitapi.cpp.

◆ DeviceInit

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 147 of file fxdeviceinitapi.cpp.

Referenced by if().

◆ DeviceInstanceKeyType

◆ DeviceLocation

◆ DeviceName

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 320 of file fxdeviceinitapi.cpp.

◆ DeviceProperty

◆ DeviceType

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 245 of file fxdeviceinitapi.cpp.

◆ DispatchTable

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 2097 of file fxdeviceinitapi.cpp.

◆ Driver

Definition at line 2681 of file fxdeviceinitapi.cpp.

◆ else

else
Initial value:
{
_In_ WDFDEVICE _In_ ULONG DeviceCharacteristics
Definition: wdfdevice.h:2772
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46

Definition at line 382 of file fxdeviceinitapi.cpp.

◆ EvtDevicePnpStateChange

◆ EvtDevicePowerPolicyStateChange

◆ EvtDevicePowerStateChange

◆ EvtDevicePreprocess

DeviceInit PreprocessInfo Dispatch [MajorFunction] EvtDevicePreprocess
Initial value:
=
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PFN_WDFDEVICE_WDM_IRP_PREPROCESS EvtDeviceWdmIrpPreprocess
Definition: wdfdevice.h:3458

Definition at line 1183 of file fxdeviceinitapi.cpp.

◆ EvtDeviceWdmIrpPreprocess

◆ EvtIoInCallerContext

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 1234 of file fxdeviceinitapi.cpp.

◆ Exclusive

◆ FdoEventCallbacks

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 1669 of file fxdeviceinitapi.cpp.

◆ fileClass

fileClass = FileObjectConfig->FileObjectClass

Definition at line 430 of file fxdeviceinitapi.cpp.

Referenced by if().

◆ FileObjectAttributes

◆ FileObjectConfig

◆ Filter

DeviceInit Fdo Filter = TRUE

Definition at line 1493 of file fxdeviceinitapi.cpp.

◆ Flags

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 2726 of file fxdeviceinitapi.cpp.

◆ ForwardRequestToParent

DeviceInit Pdo ForwardRequestToParent = TRUE

Definition at line 2659 of file fxdeviceinitapi.cpp.

◆ fxDriverGlobals

Definition at line 1259 of file fxdeviceinitapi.cpp.

Referenced by if().

◆ HardwareID

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 2262 of file fxdeviceinitapi.cpp.

◆ Inrush

DeviceInit Inrush = TRUE

Definition at line 304 of file fxdeviceinitapi.cpp.

◆ InstanceID

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 2203 of file fxdeviceinitapi.cpp.

◆ IoInCallerContextCallback

DeviceInit IoInCallerContextCallback = EvtIoInCallerContext

Definition at line 1240 of file fxdeviceinitapi.cpp.

◆ IoType

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 168 of file fxdeviceinitapi.cpp.

◆ ioTypeConfig

DeviceInit AssignIoType & ioTypeConfig

Definition at line 171 of file fxdeviceinitapi.cpp.

◆ IoTypeConfig

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 193 of file fxdeviceinitapi.cpp.

◆ IsPowerPolicyOwner

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 837 of file fxdeviceinitapi.cpp.

◆ Key

* Key
Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 1428 of file fxdeviceinitapi.cpp.

◆ KeyAttributes

◆ LastDeviceTextEntry

DeviceInit Pdo LastDeviceTextEntry = &pDeviceText->m_Entry

Definition at line 2537 of file fxdeviceinitapi.cpp.

◆ LocaleId

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 2459 of file fxdeviceinitapi.cpp.

◆ m_Description

pDeviceText m_Description
Initial value:
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
Definition: wdfpdo.h:430
_Must_inspect_result_ PWCHAR FxDuplicateUnicodeStringToString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in const UNICODE_STRING *Source)
Definition: stringutil.cpp:287
PFX_DRIVER_GLOBALS pFxDriverGlobals

Definition at line 2508 of file fxdeviceinitapi.cpp.

◆ m_LocaleId

pDeviceText m_LocaleId = LocaleId

Definition at line 2506 of file fxdeviceinitapi.cpp.

◆ m_LocationInformation

pDeviceText m_LocationInformation
Initial value:
_Must_inspect_result_ PWCHAR FxDuplicateUnicodeStringToString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in const UNICODE_STRING *Source)
Definition: stringutil.cpp:287
PFX_DRIVER_GLOBALS pFxDriverGlobals
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING _In_ PCUNICODE_STRING DeviceLocation
Definition: wdfpdo.h:430

Definition at line 2521 of file fxdeviceinitapi.cpp.

◆ MajorFunction

◆ MinorFunctions

◆ normalizedFileClass

normalizedFileClass = FxFileObjectClassNormalize(fileClass)

Definition at line 429 of file fxdeviceinitapi.cpp.

Referenced by if().

◆ normalizedState

ULONG normalizedState = WdfDevStateNormalize(PnpState)

Definition at line 866 of file fxdeviceinitapi.cpp.

◆ Notification

◆ NumMinorFunctions

◆ OrInValues

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 374 of file fxdeviceinitapi.cpp.

◆ ParentDevice

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 2039 of file fxdeviceinitapi.cpp.

◆ pCallback

◆ pDevice

FxDevice* pDevice

Definition at line 2044 of file fxdeviceinitapi.cpp.

◆ pDeviceText

Definition at line 2463 of file fxdeviceinitapi.cpp.

Referenced by FindObjectForGivenLocale().

◆ pDriver

◆ pFxDriverGlobals

pFxDriverGlobals = GetFxDriverGlobals(DriverGlobals)

Definition at line 197 of file fxdeviceinitapi.cpp.

Referenced by if(), and switch().

◆ pID

◆ pInit

◆ PnpPowerEventCallbacks

◆ PnpState

◆ PoolType

◆ PowerPageable

DeviceInit PowerPageable = FALSE

Definition at line 267 of file fxdeviceinitapi.cpp.

◆ PowerPolicyEventCallbacks

◆ PowerPolicyOwner

DeviceInit PnpPower PowerPolicyOwner = IsPowerPolicyOwner ? WdfTrue : WdfFalse

Definition at line 842 of file fxdeviceinitapi.cpp.

◆ PowerPolicyState

◆ PowerState

◆ PropertyBuffer

◆ PropertyMemory

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 1612 of file fxdeviceinitapi.cpp.

◆ PropertyMemoryAttributes

◆ Raw

Definition at line 2619 of file fxdeviceinitapi.cpp.

◆ ReadWriteIoType

ioTypeConfig ReadWriteIoType = IoType

Definition at line 176 of file fxdeviceinitapi.cpp.

Referenced by FxDevice::GetDeviceStackIoType().

◆ ReleaseHardwareOrderOnFailure

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 1322 of file fxdeviceinitapi.cpp.

◆ RemoveLockOptionFlags

DeviceInit RemoveLockOptionFlags = RemoveLockOptions->Flags

Definition at line 1306 of file fxdeviceinitapi.cpp.

Referenced by FxDevice::IsRemoveLockEnabledForIo().

◆ RemoveLockOptions

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 1256 of file fxdeviceinitapi.cpp.

Referenced by if(), and WDF_REMOVE_LOCK_OPTIONS_INIT().

◆ RequestAttributes

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 578 of file fxdeviceinitapi.cpp.

◆ RequiresSelfIoTarget

DeviceInit RequiresSelfIoTarget = TRUE

Definition at line 1375 of file fxdeviceinitapi.cpp.

◆ ResultLength

◆ return

return

Definition at line 1242 of file fxdeviceinitapi.cpp.

◆ SDDLString

Initial value:
{
#define DDI_ENTRY()
Definition: fxglobalskm.h:56

Definition at line 619 of file fxdeviceinitapi.cpp.

◆ Set

Definition at line 479 of file fxdeviceinitapi.cpp.

◆ ShutdownNotification

DeviceInit Control ShutdownNotification = Notification

Definition at line 2750 of file fxdeviceinitapi.cpp.

◆ Static

Definition at line 2081 of file fxdeviceinitapi.cpp.

Referenced by FxChildList::FxChildList().

◆ status

Initial value:
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113

Definition at line 196 of file fxdeviceinitapi.cpp.

Referenced by if().

◆ STATUS_SUCCESS

return STATUS_SUCCESS

Definition at line 922 of file fxdeviceinitapi.cpp.

Referenced by if().

◆ totalDescriptionSize

totalDescriptionSize = 0

Definition at line 1738 of file fxdeviceinitapi.cpp.

◆ Type

◆ Types

Definition at line 920 of file fxdeviceinitapi.cpp.

◆ validFlags

Definition at line 1260 of file fxdeviceinitapi.cpp.

Referenced by if().