summaryrefslogtreecommitdiffstats
path: root/private/mvdm/ieuvddex/i386
diff options
context:
space:
mode:
Diffstat (limited to 'private/mvdm/ieuvddex/i386')
-rw-r--r--private/mvdm/ieuvddex/i386/helpp.c72
-rw-r--r--private/mvdm/ieuvddex/i386/profile.c359
-rw-r--r--private/mvdm/ieuvddex/i386/reflect.c218
-rw-r--r--private/mvdm/ieuvddex/i386/regs.c150
-rw-r--r--private/mvdm/ieuvddex/i386/sources5
-rw-r--r--private/mvdm/ieuvddex/i386/vdmtib.c322
6 files changed, 1126 insertions, 0 deletions
diff --git a/private/mvdm/ieuvddex/i386/helpp.c b/private/mvdm/ieuvddex/i386/helpp.c
new file mode 100644
index 000000000..25f9e1798
--- /dev/null
+++ b/private/mvdm/ieuvddex/i386/helpp.c
@@ -0,0 +1,72 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ Helpp.c
+
+Abstract:
+
+ This module contains the processor specific help routine. Help processor
+ specific extensions go here.
+
+Author:
+
+ Dave Hastings (daveh) 1-Apr-1992
+
+Revision History:
+
+--*/
+
+#include <ieuvddex.h>
+
+VOID
+helpp(
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ This routine prints out help for the processor specific extensions
+
+Arguments:
+
+ None
+
+Return Value:
+
+ None.
+
+--*/
+{
+ (*Print)("dr\n");
+ (*Print)("\tTogles whether debug faults (1 and 3) are reflected to the\n");
+ (*Print)("\tdebugger or the application\n");
+ (*Print)("er\n");
+ (*Print)("\tTogles whether GP faults are reflected to the debugger or \n");
+ (*Print)("\tthe application\n");
+ (*Print)("eventinfo [address]\n");
+ (*Print)("\tIf [address] is present, it is used as the address of the\n");
+ (*Print)("\tEventInfo structure. If not, the address of the EventInfo\n");
+ (*Print)("\tlooked up\n");
+ (*Print)("ireg [address]\n");
+ (*Print)("\tDumps the IntelRegister structure (not necessarily the\n");
+ (*Print)("\tcurrent 16 bit register state). If [address] is present it\n");
+ (*Print)("\tis used as the address of the IntelRegisters structure,\n");
+ (*Print)("\totherwise the address is looked up\n");
+ (*Print)("pdump\n");
+ (*Print)("\tCauses profile information to be dumped to \\profile.out\n");
+ (*Print)("pint ProfileInterval\n");
+ (*Print)("\tSets the profile interval\n");
+ (*Print)("pstart\n");
+ (*Print)("\tCauses profiling to start\n");
+ (*Print)("pstop\n");
+ (*Print)("\tCauses profiling to stop\n");
+ (*Print)("vdmtib [address]\n");
+ (*Print)("\tIf [address] is present, it is used as the address of the\n");
+ (*Print)("\tVdmTib. If not, the address of the VdmTib is looked up\n");
+}
+
+
diff --git a/private/mvdm/ieuvddex/i386/profile.c b/private/mvdm/ieuvddex/i386/profile.c
new file mode 100644
index 000000000..298800a89
--- /dev/null
+++ b/private/mvdm/ieuvddex/i386/profile.c
@@ -0,0 +1,359 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ Profile.c
+
+Abstract:
+
+ This module contains routines for controling the rudimentary sampling
+ profiler built into the profiling version of Ntvdm.
+
+Author:
+
+ Dave Hastings (daveh) 31-Jul-1992
+
+Notes:
+
+ The routines in this module assume that the pointers to the ntsd
+ routines have already been set up.
+
+Revision History:
+
+--*/
+
+#include <ieuvddex.h>
+#include <stdio.h>
+
+VOID
+ProfDumpp(
+ IN HANDLE CurrentProcess,
+ IN HANDLE CurrentThread,
+ IN LPSTR ArgumentString
+ )
+/*++
+
+Routine Description:
+
+ This routine causes the profile information to be dumped the next
+ time ntvdm switches from 32 to 16 bit mode.
+
+
+Arguments:
+
+ CurrentProcess -- Supplies a handle to the current process
+ CurrentThread -- Supplies a handle to the current thread
+ ArgumentString -- Supplies a pointer to the commands argument string
+
+Return Value:
+
+ None.
+
+Notes:
+
+ This routine assumes that the pointers to the ntsd routines have already
+ been set up.
+
+--*/
+{
+ BOOL Status;
+ ULONG Address, BytesRead, Flags;
+
+ UNREFERENCED_PARAMETER(CurrentThread);
+
+ Address = FIXED_NTVDMSTATE_LINEAR;
+
+ //
+ // Get Flags
+ //
+
+ Status = ReadProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ (ULONG)Address = (*GetExpression)("ntvdm!InitialVdmTibFlags");
+ Status = ReadProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ GetLastError();
+ (*Print)("Could not get InitialVdmTibFlags\n");
+ return;
+ }
+ }
+
+ //
+ // Enable profile dump
+ //
+
+ Flags |= VDM_ANALYZE_PROFILE;
+
+ Status = WriteProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ GetLastError();
+ (*Print)("Could not set Flags\n");
+ return;
+ }
+}
+
+VOID
+ProfIntp(
+ IN HANDLE CurrentProcess,
+ IN HANDLE CurrentThread,
+ IN LPSTR ArgumentString
+ )
+/*++
+
+Routine Description:
+
+ This routine changes the profile interval the next time profiling is
+ started.
+
+Arguments:
+
+ CurrentProcess -- Supplies a handle to the current process
+ CurrentThread -- Supplies a handle to the current thread
+ ArgumentString -- Supplies a pointer to the commands argument string
+
+Return Value:
+
+ None.
+
+Notes:
+
+ This routine assumes that the pointers to the ntsd routines have already
+ been set up.
+
+--*/
+{
+ BOOL Status;
+ ULONG Address, BytesRead, ProfInt;
+
+ UNREFERENCED_PARAMETER(CurrentThread);
+
+ //
+ // Get profile interval
+ //
+
+ if (sscanf(ArgumentString, "%ld", &ProfInt) < 1) {
+ (*Print)("Profile Interval must be specified\n");
+ return;
+ }
+
+ //
+ // Get the address of the profile interval
+ //
+
+ Address = (*GetExpression)(
+ "ProfInt"
+ );
+
+ if (Address) {
+ Status = WriteProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &ProfInt,
+ sizeof(ULONG),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ GetLastError();
+ (*Print)("Could not set profile interval");
+ }
+ }
+ return;
+}
+
+VOID
+ProfStartp(
+ IN HANDLE CurrentProcess,
+ IN HANDLE CurrentThread,
+ IN LPSTR ArgumentString
+ )
+/*++
+
+Routine Description:
+
+ This routine causes profiling to start the next
+ time ntvdm switches from 32 to 16 bit mode.
+
+
+Arguments:
+
+ CurrentProcess -- Supplies a handle to the current process
+ CurrentThread -- Supplies a handle to the current thread
+ ArgumentString -- Supplies a pointer to the commands argument string
+
+Return Value:
+
+ None.
+
+Notes:
+
+ This routine assumes that the pointers to the ntsd routines have already
+ been set up.
+
+--*/
+{
+ BOOL Status;
+ ULONG Address, BytesRead, Flags;
+
+ UNREFERENCED_PARAMETER(CurrentThread);
+
+ Address = FIXED_NTVDMSTATE_LINEAR;
+
+ //
+ // Get Flags
+ //
+
+ Status = ReadProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ (ULONG)Address = (*GetExpression)("ntvdm!InitialVdmTibFlags");
+ Status = ReadProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ GetLastError();
+ (*Print)("Could not get InitialTibflags\n");
+ return;
+ }
+ }
+
+ //
+ // Enable profiling
+ //
+
+ Flags |= VDM_PROFILE;
+
+ Status = WriteProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ GetLastError();
+ (*Print)("Could not get set Flags\n");
+ return;
+ }
+}
+
+VOID
+ProfStopp(
+ IN HANDLE CurrentProcess,
+ IN HANDLE CurrentThread,
+ IN LPSTR ArgumentString
+ )
+/*++
+
+Routine Description:
+
+ This routine causes profiling to stop the next
+ time ntvdm switches from 32 to 16 bit mode.
+
+
+Arguments:
+
+ CurrentProcess -- Supplies a handle to the current process
+ CurrentThread -- Supplies a handle to the current thread
+ ArgumentString -- Supplies a pointer to the commands argument string
+
+Return Value:
+
+ None.
+
+Notes:
+
+ This routine assumes that the pointers to the ntsd routines have already
+ been set up.
+
+--*/
+{
+ BOOL Status;
+ ULONG Address, BytesRead, Flags;
+
+ UNREFERENCED_PARAMETER(CurrentThread);
+
+ Address = FIXED_NTVDMSTATE_LINEAR;
+
+
+ //
+ // Get Flags
+ //
+
+ Status = ReadProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ (ULONG)Address = (*GetExpression)("ntvdm!InitialVdmTibFlags");
+ Status = ReadProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ GetLastError();
+ (*Print)("Could not get InitialTibflags\n");
+ return;
+ }
+ }
+
+ //
+ // Disable profiling
+ //
+
+ Flags &= ~VDM_PROFILE;
+
+ Status = WriteProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ GetLastError();
+ (*Print)("Could not get set VDM Flags in DOS arena\n");
+ return;
+ }
+}
diff --git a/private/mvdm/ieuvddex/i386/reflect.c b/private/mvdm/ieuvddex/i386/reflect.c
new file mode 100644
index 000000000..f69574998
--- /dev/null
+++ b/private/mvdm/ieuvddex/i386/reflect.c
@@ -0,0 +1,218 @@
+/*++
+
+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:
+
+--*/
+
+#include "ieuvddex.h"
+
+VOID
+Erp(
+ IN HANDLE CurrentProcess,
+ IN HANDLE CurrentThread,
+ IN LPSTR ArgumentString
+ )
+/*++
+
+Routine Description:
+
+ This routine toggles the exception reflection bit in the vdmtib, and
+ reports the current state
+
+Arguments:
+
+ CurrentProcess -- Supplies a handle to the process to dump selectors for
+ CurrentThread -- Supplies a handle to the thread to dump selectors for
+ ArgumentString -- Supplies the arguments to the !sel command
+
+Return Value:
+
+ None.
+
+--*/
+{
+ BOOL Status;
+ ULONG BytesRead;
+ PVOID Address;
+ ULONG Flags;
+
+ UNREFERENCED_PARAMETER(CurrentThread);
+ UNREFERENCED_PARAMETER(ArgumentString);
+
+ if ( fWinDbg ) {
+ (*Print)("This command is not supported under WinDbg\n");
+ } else {
+ Address = (PVOID) FIXED_NTVDMSTATE_LINEAR;
+
+ //
+ // Read the current value of the flags
+ //
+
+ Status = ReadProcessMem(
+ CurrentProcess,
+ Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ (ULONG)Address = (*GetExpression)("ntvdm!InitialVdmTibFlags");
+ Status = ReadProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ GetLastError();
+ (*Print)("Could not get InitialTibflags\n");
+ return;
+ }
+ }
+
+ //
+ // Toggle exception bit
+ //
+
+ Flags ^= VDM_BREAK_EXCEPTIONS;
+
+ Status = WriteProcessMem(
+ CurrentProcess,
+ Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ 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
+Drp(
+ IN HANDLE CurrentProcess,
+ IN HANDLE CurrentThread,
+ IN LPSTR ArgumentString
+ )
+/*++
+
+Routine Description:
+
+ This routine toggles the debug reflection bit in the vdmtib, and
+ reports the current state
+
+Arguments:
+
+ CurrentProcess -- Supplies a handle to the process to dump selectors for
+ CurrentThread -- Supplies a handle to the thread to dump selectors for
+ ArgumentString -- Supplies the arguments to the !sel command
+
+Return Value:
+
+ None.
+
+--*/
+{
+ BOOL Status;
+ ULONG BytesRead;
+ PVOID Address;
+ ULONG Flags;
+
+ UNREFERENCED_PARAMETER(CurrentThread);
+ UNREFERENCED_PARAMETER(ArgumentString);
+
+ if ( fWinDbg ) {
+ (*Print)("This command is not supported under WinDbg\n");
+ } else {
+ Address = (PVOID) FIXED_NTVDMSTATE_LINEAR;
+
+
+ //
+ // Read the current value of the flags
+ //
+
+ Status = ReadProcessMem(
+ CurrentProcess,
+ Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ (ULONG)Address = (*GetExpression)("ntvdm!InitialVdmTibFlags");
+ Status = ReadProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ GetLastError();
+ (*Print)("Could not get InitialTibflags\n");
+ return;
+ }
+ }
+ //
+ // Toggle exception bit
+ //
+
+ Flags ^= VDM_BREAK_DEBUGGER;
+
+ Status = WriteProcessMem(
+ CurrentProcess,
+ Address,
+ &Flags,
+ sizeof(ULONG),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(ULONG))) {
+ 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");
+ }
+ }
+}
diff --git a/private/mvdm/ieuvddex/i386/regs.c b/private/mvdm/ieuvddex/i386/regs.c
new file mode 100644
index 000000000..c4544dc72
--- /dev/null
+++ b/private/mvdm/ieuvddex/i386/regs.c
@@ -0,0 +1,150 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ Registers.c
+
+Abstract:
+
+ This module contains routines for manipulating registers.
+
+Author:
+
+ Dave Hastings (daveh) 1-Apr-1992
+
+Notes:
+
+ The routines in this module assume that the pointers to the ntsd
+ routines have already been set up.
+
+Revision History:
+
+--*/
+
+#include <ieuvddex.h>
+#include <stdio.h>
+
+VOID
+IntelRegistersp(
+ IN HANDLE CurrentProcess,
+ IN HANDLE CurrentThread,
+ IN LPSTR ArgumentString
+ )
+/*++
+
+Routine Description:
+
+ This routine dumps out the 16 bit register set from the vdmtib
+
+
+Arguments:
+
+ CurrentProcess -- Supplies a handle to the current process
+ CurrentThread -- Supplies a handle to the current thread
+ ArgumentString -- Supplies a pointer to the commands argument string
+
+Return Value:
+
+ None.
+
+Notes:
+
+ This routine assumes that the pointers to the ntsd routines have already
+ been set up.
+
+--*/
+{
+ BOOL Status;
+ ULONG Address, BytesRead;
+ CONTEXT IntelRegisters;
+
+ UNREFERENCED_PARAMETER(CurrentThread);
+
+ //
+ // Get the address of the VdmTib
+ //
+
+ if (sscanf(ArgumentString, "%lx", &Address) < 0) {
+ Address = (*GetExpression)(
+ "ntvdm!VdmTib"
+ );
+ }
+
+ if (!Address) {
+ (*Print)("Error geting VdmTib address\n");
+ return;
+ }
+
+ //
+ // Read the 16 bit context
+ //
+
+ Status = ReadProcessMem(
+ CurrentProcess,
+ &(((PVDM_TIB)Address)->VdmContext),
+ &IntelRegisters,
+ sizeof(CONTEXT),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(CONTEXT))) {
+ GetLastError();
+ (*Print)("Could not get VdmContext\n");
+ } else {
+ PrintContext(&IntelRegisters);
+ }
+}
+
+VOID
+PrintContext(
+ IN PCONTEXT Context
+ )
+/*++
+
+Routine Description:
+
+ This routine dumps out a context.
+
+Arguments:
+
+ Context -- Supplies a pointer to the context to dump
+
+Return Value:
+
+ None.
+
+--*/
+{
+ (*Print)(
+ "eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n",
+ Context->Eax,
+ Context->Ebx,
+ Context->Ecx,
+ Context->Edx,
+ Context->Esi,
+ Context->Edi
+ );
+
+ (*Print)(
+ "eip=%08lx esp=%08lx ebp=%08lx\n",
+ Context->Eip,
+ Context->Esp,
+ Context->Ebp
+ );
+
+ (*Print)(
+ "cs=%04x ss=%04x ds=%04x es=%04x fs=%04x gs=%04x eflags=%08x\n",
+ Context->SegCs,
+ Context->SegSs,
+ Context->SegDs,
+ Context->SegEs,
+ Context->SegFs,
+ Context->SegGs,
+ Context->EFlags
+ );
+}
+
+
+
diff --git a/private/mvdm/ieuvddex/i386/sources b/private/mvdm/ieuvddex/i386/sources
new file mode 100644
index 000000000..f3b2b1959
--- /dev/null
+++ b/private/mvdm/ieuvddex/i386/sources
@@ -0,0 +1,5 @@
+i386_SOURCES=i386\helpp.c \
+ i386\profile.c \
+ i386\reflect.c \
+ i386\regs.c \
+ i386\vdmtib.c
diff --git a/private/mvdm/ieuvddex/i386/vdmtib.c b/private/mvdm/ieuvddex/i386/vdmtib.c
new file mode 100644
index 000000000..67e7aeeb2
--- /dev/null
+++ b/private/mvdm/ieuvddex/i386/vdmtib.c
@@ -0,0 +1,322 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ Vdmtib.c
+
+Abstract:
+
+ This module contains routines for manipulating the vdmtib.
+
+Author:
+
+ Dave Hastings (daveh) 1-Apr-1992
+
+Notes:
+
+ The routines in this module assume that the pointers to the ntsd
+ routines have already been set up.
+
+Revision History:
+
+--*/
+
+#include <stdio.h>
+#include <ieuvddex.h>
+
+VOID
+VdmTibp(
+ IN HANDLE CurrentProcess,
+ IN HANDLE CurrentThread,
+ IN LPSTR ArgumentString
+ )
+/*++
+
+Routine Description:
+
+ This routine dumps out the contents of the register block, and
+ event info from the vdmtib. If no address is specified (normal case),
+ then the vdmtib is looked up (symbol VdmTib).
+
+Arguments:
+
+ CurrentProcess -- Supplies a handle to the current process
+ CurrentThread -- Supplies a handle to the current thread
+ ArgumentString -- Supplies a pointer to the commands argument string
+
+Return Value:
+
+ None.
+
+Notes:
+
+ This routine assumes that the pointers to the ntsd routines have already
+ been set up.
+
+--*/
+{
+ BOOL Status;
+ ULONG Address, BytesRead;
+ CONTEXT Context;
+ VDMEVENTINFO EventInfo;
+
+ UNREFERENCED_PARAMETER(CurrentThread);
+
+ //
+ // Get the address of the vdmtib
+ //
+ if (sscanf(ArgumentString,"%lx",&Address) < 0) {
+ Address = (*GetExpression)(
+ "ntvdm!VdmTib"
+ );
+ }
+
+ if (!Address) {
+ (*Print)("Error geting VdmTib address\n");
+ return;
+ }
+
+ //
+ // Get the 32 bit context and print it out
+ //
+
+ Status = ReadProcessMem(
+ CurrentProcess,
+ &(((PVDM_TIB)Address)->MonitorContext),
+ &Context,
+ sizeof(CONTEXT),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(CONTEXT))) {
+ GetLastError();
+ (*Print)("Could not get MonitorContext\n");
+ } else {
+ (*Print)("\n32 bit context\n");
+ PrintContext(&Context);
+ }
+
+ //
+ // Get the 16 bit context and print it out
+ //
+
+ Status = ReadProcessMem(
+ CurrentProcess,
+ &(((PVDM_TIB)Address)->VdmContext),
+ &Context,
+ sizeof(CONTEXT),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(CONTEXT))) {
+ GetLastError();
+ (*Print)("Could not get VdmContext\n");
+ } else {
+ (*Print)("\n16 bit context\n");
+ PrintContext(&Context);
+ }
+
+ //
+ // Get the event info and print it out
+ //
+
+ Status = ReadProcessMem(
+ CurrentProcess,
+ &(((PVDM_TIB)Address)->EventInfo),
+ &EventInfo,
+ sizeof(VDMEVENTINFO),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(VDMEVENTINFO))) {
+ GetLastError();
+ (*Print)("Could not get EventInfo\n");
+ } else {
+ (*Print)("\nEvent Info\n");
+ PrintEventInfo(&EventInfo);
+ }
+}
+
+VOID
+EventInfop(
+ IN HANDLE CurrentProcess,
+ IN HANDLE CurrentThread,
+ IN LPSTR ArgumentString
+ )
+/*++
+
+Routine Description:
+
+ This routine dumps the contents of an event info structure. If no
+ address is specifed (normal case), the event info from the Vdmtib is
+ dumped.
+
+Arguments:
+
+ CurrentProcess -- Supplies a handle to the current process
+ CurrentThread -- Supplies a handle to the current thread
+ ArgumentString -- Supplies a pointer to the commands argument string
+
+Return Value:
+
+ None.
+
+Notes:
+
+ This routine assumes that the pointers to the ntsd routines have already
+ been set up.
+
+--*/
+{
+ BOOL Status;
+ ULONG Address, BytesRead;
+ VDMEVENTINFO EventInfo;
+
+ UNREFERENCED_PARAMETER(CurrentThread);
+
+ //
+ // Get the address of the eventinfo
+ //
+ if (sscanf(ArgumentString,"%lx",&Address) < 0) {
+ Address = (*GetExpression)(
+ "ntvdm!VdmTib"
+ );
+ Address = (ULONG)(&(((PVDM_TIB)Address)->EventInfo));
+ }
+
+ if (!Address) {
+ (*Print)("Error geting VdmTib address\n");
+ return;
+ }
+
+ //
+ // Get the event info and print it out
+ //
+
+ Status = ReadProcessMem(
+ CurrentProcess,
+ (PVOID)Address,
+ &EventInfo,
+ sizeof(VDMEVENTINFO),
+ &BytesRead
+ );
+
+ if ((!Status) || (BytesRead != sizeof(VDMEVENTINFO))) {
+ GetLastError();
+ (*Print)("Could not get EventInfo\n");
+ } else {
+ (*Print)("\nEvent Info\n");
+ PrintEventInfo(&EventInfo);
+ }
+}
+
+VOID
+PrintEventInfo(
+ IN PVDMEVENTINFO EventInfo
+ )
+/*++
+
+Routine Description:
+
+ This routine prints out the contents of an event info structure
+
+Arguments:
+
+ EventInfo -- Supplies a pointer to the eventinfo
+
+Return Value:
+
+ None.
+
+--*/
+{
+ switch (EventInfo->Event) {
+ case VdmIO :
+
+ (*Print)("IO Instruction Event\n");
+
+ if (EventInfo->IoInfo.Read) {
+ (*Print)("Read from ");
+ } else {
+ (*Print)("Write to ");
+ }
+
+ switch (EventInfo->IoInfo.Size) {
+ case 1 :
+ (*Print)("Byte port ");
+ break;
+ case 2 :
+ (*Print)("Word port ");
+ break;
+ case 4 :
+ (*Print)("Dword port ");
+ break;
+ default:
+ (*Print)("Unknown size port ");
+ }
+
+ (*Print)(" number %x\n", EventInfo->IoInfo.PortNumber);
+ break;
+
+ case VdmStringIO :
+
+ (*Print)("String IO Instruction Event\n");
+
+ if (EventInfo->StringIoInfo.Read) {
+ (*Print)("Read from ");
+ } else {
+ (*Print)("Write to ");
+ }
+
+ switch (EventInfo->StringIoInfo.Size) {
+ case 1 :
+ (*Print)("Byte port ");
+ break;
+ case 2 :
+ (*Print)("Word port ");
+ break;
+ case 4 :
+ (*Print)("Dword port ");
+ break;
+ default:
+ (*Print)("Unknown size port ");
+ }
+
+ (*Print)(" number %x, ", EventInfo->StringIoInfo.PortNumber);
+ (*Print)(
+ " Count = %lx, Address = %lx\n",
+ EventInfo->StringIoInfo.Count,
+ EventInfo->StringIoInfo.Address
+ );
+ break;
+
+ case VdmIntAck :
+
+ (*Print)("Interrupt Acknowlege Event\n");
+ break;
+
+ case VdmBop:
+
+ (*Print)("Bop Event\n");
+ (*Print)("Bop number %x\n",EventInfo->BopNumber);
+ break;
+
+ case VdmError :
+
+ (*Print)("Error Event\n");
+ (*Print)("Error Status %lx\n",EventInfo->ErrorStatus);
+
+ case VdmIrq13 :
+
+ (*Print)("IRQ 13 Event\n");
+ break;
+
+ default:
+
+ (*Print)("Unknown Event %x\n",EventInfo->Event);
+
+ }
+
+}