#endif
#endif
+#ifndef ASSERT
+#ifndef NASSERT
+#define ASSERT(x) if (!(x)) {RtlAssert("#x",__FILE__,__LINE__, ""); }
+#else
+#define ASSERT(x)
+#endif
+#endif
+
+#ifndef ASSERTMSG
+#ifndef NASSERT
+#define ASSERTMSG(x,m) if (!(x)) {RtlAssert("#x",__FILE__,__LINE__, m); }
+#else
+#define ASSERTMSG(x)
+#endif
+#endif
+
+
/* TODO: Make the output of file/line and the debug message atomic */
#define DPRINT1 DbgPrint("(%s:%d) ",__FILE__,__LINE__), DbgPrint
#define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);
#endif
#define UNIMPLEMENTED do {DbgPrint("%s at %s:%d is unimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;); } while(0)
-#ifdef DBG
-/* Assert only on "checked" version */
-#ifndef NASSERT
#ifdef assert
#undef assert
#endif
+
+#ifdef DBG
+
+/* Assert only on "checked" version */
+#ifndef NASSERT
#define assert(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); KeBugCheck(0); }
+#define ASSERT(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); KeBugCheck(0); }
#define assertmsg(_c_, _m_) \
if (!(_c_)) { \
KeBugCheck(0); \
}
+#define ASSERTMSG(_c_, _m_) \
+ if (!(_c_)) { \
+ DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
+ DbgPrint _m_ ; \
+ KeBugCheck(0); \
+ }
+
#else
-#ifdef assert
-#undef assert
-#endif
#define assert(x)
+#define ASSERT(x)
#define assertmsg(_c_, _m_)
+#define ASSERTMSG(_c_, _m_)
#endif
#else /* DBG */
#define CPRINT(args...)
-#ifdef assert
-#undef assert
-#endif
#define assert(x)
+#define ASSERT(x)
#define assertmsg(_c_, _m_)
+#define ASSERTMSG(_c_, _m_)
#endif /* DBG */
* ARGUMENTS:
* x = Maximum irql
*/
-#define ASSERT_IRQL(x) assert(KeGetCurrentIrql()<=(x))
+#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql()<=(x))
#define assert_irql(x) assert(KeGetCurrentIrql()<=(x))
#endif /* __INTERNAL_DEBUG */