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.

91 lines
1.8 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1993 **/
  4. /**********************************************************************/
  5. /*
  6. metabase.cxx
  7. This module contains a class that supports openning the metabase
  8. and keeping it open for the life of the IISAdmin Service.
  9. FILE HISTORY:
  10. emilyk - created
  11. */
  12. #include <dbgutil.h>
  13. #include <imd.h>
  14. #include "iisadminmb.hxx"
  15. /***************************************************************************++
  16. Routine Description:
  17. Opens the metabase and initializes it.
  18. Arguments:
  19. None.
  20. Return Value:
  21. HRESULT.
  22. --***************************************************************************/
  23. HRESULT
  24. CIISAdminMB::InitializeMetabase(
  25. )
  26. {
  27. HRESULT hr = S_OK;
  28. hr = CoCreateInstance( CLSID_MDCOM, NULL, CLSCTX_SERVER, IID_IMDCOM, (void**) &m_pMdObject);
  29. if( SUCCEEDED( hr ) )
  30. {
  31. hr = m_pMdObject->ComMDInitialize();
  32. if( FAILED( hr ) )
  33. {
  34. DBGPRINTF(( DBG_CONTEXT,
  35. "Error initialize MDCOM object. hr = %x\n",
  36. hr ));
  37. m_pMdObject->Release();
  38. m_pMdObject = NULL;
  39. goto exit;
  40. }
  41. }
  42. exit:
  43. return hr;
  44. }
  45. /***************************************************************************++
  46. Routine Description:
  47. Closes the metabase.
  48. Arguments:
  49. None.
  50. Return Value:
  51. None.
  52. --***************************************************************************/
  53. VOID
  54. CIISAdminMB::TerminateMetabase(
  55. )
  56. {
  57. if( m_pMdObject )
  58. {
  59. m_pMdObject->ComMDTerminate(FALSE);
  60. m_pMdObject->Release();
  61. m_pMdObject = NULL;
  62. }
  63. }