home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / Chapt_03 / Fosterer / Extension.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-11  |  2.4 KB  |  83 lines

  1. #pragma once
  2.  
  3. //-----------------------------------------------------------------------------------//
  4. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  5. //                             ISBN  0-13-086985-6                                   //
  6. //                                                                                   //
  7. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  8. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  9. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  10. //                                                                                   //
  11. //  FileName   : extension.h                                                         //
  12. //  Description: Interface with debugger extension                                   //
  13. //  Version    : 1.00.000, May 31, 2000                                              //
  14. //-----------------------------------------------------------------------------------//
  15.  
  16. #define FreeBuild    0x0F
  17. #define CheckedBuild 0x0C
  18.  
  19. #define MajorVersion FreeBuild
  20.  
  21. typedef 
  22. VOID (_stdcall * ExtensionRoutine)
  23.     (HANDLE                 hCurrentProcess,
  24.         HANDLE                 hCurrentThread,
  25.         ULONG                  dwCurrentPc,   
  26.         ULONG                  dwProcessor,   
  27.         PCSTR                  args           
  28.      );
  29.  
  30. class KExtensionRoutine
  31. {
  32.     const char      * m_funcname;
  33.     ExtensionRoutine  m_funcaddr;
  34.  
  35. public:
  36.     KExtensionRoutine()
  37.     {
  38.         m_funcname = NULL;
  39.         m_funcaddr = NULL;
  40.     }
  41.  
  42.     bool Attach(HINSTANCE hModule, const char * name);
  43.     bool Help(void);
  44.     bool Call(const char * args, HANDLE proc=NULL, HANDLE thread=NULL, ULONG pc=0, ULONG processor=1);
  45. };
  46.  
  47. class KGDIExtension
  48. {
  49.     HANDLE    m_hProcess;
  50.     HANDLE    m_hThread;
  51.     ULONG     m_dwcurrentPc;
  52.     ULONG     m_dwProcessor;
  53.  
  54.     HINSTANCE hGDI;
  55.  
  56. public:   
  57.  
  58.     KGDIExtension(void)
  59.     {
  60.         hGDI = NULL;
  61.  
  62.         m_hProcess    = 0;
  63.         m_hThread     = 0;
  64.         m_dwcurrentPc = 0;
  65.         m_dwProcessor = 1;
  66.     }
  67.    
  68.     bool Load(const void * ExtensionAPI, const char * filename);
  69.  
  70.     bool Do(const char * command);
  71.  
  72.     ~KGDIExtension()
  73.     {
  74.         if ( hGDI)
  75.             FreeLibrary(hGDI);
  76.     }
  77.  
  78.     void SetProcess(HANDLE process)
  79.     {
  80.         m_hProcess = process;
  81.     }
  82. };
  83.