Source code of Windows XP (NT5)
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.

112 lines
2.5 KiB

  1. /*===================================================================
  2. Microsoft Denali
  3. Microsoft Confidential.
  4. Copyright 1997 Microsoft Corporation. All Rights Reserved.
  5. Component: Global Interface Pointer API support
  6. File: Gip.h
  7. Owner: DmitryR
  8. This is the GIP header file.
  9. ===================================================================*/
  10. #ifndef _ASP_GIP_H
  11. #define _ASP_GIP_H
  12. /*===================================================================
  13. Includes
  14. ===================================================================*/
  15. #include "debug.h"
  16. /*===================================================================
  17. Defines
  18. ===================================================================*/
  19. #define NULL_GIP_COOKIE 0xFFFFFFFF
  20. /*===================================================================
  21. C G l o b a l I n t e r f a c e A P I
  22. ===================================================================*/
  23. class CGlobalInterfaceAPI
  24. {
  25. private:
  26. // Is inited?
  27. DWORD m_fInited : 1;
  28. // Pointer to the COM object
  29. IGlobalInterfaceTable *m_pGIT;
  30. public:
  31. CGlobalInterfaceAPI();
  32. ~CGlobalInterfaceAPI();
  33. HRESULT Init();
  34. HRESULT UnInit();
  35. // inlines for the real API calls:
  36. HRESULT Register(IUnknown *pUnk, REFIID riid, DWORD *pdwCookie);
  37. HRESULT Get(DWORD dwCookie, REFIID riid, void **ppv);
  38. HRESULT Revoke(DWORD dwCookie);
  39. public:
  40. #ifdef DBG
  41. inline void AssertValid() const
  42. {
  43. Assert(m_fInited);
  44. Assert(m_pGIT);
  45. }
  46. #else
  47. inline void AssertValid() const {}
  48. #endif
  49. };
  50. /*===================================================================
  51. CGlobalInterfaceAPI inlines
  52. ===================================================================*/
  53. inline HRESULT CGlobalInterfaceAPI::Register
  54. (
  55. IUnknown *pUnk,
  56. REFIID riid,
  57. DWORD *pdwCookie
  58. )
  59. {
  60. Assert(m_fInited);
  61. Assert(m_pGIT);
  62. return m_pGIT->RegisterInterfaceInGlobal(pUnk, riid, pdwCookie);
  63. }
  64. inline HRESULT CGlobalInterfaceAPI::Get
  65. (
  66. DWORD dwCookie,
  67. REFIID riid,
  68. void **ppv
  69. )
  70. {
  71. Assert(m_fInited);
  72. Assert(m_pGIT);
  73. return m_pGIT->GetInterfaceFromGlobal(dwCookie, riid, ppv);
  74. }
  75. inline HRESULT CGlobalInterfaceAPI::Revoke
  76. (
  77. DWORD dwCookie
  78. )
  79. {
  80. Assert(m_fInited);
  81. Assert(m_pGIT);
  82. return m_pGIT->RevokeInterfaceFromGlobal(dwCookie);
  83. }
  84. /*===================================================================
  85. Globals
  86. ===================================================================*/
  87. extern CGlobalInterfaceAPI g_GIPAPI;
  88. #endif