-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdevice.hpp
More file actions
58 lines (45 loc) · 1.66 KB
/
device.hpp
File metadata and controls
58 lines (45 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include <wdm.h>
#include <wdf.h>
#include <wmistr.h>
#include <ntstrsafe.h>
//------------------------------------------------------------- Debug Facilities
// DML macro for white text (wbg) on red background (changed)
#define DML_ERR(msg) ("<?dml?><col fg=\"wbg\" bg=\"changed\">"##msg##"</col>\n")
#if DBG
/** Print debugger message.
Arguments:
Level - DPFLTR_ERROR_LEVEL maps to Kd_IHVDRIVER_Mask 0x1
DPFLTR_WARNING_LEVEL maps to Kd_IHVDRIVER_Mask 0x2
DPFLTR_TRACE_LEVEL maps to Kd_IHVDRIVER_Mask 0x4
DPFLTR_INFO_LEVEL maps to Kd_IHVDRIVER_Mask 0x8
Format - Message in varible argument format.
*/
_IRQL_requires_same_
inline void DebugPrint(ULONG Level, PCSTR Format, ...) {
va_list Arglist;
va_start(Arglist, Format);
vDbgPrintEx(DPFLTR_IHVDRIVER_ID, Level, Format, Arglist);
}
#define DebugEnter() \
DebugPrint(DPFLTR_TRACE_LEVEL, "Entering " __FUNCTION__ "\n")
#define DebugExit() \
DebugPrint(DPFLTR_TRACE_LEVEL, "Leaving " __FUNCTION__ "\n")
#define DebugExitStatus(_status_) \
DebugPrint(DPFLTR_TRACE_LEVEL, \
"Leaving " __FUNCTION__ ": Status=0x%x\n", \
_status_)
#else
#define DebugPrint(l, m, ...)
#define DebugEnter()
#define DebugExit()
#define DebugExitStatus(_status_)
#endif
//--------------------------------------------------------------------- Literals
#define POOL_TAG 'StaB'
//------------------------------------------------------------------ Definitions
struct DRIVER_CONTEXT {
UNICODE_STRING RegistryPath;
};
WDF_DECLARE_CONTEXT_TYPE(DRIVER_CONTEXT);
EVT_WDF_DRIVER_DEVICE_ADD BattDriverDeviceAdd;