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.

108 lines
2.4 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.cpp
  7. Owner: DmitryR
  8. This is the GIP source file.
  9. ===================================================================*/
  10. #include "isapip.hxx"
  11. #include "gip.h"
  12. /*===================================================================
  13. Globals
  14. ===================================================================*/
  15. CGlobalInterfaceAPI g_GIPAPI;
  16. /*===================================================================
  17. C G l o b a l I n t e r f a c e A P I
  18. ===================================================================*/
  19. /*===================================================================
  20. CGlobalInterfaceAPI::CGlobalInterfaceAPI
  21. CGlobalInterfaceAPI constructor
  22. Parameters:
  23. Returns:
  24. ===================================================================*/
  25. CGlobalInterfaceAPI::CGlobalInterfaceAPI()
  26. : m_fInited(FALSE), m_pGIT(NULL)
  27. {
  28. }
  29. /*===================================================================
  30. CGlobalInterfaceAPI::~CGlobalInterfaceAPI
  31. CGlobalInterfaceAPI destructor
  32. Parameters:
  33. Returns:
  34. ===================================================================*/
  35. CGlobalInterfaceAPI::~CGlobalInterfaceAPI()
  36. {
  37. UnInit();
  38. }
  39. /*===================================================================
  40. CGlobalInterfaceAPI::Init
  41. Creates instance of GlobalInterfaceTable
  42. Parameters:
  43. Returns:
  44. HRESULT
  45. ===================================================================*/
  46. HRESULT CGlobalInterfaceAPI::Init()
  47. {
  48. DBG_ASSERT(!m_fInited); // don't init twice
  49. HRESULT hr = CoCreateInstance
  50. (
  51. CLSID_StdGlobalInterfaceTable,
  52. NULL,
  53. CLSCTX_INPROC_SERVER,
  54. IID_IGlobalInterfaceTable,
  55. (void **)&m_pGIT
  56. );
  57. if (SUCCEEDED(hr))
  58. m_fInited = TRUE;
  59. else
  60. m_pGIT = NULL;
  61. return hr;
  62. }
  63. /*===================================================================
  64. CGlobalInterfaceAPI::UnInit
  65. Releases instance of GlobalInterfaceTable
  66. Parameters:
  67. Returns:
  68. HRESULT (NOERROR)
  69. ===================================================================*/
  70. HRESULT CGlobalInterfaceAPI::UnInit()
  71. {
  72. if (m_pGIT)
  73. {
  74. m_pGIT->Release();
  75. m_pGIT = NULL;
  76. }
  77. m_fInited = FALSE;
  78. return NOERROR;
  79. }