|
|
1.1 ! root 1: /*++ ! 2: ! 3: Copyright (c) 1993 Microsoft Corporation ! 4: ! 5: Module Name: ! 6: ! 7: context.c ! 8: ! 9: Abstract: ! 10: ! 11: This file provides access to thread context information. ! 12: ! 13: Author: ! 14: ! 15: Wesley Witt (wesw) 1-May-1993 ! 16: ! 17: Environment: ! 18: ! 19: User Mode ! 20: ! 21: --*/ ! 22: ! 23: #include <windows.h> ! 24: #include <stdlib.h> ! 25: #include <stdio.h> ! 26: #include <string.h> ! 27: ! 28: #include "drwatson.h" ! 29: #include "proto.h" ! 30: ! 31: ! 32: void ! 33: GetContextForThread( PDEBUGPACKET dp ) ! 34: { ! 35: PTHREADCONTEXT ptctx = dp->tctx; ! 36: ! 37: memset(&ptctx->context,0,sizeof(CONTEXT)); ! 38: ! 39: ptctx->context.ContextFlags = CONTEXT_FULL; ! 40: ! 41: if (!GetThreadContext( ptctx->hThread, &ptctx->context )) { ! 42: lprintfs( ">>>>> GetThreadContext failed: err(%d), hthread(0x%x)\n", ! 43: GetLastError(), ptctx->hThread ); ! 44: ptctx->pc = 0; ! 45: ptctx->frame = 0; ! 46: ptctx->stack = 0; ! 47: ptctx->mi = NULL; ! 48: } ! 49: else { ! 50: ptctx->pc = ptctx->context.Fir; ! 51: ptctx->frame = ptctx->context.IntSp; ! 52: ptctx->stack = ptctx->context.IntSp; ! 53: ptctx->mi = GetModuleForPC( dp, ptctx->pc ); ! 54: } ! 55: ! 56: return; ! 57: } ! 58:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.