ReactOS  0.4.15-dev-3453-gff89651
fxdevicekm.hpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxDeviceKM.hpp
8 
9 Abstract:
10 
11  This is the definition of the FxDevice object KM specific
12 
13 Author:
14 
15 
16 
17 Environment:
18 
19  Kernel mode only
20 
21 Revision History:
22 
23 --*/
24 
25 #ifndef _FXDEVICEKM_H_
26 #define _FXDEVICEKM_H_
27 
28 __inline
32  )
33 {
34  //
35  // DeviceObject->DeviceExtension points to our FxDevice allocation. We
36  // get the underlying DeviceExtension allocated as part of the
37  // PDEVICE_OBJECT by adding the sizeof(DEVICE_OBJECT) to get the start
38  // of the DeviceExtension. This is documented behavior on how the
39  // DeviceExtension can be found.
40  //
42  sizeof(*DeviceObject));
43 }
44 
45 __inline
48  VOID
49  )
50 {
53 }
54 
55 __inline
56 BOOLEAN
58  VOID
59  )
60 {
61  if (m_DeviceObject.GetObject() != NULL) {
64  }
65  else {
66  return FALSE;
67  }
68 }
69 
70 __inline
71 FxDevice*
74  )
75 {
77 
78  //
79  // DeviceExtension points to the start of the first context assigned to
80  // WDFDEVICE. We walk backwards from the context to the FxDevice*.
81  //
84  Context)->Object;
85 }
86 
87 __inline
88 VOID
90  VOID
91  )
92 {
93  if (m_AttachedDevice.GetObject() != NULL) {
96  }
97 }
98 
99 __inline
100 VOID
102  VOID
103  )
104 {
105  PDEVICE_OBJECT pdo;
106 
107  //
108  // If the PDO is not yet reported to pnp, do not call the API. In this
109  // case, the PDO will soon be reported and started and the state that
110  // was just set will be queried for automatically by pnp as a part of
111  // start.
112  //
113  pdo = GetSafePhysicalDevice();
114 
115  if (pdo != NULL) {
117  }
118 }
119 
120 VOID
121 __inline
123  VOID
124  )
125 {
126  if (m_SymbolicLinkName.Buffer != NULL) {
127  //
128  // Must be at PASSIVE_LEVEL for this call
129  //
132  }
133 
136  }
137 }
138 
139 __inline
140 NTSTATUS
146  )
147 {
151  DevInstRegKey);
152 }
153 
154 __inline
155 NTSTATUS
162  )
163 {
166  BufferLength,
168  ResultLength);
169 }
170 
171 #endif //_FXDEVICEKM_H_
DEVICE_REGISTRY_PROPERTY
Definition: iotypes.h:1194
VOID InvalidateDeviceState(VOID)
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
MxDeviceObject m_AttachedDevice
Definition: fxdevice.hpp:472
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2654
MdRemoveLock GetRemoveLock(VOID)
Definition: fxdevicekm.hpp:47
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174
#define _Out_
Definition: ms_sal.h:345
#define WDF_PTR_ADD_OFFSET(_ptr, _offset)
Definition: wdfcore.h:144
#define TRUE
Definition: types.h:120
static __inline NTSTATUS _OpenDeviceRegistryKey(_In_ MdDeviceObject DeviceObject, _In_ ULONG DevInstKeyType, _In_ ACCESS_MASK DesiredAccess, _Out_ PHANDLE DevInstRegKey)
_In_ ULONG DevInstKeyType
Definition: iofuncs.h:1125
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
Definition: wdfdevice.h:3767
LONG NTSTATUS
Definition: precomp.h:26
static FxDevice * GetFxDevice(__in MdDeviceObject DeviceObject)
Definition: fxdeviceum.cpp:60
DeviceInit RemoveLockOptionFlags
UNICODE_STRING m_SymbolicLinkName
Definition: fxdevice.hpp:580
static VOID MxDetachDevice(_Inout_ MdDeviceObject Device)
Definition: mxgeneralkm.h:502
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
VOID DetachDevice(VOID)
PVOID GetDeviceExtension(VOID)
#define FALSE
Definition: types.h:117
VOID NTAPI IoInvalidateDeviceState(IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: devaction.c:2032
static __inline VOID MxDeleteSymbolicLink(__in PUNICODE_STRING Link)
Definition: mxgeneralkm.h:424
unsigned char BOOLEAN
#define _In_
Definition: ms_sal.h:308
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:1952
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
WUDF_IO_REMOVE_LOCK IoRemoveLock
Definition: fxdevice.hpp:34
BOOLEAN IsRemoveLockEnabledForIo(VOID)
Definition: fxdevicekm.hpp:57
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:454
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
Definition: wdfdevice.h:4431
MxDeviceObject deviceObject
_In_ ULONG _In_ ACCESS_MASK _Out_ PHANDLE DevInstRegKey
Definition: iofuncs.h:1125
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
MdDeviceObject __inline GetSafePhysicalDevice(VOID)
Definition: fxdevice.hpp:1005
static FxWdmDeviceExtension * _GetFxWdmExtension(__in MdDeviceObject DeviceObject)
Definition: fxdevicekm.hpp:30
__inline MdDeviceObject GetObject(VOID)
VOID DeleteSymbolicLink(VOID)
__inline VOID SetObject(__in_opt MdDeviceObject DeviceObject)
#define _Out_opt_
Definition: ms_sal.h:346
unsigned int * PULONG
Definition: retypes.h:1
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, IN ULONG DevInstKeyType, IN ACCESS_MASK DesiredAccess, OUT PHANDLE DevInstRegKey)
Definition: pnpmgr.c:2191
struct tagContext Context
Definition: acpixf.h:1034
static __inline NTSTATUS _GetDeviceProperty(_In_ MdDeviceObject DeviceObject, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ ULONG BufferLength, _Out_opt_ PVOID PropertyBuffer, _Out_ PULONG ResultLength)
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition: wdfpool.cpp:361
#define __in
Definition: dbghelp.h:35
ULONG ACCESS_MASK
Definition: nt_native.h:40
MxDeviceObject m_DeviceObject
Definition: fxdevice.hpp:471