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.

156 lines
3.3 KiB

  1. /*
  2. * C V R O O T . H
  3. *
  4. * Extended virtual root information used in link fixup
  5. * and vroot enumeration
  6. *
  7. * Copyright 1986-1997 Microsoft Corporation, All Rights Reserved
  8. */
  9. #ifndef _CVROOT_H_
  10. #define _CVROOT_H_
  11. #include <buffer.h>
  12. #include <autoptr.h>
  13. // CVroot --------------------------------------------------------------------
  14. //
  15. class IMDData;
  16. class CVRoot : public CMTRefCounted
  17. {
  18. private:
  19. // Buffer for all of the string data that we own. Note that it is
  20. // declared before any of the string pointers because it must be
  21. // constructed first.
  22. //
  23. ChainedStringBuffer<WCHAR> m_sb;
  24. // VRoot metadata
  25. //
  26. auto_ref_ptr<IMDData> m_pMDData;
  27. // Real metabase path
  28. //
  29. LPCWSTR m_pwszMbPath;
  30. // Wide copy of the virtual root's physical path
  31. //
  32. auto_heap_ptr<WCHAR> m_pwszVRPath;
  33. UINT m_cchVRPath;
  34. // Calculated values from the metadata
  35. //
  36. LPCWSTR m_pwszVRoot;
  37. UINT m_cchVRoot;
  38. LPCWSTR m_pwszServer;
  39. UINT m_cchServer;
  40. LPCWSTR m_pwszPort;
  41. UINT m_cchPort;
  42. BOOL m_fDefaultPort;
  43. BOOL m_fSecure;
  44. // NOT IMPLEMENTED
  45. //
  46. CVRoot& operator=(const CVRoot&);
  47. CVRoot(const CVRoot&);
  48. public:
  49. CVRoot( LPCWSTR pwszMetaUrl,
  50. UINT cchMetaUrlPrefix,
  51. UINT cchServerDefault,
  52. LPCWSTR pwszServerDefault,
  53. IMDData* pMDData );
  54. UINT CchPrefixOfMetabasePath (LPCWSTR* ppwsz) const
  55. {
  56. Assert (ppwsz);
  57. *ppwsz = m_pwszMbPath;
  58. return static_cast<UINT>(m_pwszVRoot - m_pwszMbPath);
  59. }
  60. UINT CchGetServerName (LPCWSTR* ppwsz) const
  61. {
  62. Assert (ppwsz);
  63. *ppwsz = m_pwszServer;
  64. return m_cchServer;
  65. }
  66. UINT CchGetPort (LPCWSTR* ppwsz) const
  67. {
  68. Assert (ppwsz);
  69. *ppwsz = m_pwszPort;
  70. return m_cchPort;
  71. }
  72. UINT CchGetVRoot (LPCWSTR* ppwsz) const
  73. {
  74. Assert (ppwsz);
  75. *ppwsz = m_pwszVRoot;
  76. return m_cchVRoot;
  77. }
  78. UINT CchGetVRPath (LPCWSTR* ppwsz) const
  79. {
  80. Assert (ppwsz);
  81. *ppwsz = m_pwszVRPath;
  82. return m_cchVRPath;
  83. }
  84. BOOL FSecure () const { return m_fSecure; }
  85. BOOL FDefaultPort () const { return m_fDefaultPort; }
  86. const IMDData * MetaData() const { return m_pMDData.get(); }
  87. };
  88. // CVroot List ---------------------------------------------------------------
  89. //
  90. // Use pragmas to disable the specific level 4 warnings
  91. // that appear when we use the STL. One would hope our version of the
  92. // STL compiles clean at level 4, but alas it doesn't....
  93. //
  94. #pragma warning(disable:4663) // C language, template<> syntax
  95. #pragma warning(disable:4244) // return conversion, data loss
  96. // Turn this warning off for good.
  97. //
  98. #pragma warning(disable:4786) // symbol truncated in debug info
  99. // Put STL includes here
  100. //
  101. #include <list>
  102. // Turn warnings back on
  103. //
  104. #pragma warning(default:4663) // C language, template<> syntax
  105. #pragma warning(default:4244) // return conversion, data loss
  106. class CSortableStrings
  107. {
  108. public:
  109. LPCWSTR m_pwsz;
  110. CSortableStrings(LPCWSTR pwsz = NULL)
  111. : m_pwsz(pwsz)
  112. {
  113. }
  114. // operators for use with list::sort
  115. //
  116. BOOL operator<( const CSortableStrings& rhs ) const
  117. {
  118. if (_wcsicmp( m_pwsz, rhs.m_pwsz ) < 0)
  119. return TRUE;
  120. return FALSE;
  121. }
  122. };
  123. typedef std::list<CSortableStrings, heap_allocator<CSortableStrings> > CVRList;
  124. #endif // _CVROOT_H_