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.

163 lines
3.3 KiB

  1. #ifndef _RESLIST_H_
  2. #define _RESLIST_H_
  3. #include "srapi.h"
  4. #define MAX_TEMP_FNAME 10
  5. #define HEAP_ALLOC( size ) \
  6. HeapAlloc( GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, size )
  7. #define HEAP_REALLOC( p, size ) \
  8. HeapReAlloc( GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, p, size )
  9. #define HEAP_FREE( p ) \
  10. if (p) { HeapFree( GetProcessHeap(), 0, p ); p = NULL; }
  11. #define STRCOPY(a,b) \
  12. if (b) { HEAP_FREE(a); a = (LPWSTR) HEAP_ALLOC(STRSIZE(b)); \
  13. if (a) memcpy(a, b, STRSIZE(b)); }
  14. #define STRSIZE(pa) (lstrlen(pa) + 1) * sizeof(WCHAR)
  15. //
  16. // CNode : Stores node specific data
  17. //
  18. struct CNode
  19. {
  20. CNode * m_pNext; // Pointer to the sibling node.
  21. CNode * m_pPrev; // Pointer to Prev node.
  22. DWORD m_dwOperation; // Restore operation.
  23. DWORD m_dwAttributes; // Restore Attributes.
  24. LPWSTR m_pszTemp; // Temp File
  25. BYTE* m_pbAcl; // acl data
  26. DWORD m_cbAcl; // acl data size
  27. BOOL m_fAclInline; // whether acl is inline or in file
  28. LPWSTR m_pPath1; // source path
  29. LPWSTR m_pPath2; // dest path on rename
  30. };
  31. CNode *
  32. AllocateNode(
  33. LPWSTR,
  34. LPWSTR);
  35. VOID
  36. FreeNode(
  37. CNode *);
  38. class CRestoreList
  39. {
  40. private:
  41. CNode * m_pListHead;
  42. CNode * m_pListTail;
  43. public:
  44. CRestoreList::CRestoreList();
  45. CRestoreList::~CRestoreList();
  46. BOOL
  47. GenerateRestoreMap(
  48. HANDLE hFile
  49. );
  50. CNode *
  51. AppendNode(
  52. LPWSTR pPath1,
  53. LPWSTR pPath2);
  54. CNode *
  55. RemoveNode(
  56. CNode * pNode
  57. );
  58. CNode *
  59. GetLastNode(
  60. LPWSTR pPath,
  61. LPWSTR pPath2,
  62. BOOL fFailOnPrefixMatch
  63. );
  64. BOOL
  65. CopyNode(
  66. CNode * pSrc,
  67. CNode * pDes,
  68. BOOL fReplacePPath2
  69. );
  70. BOOL
  71. CheckIntegrity(
  72. LPWSTR pszDrive,
  73. DWORD dwOpr,
  74. DWORD dwAttr,
  75. DWORD dwFlags,
  76. LPWSTR pTmpFile,
  77. LPWSTR pPath1,
  78. LPWSTR pPath2,
  79. BYTE * pbAcl,
  80. DWORD cbAcl,
  81. BOOL fAclInline);
  82. BOOL
  83. AddMergeElement(
  84. LPWSTR pszDrive,
  85. DWORD dwOpr,
  86. DWORD dwAttr,
  87. DWORD dwFlags,
  88. LPWSTR pTmpFile,
  89. LPWSTR pPath1,
  90. LPWSTR pPath2,
  91. BYTE * pbAcl,
  92. DWORD cbAcl,
  93. BOOL fAclInline);
  94. BOOL
  95. CreateRestoreNode(
  96. CNode *pNode,
  97. DWORD dwOpr,
  98. DWORD dwAttr,
  99. DWORD dwFlags,
  100. LPWSTR pTmpFile,
  101. LPWSTR pPath1,
  102. LPWSTR pPath2,
  103. BYTE * pbAcl,
  104. DWORD cbAcl,
  105. BOOL fAclInline);
  106. BOOL
  107. MergeRestoreNode(
  108. CNode *pNode,
  109. DWORD dwOpr,
  110. DWORD dwAttr,
  111. DWORD dwFlags,
  112. LPWSTR pTmpFile,
  113. LPWSTR pPath1,
  114. LPWSTR pPath2,
  115. BYTE * pbAcl,
  116. DWORD cbAcl,
  117. BOOL fAclInline);
  118. BOOL
  119. GenerateRenameEntry(
  120. CNode * pNode ,
  121. HANDLE hFile
  122. );
  123. BOOL
  124. GenerateOperation(
  125. CNode * pNode ,
  126. HANDLE hFile
  127. );
  128. };
  129. #endif