/*----------------------------------------------------------------------------- Copyright (c) 2000 Microsoft Corporation Module: exts.c Sample old windbg style interface using extension ------------------------------------------------------------------------------*/ #include "simple.h" // // Extension to read and dump dwords from target // DECLARE_API( read ) { ULONG cb; ULONG64 Address; ULONG Buffer[4]; Address = GetExpression(args); // Read and display first 4 dwords at Address if (ReadMemory(Address, &Buffer, sizeof(Buffer), &cb) && cb == sizeof(Buffer)) { dprintf("%I64lx: %08lx %08lx %08lx %08lx\n\n", Address, Buffer[0], Buffer[1], Buffer[2], Buffer[3]); } } // // Extension to edit a dword on target // // !edit
// DECLARE_API( edit ) { ULONG cb; ULONG64 Address; ULONG Value; if (GetExpressionEx(args, &Address, &args)) { Value = (ULONG) GetExpression( args); } else { dprintf("Usage: !edit
\n"); return; } // Read and display first 4 dwords at Address if (WriteMemory(Address, &Value, sizeof(Value), &cb) && cb == sizeof(Value)) { dprintf("%I64lx: %08lx\n", Address, Value); } } // // Extension to dump stacktrace // DECLARE_API ( stack ) { EXTSTACKTRACE64 stk[20]; ULONG frames, i; CHAR Buffer[256]; ULONG64 displacement; // Get stacktrace for surrent thread frames = StackTrace( 0, 0, 0, stk, 20 ); if (!frames) { dprintf("Stacktrace failed\n"); } for (i=0; i - It reads and dumps 4 dwords at \n" " edit - It modifies a dword value to at \n" " stack - Printd current stack trace\n" " help - Shows this help\n" ); }