forked from filipnavara/igb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrace.h
More file actions
29 lines (24 loc) · 772 Bytes
/
trace.h
File metadata and controls
29 lines (24 loc) · 772 Bytes
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
#pragma once
#if DBG
#define DBGPRINT(...) DbgPrint(__VA_ARGS__)
#else
#define DBGPRINT(...)
#endif
#define LOG_NTSTATUS(Status) DBGPRINT("%s:%d: Status %x\n", __FILE__, __LINE__, Status)
#define LOG_IF_NOT_NT_SUCCESS(Expression, ...) do { \
NTSTATUS p_status = (Expression); \
if (!NT_SUCCESS(p_status)) \
{ \
LOG_NTSTATUS(p_status); \
} \
} while(0)
#define GOTO_IF_NOT_NT_SUCCESS(Label, StatusLValue, Expression, ...) do { \
StatusLValue = (Expression); \
if (!NT_SUCCESS(StatusLValue)) \
{ \
LOG_NTSTATUS(StatusLValue); \
goto Label; \
} \
} while (0)
#define GOTO_WITH_INSUFFICIENT_RESOURCES_IF_NULL(Label, StatusLValue, Object) \
GOTO_IF_NOT_NT_SUCCESS(Label, StatusLValue, (((Object) == NULL) ? STATUS_INSUFFICIENT_RESOURCES : STATUS_SUCCESS))