ReactOS 0.4.15-dev-7674-gc0b4db1
fxdriverapium.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 User mode only
20
21Revision History:
22
23--*/
24
25#include "coreprivshared.hpp"
26
27// Tracing support
28extern "C" {
29#include <ntverp.h>
30#include "FxDriverApiUm.tmh"
31}
32
33//
34// extern the whole file
35//
36extern "C" {
37
41WDFEXPORT(WdfDriverOpenParametersRegistryKey)(
42 __in
44 __in
45 WDFDRIVER Driver,
46 __in
50 __out
51 WDFKEY* Key
52 )
53{
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 if (pKey == NULL) {
86 }
87
91 //
92 // These access rights are not allowed. This restriction is
93 // imposed by the host process and the reflector driver.
94 //
95 // Even though the maximum-permissions handle is already opened,
96 // we fail so that the caller knows not to assume it has the
97 // GENERIC_WRITE, KEY_CREATE_SUB_KEY, or WRITE_DAC permissions.
98 //
102 "Could not open '%s' service parameters key "
103 "with access rights 0x%x, %!STATUS!",
104 pFxDriverGlobals->Public.DriverName,
106 } else if ((DesiredAccess & ~(KEY_READ | GENERIC_READ)) == 0) {
107 //
108 // If caller requested read-only access, open a new handle
109 // to the parameters key, no reason to give more privileges
110 // than needed.
111 //
112 result = RegOpenKeyEx(pDriver->GetDriverParametersKey(),
113 L"",
114 0,
116 &hKey);
118 if (!NT_SUCCESS(status)) {
121 "Could not open '%s' service parameters key "
122 "with access rights 0x%x, %!STATUS!",
123 pFxDriverGlobals->Public.DriverName,
125 }
126 } else {
127 //
128 // If caller requested write access, give it the pre-opened
129 // handle, since we do not have permission to open this key
130 // with write access rights from user mode.
131 //
132 hKey = pDriver->GetDriverParametersKey();
133
134 //
135 // Mark the registry key handle such that it won't be closed
136 // when this FxRegKey is deleted. We might need the handle again
137 // for future calls to WdfDriverOpenParametersRegistryKey.
138 //
140 }
141
142 if (NT_SUCCESS(status)) {
144 *Key = keyHandle;
145 }
146 }
147
148 if (!NT_SUCCESS(status)) {
150 }
151
152 return status;
153}
154
157WDFEXPORT(WdfDriverWdmGetDriverObject)(
158 __in
160 __in
161 WDFDRIVER Driver
162 )
163{
164 DDI_ENTRY();
165
168
169 ASSERTMSG("Not implemented for UMDF\n", FALSE);
170
171 return NULL;
172}
173
175WDFDRIVER
176WDFEXPORT(WdfWdmDriverGetWdfDriverHandle)(
177 __in
179 __in
181 )
182{
183 DDI_ENTRY();
184
187
188 ASSERTMSG("Not implemented for UMDF\n", FALSE);
189
190 return NULL;
191}
192
193VOID
195 __in
197 __in
198 WDFDRIVER Driver
199 )
200{
201 DDI_ENTRY();
202
205
206 ASSERTMSG("Not implemented for UMDF\n", FALSE);
207}
208
212WDFEXPORT(WdfDeviceMiniportCreate)(
213 __in
215 __in
216 WDFDRIVER Driver,
219 __in
225 __out
226 WDFDEVICE* Device
227 )
228{
229 DDI_ENTRY();
230
238
239 ASSERTMSG("Not implemented for UMDF\n", FALSE);
240
242}
243
244} // extern "C"
LONG NTSTATUS
Definition: precomp.h:26
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
__inline VOID SetHandle(__in HANDLE Key)
Definition: fxregkey.hpp:94
VOID __inline SetCanCloseHandle(BOOLEAN CanCloseHandle)
Definition: fxregkey.hpp:277
#define __in
Definition: dbghelp.h:35
#define __in_opt
Definition: dbghelp.h:38
#define __out
Definition: dbghelp.h:62
#define TRACINGDRIVER
Definition: dbgtrace.h:68
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define GENERIC_READ
Definition: compat.h:135
#define __drv_maxIRQL(irql)
Definition: driverspecs.h:291
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
NTSTATUS WinErrorToNtStatus(__in ULONG WinError)
Definition: errtostatus.cpp:60
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
DriverGlobals
_Must_inspect_result_ __in WDFDRIVER __in_opt PWDF_OBJECT_ATTRIBUTES __in PDEVICE_OBJECT DeviceObject
FxDriver * pDriver
return NULL
VOID WDFEXPORT() WdfDriverMiniportUnload(__in PWDF_DRIVER_GLOBALS DriverGlobals, __in WDFDRIVER Driver)
return STATUS_NOT_IMPLEMENTED
_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
HKEY hKey
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
LONG result
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
__in PDRIVER_OBJECT DriverObject
FxRegKey * pKey
PFX_DRIVER_GLOBALS pFxDriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
#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
GLuint64EXT * result
Definition: glext.h:11304
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define WRITE_DAC
Definition: nt_native.h:59
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
#define GENERIC_WRITE
Definition: nt_native.h:90
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_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
_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
#define RegOpenKeyEx
Definition: winreg.h:520