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.

107 lines
2.7 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 __GIP_H__
  11. #define __GIP_H__
  12. /*===================================================================
  13. Includes
  14. ===================================================================*/
  15. #include <irtldbg.h>
  16. #include <objidl.h>
  17. /*===================================================================
  18. Defines
  19. ===================================================================*/
  20. #define NULL_GIP_COOKIE 0xFFFFFFFF
  21. /*===================================================================
  22. C G l o b a l I n t e r f a c e A P I
  23. ===================================================================*/
  24. class dllexp CGlobalInterfaceAPI
  25. {
  26. private:
  27. // Is inited?
  28. DWORD m_fInited : 1;
  29. // Pointer to the COM object
  30. IGlobalInterfaceTable *m_pGIT;
  31. public:
  32. CGlobalInterfaceAPI();
  33. ~CGlobalInterfaceAPI();
  34. HRESULT Init();
  35. HRESULT UnInit();
  36. // inlines for the real API calls:
  37. HRESULT Register(IUnknown *pUnk, REFIID riid, DWORD *pdwCookie);
  38. HRESULT Get(DWORD dwCookie, REFIID riid, void **ppv);
  39. HRESULT Revoke(DWORD dwCookie);
  40. public:
  41. #ifdef _DEBUG
  42. inline void AssertValid() const
  43. {
  44. IRTLASSERT(m_fInited);
  45. IRTLASSERT(m_pGIT);
  46. }
  47. #else
  48. inline void AssertValid() const {}
  49. #endif
  50. };
  51. /*===================================================================
  52. CGlobalInterfaceAPI inlines
  53. ===================================================================*/
  54. inline HRESULT CGlobalInterfaceAPI::Register(
  55. IUnknown *pUnk,
  56. REFIID riid,
  57. DWORD *pdwCookie)
  58. {
  59. IRTLASSERT(m_fInited);
  60. IRTLASSERT(m_pGIT);
  61. return m_pGIT->RegisterInterfaceInGlobal(pUnk, riid, pdwCookie);
  62. }
  63. inline HRESULT CGlobalInterfaceAPI::Get(
  64. DWORD dwCookie,
  65. REFIID riid,
  66. void **ppv)
  67. {
  68. IRTLASSERT(m_fInited);
  69. IRTLASSERT(m_pGIT);
  70. return m_pGIT->GetInterfaceFromGlobal(dwCookie, riid, ppv);
  71. }
  72. inline HRESULT CGlobalInterfaceAPI::Revoke(
  73. DWORD dwCookie)
  74. {
  75. IRTLASSERT(m_fInited);
  76. IRTLASSERT(m_pGIT);
  77. return m_pGIT->RevokeInterfaceFromGlobal(dwCookie);
  78. }
  79. /*===================================================================
  80. Globals
  81. ===================================================================*/
  82. extern CGlobalInterfaceAPI g_GIPAPI;
  83. #endif // __GIP_H__