ReactOS  0.4.15-dev-3446-g30010a5
fxcxdeviceinitapi.cpp File Reference
#include "coreprivshared.hpp"
Include dependency graph for fxcxdeviceinitapi.cpp:

Go to the source code of this file.

Functions

static __inline NTSTATUS FxValiateCx (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PFX_DRIVER_GLOBALS CxDriverGlobals)
 
_Must_inspect_result_ __drv_maxIRQL (DISPATCH_LEVEL) WDFAPI NTSTATUS WDFEXPORT(WdfCxDeviceInitAssignWdmIrpPreprocessCallback)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
_Must_inspect_result_ __in PWDFCXDEVICE_INIT __in PFN_WDFCXDEVICE_WDM_IRP_PREPROCESS __in UCHAR __drv_when (NumMinorFunctions > 0, __in_bcount(NumMinorFunctions)) __drv_when(NumMinorFunctions
 
 FxPointerNotNull (cxDriverGlobals, CxDeviceInit)
 
 if (!NT_SUCCESS(status))
 
 FxPointerNotNull (fxDriverGlobals, EvtCxDeviceWdmIrpPreprocess)
 
 if (NumMinorFunctions > 0)
 
 if (MajorFunction >=ARRAY_SIZE(CxDeviceInit->PreprocessInfo->Dispatch))
 
 if (CxDeviceInit->PreprocessInfo==NULL)
 
 ASSERT (CxDeviceInit->PreprocessInfo->ClassExtension)
 
 FxPointerNotNull (fxDriverGlobals, EvtIoInCallerContext)
 
 FxPointerNotNull (fxDriverGlobals, RequestAttributes)
 
RtlCopyMemoryCxDeviceInit (WDF_OBJECT_ATTRIBUTES)
 
 FxPointerNotNull (fxDriverGlobals, CxFileObjectConfig)
 
 if (CxFileObjectConfig->Size !=sizeof(WDFCX_FILEOBJECT_CONFIG))
 
 switch (CxFileObjectConfig->AutoForwardCleanupClose)
 
 if (normalizedFileClass==WdfFileObjectInvalid||normalizedFileClass > WdfFileObjectWdfCannotUseFsContexts)
 
 if (FxIsFileObjectOptional(CxFileObjectConfig->FileObjectClass))
 
RtlCopyMemoryCxDeviceInit (CxDeviceInit->FileObject.Callbacks)
 
 if (FileObjectAttributes !=NULL)
 
_Must_inspect_result_ __drv_maxIRQL (PASSIVE_LEVEL) PWDFCXDEVICE_INIT WDFEXPORT(WdfCxDeviceInitAllocate)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
 FxPointerNotNull (cxDriverGlobals, DeviceInit)
 
 if (NULL==cxDeviceInit)
 

Variables

_Must_inspect_result_ __in PWDFCXDEVICE_INIT CxDeviceInit
 
_Must_inspect_result_ __in PWDFCXDEVICE_INIT __in PFN_WDFCXDEVICE_WDM_IRP_PREPROCESS EvtCxDeviceWdmIrpPreprocess
 
_Must_inspect_result_ __in PWDFCXDEVICE_INIT __in PFN_WDFCXDEVICE_WDM_IRP_PREPROCESS __in UCHAR MajorFunction
 
_Must_inspect_result_ __in PWDFCXDEVICE_INIT __in PFN_WDFCXDEVICE_WDM_IRP_PREPROCESS __in UCHAR __in_opt PUCHAR MinorFunctions
 
_Must_inspect_result_ __in PWDFCXDEVICE_INIT __in PFN_WDFCXDEVICE_WDM_IRP_PREPROCESS __in UCHAR __in_opt PUCHAR __in ULONG NumMinorFunctions
 
PFX_DRIVER_GLOBALS fxDriverGlobals = CxDeviceInit->ClientDriverGlobals
 
PFX_DRIVER_GLOBALS cxDriverGlobals = GetFxDriverGlobals(DriverGlobals)
 
NTSTATUS status = FxValiateCx(fxDriverGlobals, cxDriverGlobals)
 
CxDeviceInit PreprocessInfo Dispatch [MajorFunctionEvtCxDevicePreprocess
 
Done __pad0__
 
__in PWDFCXDEVICE_INIT __in PFN_WDF_IO_IN_CALLER_CONTEXT EvtIoInCallerContext
 
CxDeviceInit IoInCallerContextCallback = EvtIoInCallerContext
 
Done __pad1__
 
__in PWDFCXDEVICE_INIT __in PWDF_OBJECT_ATTRIBUTES RequestAttributes
 
Done __pad2__
 
__in PWDFCXDEVICE_INIT __in PWDFCX_FILEOBJECT_CONFIG CxFileObjectConfig
 
__in PWDFCXDEVICE_INIT __in PWDFCX_FILEOBJECT_CONFIG __in_opt PWDF_OBJECT_ATTRIBUTES FileObjectAttributes
 
WDF_FILEOBJECT_CLASS normalizedFileClass
 
CxDeviceInit FileObject Set = TRUE
 
CxDeviceInit FileObject AutoForwardCleanupClose
 
CxDeviceInit FileObject Class = CxFileObjectConfig->FileObjectClass
 
Done __pad3__
 
_Must_inspect_result_ __in PWDFDEVICE_INIT DeviceInit
 
PWDFCXDEVICE_INIT cxDeviceInit = NULL
 
cxDeviceInit ClientDriverGlobals = fxDriverGlobals
 
cxDeviceInit CxDriverGlobals = cxDriverGlobals
 
Done __pad4__
 

Function Documentation

◆ __drv_maxIRQL() [1/2]

◆ __drv_maxIRQL() [2/2]

_Must_inspect_result_ __drv_maxIRQL ( PASSIVE_LEVEL  )

◆ __drv_when()

◆ ASSERT()

ASSERT ( CxDeviceInit->PreprocessInfo->  ClassExtension)

◆ CxDeviceInit() [1/2]

RtlCopyMemory& CxDeviceInit ( WDF_OBJECT_ATTRIBUTES  )

◆ CxDeviceInit() [2/2]

RtlCopyMemory& CxDeviceInit ( CxDeviceInit->FileObject.  Callbacks)

◆ FxPointerNotNull() [1/6]

FxPointerNotNull ( cxDriverGlobals  ,
CxDeviceInit   
)

Referenced by if().

◆ FxPointerNotNull() [2/6]

FxPointerNotNull ( fxDriverGlobals  ,
EvtCxDeviceWdmIrpPreprocess   
)

◆ FxPointerNotNull() [3/6]

FxPointerNotNull ( fxDriverGlobals  ,
EvtIoInCallerContext   
)

◆ FxPointerNotNull() [4/6]

FxPointerNotNull ( fxDriverGlobals  ,
RequestAttributes   
)

◆ FxPointerNotNull() [5/6]

FxPointerNotNull ( fxDriverGlobals  ,
CxFileObjectConfig   
)

◆ FxPointerNotNull() [6/6]

FxPointerNotNull ( cxDriverGlobals  ,
DeviceInit   
)

◆ FxValiateCx()

static __inline NTSTATUS FxValiateCx ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in PFX_DRIVER_GLOBALS  CxDriverGlobals 
)
static

Definition at line 42 of file fxcxdeviceinitapi.cpp.

46 {
48 
49  if (FxIsClassExtension(FxDriverGlobals, CxDriverGlobals) == FALSE) {
52  "This function can only be called by a WDF "
53  "extension driver, Driver 0x%p, %!STATUS!",
54  CxDriverGlobals->Public.Driver, status);
55  FxVerifierDbgBreakPoint(FxDriverGlobals);
56  }
57 
58  return status;
59 }
NTSTATUS status
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define FALSE
Definition: types.h:117
#define TRACINGDEVICE
Definition: dbgtrace.h:58
cxDeviceInit CxDriverGlobals
_Must_inspect_result_ __inline BOOLEAN FxIsClassExtension(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PFX_DRIVER_GLOBALS ExtDriverGlobals)
Definition: fxglobals.h:965
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define STATUS_SUCCESS
Definition: shellext.h:65
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ if() [1/9]

