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.

198 lines
6.2 KiB

  1. /*++
  2. Copyright (C) 1996-2000 Microsoft Corporation
  3. Module Name:
  4. EXPORT.H
  5. Abstract:
  6. Exporting
  7. History:
  8. --*/
  9. #ifndef __export_h__
  10. #define __export_h__
  11. /*================================================================================
  12. *
  13. * EXPORT FILE FORMAT
  14. * ==================
  15. *
  16. * File Header Block:
  17. * wchar_t wszFileHeader = REP_EXPORT_FILE_START_TAG ("repexp2")
  18. *
  19. * Namespace Block:
  20. * DWORD dwObjectType = REP_EXPORT_NAMESPACE_TAG (0x00000001)
  21. * DWORD dwNamespaceNameSize
  22. * wchar_t wszNamespaceName[dwNamespaceNameSize] = Full namespace name
  23. * (\root\default\fred)
  24. *
  25. * Class Block:
  26. * DWORD dwObjectType = REP_EXPORT_CLASS_TAG (0x00000002)
  27. * DWORD dwClassNameSize
  28. * wchar_t wszClassName[dwClassNameSize] = Class name (my_class_name)
  29. * DWORD dwClassObjectSize
  30. * DWORD adwClassObject[dwClassObjectSize]
  31. *
  32. * Instance Block - key of type int:
  33. * DWORD dwObjectType = REP_EXPORT_INST_INT_TAG (0x00000003)
  34. * DWORD dwInstanceKey
  35. * DWORD dwInstanceObjectSize
  36. * DWORD adwInstanceObject[dwInstanceObjectSize]
  37. *
  38. * Instance Block - key of type string
  39. * DWORD dwObjectType = REP_EXPORT_INST_STR_TAG (0x00000004)
  40. * DWORD dwInstanceKeySize
  41. * DWORD dwInstanceKey[dwInstanceKeySize] = Instance key (MyKeyValue)
  42. * DWORD dwInstanceObjectSize
  43. * DWORD adwInstanceObject[dwInstanceObjectSize]
  44. *
  45. * End of class block
  46. * DWORD dwObjectType = REP_EXPORT_CLASS_END_TAG (0x00000005)
  47. * DWORD dwEndOfBlockSize = REP_EXPORT_END_TAG_SIZE (0x00000010)
  48. * DWORD adwEndOfBlock[dwEndOfBlockSize] = REP_EXPORT_END_TAG_MARKER * 16
  49. * (0xFF, 0xFF, 0xFF, 0xFF,
  50. * 0xFF, 0xFF, 0xFF, 0xFF,
  51. * 0xFF, 0xFF, 0xFF, 0xFF,
  52. * 0xFF, 0xFF, 0xFF, 0xFF)
  53. *
  54. * End of namespace block
  55. * DWORD dwObjectType = REP_EXPORT_NAMESPACE_END_TAG (0x00000006)
  56. * DWORD dwEndOfBlockSize = REP_EXPORT_END_TAG_SIZE (0x00000010)
  57. * DWORD adwEndOfBlock[dwEndOfBlockSize] = REP_EXPORT_END_TAG_MARKER * 16
  58. * (0xFF, 0xFF, 0xFF, 0xFF,
  59. * 0xFF, 0xFF, 0xFF, 0xFF,
  60. * 0xFF, 0xFF, 0xFF, 0xFF,
  61. * 0xFF, 0xFF, 0xFF, 0xFF)
  62. *
  63. * Namespace security block
  64. * DWORD dwObjectType = REP_EXPORT_NAMESPACE_SEC_TAG (0x00000007)
  65. * DWORD dwSecurityBlobSize
  66. * DWORD dwSecurityBlob[dwSecurityBlobSize] = Security blob
  67. *
  68. * End of file block
  69. * DWORD dwObjectType = REP_EXPORT_FILE_END_TAG (0xFFFFFFFF)
  70. * DWORD dwEndOfBlockSize = REP_EXPORT_END_TAG_SIZE (0x00000010)
  71. * DWORD adwEndOfBlock[dwEndOfBlockSize] = REP_EXPORT_END_TAG_MARKER * 16
  72. * (0xFF, 0xFF, 0xFF, 0xFF,
  73. * 0xFF, 0xFF, 0xFF, 0xFF,
  74. * 0xFF, 0xFF, 0xFF, 0xFF,
  75. * 0xFF, 0xFF, 0xFF, 0xFF)
  76. *
  77. * Ordering:
  78. * File Header Block
  79. * (one or more)
  80. * Namespace Block
  81. * Namespace security block
  82. * (zero or more)
  83. * {
  84. * Namespace Block
  85. * Namespace security block
  86. * etc...
  87. * End namespace block
  88. * (or)
  89. * Class Block
  90. * (zero or more)
  91. * {
  92. * Instance Block
  93. * (or)
  94. * Class Block
  95. * etc...
  96. * End class block
  97. * }
  98. * End class block
  99. * }
  100. * End namespace block
  101. * End of file block
  102. *
  103. *================================================================================
  104. */
  105. #define FAILURE_DIRTY 1
  106. #define FAILURE_WRITE 2
  107. #define REP_EXPORT_FILE_START_TAG "repexp3"
  108. #define REP_EXPORT_NAMESPACE_TAG 0x00000001
  109. #define REP_EXPORT_CLASS_TAG 0x00000002
  110. #define REP_EXPORT_INST_INT_TAG 0x00000003
  111. #define REP_EXPORT_INST_STR_TAG 0x00000004
  112. #define REP_EXPORT_CLASS_END_TAG 0x00000005
  113. #define REP_EXPORT_NAMESPACE_END_TAG 0x00000006
  114. #define REP_EXPORT_NAMESPACE_SEC_TAG 0x00000007
  115. #define REP_EXPORT_FILE_END_TAG 0xFFFFFFFF
  116. #define REP_EXPORT_END_TAG_SIZE 0x00000010
  117. #define REP_EXPORT_END_TAG_MARKER 0xFF
  118. #include "MMFArena2.h"
  119. class CDbAvlTree;
  120. struct DBROOT;
  121. struct NSREP;
  122. struct INSTDEF;
  123. struct CLASSDEF;
  124. struct AVLNode;
  125. struct RepCollection;
  126. class CRepExporter
  127. {
  128. protected:
  129. CMMFArena2 *m_pDbArena;
  130. HANDLE g_hFile;
  131. virtual void DumpInstanceString(INSTDEF* pInstDef, const wchar_t *wszKey, const wchar_t *pszClass);
  132. virtual void DumpInstanceInt(INSTDEF* pInstDef, INT_PTR nKey, const wchar_t *pszClass);
  133. virtual void IterateKeyTree(const wchar_t *wszClassName, CLASSDEF *pOwningClass, AVLNode *pInstNode, BOOL bStringKey);
  134. virtual void DumpClass(CLASSDEF* pClassDef, const wchar_t *wszClassName);
  135. virtual void IterateClassNodes(AVLNode *pClassNode, CLASSDEF *poParentClass);
  136. virtual void IterateChildNamespaceTree(AVLNode *pNsNode);
  137. virtual void IterateChildNamespaces(RepCollection *childNamespaces);
  138. virtual void DumpNamespace(NSREP *pNsRep);
  139. virtual void DumpNamespaceSecurity(NSREP *pNsRep);
  140. virtual void DumpRootBlock(DBROOT *pRootBlock);
  141. virtual void DumpMMFHeader();
  142. virtual DWORD GetMMFBlockOverhead() = 0;
  143. virtual int GetAvlTreeNodeType(CDbAvlTree *pTree) = 0;
  144. public:
  145. virtual int Export(CMMFArena2 *pDbArena, const TCHAR *pszFilename);
  146. CRepExporter(){}
  147. virtual ~CRepExporter() {};
  148. };
  149. class CRepExporterV1 : public CRepExporter
  150. {
  151. protected:
  152. //This is different from the standard base-class definition!
  153. DWORD GetMMFBlockOverhead() { return sizeof(MMF_BLOCK_HEADER); }
  154. virtual int GetAvlTreeNodeType(CDbAvlTree *pTree) { return ((int*)pTree)[1]; }
  155. void DumpMMFHeader();
  156. };
  157. class CRepExporterV5 : public CRepExporterV1
  158. {
  159. protected:
  160. //This works in the same way as the standard base-class definition!
  161. virtual DWORD GetMMFBlockOverhead() { return (sizeof(MMF_BLOCK_HEADER) + sizeof(MMF_BLOCK_TRAILER)); }
  162. void DumpMMFHeader();
  163. };
  164. class CRepExporterV7 : public CRepExporterV5
  165. {
  166. protected:
  167. //This is different from the standard base-class definition!
  168. int GetAvlTreeNodeType(CDbAvlTree *pTree) { return ((int*)pTree)[3]; }
  169. };
  170. class CRepExporterV9 : public CRepExporterV7
  171. {
  172. protected:
  173. void DumpNamespaceSecurity(NSREP *pNsRep);
  174. };
  175. #endif
  176.