diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/mvdm/vdmexts/reflect.c | |
download | NT4.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/mvdm/vdmexts/reflect.c')
-rw-r--r-- | private/mvdm/vdmexts/reflect.c | 200 |
1 files changed, 200 insertions, 0 deletions
diff --git a/private/mvdm/vdmexts/reflect.c b/private/mvdm/vdmexts/reflect.c new file mode 100644 index 000000000..1dc1e1ba4 --- /dev/null +++ b/private/mvdm/vdmexts/reflect.c @@ -0,0 +1,200 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + reflect.c + +Abstract: + + This module contains extensions having to do with event and exception + reflection. + +Author: + + Dave Hastings (daveh) 20-Apr-1992 + +Revision History: + + Neil Sandlin (NeilSa) 15-Jan-1996 Merged with vdmexts + +--*/ + +#include <precomp.h> +#pragma hdrstop + +VOID +er( + CMD_ARGLIST + ) +/*++ + +Routine Description: + + This routine toggles the exception reflection bit in the vdmtib, and + reports the current state + +Arguments: + + None. + +Return Value: + + None. + +--*/ +{ + BOOL Status; + PVOID Address; + ULONG Flags; + + CMD_INIT(); + + if ( fWinDbg ) { + (*Print)("This command is not supported under WinDbg\n"); + } else { + Address = (PVOID) (FIXED_NTVDMSTATE_LINEAR + GetIntelBase()); + + // + // Read the current value of the flags + // + + Status = READMEM( + Address, + &Flags, + sizeof(ULONG) + ); + + if (!Status) { + + (ULONG)Address = (*GetExpression)("ntvdm!InitialVdmTibFlags"); + Status = READMEM( + (PVOID)Address, + &Flags, + sizeof(ULONG) + ); + + if (!Status) { + GetLastError(); + (*Print)("Could not get InitialTibflags\n"); + return; + } + } + + // + // Toggle exception bit + // + + Flags ^= VDM_BREAK_EXCEPTIONS; + + Status = WRITEMEM( + Address, + &Flags, + sizeof(ULONG) + ); + + if (!Status) { + GetLastError(); + (*Print)("Could not get set Flags\n"); + return; + } + + // + // Tell user what will happen with exceptions + // + + if (Flags & VDM_BREAK_EXCEPTIONS) { + (*Print)("GP Fault exceptions will be reflected to the debugger\n"); + } else { + (*Print)("GP Fault exceptions will be reflected to the application\n"); + } + } +} + +VOID +dr( + CMD_ARGLIST + ) +/*++ + +Routine Description: + + This routine toggles the debug reflection bit in the vdmtib, and + reports the current state + +Arguments: + + None. + +Return Value: + + None. + +--*/ +{ + BOOL Status; + PVOID Address; + ULONG Flags; + + CMD_INIT(); + + if ( fWinDbg ) { + (*Print)("This command is not supported under WinDbg\n"); + } else { + Address = (PVOID) (FIXED_NTVDMSTATE_LINEAR + GetIntelBase()); + + + // + // Read the current value of the flags + // + + Status = READMEM( + Address, + &Flags, + sizeof(ULONG) + ); + + if (!Status) { + (ULONG)Address = (*GetExpression)("ntvdm!InitialVdmTibFlags"); + Status = READMEM( + (PVOID)Address, + &Flags, + sizeof(ULONG) + ); + + if (!Status) { + GetLastError(); + (*Print)("Could not get InitialTibflags\n"); + return; + } + } + // + // Toggle exception bit + // + + Flags ^= VDM_BREAK_DEBUGGER; + + Status = WRITEMEM( + Address, + &Flags, + sizeof(ULONG) + ); + + if (!Status) { + GetLastError(); + (*Print)("Could not get set Flags\n"); + return; + } + + // + // Tell user what will happen with exceptions + // + + if (!(Flags & VDM_BREAK_DEBUGGER)) { + (*Print)("Debug faults will be reflected to the application\n"); + } else { + (*Print)("Debug faults will be reflected to the debugger\n"); + } + } +} |