ReactOS  0.4.15-dev-2701-g34593d9
fxuserobject.hpp
Go to the documentation of this file.
1 
2 /*++
3 
4 Copyright (c) Microsoft. All rights reserved.
5 
6 Module Name:
7 
8  FxUserObject.hpp
9 
10 Abstract:
11 
12  This module implements the user object that device
13  driver writers can use to take advantage of the
14  driver frameworks infrastructure.
15 
16 Author:
17 
18 
19 
20 
21 Environment:
22 
23  Both kernel and user mode
24 
25 Revision History:
26 
27 
28  Made mode agnostic
29 
30 --*/
31 
32 #ifndef _FXUSEROBJECT_H_
33 #define _FXUSEROBJECT_H_
34 
36 
37 private:
38 
39 public:
40 
41  static
43  NTSTATUS
44  _Create(
45  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
48  );
49 
51  __in PFX_DRIVER_GLOBALS FxDriverGlobals
52  );
53 
54  virtual
55  NTSTATUS
58  )
59  {
60  switch (Params->Type) {
61  case FX_TYPE_USEROBJECT:
62  *Params->Object = (FxUserObject*) this;
63  break;
64 
65  default:
66  return FxNonPagedObject::QueryInterface(Params); // __super call
67  }
68 
69  return STATUS_SUCCESS;
70  }
71 
72  __inline
73  WDFOBJECT
75  VOID
76  )
77  {
78  return (WDFOBJECT) GetObjectHandle();
79  }
80 
81 private:
82 
83 #ifdef INLINE_WRAPPER_ALLOCATION
84 #if (FX_CORE_MODE==FX_CORE_USER_MODE)
85  static
86  USHORT
87  GetWrapperSize(
88  VOID
89  );
90 
91 public:
93  PVOID
95  VOID
96  )
97  {
98  PBYTE ptr = (PBYTE) this;
99  return (ptr + (USHORT) WDF_ALIGN_SIZE_UP(sizeof(*this), MEMORY_ALLOCATION_ALIGNMENT));
100  }
101 #endif
102 #endif
103 };
104 
105 #endif // _FXUSEROBJECT_H_
106 
#define _Must_inspect_result_
Definition: no_sal2.h:62
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:306
virtual NTSTATUS QueryInterface(__in FxQueryInterfaceParams *Params)
#define __in_opt
Definition: dbghelp.h:38
LONG NTSTATUS
Definition: precomp.h:26
PVOID GetCOMWrapper()
Definition: fxobject.hpp:518
FORCEINLINE size_t WDF_ALIGN_SIZE_UP(_In_ size_t Length, _In_ size_t AlignTo)
Definition: wdfcore.h:129
static PVOID ptr
Definition: dispmode.c:27
PVOID __inline GetObjectHandle(VOID)
Definition: fxobject.hpp:603
#define __out
Definition: dbghelp.h:62
__inline WDFOBJECT GetHandle(VOID)
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
unsigned short USHORT
Definition: pedump.c:61
#define FORCEINLINE
Definition: wdftypes.h:67
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out FxUserObject **Object)
FxUserObject(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
virtual _Must_inspect_result_ NTSTATUS QueryInterface(__in FxQueryInterfaceParams *Params)
Definition: fxobject.cpp:255
#define STATUS_SUCCESS
Definition: shellext.h:65
#define __in
Definition: dbghelp.h:35
BYTE * PBYTE
Definition: pedump.c:66
#define MEMORY_ALLOCATION_ALIGNMENT
Definition: ntbasedef.h:90
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes