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.

165 lines
3.6 KiB

  1. /*
  2. Module Name:
  3. mirror.h
  4. Abstract:
  5. This module is the header file for the code that copies from one
  6. tree to another.
  7. Author:
  8. Andy Herron May 27 1998
  9. Revision History:
  10. */
  11. //
  12. // This structure contains all the global data passed around for the
  13. // different instances of copying subtrees active.
  14. //
  15. typedef struct _COPY_TREE_CONTEXT {
  16. LIST_ENTRY PendingDirectoryList;
  17. LARGE_INTEGER BytesCopied;
  18. ULONG FilesCopied;
  19. ULONG AttributesModified;
  20. ULONG SourceFilesScanned;
  21. ULONG DestFilesScanned;
  22. ULONG DirectoriesCreated;
  23. ULONG ErrorsEncountered;
  24. ULONG FilesDeleted;
  25. ULONG DirectoriesDeleted;
  26. ULONG SecurityDescriptorsWritten;
  27. ULONG SourceSecurityDescriptorsRead;
  28. ULONG SFNWritten;
  29. BOOLEAN Cancelled;
  30. BOOLEAN DeleteOtherFiles;
  31. CRITICAL_SECTION Lock;
  32. } COPY_TREE_CONTEXT, *PCOPY_TREE_CONTEXT;
  33. //
  34. // this is the structure we use to track per thread instance data, per thread
  35. // buffers, etc.
  36. //
  37. #define IMIRROR_INITIAL_SD_LENGTH 2048
  38. #define IMIRROR_INITIAL_SFN_LENGTH 32
  39. typedef struct _IMIRROR_THREAD_CONTEXT {
  40. PCOPY_TREE_CONTEXT CopyContext;
  41. LPBYTE SDBuffer;
  42. DWORD SDBufferLength;
  43. LPBYTE SFNBuffer;
  44. DWORD SFNBufferLength;
  45. LPBYTE DirectoryBuffer;
  46. DWORD DirectoryBufferLength;
  47. BOOLEAN IsNTFS;
  48. HANDLE SourceDirHandle;
  49. HANDLE DestDirHandle;
  50. PVOID FindBufferBase;
  51. PVOID FindBufferNext;
  52. ULONG FindBufferLength;
  53. LIST_ENTRY FilesToIgnore;
  54. } IMIRROR_THREAD_CONTEXT, *PIMIRROR_THREAD_CONTEXT;
  55. //
  56. // This structure is used to report back errors that occurred during copying.
  57. //
  58. typedef struct _COPY_ERROR {
  59. LIST_ENTRY ListEntry;
  60. DWORD Error;
  61. DWORD ActionCode;
  62. PWCHAR FileName;
  63. WCHAR FileNameBuffer[1];
  64. } COPY_ERROR, *PCOPY_ERROR;
  65. #define IMIRROR_ATTRIBUTES_TO_REPLICATE ( FILE_ATTRIBUTE_HIDDEN | \
  66. FILE_ATTRIBUTE_READONLY | \
  67. FILE_ATTRIBUTE_SYSTEM | \
  68. FILE_ATTRIBUTE_TEMPORARY | \
  69. FILE_ATTRIBUTE_NORMAL | \
  70. FILE_ATTRIBUTE_DIRECTORY | \
  71. FILE_ATTRIBUTE_ARCHIVE )
  72. #define IMIRROR_ATTRIBUTES_TO_STORE (~(IMIRROR_ATTRIBUTES_TO_REPLICATE))
  73. #define IMIRROR_ATTRIBUTES_TO_IGNORE ( FILE_ATTRIBUTE_OFFLINE | \
  74. FILE_ATTRIBUTE_SPARSE_FILE | \
  75. FILE_ATTRIBUTE_NOT_CONTENT_INDEXED )
  76. //
  77. // These are the functions in mirror.c
  78. //
  79. DWORD
  80. AllocateCopyTreeContext (
  81. PCOPY_TREE_CONTEXT *CopyContext,
  82. BOOLEAN DeleteOtherFiles
  83. );
  84. VOID
  85. FreeCopyTreeContext (
  86. PCOPY_TREE_CONTEXT CopyContext
  87. );
  88. DWORD
  89. CopyTree (
  90. PCOPY_TREE_CONTEXT CopyContext,
  91. BOOLEAN IsNtfs,
  92. PWCHAR SourceRoot,
  93. PWCHAR DestRoot
  94. );
  95. ULONG
  96. ReportCopyError (
  97. PCOPY_TREE_CONTEXT CopyContext OPTIONAL,
  98. PWCHAR File,
  99. DWORD ActionCode,
  100. DWORD err
  101. );
  102. ULONG
  103. IMConvertNT2Win32Error(
  104. IN NTSTATUS Status
  105. );
  106. DWORD
  107. IMFindNextFile(
  108. PIMIRROR_THREAD_CONTEXT ThreadContext,
  109. HANDLE DirHandle,
  110. PFILE_FULL_DIR_INFORMATION *lpFindFileData
  111. );
  112. DWORD
  113. IMFindFirstFile(
  114. PIMIRROR_THREAD_CONTEXT ThreadContext,
  115. HANDLE DirHandle,
  116. PFILE_FULL_DIR_INFORMATION *lpFindFileData
  117. );
  118. NTSTATUS
  119. GetTokenHandle(
  120. IN OUT PHANDLE TokenHandle
  121. );
  122. NTSTATUS
  123. SetPrivs(
  124. IN HANDLE TokenHandle,
  125. IN LPTSTR lpszPriv
  126. );