home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / Chapt_04 / Pogy / ApiTable.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-11  |  2.9 KB  |  113 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   : apitable.h                                                             //
  12. //  Description: KApiTable class                                                     //
  13. //  Version    : 1.00.000, May 31, 2000                                              //
  14. //-----------------------------------------------------------------------------------//
  15.  
  16. #include "..\..\include\Profile.h"
  17. #include "..\..\include\atom.h"
  18.  
  19. class KMethod
  20. {
  21. public:
  22.     void *           pFunction;
  23.  
  24.     unsigned short nOpt;
  25.     short           nInterface;
  26.     short           nSysCallId;
  27.     short           nParaNo;
  28.     
  29.     ATOM           aMethodName;
  30.     ATOM           aParaName; // type1 type2 type3 .. typen
  31. };
  32.  
  33.  
  34. class KInterface
  35. {
  36. public:
  37.     ATOM      aCaller;
  38.     ATOM      aCallee;
  39.     ATOM      aInterface;
  40.  
  41.     unsigned  vTable;
  42.     unsigned  pQueryInterface;
  43.     int          nMethodNo;
  44.     GUID      iid;
  45. };
  46.  
  47.  
  48. class KTarget : public KAtomTable
  49. {
  50.     typedef enum
  51.     { 
  52.         INTERFACETABLESIZE = 64,
  53.         METHODTABLESIZE    = 1024
  54.     }; 
  55.     
  56.     KInterface  InterfaceTable[INTERFACETABLESIZE];
  57.     int            InterfaceTable_nElement;
  58.  
  59.     KMethod        MethodTable[METHODTABLESIZE];
  60.     int            MethodTable_nElement;
  61.  
  62. public:
  63.     KTarget()
  64.     {
  65.         InterfaceTable_nElement = 0;
  66.            MethodTable_nElement = 0;
  67.     }
  68.  
  69.     TCHAR TargetName[64];
  70.  
  71.     int  ParseAPISet(HINSTANCE hInstance, const char * szAPISetName, KMethod & Method);
  72.  
  73.     BOOL ParseMethod(KProfile & Profile, KMethod & Method);
  74.     BOOL ParseInterface(KProfile & Profile, KMethod & Win32Method);
  75.  
  76.     void Initialize(HINSTANCE hInstance, const TCHAR *Target, const TCHAR *ProjectFile);
  77.     int  Add2ListView(KListView & listview);
  78.     int  InterceptTarget(HWND hSender, HWND hReceiver, BOOL logcall, BOOL dispcall);
  79.     
  80. };
  81.  
  82.  
  83. const int MAXTARGETNO = 10;
  84.  
  85. class KApiTable
  86. {
  87.     KTarget * TargetList[MAXTARGETNO];    
  88.     int       TargetNo;
  89.     
  90.     void ClearTargets(void);
  91.  
  92. public:
  93.  
  94.     KApiTable()
  95.     {
  96.         TargetNo = 0;
  97.     }
  98.  
  99.     ~KApiTable()
  100.     {
  101.         ClearTargets();
  102.     }
  103.  
  104.     const TCHAR *MainTarget(void);
  105.  
  106.     int Add2ListView(KListView & listview);
  107.     int AddTargets(HINSTANCE hInstance, HWND hWnd);
  108.     
  109.     int Initialize(HINSTANCE hInstance, int projno);
  110.     int InterceptApi(HWND hSender, HWND hReceiver, BOOL logcall, BOOL dispcall);
  111. };
  112.  
  113.