ReactOS 0.4.16-dev-109-gf4cb10f
fxfileobject.hpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxFileObject.hpp
8
9Abstract:
10
11 This module implements a frameworks managed FileObject
12
13Author:
14
15
16
17Environment:
18
19 Both kernel and user mode
20
21Revision History:
22
23
24--*/
25
26#ifndef _FXFILEOBJECT_H_
27#define _FXFILEOBJECT_H_
28
30
31private:
32
33 // Pointer to WDM FileObject
36
37#if (FX_CORE_MODE == FX_CORE_USER_MODE)
38 //
39 // KMDF retrieves the name unicode string directly from wdm file object,
40 // and returns it to caller. UMDF doesn't provide a unicode string and
41 // therefore we allocate it in this object and return that to caller after
42 // populating it with name string retrieved from host.
43 //
45
46 //
47 // Framework related file object
48 //
50
51#endif
52
53public:
54
55 // ListEntry for linking FileObjects off of the device
57
58private:
59
60 VOID
62 _In_ MdFileObject WdmFileObject,
63 _In_ WDF_FILEOBJECT_CLASS NormalizedFileClass,
66 );
67
68public:
70 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
71 __in MdFileObject pWdmFileObject,
73 );
74
75 virtual
77 );
78
79 __inline
80 WDFFILEOBJECT
82 VOID
83 )
84 {
85 return (WDFFILEOBJECT) GetObjectHandle();
86 }
87
88 __inline
91 VOID
92 )
93 {
95 }
96
97 __inline
100 VOID
101 )
102 {
103 return m_Device;
104 }
105
106 __inline
109 VOID
110 )
111 {
112 #if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
114 #else
116 #endif
117 }
118
119 __inline
122 VOID
123 )
124 {
126 }
127
128 __inline
129 ULONG
131 VOID
132 )
133 {
134 return m_FileObject.GetFlags();
135 }
136
137 __inline
138 VOID
141 )
142 {
144 }
145
146 __inline
147 PVOID
149 VOID
150 )
151 {
152 return m_PkgContext;
153 }
154
155 //
156 // Create a WDFFILEOBJECT from the WDM PFILE_OBJECT
157 // and associate it with the WDM PFILE_OBJECT according
158 // to the FileObjectClass.
159 //
161 static
165 __in MdIrp Irp,
166 __in WDF_FILEOBJECT_CLASS FileObjectClass,
167 __in_opt PWDF_OBJECT_ATTRIBUTES pObjectAttributes,
168 __in_opt MdFileObject pWdmFileObject,
169 __deref_out_opt FxFileObject** ppFxFileObject
170 );
171
172 VOID
174 _In_ MdIrp CreateIrp
175 );
176
177 //
178 // Destroy (dereference) the WDFFILEOBJECT related to the
179 // WDM PFILE_OBJECT according to its FileObjectClass.
180 //
181 static
182 VOID
185 __in WDF_FILEOBJECT_CLASS FileObjectClass,
186 __in_opt MdFileObject pWdmFileObject
187 );
188
189 //
190 // Return the FxFileObject* for the given WDM PFILE_OBJECT
191 // based on the FileObjectClass.
192 //
194 static
198 __in WDF_FILEOBJECT_CLASS FileObjectClass,
199 __in_opt MdFileObject pWdmFileObject,
200 __deref_out_opt FxFileObject** ppFxFileObject
201 );
202
203 VOID
205 VOID
206 );
207
208 // begin FxObject overrides
213 );
214 // end FxObject overrides
215
216 // begin IFxHasCallbacks overrides
217 VOID
219 __in WDF_EXECUTION_LEVEL* ExecutionLevel,
220 __in WDF_SYNCHRONIZATION_SCOPE* SynchronizationScope
221 ) ;
222
227 );
228 // end IFxHasCallbacks overrides
229
230 //
231 // Update the process keep-alive count
232 // TRUE: increment, FALSE: decrement
233 //
238 );
239
240#if (FX_CORE_MODE == FX_CORE_USER_MODE)
241
244 VOID
245 )
246 {
247 return m_RelatedFileObject;
248 }
249
250#endif
251
252};
253
254#endif // _FXFILEOBJECT_H_
255
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
static _Must_inspect_result_ NTSTATUS _CreateFileObject(__in FxDevice *pDevice, __in MdIrp Irp, __in WDF_FILEOBJECT_CLASS FileObjectClass, __in_opt PWDF_OBJECT_ATTRIBUTES pObjectAttributes, __in_opt MdFileObject pWdmFileObject, __deref_out_opt FxFileObject **ppFxFileObject)
VOID SetFileObjectContext(_In_ MdFileObject WdmFileObject, _In_ WDF_FILEOBJECT_CLASS NormalizedFileClass, _In_ MdIrp Irp, _In_ FxDevice *Device)
LIST_ENTRY m_Link
__inline VOID SetPkgCleanupCloseContext(PVOID Context)
VOID GetConstraints(__in WDF_EXECUTION_LEVEL *ExecutionLevel, __in WDF_SYNCHRONIZATION_SCOPE *SynchronizationScope)
virtual ~FxFileObject()
VOID DeleteFileObjectFromFailedCreate(VOID)
UNICODE_STRING m_FileName
__inline PVOID GetPkgCleanupCloseContext(VOID)
FxFileObject * GetRelatedFileObject(VOID)
static _Must_inspect_result_ NTSTATUS _GetFileObjectFromWdm(__in FxDevice *pDevice, __in WDF_FILEOBJECT_CLASS FileObjectClass, __in_opt MdFileObject pWdmFileObject, __deref_out_opt FxFileObject **ppFxFileObject)
__inline ULONG GetFlags(VOID)
__inline MdFileObject GetWdmFileObject(VOID)
static VOID _DestroyFileObject(__in FxDevice *pDevice, __in WDF_FILEOBJECT_CLASS FileObjectClass, __in_opt MdFileObject pWdmFileObject)
PVOID m_PkgContext
MxFileObject m_FileObject
__inline WDFFILEOBJECT GetHandle(VOID)
__inline CfxDevice * GetDevice(VOID)
__inline PLARGE_INTEGER GetCurrentByteOffset(VOID)
_Must_inspect_result_ FxCallbackLock * GetCallbackLockPtr(__deref_out_opt FxObject **LockObject)
_Must_inspect_result_ NTSTATUS UpdateProcessKeepAliveCount(_In_ BOOLEAN Increment)
__inline PUNICODE_STRING GetFileName(VOID)
FxFileObject * m_RelatedFileObject
_Must_inspect_result_ NTSTATUS QueryInterface(__in FxQueryInterfaceParams *Params)
CfxDevice * m_Device
Definition: fxobject.hpp:329
__inline MdFileObject GetFileObject(VOID)
Definition: mxfileobject.h:45
ULONG GetFlags(VOID)
PUNICODE_STRING GetFileName(_Inout_opt_ PUNICODE_STRING Filename)
PLARGE_INTEGER GetCurrentByteOffset(VOID)
_In_ PIRP Irp
Definition: csq.h:116
#define __in
Definition: dbghelp.h:35
#define __in_opt
Definition: dbghelp.h:38
#define __deref_out_opt
Definition: dbghelp.h:29
#define NULL
Definition: types.h:112
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:46
FxDevice * pDevice
return pObject GetObjectHandle()
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define _In_
Definition: ms_sal.h:308
PFILE_OBJECT MdFileObject
Definition: mxgeneralkm.h:32
IWudfIrp * MdIrp
Definition: mxum.h:103
Definition: typedefs.h:120
#define LockObject(Object)
Definition: titypes.h:34
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
enum _WDF_FILEOBJECT_CLASS WDF_FILEOBJECT_CLASS
WDF_EXTERN_C_START enum _WDF_EXECUTION_LEVEL WDF_EXECUTION_LEVEL
enum _WDF_SYNCHRONIZATION_SCOPE WDF_SYNCHRONIZATION_SCOPE
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:308
static void Initialize()
Definition: xlate.c:212