1998-08-25 04:27:41 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
2013-12-13 17:50:49 +00:00
|
|
|
* FILE: include/reactos/debug.h
|
1998-08-25 04:27:41 +00:00
|
|
|
* PURPOSE: Useful debugging macros
|
2013-01-06 18:47:39 +00:00
|
|
|
* PROGRAMMERS: David Welch (welch@mcmail.com)
|
|
|
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
1998-08-25 04:27:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-06 18:47:39 +00:00
|
|
|
* NOTE: Define NDEBUG before including this header
|
|
|
|
* to disable debugging macros.
|
1998-08-25 04:27:41 +00:00
|
|
|
*/
|
|
|
|
|
2013-12-13 17:50:49 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <builddir.h>
|
|
|
|
|
2013-01-10 01:45:22 +00:00
|
|
|
/* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */
|
2009-02-09 22:50:40 +00:00
|
|
|
#if !defined(_RTLFUNCS_H) && !defined(_NTDDK_)
|
2005-11-25 00:17:40 +00:00
|
|
|
|
2013-01-06 18:47:39 +00:00
|
|
|
/* Make sure we have basic types (some people include us *before* SDK)... */
|
2008-11-21 18:18:12 +00:00
|
|
|
#if !defined(_NTDEF_) && !defined(_NTDEF_H) && !defined(_WINDEF_) && !defined(_WINDEF_H)
|
2007-12-14 15:59:14 +00:00
|
|
|
#error Please include SDK first.
|
|
|
|
#endif
|
|
|
|
|
2013-07-13 18:03:16 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2005-11-25 00:17:40 +00:00
|
|
|
ULONG
|
|
|
|
__cdecl
|
|
|
|
DbgPrint(
|
2012-07-29 17:25:05 +00:00
|
|
|
_In_z_ _Printf_format_string_ PCSTR Format,
|
|
|
|
...
|
2005-11-25 00:17:40 +00:00
|
|
|
);
|
|
|
|
|
2009-07-26 15:36:35 +00:00
|
|
|
NTSYSAPI
|
2007-12-14 15:59:14 +00:00
|
|
|
ULONG
|
|
|
|
__cdecl
|
|
|
|
DbgPrintEx(
|
2012-07-29 17:25:05 +00:00
|
|
|
_In_ ULONG ComponentId,
|
|
|
|
_In_ ULONG Level,
|
2013-07-13 18:03:16 +00:00
|
|
|
_In_z_ _Printf_format_string_ PCSTR Format,
|
2012-07-29 17:25:05 +00:00
|
|
|
...
|
2007-12-14 15:59:14 +00:00
|
|
|
);
|
|
|
|
|
2012-07-29 17:25:05 +00:00
|
|
|
__analysis_noreturn
|
2006-03-04 17:27:40 +00:00
|
|
|
NTSYSAPI
|
2005-11-25 00:17:40 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
RtlAssert(
|
2013-07-13 18:03:16 +00:00
|
|
|
_In_ PVOID FailedAssertion,
|
|
|
|
_In_ PVOID FileName,
|
|
|
|
_In_ ULONG LineNumber,
|
|
|
|
_In_opt_z_ PCHAR Message
|
2005-11-25 00:17:40 +00:00
|
|
|
);
|
2006-01-08 19:50:52 +00:00
|
|
|
|
2013-07-13 18:03:16 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
2009-10-05 14:12:49 +00:00
|
|
|
#endif /* !defined(_RTLFUNCS_H) && !defined(_NTDDK_) */
|
2005-11-25 00:17:40 +00:00
|
|
|
|
2002-11-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
* drivers/bus/acpi/ospm/osl.c (acpi_os_readable, acpi_os_writable):
Match prototypes.
* include/ascii.h (AbortSystemShutdownA): Correct prototype.
* include/debug.h (assert): Wrap in #ifndef assert.
* include/funcs.h (AbortSystemShutdown): Remove duplicate prototype.
* include/ddk/rtltypes.h: Move ...
* include/ntos/rtltypes.h: ... here.
* include/ddk/rtl.h: Move ...
* include/ntos/rtl.h: ... here.
* include/ddk/zwtypes.h: Move ...
* include/ntos/zwtypes.h: ... here.
* include/ddk/zw.h: Move ...
* include/ntos/zw.h: ... here.
| include/ddk/cmfuncs.h: Remove file; Move NtCreateKey to ntos/zw.h.
* include/ntos.h: #include ntos/rtltypes.h, ntos/rtl.h, ntos/zwtypes.h,
and ntos/zw.h.
* include/unicode.h: (AbortSystemShutdownW): Correct prototype.
* include/ddk/ntddk.h: Include headers at new location; Don't include
removed files.
* include/defines.h: Wrap definitions in w32api in #ifndef __USE_W32API.
* include/ntos/zwtypes.h: Ditto.
* include/napi/lpc.h: Ditto.
* include/napi/shared_data.h: Ditto.
* include/napi/teb.h: Ditto.
* include/napi/types.h: Ditto.
* include/ntdll/ldr.h: Ditto.
* include/ntdll/rtl.h: Ditto.
* include/ntos/console.h: Ditto.
* include/ntos/disk.h: Ditto.
* include/ntos/except.h: Ditto.
* include/ntos/file.h: Ditto.
* include/ntos/gditypes.h: Ditto.
* include/ntos/heap.h: Ditto.
* include/ntos/keyboard.h: Ditto.
* include/ntos/mm.h: Ditto.
* include/ntos/ntdef.h: Ditto.
* include/ntos/ps.h: Ditto.
* include/ntos/registry.h: Ditto.
* include/ntos/security.h: Ditto.
* include/ntos/synch.h: Ditto.
* include/ntos/time.h: Ditto.
* include/ntos/types.h: Ditto.
* include/ntos/port.h: Ditto.
* lib/advapi32/misc/shutdown.c (AbortSystemShutdownW,
AbortSystemShutdownA): Correct prototype.
* lib/advapi32/reg/reg.c: #include ntos.h.
* lib/advapi32/sec/misc.c: Ditto.
* lib/advapi32/sec/sid.c: Ditto.
* lib/advapi32/service/sctrl.c: Ditto.
* lib/advapi32/token/token.c: Ditto.
* lib/kernel32/misc/dllmain.c: Ditto.
* ntoskrnl/ex/napi.c: Ditto.
* ntoskrnl/rtl/i386/exception.c: Ditto.
* lib/advapi32/sec/ac.c: Ditto.
(FindFirstFreeAce, GetAce): Change PACE* to PACE_HEADER*.
* lib/advapi32/service/scm.c (EnumServicesStatusExA,
EnumServicesStatusExW, QueryServiceStatusEx): Correct prototype.
* lib/ntdll/rtl/ppb.c (RtlDestroyProcessParameters): Match prototype.
* ntoskrnl/dbg/errinfo.c (DbgGetErrorText): Use %08x, not %08lx.
* ntoskrnl/io/arcname.c (IoCreateSystemRootLink): Use %u, not %lu.
* ntoskrnl/ke/main.c (ExpInitializeExecutive): Ditto.
* (_main): Use %d, not %ld.
* ntoskrnl/include/internal/i386/ke.h: Add #pragma GCC system_header.
* include/ddk/ntdef.h (NTSYSAPI, NTAPI, NTKERNELAPI): Define to STDCALL;
Check if already defined.
* include/base.h (STDCALL, CDECL, CALLBACK, PASCAL): Move to ntos/types.h.
svn path=/trunk/; revision=3755
2002-11-14 18:21:07 +00:00
|
|
|
#ifndef assert
|
2013-10-14 16:39:18 +00:00
|
|
|
#if DBG && !defined(NASSERT)
|
2013-12-13 17:50:49 +00:00
|
|
|
#define assert(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__RELFILE__, __LINE__, ""); }
|
1998-11-29 19:11:10 +00:00
|
|
|
#else
|
2013-10-14 16:39:18 +00:00
|
|
|
#define assert(x) ((VOID) 0)
|
1998-11-29 19:11:10 +00:00
|
|
|
#endif
|
2002-11-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
* drivers/bus/acpi/ospm/osl.c (acpi_os_readable, acpi_os_writable):
Match prototypes.
* include/ascii.h (AbortSystemShutdownA): Correct prototype.
* include/debug.h (assert): Wrap in #ifndef assert.
* include/funcs.h (AbortSystemShutdown): Remove duplicate prototype.
* include/ddk/rtltypes.h: Move ...
* include/ntos/rtltypes.h: ... here.
* include/ddk/rtl.h: Move ...
* include/ntos/rtl.h: ... here.
* include/ddk/zwtypes.h: Move ...
* include/ntos/zwtypes.h: ... here.
* include/ddk/zw.h: Move ...
* include/ntos/zw.h: ... here.
| include/ddk/cmfuncs.h: Remove file; Move NtCreateKey to ntos/zw.h.
* include/ntos.h: #include ntos/rtltypes.h, ntos/rtl.h, ntos/zwtypes.h,
and ntos/zw.h.
* include/unicode.h: (AbortSystemShutdownW): Correct prototype.
* include/ddk/ntddk.h: Include headers at new location; Don't include
removed files.
* include/defines.h: Wrap definitions in w32api in #ifndef __USE_W32API.
* include/ntos/zwtypes.h: Ditto.
* include/napi/lpc.h: Ditto.
* include/napi/shared_data.h: Ditto.
* include/napi/teb.h: Ditto.
* include/napi/types.h: Ditto.
* include/ntdll/ldr.h: Ditto.
* include/ntdll/rtl.h: Ditto.
* include/ntos/console.h: Ditto.
* include/ntos/disk.h: Ditto.
* include/ntos/except.h: Ditto.
* include/ntos/file.h: Ditto.
* include/ntos/gditypes.h: Ditto.
* include/ntos/heap.h: Ditto.
* include/ntos/keyboard.h: Ditto.
* include/ntos/mm.h: Ditto.
* include/ntos/ntdef.h: Ditto.
* include/ntos/ps.h: Ditto.
* include/ntos/registry.h: Ditto.
* include/ntos/security.h: Ditto.
* include/ntos/synch.h: Ditto.
* include/ntos/time.h: Ditto.
* include/ntos/types.h: Ditto.
* include/ntos/port.h: Ditto.
* lib/advapi32/misc/shutdown.c (AbortSystemShutdownW,
AbortSystemShutdownA): Correct prototype.
* lib/advapi32/reg/reg.c: #include ntos.h.
* lib/advapi32/sec/misc.c: Ditto.
* lib/advapi32/sec/sid.c: Ditto.
* lib/advapi32/service/sctrl.c: Ditto.
* lib/advapi32/token/token.c: Ditto.
* lib/kernel32/misc/dllmain.c: Ditto.
* ntoskrnl/ex/napi.c: Ditto.
* ntoskrnl/rtl/i386/exception.c: Ditto.
* lib/advapi32/sec/ac.c: Ditto.
(FindFirstFreeAce, GetAce): Change PACE* to PACE_HEADER*.
* lib/advapi32/service/scm.c (EnumServicesStatusExA,
EnumServicesStatusExW, QueryServiceStatusEx): Correct prototype.
* lib/ntdll/rtl/ppb.c (RtlDestroyProcessParameters): Match prototype.
* ntoskrnl/dbg/errinfo.c (DbgGetErrorText): Use %08x, not %08lx.
* ntoskrnl/io/arcname.c (IoCreateSystemRootLink): Use %u, not %lu.
* ntoskrnl/ke/main.c (ExpInitializeExecutive): Ditto.
* (_main): Use %d, not %ld.
* ntoskrnl/include/internal/i386/ke.h: Add #pragma GCC system_header.
* include/ddk/ntdef.h (NTSYSAPI, NTAPI, NTKERNELAPI): Define to STDCALL;
Check if already defined.
* include/base.h (STDCALL, CDECL, CALLBACK, PASCAL): Move to ntos/types.h.
svn path=/trunk/; revision=3755
2002-11-14 18:21:07 +00:00
|
|
|
#endif
|
1998-11-29 19:11:10 +00:00
|
|
|
|
2004-10-22 20:02:32 +00:00
|
|
|
#ifndef ASSERT
|
2013-10-14 16:39:18 +00:00
|
|
|
#if DBG && !defined(NASSERT)
|
2013-12-13 17:50:49 +00:00
|
|
|
#define ASSERT(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__RELFILE__, __LINE__, ""); }
|
2004-10-22 20:02:32 +00:00
|
|
|
#else
|
2013-10-14 16:39:18 +00:00
|
|
|
#define ASSERT(x) ((VOID) 0)
|
2004-10-22 20:02:32 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef ASSERTMSG
|
2013-10-14 16:39:18 +00:00
|
|
|
#if DBG && !defined(NASSERT)
|
2013-12-13 17:50:49 +00:00
|
|
|
#define ASSERTMSG(m, x) if (!(x)) { RtlAssert((PVOID)#x, __RELFILE__, __LINE__, m); }
|
2004-10-22 20:02:32 +00:00
|
|
|
#else
|
2013-10-14 16:39:18 +00:00
|
|
|
#define ASSERTMSG(m, x) ((VOID) 0)
|
2004-10-22 20:02:32 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2013-01-06 18:47:39 +00:00
|
|
|
/* For internal purposes only */
|
2013-12-13 17:50:49 +00:00
|
|
|
#define __NOTICE(level, fmt, ...) DbgPrint(#level ": %s at %s:%d " fmt, __FUNCTION__, __RELFILE__, __LINE__, ##__VA_ARGS__)
|
2013-01-06 18:47:39 +00:00
|
|
|
|
2005-07-29 00:14:05 +00:00
|
|
|
/* Print stuff only on Debug Builds*/
|
2009-06-17 12:44:05 +00:00
|
|
|
#if DBG
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2005-07-29 00:14:05 +00:00
|
|
|
/* These are always printed */
|
2009-10-05 14:12:49 +00:00
|
|
|
#define DPRINT1(fmt, ...) do { \
|
2013-12-13 17:50:49 +00:00
|
|
|
if (DbgPrint("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)) \
|
|
|
|
DbgPrint("(%s:%d) DbgPrint() failed!\n", __RELFILE__, __LINE__); \
|
2009-10-05 14:12:49 +00:00
|
|
|
} while (0)
|
2005-07-29 00:14:05 +00:00
|
|
|
|
|
|
|
/* These are printed only if NDEBUG is NOT defined */
|
|
|
|
#ifndef NDEBUG
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2009-10-05 14:12:49 +00:00
|
|
|
#define DPRINT(fmt, ...) do { \
|
2013-12-13 17:50:49 +00:00
|
|
|
if (DbgPrint("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)) \
|
|
|
|
DbgPrint("(%s:%d) DbgPrint() failed!\n", __RELFILE__, __LINE__); \
|
2009-10-05 14:12:49 +00:00
|
|
|
} while (0)
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2005-07-29 00:14:05 +00:00
|
|
|
#else
|
2009-08-23 15:49:43 +00:00
|
|
|
|
2015-09-11 20:18:12 +00:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define DPRINT __noop
|
|
|
|
#else
|
2009-08-23 15:49:43 +00:00
|
|
|
#define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
2015-09-11 20:18:12 +00:00
|
|
|
#endif
|
2009-08-23 15:49:43 +00:00
|
|
|
|
2005-07-29 00:14:05 +00:00
|
|
|
#endif
|
1999-11-02 08:55:45 +00:00
|
|
|
|
2017-02-06 15:49:23 +00:00
|
|
|
#define UNIMPLEMENTED __NOTICE(WARNING, "is UNIMPLEMENTED!\n")
|
2018-01-08 20:06:23 +00:00
|
|
|
#define UNIMPLEMENTED_ONCE do { static int bWarnedOnce = 0; if (!bWarnedOnce) { bWarnedOnce++; UNIMPLEMENTED; } } while (0)
|
2008-02-27 19:58:48 +00:00
|
|
|
|
2013-12-13 17:50:49 +00:00
|
|
|
#define ERR_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
|
|
|
|
#define WARN_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
|
|
|
|
#define TRACE_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
|
|
|
|
#define INFO_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
|
2012-07-29 17:25:05 +00:00
|
|
|
|
2013-12-13 17:50:49 +00:00
|
|
|
#define ERR__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_ERROR_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
|
|
|
|
#define WARN__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_WARNING_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
|
|
|
|
#define TRACE__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_TRACE_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
|
|
|
|
#define INFO__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_INFO_LEVEL, "(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
|
2013-01-06 18:47:39 +00:00
|
|
|
|
2009-10-05 14:12:49 +00:00
|
|
|
#else /* not DBG */
|
2005-07-29 00:14:05 +00:00
|
|
|
|
|
|
|
/* On non-debug builds, we never show these */
|
2015-09-11 20:18:12 +00:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define DPRINT1 __noop
|
|
|
|
#define DPRINT __noop
|
|
|
|
|
|
|
|
#define UNIMPLEMENTED
|
|
|
|
|
2016-02-02 20:51:50 +00:00
|
|
|
#define ERR_(ch, ...) __noop
|
|
|
|
#define WARN_(ch, ...) __noop
|
|
|
|
#define TRACE_(ch, ...) __noop
|
|
|
|
#define INFO_(ch, ...) __noop
|
|
|
|
|
|
|
|
#define ERR__(ch, ...) __noop
|
|
|
|
#define WARN__(ch, ...) __noop
|
|
|
|
#define TRACE__(ch, ...) __noop
|
|
|
|
#define INFO__(ch, ...) __noop
|
2015-09-11 20:18:12 +00:00
|
|
|
#else
|
2006-01-10 21:36:42 +00:00
|
|
|
#define DPRINT1(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
|
|
|
#define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
2006-01-07 02:06:22 +00:00
|
|
|
|
2005-11-05 06:44:03 +00:00
|
|
|
#define UNIMPLEMENTED
|
2018-01-08 20:06:23 +00:00
|
|
|
#define UNIMPLEMENTED_ONCE
|
2007-12-14 15:59:14 +00:00
|
|
|
|
|
|
|
#define ERR_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
|
|
|
#define WARN_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
|
|
|
#define TRACE_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
|
|
|
#define INFO_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
2012-07-29 17:25:05 +00:00
|
|
|
|
2010-08-07 16:01:30 +00:00
|
|
|
#define ERR__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
|
|
|
#define WARN__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
|
|
|
#define TRACE__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
|
|
|
#define INFO__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
2015-09-11 20:18:12 +00:00
|
|
|
#endif /* _MSC_VER */
|
2013-01-06 18:47:39 +00:00
|
|
|
|
2009-10-05 14:12:49 +00:00
|
|
|
#endif /* not DBG */
|
1998-08-25 04:27:41 +00:00
|
|
|
|
2013-01-06 23:29:05 +00:00
|
|
|
/******************************************************************************/
|
2013-01-10 01:45:22 +00:00
|
|
|
/*
|
|
|
|
* Declare a target-dependent process termination procedure.
|
|
|
|
*/
|
|
|
|
#ifndef _NTDDK_ /* User-Mode */
|
|
|
|
#ifndef NTOS_MODE_USER /* Should be Win32 */
|
|
|
|
#ifndef _WIN32
|
|
|
|
#error "Unsupported target."
|
|
|
|
#else
|
|
|
|
#define TerminateCurrentProcess(Status) TerminateProcess(GetCurrentProcess(), (Status))
|
|
|
|
#endif
|
|
|
|
#else /* Native */
|
|
|
|
#ifndef _PSFUNCS_H
|
|
|
|
NTSYSCALLAPI
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NtTerminateProcess(
|
|
|
|
IN HANDLE ProcessHandle,
|
|
|
|
IN NTSTATUS ExitStatus
|
|
|
|
);
|
|
|
|
#endif
|
|
|
|
#ifndef NtCurrentProcess
|
|
|
|
#define NtCurrentProcess() ((HANDLE)(LONG_PTR)-1)
|
|
|
|
#endif
|
|
|
|
#define TerminateCurrentProcess(Status) NtTerminateProcess(NtCurrentProcess(), (Status))
|
|
|
|
#endif
|
|
|
|
#else /* Kernel-Mode */
|
|
|
|
#include <bugcodes.h>
|
|
|
|
#define TerminateCurrentProcess(Status) KeBugCheckEx(CRITICAL_SERVICE_FAILED, (Status), 0, 0, 0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2013-01-06 18:47:39 +00:00
|
|
|
/* For internal purposes only */
|
|
|
|
#define __ERROR_DBGBREAK(...) \
|
|
|
|
do { \
|
|
|
|
DbgPrint("" __VA_ARGS__); \
|
|
|
|
DbgBreakPoint(); \
|
|
|
|
} while (0)
|
|
|
|
|
2013-01-06 23:29:05 +00:00
|
|
|
/* For internal purposes only */
|
2013-01-10 01:45:22 +00:00
|
|
|
#define __ERROR_FATAL(Status, ...) \
|
|
|
|
do { \
|
|
|
|
DbgPrint("" __VA_ARGS__); \
|
|
|
|
DbgBreakPoint(); \
|
|
|
|
TerminateCurrentProcess(Status); \
|
2013-01-06 23:29:05 +00:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* These macros are designed to display an optional printf-like
|
|
|
|
* user-defined message and to break into the debugger.
|
|
|
|
* After that they allow to continue the program execution.
|
|
|
|
*/
|
2013-01-06 18:47:39 +00:00
|
|
|
#define ERROR_DBGBREAK(...) \
|
|
|
|
do { \
|
|
|
|
__NOTICE(ERROR, "\n"); \
|
|
|
|
__ERROR_DBGBREAK(__VA_ARGS__); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define UNIMPLEMENTED_DBGBREAK(...) \
|
|
|
|
do { \
|
|
|
|
__NOTICE(ERROR, "is UNIMPLEMENTED!\n"); \
|
|
|
|
__ERROR_DBGBREAK(__VA_ARGS__); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* These macros are designed to display an optional printf-like
|
|
|
|
* user-defined message and to break into the debugger.
|
|
|
|
* After that they halt the execution of the current thread.
|
|
|
|
*/
|
2013-01-06 23:29:05 +00:00
|
|
|
#define ERROR_FATAL(...) \
|
|
|
|
do { \
|
|
|
|
__NOTICE(UNRECOVERABLE ERROR, "\n"); \
|
|
|
|
__ERROR_FATAL(STATUS_ASSERTION_FAILURE, __VA_ARGS__); \
|
2013-01-06 18:47:39 +00:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define UNIMPLEMENTED_FATAL(...) \
|
|
|
|
do { \
|
|
|
|
__NOTICE(UNRECOVERABLE ERROR, "is UNIMPLEMENTED!\n"); \
|
2013-01-06 23:29:05 +00:00
|
|
|
__ERROR_FATAL(STATUS_NOT_IMPLEMENTED, __VA_ARGS__); \
|
2013-01-06 18:47:39 +00:00
|
|
|
} while (0)
|
2013-01-06 23:29:05 +00:00
|
|
|
/******************************************************************************/
|
2013-01-06 18:47:39 +00:00
|
|
|
|
2008-08-30 15:14:12 +00:00
|
|
|
#define ASSERT_IRQL_LESS_OR_EQUAL(x) ASSERT(KeGetCurrentIrql()<=(x))
|
|
|
|
#define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql()==(x))
|
|
|
|
#define ASSERT_IRQL_LESS(x) ASSERT(KeGetCurrentIrql()<(x))
|
2005-06-17 13:13:37 +00:00
|
|
|
|
2013-09-22 21:19:40 +00:00
|
|
|
#define __STRING2__(x) #x
|
|
|
|
#define __STRING__(x) __STRING2__(x)
|
|
|
|
#define __STRLINE__ __STRING__(__LINE__)
|
|
|
|
|
2013-12-13 17:50:49 +00:00
|
|
|
#if !defined(_MSC_VER) && !defined(__pragma)
|
|
|
|
#define __pragma(x) _Pragma(#x)
|
|
|
|
#endif
|
2013-09-22 21:19:40 +00:00
|
|
|
|
|
|
|
#define _WARN(msg) __pragma(message("WARNING! Line " __STRLINE__ ": " msg))
|
|
|
|
|
2013-12-13 17:50:49 +00:00
|
|
|
/* EOF */
|