Annotation of mstools/samples/sdktools/image/drwatson/i386/context.c, revision 1.1.1.1

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:                                   CONTEXT_FLOATING_POINT |
                     41:                                   CONTEXT_DEBUG_REGISTERS;
                     42: 
                     43:     if (!GetThreadContext( ptctx->hThread, &ptctx->context )) {
                     44:         lprintfs( ">>>>> GetThreadContext failed: err(%d), hthread(0x%x)\n",
                     45:                   GetLastError(), ptctx->hThread );
                     46:         ptctx->pc = 0;
                     47:         ptctx->frame = 0;
                     48:         ptctx->stack = 0;
                     49:         ptctx->mi = NULL;
                     50:     }
                     51:     else {
                     52:         ptctx->pc = ptctx->context.Eip;
                     53:         ptctx->frame = ptctx->context.Ebp;
                     54:         ptctx->stack = ptctx->context.Esp;
                     55:         ptctx->mi = GetModuleForPC( dp, ptctx->pc );
                     56:     }
                     57: 
                     58:     return;
                     59: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.