ReactOS 0.4.15-dev-5666-gc548b97
fxdriverapikm.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxDriverApiKm.cpp
8
9Abstract:
10
11 This module contains the "C" interface for the FxDriver object.
12
13Author:
14
15
16
17Environment:
18
19 Kernel mode only
20
21Revision History:
22
23--*/
24
25#include "coreprivshared.hpp"
26
27// Tracing support
28extern "C" {
29#include <ntverp.h>
30// #include "FxDriverApiKm.tmh"
31}
32
33//
34// extern the whole file
35//
36extern "C" {
37
42WDFEXPORT(WdfDriverOpenParametersRegistryKey)(
43 __in
45 __in
46 WDFDRIVER Driver,
47 __in
51 __out
52 WDFKEY* Key
53 )
54{
60 WDFKEY keyHandle;
61
63
65
66 *Key = NULL;
67
70 return status;
71 }
72
74 if (!NT_SUCCESS(status)) {
75 return status;
76 }
77
79 Driver,
81 (PVOID*) &pDriver);
82
84
85 if (pKey == NULL) {
87 }
88
90
92 //
93 // Static worker function (no object assignment for opened handled)
94 //
95 status = FxRegKey::_OpenKey(
97
98 if (NT_SUCCESS(status)) {
99 DECLARE_CONST_UNICODE_STRING(parameters, L"Parameters");
100
101 //
102 // This will store the resulting handle in pKey
103 //
104 status = pKey->Create(hKey.m_Key, &parameters, DesiredAccess);
105
106 if (NT_SUCCESS(status)) {
107 *Key = keyHandle;
108 }
109 }
110 }
111
112 if (!NT_SUCCESS(status)) {
114 }
115
116 return status;
117}
118
122WDFEXPORT(WdfDriverWdmGetDriverObject)(
123 __in
125 __in
126 WDFDRIVER Driver
127 )
128{
130
132 Driver,
134 (PVOID*) &pDriver);
135
137}
138
140WDFDRIVER
142WDFEXPORT(WdfWdmDriverGetWdfDriverHandle)(
143 __in
145 __in
147 )
148{
150
152}
153
154VOID
157 __in
159 __in
160 WDFDRIVER Driver
161 )
162{
164
166 Driver,
168 (PVOID *)&pDriver);
169
171}
172
177WDFEXPORT(WdfDeviceMiniportCreate)(
178 __in
180 __in
181 WDFDRIVER Driver,
184 __in
190 __out
191 WDFDEVICE* Device
192 )
193{
198
200 Driver,
202 (PVOID *)&pDriver,
204
206
209 }
210 else if (AttachedDeviceObject != NULL && Pdo == NULL) {
212 }
213
215 if (!NT_SUCCESS(status)) {
216 return status;
217 }
218
220 if (!NT_SUCCESS(status)) {
221 return status;
222 }
223
226 pDriver,
229 Pdo);
230
231 if (pMpDevice == NULL) {
233 }
234
235 if (AttachedDeviceObject != NULL) {
237 FALSE /*SelfTarget=FALSE*/);
238 if (!NT_SUCCESS(status)) {
239 goto Done;
240 }
241 }
242
246 if (!NT_SUCCESS(status)) {
247 goto Done;
248 }
249
251 if (!NT_SUCCESS(status)) {
252 goto Done;
253 }
254
256 if (!NT_SUCCESS(status)) { // follow the same error pattern as above.
257 goto Done;
258 }
259
260Done:
261 if (!NT_SUCCESS(status)) {
263 }
264
265 return status;
266}
267
268} // extern "C"
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS ConfigureConstraints(__in_opt PWDF_OBJECT_ATTRIBUTES ObjectAttributes)
_Must_inspect_result_ NTSTATUS AllocateTarget(_Out_ FxIoTarget **Target, _In_ BOOLEAN SelfTarget)
FxDisposeList * m_DisposeList
Definition: fxdevice.hpp:466
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174
static NTSTATUS _Create(PFX_DRIVER_GLOBALS FxDriverGlobals, PVOID WdmObject, FxDisposeList **pObject)
PUNICODE_STRING GetRegistryPathUnicodeString(VOID)
Definition: fxdriver.hpp:243
__inline MdDriverObject GetDriverObject(VOID)
Definition: fxdriver.hpp:252
__inline WDFDRIVER GetHandle(VOID)
Definition: fxdriver.hpp:202
static FxDriver * GetFxDriver(__in MdDriverObject DriverObject)
Definition: fxdriverkm.cpp:159
static MdDriverUnloadType Unload
Definition: fxdriver.hpp:369
FxIoTarget * m_DefaultTarget
Definition: fxdevice.hpp:2291
VOID DeleteFromFailedCreate(VOID)
Definition: fxobject.cpp:391
_Must_inspect_result_ NTSTATUS Commit(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
Definition: fxobject.cpp:904
#define __in
Definition: dbghelp.h:35
#define __in_opt
Definition: dbghelp.h:38
#define __out
Definition: dbghelp.h:62
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define __drv_maxIRQL(irql)
Definition: driverspecs.h:290
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
DriverGlobals
_Must_inspect_result_ __in WDFDRIVER __in_opt PWDF_OBJECT_ATTRIBUTES __in PDEVICE_OBJECT DeviceObject
FxDriver * pDriver
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Driver, FX_TYPE_DRIVER,(PVOID *)&pDriver, &pFxDriverGlobals)
FxAutoRegKey hKey
_Must_inspect_result_ __in WDFDRIVER __in_opt PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ __in WDFDRIVER __in_opt PWDF_OBJECT_ATTRIBUTES __in PDEVICE_OBJECT __in_opt PDEVICE_OBJECT AttachedDeviceObject
_Must_inspect_result_ __in WDFDRIVER Driver
_Must_inspect_result_ __in WDFDRIVER __in ACCESS_MASK __in_opt PWDF_OBJECT_ATTRIBUTES KeyAttributes
_Must_inspect_result_ __in WDFDRIVER __in_opt PWDF_OBJECT_ATTRIBUTES __in PDEVICE_OBJECT __in_opt PDEVICE_OBJECT __in_opt PDEVICE_OBJECT Pdo
NTSTATUS status
_Must_inspect_result_ __in WDFDRIVER __in ACCESS_MASK __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFKEY * Key
_Must_inspect_result_ __in WDFDRIVER __in ACCESS_MASK DesiredAccess
WDFKEY keyHandle
FxObjectHandleGetPtr(pFxDriverGlobals, Driver, FX_TYPE_DRIVER,(PVOID *) &pDriver)
_Must_inspect_result_ __in WDFDRIVER __in_opt PWDF_OBJECT_ATTRIBUTES __in PDEVICE_OBJECT __in_opt PDEVICE_OBJECT __in_opt PDEVICE_OBJECT __out WDFDEVICE * Device
VOID STDCALL WDFEXPORT() WdfDriverMiniportUnload(__in PWDF_DRIVER_GLOBALS DriverGlobals, __in WDFDRIVER Driver)
__in PDRIVER_OBJECT DriverObject
FxMpDevice * pMpDevice
FxRegKey * pKey
pFxDriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define WDFEXPORT(a)
Definition: fxmacros.hpp:157
#define FxPointerNotNull(FxDriverGlobals, Ptr)
Definition: fxmacros.hpp:253
@ FX_TYPE_DRIVER
Definition: fxtypes.h:46
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define _Must_inspect_result_
Definition: ms_sal.h:558
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define L(x)
Definition: ntvdm.h:50
Definition: ps.c:97
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STDCALL
Definition: wdf.h:45
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ _In_ WDFDRIVER Driver
Definition: wdfcontrol.h:83
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
Definition: wdfcore.h:161
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK _In_opt_ PWDF_OBJECT_ATTRIBUTES KeyAttributes
Definition: wdfdevice.h:2660
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213