28#define WDF_PATH_SEPARATOR L"\\"
29#define WUDF_SUB_KEY L"WUDF"
30#define WUDF_ADDITIONAL_SUB_KEY L"WDF"
32#define FX_DIRECT_HARDWARE_ACCESS L"DirectHardwareAccess"
33#define FX_DIRECT_HARDWARE_ACCESS_DEFAULT (WdfRejectDirectHardwareAccess)
35#define FX_REGISTER_ACCESS_MODE L"RegisterAccessMode"
36#define FX_REGISTER_ACCESS_MODE_DEFAULT (WdfRegisterAccessUsingSystemCall)
38#define FX_FILE_OBJECT_POLICY L"FileObjectPolicy"
39#define FX_FILE_OBJECT_POLICY_DEFAULT (WdfRejectNullAndUnknownFileObjects)
41#define FX_FS_CONTEXT_USE_POLICY L"FsContextUsePolicy"
42#define FX_FS_CONTEXT_USE_POLICY_DEFAULT (WdfDefaultFsContextUsePolicy)
44#define FX_KERNEL_MODE_CLIENT_POLICY L"KernelModeClientPolicy"
45#define FX_METHOD_NEITHER_ACTION L"MethodNeitherAction"
46#define FX_PROCESS_SHARING_ENABLED L"HostProcessSharingEnabled"
47#define FX_DEVICE_GROUP_ID L"DeviceGroupId"
48#define FX_FILE_OBJECT_POLICY L"FileObjectPolicy"
70#define READ_REGISTER_UCHAR(x) \
71 (MemoryBarrier(), *(volatile UCHAR * const)(x))
73#define READ_REGISTER_USHORT(x) \
74 (MemoryBarrier(), *(volatile USHORT * const)(x))
76#define READ_REGISTER_ULONG(x) \
77 (MemoryBarrier(), *(volatile ULONG * const)(x))
79#define READ_REGISTER_ULONG64(x) \
80 (MemoryBarrier(), *(volatile ULONG64 * const)(x))
82#define READ_REGISTER_BUFFER_UCHAR(x, y, z) { \
83 PUCHAR registerBuffer = x; \
84 PUCHAR readBuffer = y; \
87 for (readCount = z; readCount--; readBuffer++, registerBuffer++) { \
88 *readBuffer = *(volatile UCHAR * const)(registerBuffer); \
92#define READ_REGISTER_BUFFER_USHORT(x, y, z) { \
93 PUSHORT registerBuffer = x; \
94 PUSHORT readBuffer = y; \
97 for (readCount = z; readCount--; readBuffer++, registerBuffer++) { \
98 *readBuffer = *(volatile USHORT * const)(registerBuffer); \
102#define READ_REGISTER_BUFFER_ULONG(x, y, z) { \
103 PULONG registerBuffer = x; \
104 PULONG readBuffer = y; \
107 for (readCount = z; readCount--; readBuffer++, registerBuffer++) { \
108 *readBuffer = *(volatile ULONG * const)(registerBuffer); \
112#define READ_REGISTER_BUFFER_ULONG64(x, y, z) { \
113 PULONG64 registerBuffer = x; \
114 PULONG64 readBuffer = y; \
117 for (readCount = z; readCount--; readBuffer++, registerBuffer++) { \
118 *readBuffer = *(volatile ULONG64 * const)(registerBuffer); \
122#define WRITE_REGISTER_UCHAR(x, y) { \
123 *(volatile UCHAR * const)(x) = y; \
127#define WRITE_REGISTER_USHORT(x, y) { \
128 *(volatile USHORT * const)(x) = y; \
132#define WRITE_REGISTER_ULONG(x, y) { \
133 *(volatile ULONG * const)(x) = y; \
137#define WRITE_REGISTER_ULONG64(x, y) { \
138 *(volatile ULONG64 * const)(x) = y; \
142#define WRITE_REGISTER_BUFFER_UCHAR(x, y, z) { \
143 PUCHAR registerBuffer = x; \
144 PUCHAR writeBuffer = y; \
146 for (writeCount = z; writeCount--; writeBuffer++, registerBuffer++) { \
147 *(volatile UCHAR * const)(registerBuffer) = *writeBuffer; \
152#define WRITE_REGISTER_BUFFER_USHORT(x, y, z) { \
153 PUSHORT registerBuffer = x; \
154 PUSHORT writeBuffer = y; \
156 for (writeCount = z; writeCount--; writeBuffer++, registerBuffer++) { \
157 *(volatile USHORT * const)(registerBuffer) = *writeBuffer; \
162#define WRITE_REGISTER_BUFFER_ULONG(x, y, z) { \
163 PULONG registerBuffer = x; \
164 PULONG writeBuffer = y; \
166 for (writeCount = z; writeCount--; writeBuffer++, registerBuffer++) { \
167 *(volatile ULONG * const)(registerBuffer) = *writeBuffer; \
172#define WRITE_REGISTER_BUFFER_ULONG64(x, y, z) { \
173 PULONG64 registerBuffer = x; \
174 PULONG64 writeBuffer = y; \
176 for (writeCount = z; writeCount--; writeBuffer++, registerBuffer++) { \
177 *(volatile ULONG64 * const)(registerBuffer) = *writeBuffer; \
187 __in WDF_DEVICE_HWACCESS_TARGET_SIZE
Size,
196 EventWriteEVENT_UMDF_FX_READ_FROM_HARDWARE_START(
197 WdfDeviceHwAccessTargetTypeRegister,
Size, 0);
200 case WdfDeviceHwAccessTargetSizeUchar:
203 case WdfDeviceHwAccessTargetSizeUshort:
206 case WdfDeviceHwAccessTargetSizeUlong:
209 case WdfDeviceHwAccessTargetSizeUlong64:
214 "hardware access function",
FALSE));
218 FX_VERIFY(INTERNAL, TRAPMSG(
"Unexpected"));
225 EventWriteEVENT_UMDF_FX_READ_FROM_HARDWARE_END(
226 WdfDeviceHwAccessTargetTypeRegister,
Size, 0);
234 __in WDF_DEVICE_HWACCESS_TARGET_SIZE
Size,
243 EventWriteEVENT_UMDF_FX_READ_FROM_HARDWARE_START(
244 WdfDeviceHwAccessTargetTypeRegisterBuffer,
Size,
Count);
247 case WdfDeviceHwAccessTargetSizeUchar:
250 case WdfDeviceHwAccessTargetSizeUshort:
251#pragma prefast(suppress:26000, "The Size parameter dictates the buffer size")
254 case WdfDeviceHwAccessTargetSizeUlong:
257 case WdfDeviceHwAccessTargetSizeUlong64:
262 "hardware access function",
FALSE));
266 FX_VERIFY(INTERNAL, TRAPMSG(
"Unexpected"));
273 EventWriteEVENT_UMDF_FX_READ_FROM_HARDWARE_END(
274 WdfDeviceHwAccessTargetTypeRegisterBuffer,
Size,
Count);
280 __in WDF_DEVICE_HWACCESS_TARGET_SIZE
Size,
288 EventWriteEVENT_UMDF_FX_WRITE_TO_HARDWARE_START(
289 WdfDeviceHwAccessTargetTypeRegister,
Size, 0);
292 case WdfDeviceHwAccessTargetSizeUchar:
295 case WdfDeviceHwAccessTargetSizeUshort:
298 case WdfDeviceHwAccessTargetSizeUlong:
301 case WdfDeviceHwAccessTargetSizeUlong64:
306 "hardware access function",
FALSE));
310 FX_VERIFY(INTERNAL, TRAPMSG(
"Unexpected"));
317 EventWriteEVENT_UMDF_FX_WRITE_TO_HARDWARE_END(
318 WdfDeviceHwAccessTargetTypeRegister,
Size, 0);
324 __in WDF_DEVICE_HWACCESS_TARGET_SIZE
Size,
333 EventWriteEVENT_UMDF_FX_WRITE_TO_HARDWARE_START(
334 WdfDeviceHwAccessTargetTypeRegisterBuffer,
Size,
Count);
337 case WdfDeviceHwAccessTargetSizeUchar:
340 case WdfDeviceHwAccessTargetSizeUshort:
341#pragma prefast(suppress:26000, "The Size parameter dictates the buffer size")
344 case WdfDeviceHwAccessTargetSizeUlong:
347 case WdfDeviceHwAccessTargetSizeUlong64:
352 "hardware access function",
FALSE));
356 FX_VERIFY(INTERNAL, TRAPMSG(
"Unexpected"));
363 EventWriteEVENT_UMDF_FX_WRITE_TO_HARDWARE_END(
364 WdfDeviceHwAccessTargetTypeRegisterBuffer,
Size,
Count);
374 ((
static_cast<IWudfDevice2*
> (
DeviceObject))->GetDeviceExtension());
447 IWudfDeviceStack2 *pDeviceStack2;
451 (
PVOID*)&pDeviceStack2);
456 return pDeviceStack2;
#define WRITE_REGISTER_USHORT(r, v)
#define READ_REGISTER_USHORT(r)
#define WRITE_REGISTER_ULONG(r, v)
#define READ_REGISTER_ULONG(r)
VOID ReadRegisterBuffer(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __out_ecount_full(Count) PVOID Buffer, __in ULONG Count)
VOID WriteRegisterBuffer(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __in_ecount(Count) PVOID Buffer, __in ULONG Count)
VOID WriteRegister(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __in SIZE_T Value)
VOID WmiPkgDeregister(VOID)
BOOLEAN IsRemoveLockEnabledForIo(VOID)
static FxWdmDeviceExtension * _GetFxWdmExtension(__in MdDeviceObject DeviceObject)
MdRemoveLock GetRemoveLock(VOID)
IWudfDeviceStack2 * GetDeviceStack2(VOID)
IWudfDeviceStack * GetDeviceStack(VOID)
NTSTATUS WmiPkgRegister(VOID)
IWudfDeviceStack * m_DevStack
SIZE_T ReadRegister(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register)
FX_VERIFY(INTERNAL, CHECK_NOT_NULL(LoaderInterface->pIWudfHost))
return pDevice GetDeviceObject()
unsigned __int64 * PULONG64
#define __out_ecount_full(size)
WUDF_IO_REMOVE_LOCK IoRemoveLock
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
NTKERNELAPI VOID NTAPI WRITE_REGISTER_BUFFER_UCHAR(IN PUCHAR Register, IN PUCHAR Buffer, IN ULONG Count)
NTKERNELAPI VOID NTAPI READ_REGISTER_BUFFER_UCHAR(IN PUCHAR Register, IN PUCHAR Buffer, IN ULONG Count)
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)
NTKERNELAPI VOID NTAPI READ_REGISTER_BUFFER_USHORT(IN PUSHORT Register, IN PUSHORT Buffer, IN ULONG Count)
NTKERNELAPI VOID NTAPI READ_REGISTER_BUFFER_ULONG(IN PULONG Register, IN PULONG Buffer, IN ULONG Count)
NTKERNELAPI VOID NTAPI WRITE_REGISTER_BUFFER_ULONG(IN PULONG Register, IN PULONG Buffer, IN ULONG Count)
NTKERNELAPI VOID NTAPI WRITE_REGISTER_BUFFER_USHORT(IN PUSHORT Register, IN PUSHORT Buffer, IN ULONG Count)
NTKERNELAPI UCHAR NTAPI READ_REGISTER_UCHAR(IN PUCHAR Register)