ReactOS 0.4.16-dev-205-g7b2bb7e
fxfileobjectapium.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxFileObjectApiUm.cpp
8
9Abstract:
10
11 This modules implements the C API's for the FxFileObject.
12
13Author:
14
15
16
17Environment:
18
19 User mode only
20
21Revision History:
22
23
24--*/
25
26#include "coreprivshared.hpp"
27#include "FxFileObject.hpp"
28
29extern "C" {
30#include "FxFileObjectApiUm.tmh"
31}
32
33//
34// Extern "C" the entire file
35//
36extern "C" {
37
40VOID
41WDFEXPORT(WdfFileObjectClose)(
42 _In_
44 _In_
45 WDFFILEOBJECT FileObject
46 )
47{
48 DDI_ENTRY();
49
52
53 FX_VERIFY_WITH_NAME(INTERNAL, TRAPMSG("Not implemented"), DriverGlobals->DriverName);
54}
55
59WDFEXPORT(WdfFileObjectGetInitiatorProcessId)(
60 _In_
62 _In_
63 WDFFILEOBJECT FileObject
64 )
65{
66 DDI_ENTRY();
67
69
70 //
71 // Validate the FileObject object handle, and get its FxFileObject*
72 //
76 (PVOID*)&pFO);
77
79 return pFO->GetWdmFileObject()->GetInitiatorProcessId();
80 }
81 else {
82 FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), TRAPMSG("Cannot get initiator "
83 "process ID from a file object that doesn't have a WDM file object"),
84 DriverGlobals->DriverName);
85 return 0;
86 }
87}
88
91WDFFILEOBJECT
92WDFEXPORT(WdfFileObjectGetRelatedFileObject)(
93 _In_
95 _In_
96 WDFFILEOBJECT FileObject
97 )
98{
99 DDI_ENTRY();
100
103
104 //
105 // Validate the FileObject object handle, and get its FxFileObject*
106 //
110 (PVOID*)&pFO);
111
113
114 if (pFoRelated != NULL) {
115 return pFoRelated->GetHandle();
116 }
117 else {
118 return NULL;
119 }
120}
121
123WDFAPI
125WDFEXPORT(WdfFileObjectIncrementProcessKeepAliveCount)(
126 _In_
128 _In_
129 WDFFILEOBJECT FileObject
130 )
131{
132 //
133 // This DDI is expected to be called per WDFREQUEST
134 // and the caller may be impersonated at that time.
135 //
137
139
140 //
141 // Validate the FileObject object handle, and get its FxFileObject*
142 //
146 (PVOID*)&pFO);
147
148 return pFO->UpdateProcessKeepAliveCount(TRUE /*Increment*/);
149}
150
152WDFAPI
154WDFEXPORT(WdfFileObjectDecrementProcessKeepAliveCount)(
155 _In_
157 _In_
158 WDFFILEOBJECT FileObject
159 )
160{
161 //
162 // This DDI is expected to be called per WDFREQUEST
163 // and the caller may be impersonated at that time.
164 //
166
168
169 //
170 // Validate the FileObject object handle, and get its FxFileObject*
171 //
175 (PVOID*)&pFO);
176
177 return pFO->UpdateProcessKeepAliveCount(FALSE /*Increment*/);
178}
179
180} // extern "C"
#define TODO
Definition: SAX2.c:44
LONG NTSTATUS
Definition: precomp.h:26
FxFileObject * GetRelatedFileObject(VOID)
__inline MdFileObject GetWdmFileObject(VOID)
__inline WDFFILEOBJECT GetHandle(VOID)
_Must_inspect_result_ NTSTATUS UpdateProcessKeepAliveCount(_In_ BOOLEAN Increment)
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define _IRQL_requires_max_(irql)
Definition: driverspecs.h:230
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
DriverGlobals
_In_ WDFFILEOBJECT FileObject
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), FileObject, FX_TYPE_FILEOBJECT,(PVOID *)&pFO)
FX_VERIFY_WITH_NAME(INTERNAL, TRAPMSG("Not implemented"), DriverGlobals->DriverName)
FxFileObject * pFoRelated
FxFileObject * pFO
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define DDI_ENTRY_IMPERSONATION_OK()
Definition: fxglobalskm.h:55
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
#define WDFEXPORT(a)
Definition: fxmacros.hpp:157
@ FX_TYPE_FILEOBJECT
Definition: fxtypes.h:71
#define _In_
Definition: ms_sal.h:308
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
#define WDFAPI
Definition: wdftypes.h:53