18#define __RELFILE__ __FILE__
22#if !defined(_RTLFUNCS_H) && !defined(_NTDDK_)
25#if !defined(_NTDEF_) && !defined(_NTDEF_H) && !defined(_WINDEF_) && !defined(_WINDEF_H)
26#error Please include SDK first.
68#if DBG && !defined(NASSERT)
69#define assert(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__RELFILE__, __LINE__, (PCHAR)""); }
71#define assert(x) ((VOID) 0)
76#if DBG && !defined(NASSERT)
77#define ASSERT(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__RELFILE__, __LINE__, (PCHAR)""); }
79#define ASSERT(x) ((VOID) 0)
84#if DBG && !defined(NASSERT)
85#define ASSERTMSG(m, x) if (!(x)) { RtlAssert((PVOID)#x, __RELFILE__, __LINE__, m); }
87#define ASSERTMSG(m, x) ((VOID) 0)
92#define __NOTICE(level, fmt, ...) DbgPrint(#level ": %s at %s:%d " fmt, __FUNCTION__, __RELFILE__, __LINE__, ##__VA_ARGS__)
98 #define DPRINT1(fmt, ...) do { \
99 if (DbgPrint("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)) \
100 DbgPrint("(%s:%d) DbgPrint() failed!\n", __RELFILE__, __LINE__); \
106 #define DPRINT(fmt, ...) do { \
107 if (DbgPrint("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)) \
108 DbgPrint("(%s:%d) DbgPrint() failed!\n", __RELFILE__, __LINE__); \
114 #define DPRINT __noop
116 #define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
121 #define UNIMPLEMENTED __NOTICE(WARNING, "is UNIMPLEMENTED!\n")
122 #define UNIMPLEMENTED_ONCE do { static int bWarnedOnce = 0; if (!bWarnedOnce) { bWarnedOnce++; UNIMPLEMENTED; } } while (0)
124 #define ERR_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
125 #define WARN_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
126 #define TRACE_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
127 #define INFO_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
129 #define ERR__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_ERROR_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
130 #define WARN__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_WARNING_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
131 #define TRACE__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_TRACE_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
132 #define INFO__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_INFO_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
137 #define UNIMPLEMENTED
138 #define UNIMPLEMENTED_ONCE
140 #define DPRINT1 __noop
141 #define DPRINT __noop
143 #define ERR_(ch, ...) __noop
144 #define WARN_(ch, ...) __noop
145 #define TRACE_(ch, ...) __noop
146 #define INFO_(ch, ...) __noop
148 #define ERR__(ch, ...) __noop
149 #define WARN__(ch, ...) __noop
150 #define TRACE__(ch, ...) __noop
151 #define INFO__(ch, ...) __noop
153 #define DPRINT1(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
154 #define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
156 #define ERR_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
157 #define WARN_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
158 #define TRACE_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
159 #define INFO_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
161 #define ERR__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
162 #define WARN__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
163 #define TRACE__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
164 #define INFO__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
174 #ifndef NTOS_MODE_USER
176 #error "Unsupported target."
178 #define TerminateCurrentProcess(Status) TerminateProcess(GetCurrentProcess(), (Status))
190 #ifndef NtCurrentProcess
191 #define NtCurrentProcess() ((HANDLE)(LONG_PTR)-1)
193 #define TerminateCurrentProcess(Status) NtTerminateProcess(NtCurrentProcess(), (Status))
196 #include <bugcodes.h>
197 #define TerminateCurrentProcess(Status) KeBugCheckEx(CRITICAL_SERVICE_FAILED, (Status), 0, 0, 0)
202#define __ERROR_DBGBREAK(...) \
204 DbgPrint("" __VA_ARGS__); \
209#define __ERROR_FATAL(Status, ...) \
211 DbgPrint("" __VA_ARGS__); \
213 TerminateCurrentProcess(Status); \
221#define ERROR_DBGBREAK(...) \
223 __NOTICE(ERROR, "\n"); \
224 __ERROR_DBGBREAK(__VA_ARGS__); \
227#define UNIMPLEMENTED_DBGBREAK(...) \
229 __NOTICE(ERROR, "is UNIMPLEMENTED!\n"); \
230 __ERROR_DBGBREAK(__VA_ARGS__); \
238#define ERROR_FATAL(...) \
240 __NOTICE(UNRECOVERABLE ERROR, "\n"); \
241 __ERROR_FATAL(STATUS_ASSERTION_FAILURE, __VA_ARGS__); \
244#define UNIMPLEMENTED_FATAL(...) \
246 __NOTICE(UNRECOVERABLE ERROR, "is UNIMPLEMENTED!\n"); \
247 __ERROR_FATAL(STATUS_NOT_IMPLEMENTED, __VA_ARGS__); \
251#define ASSERT_IRQL_LESS_OR_EQUAL(x) ASSERT(KeGetCurrentIrql()<=(x))
252#define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql()==(x))
253#define ASSERT_IRQL_LESS(x) ASSERT(KeGetCurrentIrql()<(x))
255#define __STRING2__(x) #x
256#define __STRING__(x) __STRING2__(x)
257#define __STRLINE__ __STRING__(__LINE__)
259#if !defined(_MSC_VER) && !defined(__pragma)
260#define __pragma(x) _Pragma(#x)
263#define _WARN(msg) __pragma(message("WARNING! Line " __STRLINE__ ": " msg))
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
static const WCHAR Message[]
#define _Printf_format_string_
_In_ HANDLE ProcessHandle
NTSTATUS NTAPI NtTerminateProcess(HANDLE ProcessHandle, LONG ExitStatus)
NTSYSAPI ULONG __cdecl DbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ _Printf_format_string_ PCSTR Format,...)
__analysis_noreturn NTSYSAPI VOID NTAPI RtlAssert(_In_ PVOID FailedAssertion, _In_ PVOID FileName, _In_ ULONG LineNumber, _In_opt_z_ PCHAR Message)
#define __analysis_noreturn
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level