ReactOS  0.4.15-dev-3017-g1d9542d
fxdevice.cpp File Reference
#include "coreprivshared.hpp"
Include dependency graph for fxdevice.cpp:

Go to the source code of this file.

Functions

_Must_inspect_result_ __inline BOOLEAN IsPreprocessIrp (__in MdIrp Irp, __in FxIrpPreprocessInfo *Info)
 
_Must_inspect_result_ __inline NTSTATUS PreprocessIrp (__in FxDevice *Device, __in MdIrp Irp, __in FxIrpPreprocessInfo *Info, __in PVOID DispatchContext)
 
_Must_inspect_result_ __inline NTSTATUS DispatchWorker (__in FxDevice *Device, __in MdIrp Irp, __in WDFCONTEXT DispatchContext)
 

Function Documentation

◆ DispatchWorker()

_Must_inspect_result_ __inline NTSTATUS DispatchWorker ( __in FxDevice Device,
__in MdIrp  Irp,
__in WDFCONTEXT  DispatchContext 
)

Definition at line 1507 of file fxdevice.cpp.

1512 {
1513  PLIST_ENTRY next;
1514  FxIrp irp(Irp);
1515 
1517 
1520 
1521  //
1522  // Check for any driver/class-extensions' preprocess requirements.
1523  //
1524  while (next != &Device->m_PreprocessInfoListHead) {
1526 
1528 
1529  //
1530  // Advance to next node.
1531  //
1532  next = next->Flink;
1533 
1534  if (IsPreprocessIrp(Irp, info)) {
1535  return PreprocessIrp(Device, Irp, info, next);
1536  }
1537  }
1538 
1539  //
1540  // No preprocess requirements, directly dispatch the IRP.
1541  //
1542  return Device->GetDispatchPackage(
1544  )->Dispatch(Irp);
1545 }
struct _LIST_ENTRY * PLIST_ENTRY
_In_ UCHAR _In_ UCHAR _In_ ULONG _In_ WDFCONTEXT _Inout_ PIRP _In_ WDFCONTEXT DispatchContext
Definition: wdfdevice.h:1697
_Must_inspect_result_ __inline NTSTATUS PreprocessIrp(__in FxDevice *Device, __in MdIrp Irp, __in FxIrpPreprocessInfo *Info, __in PVOID DispatchContext)
Definition: fxdevice.cpp:1451
Definition: fxirp.hpp:28
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_ PIRP Irp
Definition: csq.h:116
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define ASSERT(a)
Definition: mode.c:44
_Must_inspect_result_ __inline BOOLEAN IsPreprocessIrp(__in MdIrp Irp, __in FxIrpPreprocessInfo *Info)
Definition: fxdevice.cpp:1408
struct _test_info info[]
Definition: SetCursorPos.c:19
unsigned char UCHAR
Definition: xmlstorage.h:181
Definition: typedefs.h:119
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH * Dispatch
Definition: wsk.h:182
static unsigned __int64 next
Definition: rand_nt.c:6
#define NULL
Definition: types.h:112
UCHAR GetMajorFunction(VOID)
Definition: fxirpum.cpp:217
#define FX_IN_DISPATCH_CALLBACK
Definition: fxpkgio.hpp:39
FxIrp * irp

Referenced by FxDevice::Dispatch(), and FxDevice::DispatchPreprocessedIrp().

◆ IsPreprocessIrp()

_Must_inspect_result_ __inline BOOLEAN IsPreprocessIrp ( __in MdIrp  Irp,
__in FxIrpPreprocessInfo Info 
)

Definition at line 1408 of file fxdevice.cpp.