if ( NT_SUCCESSstatus)

Definition at line 95 of file fxcxdeviceinitapi.cpp.

95  {
96  goto Done;
97  }

◆ if() [2/9]

if ( NumMinorFunctions  ,
 
)

Definition at line 101 of file fxcxdeviceinitapi.cpp.

101  {
103  }
_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 fxDriverGlobals
FxPointerNotNull(cxDriverGlobals, CxDeviceInit)

◆ if() [3/9]

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

Definition at line 110 of file fxcxdeviceinitapi.cpp.

110  {
113  "MajorFunction %x is invalid, %!STATUS!",
115 
116  goto Done;
117  }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
_In_ UCHAR MajorFunction
Definition: wdfdevice.h:1697
PFX_DRIVER_GLOBALS fxDriverGlobals
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
unsigned int ULONG
Definition: retypes.h:1
Definition: ps.c:97

◆ if() [4/9]

if ( CxDeviceInit->  PreprocessInfo = NULL)

Definition at line 123 of file fxcxdeviceinitapi.cpp.

123  {
125  if (CxDeviceInit->PreprocessInfo == NULL) {
128  "Couldn't create object PreprocessInfo, "
129  "%!STATUS!", status);
130 
131  goto Done;
132  }
134  }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TRUE
Definition: types.h:120
FxIrpPreprocessInfo * PreprocessInfo
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
PFX_DRIVER_GLOBALS fxDriverGlobals
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
_Must_inspect_result_ __in PWDFCXDEVICE_INIT CxDeviceInit
Definition: ps.c:97

