ReactOS  0.4.15-dev-5499-g1341c38
fxfileobjectapi.cpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxFileObjectApi.cpp
8 
9 Abstract:
10 
11  This modules implements the C API's for the FxFileObject.
12 
13 Author:
14 
15 
16 
17 Environment:
18 
19  Both kernel and user mode
20 
21 Revision History:
22 
23 
24 --*/
25 
26 #include "coreprivshared.hpp"
27 #include "fxfileobject.hpp"
28 
29 extern "C" {
30 // #include "FxFileObjectApi.tmh"
31 }
32 
33 //
34 // Extern "C" the entire file
35 //
36 extern "C" {
37 
40 STDCALL
41 WDFEXPORT(WdfFileObjectGetFileName)(
42  __in
44  __in
45  WDFFILEOBJECT FileObject
46  )
47 
48 /*++
49 
50 Routine Description:
51 
52  This returns the UNICODE_STRING for the FileName inside
53  the WDM fileobject.
54 
55 Arguments:
56 
57  FileObject - WDFFILEOBJECT
58 
59 Return Value:
60 
61  PUNICODE_STRING (file name)
62 
63 --*/
64 
65 {
66  DDI_ENTRY();
67 
71 
72  //
73  // Validate the FileObject object handle, and get its FxFileObject*
74  //
76  FileObject,
78  (PVOID*)&pFO,
80 
82  if (!NT_SUCCESS(status)) {
83  return NULL;
84  }
85 
86  if (pFO->GetWdmFileObject() != NULL) {
87  return pFO->GetFileName();
88  }
89  else {
90  return NULL;
91  }
92 }
93 
94 
96 ULONG
97 STDCALL
98 WDFEXPORT(WdfFileObjectGetFlags)(
99  __in
101  __in
102  WDFFILEOBJECT FileObject
103  )
104 
105 /*++
106 
107 Routine Description:
108 
109  This returns the flags inside the WDM fileobject.
110 
111 Arguments:
112 
113  FileObject - WDFFILEOBJECT
114 
115 Return Value:
116 
117  ULONG (flags)
118 
119 --*/
120 
121 {
122  DDI_ENTRY();
123 
124  FxFileObject* pFO;
125 
126  //
127  // Validate the FileObject object handle, and get its FxFileObject*
128  //
130  FileObject,
132  (PVOID*)&pFO);
133 
134  if (pFO->GetWdmFileObject() != NULL) {
135  return pFO->GetFlags();
136  }
137  else {
138  return 0x0;
139  }
140 }
141 
143 WDFDEVICE
144 STDCALL
145 WDFEXPORT(WdfFileObjectGetDevice)(
146  __in
148  __in
149  WDFFILEOBJECT FileObject
150  )
151 
152 /*++
153 
154 Routine Description:
155 
156  This returns the Device that the fileobject is associated with.
157 
158 Arguments:
159 
160  FileObject - WDFFILEOBJECT
161 
162 Return Value:
163 
164  WDFDEVICE
165 
166 --*/
167 
168 {
169  DDI_ENTRY();
170 
171  FxFileObject* pFO;
172 
173  //
174  // Validate the FileObject object handle, and get its FxFileObject*
175  //
177  FileObject,
179  (PVOID*)&pFO);
180 
181  return pFO->GetDevice()->GetHandle();
182 }
183 
184 } // extern "C"
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
FxFileObject * pFO
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), FileObject, FX_TYPE_FILEOBJECT,(PVOID *)&pFO, &pFxDriverGlobals)
__inline PUNICODE_STRING GetFileName(VOID)
LONG NTSTATUS
Definition: precomp.h:26
DriverGlobals
__inline ULONG GetFlags(VOID)
__in WDFFILEOBJECT FileObject
#define WDFEXPORT(a)
Definition: fxmacros.hpp:157
NTSTATUS status
__inline MdFileObject GetWdmFileObject(VOID)
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define STDCALL
Definition: wdf.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), FileObject, FX_TYPE_FILEOBJECT,(PVOID *)&pFO)
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define __in
Definition: dbghelp.h:35
__inline CfxDevice * GetDevice(VOID)
__drv_maxIRQL(PASSIVE_LEVEL) PUNICODE_STRING STDCALL WDFEXPORT(WdfFileObjectGetFileName)(__in PWDF_DRIVER_GLOBALS DriverGlobals
Definition: ps.c:97