1412 {
1413  UCHAR major, minor;
1414  BOOLEAN preprocess;
1415  FxIrp irp(Irp);
1416 
1419 
1420  preprocess = FALSE;
1421 
1422  if (Info->Dispatch[major].EvtDevicePreprocess != NULL) {
1423  if (Info->Dispatch[major].NumMinorFunctions == 0) {
1424  //
1425  // If the driver is not interested in particular minor codes,
1426  // just give the irp to it.
1427  //
1428  preprocess = TRUE;
1429  }
1430  else {
1431  ULONG i;
1432 
1433  //
1434  // Try to match up to a minor code.
1435  //
1436  for (i = 0; i < Info->Dispatch[major].NumMinorFunctions; i++) {
1437  if (Info->Dispatch[major].MinorFunctions[i] == minor) {
1438  preprocess = TRUE;
1439  break;
1440  }
1441  }
1442  }
1443  }
1444 
1445  return preprocess;
1446 }
#define TRUE
Definition: types.h:120
Definition: fxirp.hpp:28
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
unsigned char BOOLEAN
ULONG major
unsigned char UCHAR
Definition: xmlstorage.h:181
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
UCHAR GetMinorFunction(VOID)
Definition: fxirpum.cpp:297
unsigned int ULONG
Definition: retypes.h:1
UCHAR GetMajorFunction(VOID)
Definition: fxirpum.cpp:217
ULONG minor
FxIrp * irp

Referenced by DispatchWorker().

◆ PreprocessIrp()

_Must_inspect_result_ __inline NTSTATUS PreprocessIrp ( __in FxDevice Device,
__in MdIrp  Irp,
__in FxIrpPreprocessInfo Info,
__in PVOID  DispatchContext 
)

Definition at line 1451 of file fxdevice.cpp.

1457 {
1458  NTSTATUS status;
1459  UCHAR major, minor;
1460  FxIrp irp(Irp);
1461 
1464 
1465  //
1466  // If this is a pnp remove irp, this object could be deleted by the time
1467  // EvtDevicePreprocess returns. To not touch freed pool, capture all
1468  // values we will need before preprocessing.
1469  //
1470 
1471  if (Info->ClassExtension == FALSE) {
1472  status = Info->Dispatch[major].EvtDevicePreprocess( Device->GetHandle(),
1473  Irp);
1474  }
1475  else {
1476  status = Info->Dispatch[major].EvtCxDevicePreprocess(
1477  Device->GetHandle(),
1478  Irp,
1479  DispatchContext);
1480  }
1481 
1482  //
1483  // If we got this far, we handed the irp off to EvtDevicePreprocess, so we
1484  // must now do our remlock maintainance if necessary.
1485  //
1487  //
1488  // Keep the remove lock active until after we call into the driver.
1489  // If the driver redispatches the irp to the framework, we will
1490  // reacquire the remove lock at that point in time.
1491  //
1492  // Touching pDevObj after sending the pnp remove irp to the framework
1493  // is OK b/c we have acquired the remlock previously and that will
1494  // prevent this irp's processing racing with the pnp remove irp
1495  // processing.
1496  //
1497  Mx::MxReleaseRemoveLock(Device->GetRemoveLock(),
1498  Irp);
1499  }
1500 
1501  return status;
1502 }
_In_ UCHAR _In_ UCHAR _In_ ULONG _In_ WDFCONTEXT _Inout_ PIRP _In_ WDFCONTEXT DispatchContext
Definition: wdfdevice.h:1697
LONG NTSTATUS
Definition: precomp.h:26
Definition: fxirp.hpp:28
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
ULONG major
unsigned char UCHAR
Definition: xmlstorage.h:181
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
static __inline VOID MxReleaseRemoveLock(__in MdRemoveLock RemoveLock, __in PVOID Tag)
Definition: mxgeneralkm.h:278
static FxDeviceRemLockAction __inline _RequiresRemLock(__in UCHAR MajorCode, __in UCHAR MinorCode)
Definition: fxdevice.hpp:933
UCHAR GetMinorFunction(VOID)
Definition: fxirpum.cpp:297
UCHAR GetMajorFunction(VOID)
Definition: fxirpum.cpp:217
static SERVICE_STATUS status
Definition: service.c:31
ULONG minor
FxIrp * irp
Definition: ps.c:97

Referenced by DispatchWorker().