Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
4.7 KiB

  1. /********************************************************************
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. PCH_SystemHook.H
  5. Abstract:
  6. WBEM provider class definition for PCH_SystemHook class
  7. Revision History:
  8. Ghim-Sim Chua (gschua) 05/05/99
  9. - Created
  10. ********************************************************************/
  11. // Property set identification
  12. //============================
  13. #ifndef _PCH_SystemHook_H_
  14. #define _PCH_SystemHook_H_
  15. #define PROVIDER_NAME_PCH_SYSTEMHOOK "PCH_SystemHook"
  16. // Property name externs -- defined in PCH_SystemHook.cpp
  17. //=================================================
  18. extern const WCHAR* pApplication ;
  19. extern const WCHAR* pApplicationPath ;
  20. extern const WCHAR* pDLLPath ;
  21. extern const WCHAR* pFullPath ;
  22. extern const WCHAR* pHookedBy ;
  23. extern const WCHAR* pHookType ;
  24. class CPCH_SystemHook : public Provider
  25. {
  26. public:
  27. // Constructor/destructor
  28. //=======================
  29. CPCH_SystemHook(const CHString& chsClassName, LPCWSTR lpszNameSpace) : Provider(chsClassName, lpszNameSpace) {};
  30. virtual ~CPCH_SystemHook() {};
  31. protected:
  32. // Reading Functions
  33. //============================
  34. virtual HRESULT EnumerateInstances(MethodContext* pMethodContext, long lFlags = 0L);
  35. virtual HRESULT GetObject(CInstance* pInstance, long lFlags = 0L) { return (WBEM_E_PROVIDER_NOT_CAPABLE); };
  36. virtual HRESULT ExecQuery(MethodContext *pMethodContext, CFrameworkQuery& Query, long lFlags = 0L) { return (WBEM_E_PROVIDER_NOT_CAPABLE); };
  37. // Writing Functions
  38. //============================
  39. virtual HRESULT PutInstance(const CInstance& Instance, long lFlags = 0L) { return (WBEM_E_PROVIDER_NOT_CAPABLE); };
  40. virtual HRESULT DeleteInstance(const CInstance& Instance, long lFlags = 0L) { return (WBEM_E_PROVIDER_NOT_CAPABLE); };
  41. // Other Functions
  42. virtual HRESULT ExecMethod( const CInstance& Instance,
  43. const BSTR bstrMethodName,
  44. CInstance *pInParams,
  45. CInstance *pOutParams,
  46. long lFlags = 0L ) { return (WBEM_E_PROVIDER_NOT_CAPABLE); };
  47. } ;
  48. //-----------------------------------------------------------------------------
  49. // There are a bunch of macros and type definitions used by the Dr. Watson
  50. // code, which are included here. There's also a lot we use from hook.c.
  51. //-----------------------------------------------------------------------------
  52. // Various macros used by the Dr. Watson source code.
  53. #define cbX(X) sizeof(X)
  54. #define cA(a) (cbX(a)/cbX(a[0]))
  55. #define ZeroBuf(pv, cb) memset(pv, 0, cb)
  56. #define ZeroX(x) ZeroBuf(&(x), cbX(x))
  57. #define PV LPVOID
  58. #define pvAddPvCb(pv, cb) ((PV)((PBYTE)pv + (cb)))
  59. // A few constants used in this code.
  60. #define HK_MAGIC 0x4B48 /* "HK" */
  61. #define HOOK_32BIT 0x0002 /* 32-bit hook */
  62. // Type definitons used in the hook code from Dr. Watson.
  63. typedef WORD HMODULE16;
  64. typedef struct Q16
  65. {
  66. WORD hqNext; /* Pointer to next */
  67. WORD htask; /* Owner task */
  68. } Q16, *PQ16;
  69. typedef struct HOOKWALKINFO
  70. {
  71. int ihkShellShell; /* Last shell hook installed by shell */
  72. } HOOKWALKINFO, *PHOOKWALKINFO;
  73. typedef struct HOOKINFO
  74. {
  75. int iHook; /* Hook number */
  76. char szHookDll[MAX_PATH];/* Who hooked it? (must be >= 256 bytes) */
  77. char szHookExe[MAX_PATH];/* Whose idea was it? */
  78. } HOOKINFO, *PHOOKINFO;
  79. typedef struct HOOK16
  80. {
  81. WORD hkMagic; /* Must be HK_MAGIC */
  82. WORD phkNext; /* Near pointer to next (or 0) */
  83. short idHook; /* Hook type */
  84. WORD ppiCreator; /* App which created the hook */
  85. WORD hq; /* Queue for which hook applies */
  86. WORD hqCreator; /* Queue which created the hook */
  87. WORD uiFlags; /* Flags */
  88. WORD atomModule; /* If 32-bit module, atom for DLL name */
  89. DWORD hmodOwner; /* Module handle of owner */
  90. FARPROC lpfn; /* The hook procedure itself */
  91. short cCalled; /* Number of active calls */
  92. } HOOK16, *PHOOK16;
  93. extern "C"
  94. {
  95. // External functions.
  96. int NTAPI GetModuleFileName16(HMODULE16 hmod, LPSTR sz, int cch);
  97. DWORD NTAPI GetUserHookTable(void);
  98. WINBASEAPI void WINAPI EnterSysLevel(PV pvCrst);
  99. WINBASEAPI void WINAPI LeaveSysLevel(PV pvCrst);
  100. WINBASEAPI LPVOID WINAPI MapSL(LPVOID);
  101. UINT GetUserAtomName(UINT atom, LPSTR psz);
  102. // Global variables defined in thunk.c
  103. extern LPVOID g_pvWin16Lock;
  104. HINSTANCE g_hinstUser;
  105. }
  106. void NTAPI PathAdjustCase(LPSTR psz, BOOL f16);
  107. #endif