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.

122 lines
3.6 KiB

  1. /*
  2. ****************************************************************************
  3. | Copyright (C) 2002 Microsoft Corporation
  4. |
  5. | Component / Subcomponent
  6. | IIS 6.0 / IIS Migration Wizard
  7. |
  8. | Based on:
  9. | http://iis6/Specs/IIS%20Migration6.0_Final.doc
  10. |
  11. | Abstract:
  12. | IIS Metabase interface helper
  13. |
  14. | Author:
  15. | ivelinj
  16. |
  17. | Revision History:
  18. | V1.00 March 2002
  19. |
  20. ****************************************************************************
  21. */
  22. #pragma once
  23. #include "Wrappers.h"
  24. // Class for an IIS Web Site
  25. class CIISSite
  26. {
  27. // Data types
  28. private:
  29. enum
  30. {
  31. KeyAccessTimeout = 2000 // 2sec
  32. };
  33. public:
  34. CIISSite ( ULONG nSiteID, bool bReadOnly = true );
  35. ~CIISSite ( void );
  36. // Class Interface
  37. public:
  38. void Close ( void );
  39. void AddKey ( LPCWSTR wszKey )const;
  40. void ExportConfig ( const IXMLDOMDocumentPtr& spDoc,
  41. const IXMLDOMElementPtr& spRoot,
  42. HCRYPTKEY hEncryptKey )const;
  43. void ExportCert ( const IXMLDOMDocumentPtr& spDoc,
  44. const IXMLDOMElementPtr& spRoot,
  45. LPCWSTR wszPassword )const;
  46. void ImportConfig ( const IXMLDOMNodePtr& spSite,
  47. HCRYPTKEY hDecryptKey,
  48. bool bImportInherited )const;
  49. const std::wstring GetDisplayName ( void )const;
  50. const std::wstring GetAnonUser ( void )const;
  51. bool HaveCertificate ( void )const;
  52. static void BackupMetabase ( LPCWSTR wszLocation = NULL );
  53. static DWORD CreateNew ( DWORD dwHint = 1 );
  54. static void DeleteSite ( DWORD dwSiteID );
  55. static const std::wstring GetDefaultAnonUser( void );
  56. // Implementation
  57. private:
  58. void SetKeyData ( LPCWSTR wszPath,
  59. DWORD dwID,
  60. DWORD dwUserType,
  61. LPCWSTR wszData )const;
  62. void ExportKey ( const IXMLDOMDocumentPtr& spDoc,
  63. const IXMLDOMElementPtr& spRoot,
  64. HCRYPTKEY hCryptKey,
  65. LPCWSTR wszNodePath,
  66. TByteAutoPtr& rspBuffer,
  67. DWORD& rdwBufferSize )const;
  68. void ExportInheritData ( const IXMLDOMDocumentPtr& spXMLDoc,
  69. const IXMLDOMElementPtr& spInheritRoot,
  70. HCRYPTKEY hEncryptKey,
  71. TByteAutoPtr& rspBuffer,
  72. DWORD& rdwBufferSize )const;
  73. void ExportKeyData ( const IXMLDOMDocumentPtr& spDoc,
  74. const IXMLDOMElementPtr& spKey,
  75. HCRYPTKEY hCryptKey,
  76. LPCWSTR wszNodePath,
  77. TByteAutoPtr& rspBuffer,
  78. DWORD& rdwBufferSize )const;
  79. void ExportMetaRecord ( const IXMLDOMDocumentPtr& spDoc,
  80. const IXMLDOMElementPtr& spKey,
  81. HCRYPTKEY hCryptKey,
  82. const METADATA_GETALL_RECORD& Data,
  83. void* pvData )const;
  84. void RemoveLocalMetadata ( const IXMLDOMElementPtr& spRoot )const;
  85. void ImportMetaValue ( const IXMLDOMNodePtr& spValue,
  86. LPCWSTR wszLocation,
  87. HCRYPTKEY hDecryptKey )const;
  88. void DecryptData ( HCRYPTKEY hDecryptKey,
  89. LPWSTR wszData )const;
  90. const TCertContextHandle GetCert ( void )const;
  91. void ChainCertificate ( PCCERT_CONTEXT hCert, HCERTSTORE hStore )const;
  92. // Conversion helpers
  93. void MultiStrToString ( LPWSTR wszData )const;
  94. void XMLToMultiSz ( CComBSTR& bstrData, DWORD& rdwSize )const;
  95. // Data members
  96. private:
  97. METADATA_HANDLE m_hSiteHandle;
  98. IMSAdminBasePtr m_spIABO;
  99. // Restricted
  100. private:
  101. CIISSite( const CIISSite& );
  102. void operator =( const CIISSite& );
  103. };