summaryrefslogtreecommitdiffstats
path: root/private/ntos/rtl/assert.c
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/ntos/rtl/assert.c
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/ntos/rtl/assert.c')
-rw-r--r--private/ntos/rtl/assert.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/private/ntos/rtl/assert.c b/private/ntos/rtl/assert.c
new file mode 100644
index 000000000..b3eb28b3c
--- /dev/null
+++ b/private/ntos/rtl/assert.c
@@ -0,0 +1,82 @@
+/*++
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ assert.c
+
+Abstract:
+
+ This module implements the RtlAssert function that is referenced by the
+ debugging version of the ASSERT macro defined in NTDEF.H
+
+Author:
+
+ Steve Wood (stevewo) 03-Oct-1989
+
+Revision History:
+
+--*/
+
+#include <nt.h>
+#include <ntrtl.h>
+#include <zwapi.h>
+
+VOID
+RtlAssert(
+ IN PVOID FailedAssertion,
+ IN PVOID FileName,
+ IN ULONG LineNumber,
+ IN PCHAR Message OPTIONAL
+ )
+{
+#if DBG
+ char Response[ 2 ];
+ CONTEXT Context;
+
+#ifndef BLDR_KERNEL_RUNTIME
+ RtlCaptureContext( &Context );
+#endif
+
+ while (TRUE) {
+ DbgPrint( "\n*** Assertion failed: %s%s\n*** Source File: %s, line %ld\n\n",
+ Message ? Message : "",
+ FailedAssertion,
+ FileName,
+ LineNumber
+ );
+
+ DbgPrompt( "Break, Ignore, Terminate Process or Terminate Thread (bipt)? ",
+ Response,
+ sizeof( Response )
+ );
+ switch (Response[0]) {
+ case 'B':
+ case 'b':
+ DbgPrint( "Execute '!cxr %lx' to dump context\n",
+ &Context
+ );
+ DbgBreakPoint();
+ break;
+
+ case 'I':
+ case 'i':
+ return;
+
+ case 'P':
+ case 'p':
+ ZwTerminateProcess( NtCurrentProcess(), STATUS_UNSUCCESSFUL );
+ break;
+
+ case 'T':
+ case 't':
+ ZwTerminateThread( NtCurrentThread(), STATUS_UNSUCCESSFUL );
+ break;
+ }
+ }
+
+ DbgBreakPoint();
+ ZwTerminateProcess( NtCurrentProcess(), STATUS_UNSUCCESSFUL );
+#endif
+}