◆ if() [5/9]

Definition at line 352 of file fxcxdeviceinitapi.cpp.

352  {
355  "Invalid CxFileObjectConfig Size %d, expected %d",
357 
359  goto Done;
360  }
__in PWDFCXDEVICE_INIT __in PWDFCX_FILEOBJECT_CONFIG CxFileObjectConfig
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#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() [6/9]

Definition at line 406 of file fxcxdeviceinitapi.cpp.

407  {
410  "Out of range CxFileObjectConfig->FileObjectClass %d",
411  CxFileObjectConfig->FileObjectClass);
413  goto Done;
414  }
__in PWDFCXDEVICE_INIT __in PWDFCX_FILEOBJECT_CONFIG CxFileObjectConfig
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#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() [7/9]

if ( FxIsFileObjectOptional(CxFileObjectConfig->FileObjectClass)  )

Definition at line 419 of file fxcxdeviceinitapi.cpp.

419  {
420  switch(normalizedFileClass) {
424  break;
425 
426  default:
429  "Invalid CxFileObjectConfig->FileObjectClass %d",
430  CxFileObjectConfig->FileObjectClass);
432  goto Done;
433  break; // just in case static verification tools complain.
434  }
435  }
__in PWDFCXDEVICE_INIT __in PWDFCX_FILEOBJECT_CONFIG CxFileObjectConfig
#define TRACINGDEVICE
Definition: dbgtrace.h:58
WDF_FILEOBJECT_CLASS normalizedFileClass
#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() [8/9]

Definition at line 443 of file fxcxdeviceinitapi.cpp.

443  {
447  }
CxFileObjectInit FileObject
_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
_Must_inspect_result_ __in PWDFCXDEVICE_INIT CxDeviceInit
WDF_OBJECT_ATTRIBUTES Attributes

◆ if() [9/9]

if ( NULL  = cxDeviceInit)

Definition at line 489 of file fxcxdeviceinitapi.cpp.

489  {
490  goto Done;
491  }

◆ switch()

switch ( CxFileObjectConfig->  AutoForwardCleanupClose)

Definition at line 378 of file fxcxdeviceinitapi.cpp.

378  {
379  case WdfTrue:
380  case WdfFalse:
381  case WdfUseDefault:
382  break;
383 
384  default:
387  "Invalid CxFileObjectConfig->AutoForwardCleanupClose value 0x%x, "
388  "expected WDF_TRI_STATE value",
389  CxFileObjectConfig->AutoForwardCleanupClose);
390 
392  goto Done;
393  }
__in PWDFCXDEVICE_INIT __in PWDFCX_FILEOBJECT_CONFIG CxFileObjectConfig
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
PFX_DRIVER_GLOBALS fxDriverGlobals
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

