reactos/sdk/include/reactos/debug.h

266 lines
8.5 KiB
C
Raw Normal View History

/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: include/reactos/debug.h
* PURPOSE: Useful debugging macros
* PROGRAMMERS: David Welch (welch@mcmail.com)
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
/*
* NOTE: Define NDEBUG before including this header
* to disable debugging macros.
*/
#pragma once
#ifndef __RELFILE__
#define __RELFILE__ __FILE__
#endif
/* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */
#if !defined(_RTLFUNCS_H) && !defined(_NTDDK_)
- Update NDK to remove zwfuncs.h and place the native functions in their respective xxfuncs.h instead, so that applications can now include only what they need. Add more xxfuncs.h files for every API. - Make the NDK smarter so that using #define NTOS_MODE_USER isn't needed anymore: the NDK can now auto-detect the presence of windows.h or ntddk.h and make the appropriate decision. - re-arrange ntndk.h to include all types in alphabetical order, and then all functions, regardless of um/kmode usage. - Make each file auto-detect if this is NTOS_MODE_USER or not and include each files it needs, instead of depending on a predefined order inside ntndk.h This way, any file can be included from both user-mode or kmode as simply as #include <iofuncs.h>, wthout any adtional work. - Update FIXME list with these changes and delay NDK release date since my trip is lasting a day longer. - Fix ntsecapi.h to define UNICODE_STRING, like it does in the PSDK. - Fix apps including ntsecapi + winternl.h These two cause a conflict even on PSDK and shouldn't be included together. - Make winlogon include only the NDK files it needs (2) instead of the whole NDK, as test for this faster newly supported method. - Remove some NDK apps from the FIXME list (the ones that weren't being built/are on my rewrite branch/are better off including the whole NDK instead of file-by-file). - Update debug.h to define RtlAssert and DbgPrint in case the NDK or DDK aren't already included, which will allow some of the apps to stop using the NDK solely for DPRINT/DPRINT1. Diabled for now since a lot of code needs to be changed to #include <debug.h> *After* they include the other headers. (so that the anti-double-definition check can work). svn path=/trunk/; revision=19538
2005-11-25 00:17:40 +00:00
/* Make sure we have basic types (some people include us *before* SDK)... */
#if !defined(_NTDEF_) && !defined(_NTDEF_H) && !defined(_WINDEF_) && !defined(_WINDEF_H)
#error Please include SDK first.
#endif
#ifdef __cplusplus
extern "C" {
#endif
- Update NDK to remove zwfuncs.h and place the native functions in their respective xxfuncs.h instead, so that applications can now include only what they need. Add more xxfuncs.h files for every API. - Make the NDK smarter so that using #define NTOS_MODE_USER isn't needed anymore: the NDK can now auto-detect the presence of windows.h or ntddk.h and make the appropriate decision. - re-arrange ntndk.h to include all types in alphabetical order, and then all functions, regardless of um/kmode usage. - Make each file auto-detect if this is NTOS_MODE_USER or not and include each files it needs, instead of depending on a predefined order inside ntndk.h This way, any file can be included from both user-mode or kmode as simply as #include <iofuncs.h>, wthout any adtional work. - Update FIXME list with these changes and delay NDK release date since my trip is lasting a day longer. - Fix ntsecapi.h to define UNICODE_STRING, like it does in the PSDK. - Fix apps including ntsecapi + winternl.h These two cause a conflict even on PSDK and shouldn't be included together. - Make winlogon include only the NDK files it needs (2) instead of the whole NDK, as test for this faster newly supported method. - Remove some NDK apps from the FIXME list (the ones that weren't being built/are on my rewrite branch/are better off including the whole NDK instead of file-by-file). - Update debug.h to define RtlAssert and DbgPrint in case the NDK or DDK aren't already included, which will allow some of the apps to stop using the NDK solely for DPRINT/DPRINT1. Diabled for now since a lot of code needs to be changed to #include <debug.h> *After* they include the other headers. (so that the anti-double-definition check can work). svn path=/trunk/; revision=19538
2005-11-25 00:17:40 +00:00
ULONG
__cdecl
DbgPrint(
_In_z_ _Printf_format_string_ PCSTR Format,
...
- Update NDK to remove zwfuncs.h and place the native functions in their respective xxfuncs.h instead, so that applications can now include only what they need. Add more xxfuncs.h files for every API. - Make the NDK smarter so that using #define NTOS_MODE_USER isn't needed anymore: the NDK can now auto-detect the presence of windows.h or ntddk.h and make the appropriate decision. - re-arrange ntndk.h to include all types in alphabetical order, and then all functions, regardless of um/kmode usage. - Make each file auto-detect if this is NTOS_MODE_USER or not and include each files it needs, instead of depending on a predefined order inside ntndk.h This way, any file can be included from both user-mode or kmode as simply as #include <iofuncs.h>, wthout any adtional work. - Update FIXME list with these changes and delay NDK release date since my trip is lasting a day longer. - Fix ntsecapi.h to define UNICODE_STRING, like it does in the PSDK. - Fix apps including ntsecapi + winternl.h These two cause a conflict even on PSDK and shouldn't be included together. - Make winlogon include only the NDK files it needs (2) instead of the whole NDK, as test for this faster newly supported method. - Remove some NDK apps from the FIXME list (the ones that weren't being built/are on my rewrite branch/are better off including the whole NDK instead of file-by-file). - Update debug.h to define RtlAssert and DbgPrint in case the NDK or DDK aren't already included, which will allow some of the apps to stop using the NDK solely for DPRINT/DPRINT1. Diabled for now since a lot of code needs to be changed to #include <debug.h> *After* they include the other headers. (so that the anti-double-definition check can work). svn path=/trunk/; revision=19538
2005-11-25 00:17:40 +00:00
);
NTSYSAPI
ULONG
__cdecl
DbgPrintEx(
_In_ ULONG ComponentId,
_In_ ULONG Level,
_In_z_ _Printf_format_string_ PCSTR Format,
...
);
__analysis_noreturn
NTSYSAPI
- Update NDK to remove zwfuncs.h and place the native functions in their respective xxfuncs.h instead, so that applications can now include only what they need. Add more xxfuncs.h files for every API. - Make the NDK smarter so that using #define NTOS_MODE_USER isn't needed anymore: the NDK can now auto-detect the presence of windows.h or ntddk.h and make the appropriate decision. - re-arrange ntndk.h to include all types in alphabetical order, and then all functions, regardless of um/kmode usage. - Make each file auto-detect if this is NTOS_MODE_USER or not and include each files it needs, instead of depending on a predefined order inside ntndk.h This way, any file can be included from both user-mode or kmode as simply as #include <iofuncs.h>, wthout any adtional work. - Update FIXME list with these changes and delay NDK release date since my trip is lasting a day longer. - Fix ntsecapi.h to define UNICODE_STRING, like it does in the PSDK. - Fix apps including ntsecapi + winternl.h These two cause a conflict even on PSDK and shouldn't be included together. - Make winlogon include only the NDK files it needs (2) instead of the whole NDK, as test for this faster newly supported method. - Remove some NDK apps from the FIXME list (the ones that weren't being built/are on my rewrite branch/are better off including the whole NDK instead of file-by-file). - Update debug.h to define RtlAssert and DbgPrint in case the NDK or DDK aren't already included, which will allow some of the apps to stop using the NDK solely for DPRINT/DPRINT1. Diabled for now since a lot of code needs to be changed to #include <debug.h> *After* they include the other headers. (so that the anti-double-definition check can work). svn path=/trunk/; revision=19538
2005-11-25 00:17:40 +00:00
VOID
NTAPI
RtlAssert(
_In_ PVOID FailedAssertion,
_In_ PVOID FileName,
_In_ ULONG LineNumber,
_In_opt_z_ PCHAR Message
- Update NDK to remove zwfuncs.h and place the native functions in their respective xxfuncs.h instead, so that applications can now include only what they need. Add more xxfuncs.h files for every API. - Make the NDK smarter so that using #define NTOS_MODE_USER isn't needed anymore: the NDK can now auto-detect the presence of windows.h or ntddk.h and make the appropriate decision. - re-arrange ntndk.h to include all types in alphabetical order, and then all functions, regardless of um/kmode usage. - Make each file auto-detect if this is NTOS_MODE_USER or not and include each files it needs, instead of depending on a predefined order inside ntndk.h This way, any file can be included from both user-mode or kmode as simply as #include <iofuncs.h>, wthout any adtional work. - Update FIXME list with these changes and delay NDK release date since my trip is lasting a day longer. - Fix ntsecapi.h to define UNICODE_STRING, like it does in the PSDK. - Fix apps including ntsecapi + winternl.h These two cause a conflict even on PSDK and shouldn't be included together. - Make winlogon include only the NDK files it needs (2) instead of the whole NDK, as test for this faster newly supported method. - Remove some NDK apps from the FIXME list (the ones that weren't being built/are on my rewrite branch/are better off including the whole NDK instead of file-by-file). - Update debug.h to define RtlAssert and DbgPrint in case the NDK or DDK aren't already included, which will allow some of the apps to stop using the NDK solely for DPRINT/DPRINT1. Diabled for now since a lot of code needs to be changed to #include <debug.h> *After* they include the other headers. (so that the anti-double-definition check can work). svn path=/trunk/; revision=19538
2005-11-25 00:17:40 +00:00
);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* !defined(_RTLFUNCS_H) && !defined(_NTDDK_) */
- Update NDK to remove zwfuncs.h and place the native functions in their respective xxfuncs.h instead, so that applications can now include only what they need. Add more xxfuncs.h files for every API. - Make the NDK smarter so that using #define NTOS_MODE_USER isn't needed anymore: the NDK can now auto-detect the presence of windows.h or ntddk.h and make the appropriate decision. - re-arrange ntndk.h to include all types in alphabetical order, and then all functions, regardless of um/kmode usage. - Make each file auto-detect if this is NTOS_MODE_USER or not and include each files it needs, instead of depending on a predefined order inside ntndk.h This way, any file can be included from both user-mode or kmode as simply as #include <iofuncs.h>, wthout any adtional work. - Update FIXME list with these changes and delay NDK release date since my trip is lasting a day longer. - Fix ntsecapi.h to define UNICODE_STRING, like it does in the PSDK. - Fix apps including ntsecapi + winternl.h These two cause a conflict even on PSDK and shouldn't be included together. - Make winlogon include only the NDK files it needs (2) instead of the whole NDK, as test for this faster newly supported method. - Remove some NDK apps from the FIXME list (the ones that weren't being built/are on my rewrite branch/are better off including the whole NDK instead of file-by-file). - Update debug.h to define RtlAssert and DbgPrint in case the NDK or DDK aren't already included, which will allow some of the apps to stop using the NDK solely for DPRINT/DPRINT1. Diabled for now since a lot of code needs to be changed to #include <debug.h> *After* they include the other headers. (so that the anti-double-definition check can work). svn path=/trunk/; revision=19538
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
#if DBG && !defined(NASSERT)
#define assert(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__RELFILE__, __LINE__, (PCHAR)""); }
#else
#define assert(x) ((VOID) 0)
#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
#ifndef ASSERT
#if DBG && !defined(NASSERT)
#define ASSERT(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__RELFILE__, __LINE__, (PCHAR)""); }
#else
#define ASSERT(x) ((VOID) 0)
#endif
#endif
#ifndef ASSERTMSG
#if DBG && !defined(NASSERT)
#define ASSERTMSG(m, x) if (!(x)) { RtlAssert((PVOID)#x, __RELFILE__, __LINE__, m); }
#else
#define ASSERTMSG(m, x) ((VOID) 0)
#endif
#endif
/* For internal purposes only */
#define __NOTICE(level, fmt, ...) DbgPrint(#level ": %s at %s:%d " fmt, __FUNCTION__, __RELFILE__, __LINE__, ##__VA_ARGS__)
/* Print stuff only on Debug Builds*/
#if DBG
/* These are always printed */
#define DPRINT1(fmt, ...) do { \
if (DbgPrint("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)) \
DbgPrint("(%s:%d) DbgPrint() failed!\n", __RELFILE__, __LINE__); \
} while (0)
/* These are printed only if NDEBUG is NOT defined */
#ifndef NDEBUG
#define DPRINT(fmt, ...) do { \
if (DbgPrint("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)) \
DbgPrint("(%s:%d) DbgPrint() failed!\n", __RELFILE__, __LINE__); \
} while (0)
#else
#if defined(_MSC_VER)
#define DPRINT __noop
#else
#define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
#endif
#endif
#define UNIMPLEMENTED __NOTICE(WARNING, "is UNIMPLEMENTED!\n")
#define UNIMPLEMENTED_ONCE do { static int bWarnedOnce = 0; if (!bWarnedOnce) { bWarnedOnce++; UNIMPLEMENTED; } } while (0)
#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__)
#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__)
#else /* not DBG */
/* On non-debug builds, we never show these */
#define UNIMPLEMENTED
#define UNIMPLEMENTED_ONCE
#if defined(_MSC_VER)
#define DPRINT1 __noop
#define DPRINT __noop
#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
#else
#define DPRINT1(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
#define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
#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)
#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)
#endif /* _MSC_VER */
#endif /* not DBG */
/******************************************************************************/
/*
* 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
/* For internal purposes only */
#define __ERROR_DBGBREAK(...) \
do { \
DbgPrint("" __VA_ARGS__); \
DbgBreakPoint(); \
} while (0)
/* For internal purposes only */
#define __ERROR_FATAL(Status, ...) \
do { \
DbgPrint("" __VA_ARGS__); \
DbgBreakPoint(); \
TerminateCurrentProcess(Status); \
} 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.
*/
#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.
*/
#define ERROR_FATAL(...) \
do { \
__NOTICE(UNRECOVERABLE ERROR, "\n"); \
__ERROR_FATAL(STATUS_ASSERTION_FAILURE, __VA_ARGS__); \
} while (0)
#define UNIMPLEMENTED_FATAL(...) \
do { \
__NOTICE(UNRECOVERABLE ERROR, "is UNIMPLEMENTED!\n"); \
__ERROR_FATAL(STATUS_NOT_IMPLEMENTED, __VA_ARGS__); \
} while (0)
/******************************************************************************/
#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))
#define __STRING2__(x) #x
#define __STRING__(x) __STRING2__(x)
#define __STRLINE__ __STRING__(__LINE__)
#if !defined(_MSC_VER) && !defined(__pragma)
#define __pragma(x) _Pragma(#x)
#endif
#define _WARN(msg) __pragma(message("WARNING! Line " __STRLINE__ ": " msg))
/* EOF */