Variable Documentation

◆ __pad0__

Done __pad0__

Definition at line 176 of file fxcxdeviceinitapi.cpp.

◆ __pad1__

Done __pad1__

Definition at line 249 of file fxcxdeviceinitapi.cpp.

◆ __pad2__

Done __pad2__

Definition at line 300 of file fxcxdeviceinitapi.cpp.

◆ __pad3__

Done __pad3__

Definition at line 450 of file fxcxdeviceinitapi.cpp.

◆ __pad4__

Done __pad4__

Definition at line 497 of file fxcxdeviceinitapi.cpp.

◆ AutoForwardCleanupClose

CxDeviceInit FileObject AutoForwardCleanupClose
Initial value:
=
CxFileObjectConfig->AutoForwardCleanupClose
__in PWDFCXDEVICE_INIT __in PWDFCX_FILEOBJECT_CONFIG CxFileObjectConfig

Definition at line 397 of file fxcxdeviceinitapi.cpp.

◆ Class

Definition at line 437 of file fxcxdeviceinitapi.cpp.

◆ ClientDriverGlobals

cxDeviceInit ClientDriverGlobals = fxDriverGlobals

Definition at line 493 of file fxcxdeviceinitapi.cpp.

◆ CxDeviceInit

__in PWDFCXDEVICE_INIT CxDeviceInit

Definition at line 69 of file fxcxdeviceinitapi.cpp.

Referenced by if().

◆ cxDeviceInit

cxDeviceInit = NULL

Definition at line 467 of file fxcxdeviceinitapi.cpp.

◆ cxDriverGlobals

Definition at line 84 of file fxcxdeviceinitapi.cpp.

◆ CxDriverGlobals

cxDeviceInit CxDriverGlobals = cxDriverGlobals

Definition at line 494 of file fxcxdeviceinitapi.cpp.

Referenced by FxValiateCx().

◆ CxFileObjectConfig

Definition at line 309 of file fxcxdeviceinitapi.cpp.

Referenced by if(), and switch().

◆ DeviceInit

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

Definition at line 462 of file fxcxdeviceinitapi.cpp.

◆ EvtCxDevicePreprocess

CxDeviceInit PreprocessInfo Dispatch [MajorFunction] EvtCxDevicePreprocess
Initial value:
=
_Must_inspect_result_ __in PWDFCXDEVICE_INIT __in PFN_WDFCXDEVICE_WDM_IRP_PREPROCESS EvtCxDeviceWdmIrpPreprocess

Definition at line 170 of file fxcxdeviceinitapi.cpp.

◆ EvtCxDeviceWdmIrpPreprocess

◆ EvtIoInCallerContext

◆ FileObjectAttributes

◆ fxDriverGlobals

◆ IoInCallerContextCallback

CxDeviceInit IoInCallerContextCallback = EvtIoInCallerContext

Definition at line 246 of file fxcxdeviceinitapi.cpp.

◆ MajorFunction

◆ MinorFunctions

◆ normalizedFileClass

normalizedFileClass
Initial value:
CxFileObjectConfig->FileObjectClass)
__in PWDFCXDEVICE_INIT __in PWDFCX_FILEOBJECT_CONFIG CxFileObjectConfig
WDF_FILEOBJECT_CLASS __inline FxFileObjectClassNormalize(__in WDF_FILEOBJECT_CLASS FileObjectClass)
Definition: fxdevice.hpp:103

Definition at line 336 of file fxcxdeviceinitapi.cpp.

Referenced by FxFileObject::_CreateFileObject(), FxFileObject::_DestroyFileObject(), FxFileObject::_GetFileObjectFromWdm(), and if().

◆ NumMinorFunctions

◆ RequestAttributes

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

Definition at line 262 of file fxcxdeviceinitapi.cpp.

◆ Set

Definition at line 395 of file fxcxdeviceinitapi.cpp.

◆ status