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.

136 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. exclproc.h
  5. Abstract:
  6. Exclude processing mechanism. Processes the FilesNotToBackup key and
  7. zero or more exclude files with exclude rules.
  8. Author:
  9. Stefan R. Steiner [ssteiner] 03-21-2000
  10. Revision History:
  11. --*/
  12. #ifndef __H_EXCLPROC_
  13. #define __H_EXCLPROC_
  14. #define FSD_REG_EXCLUDE_PATH L"SYSTEM\\CurrentControlSet\\Control\\BackupRestore\\FilesNotToBackup"
  15. struct SFsdVolumeId;
  16. //
  17. // Structure definition of one exclude rule
  18. //
  19. class SFsdExcludeRule
  20. {
  21. public:
  22. CBsString cwsExcludeFromSource; // File name or key name
  23. CBsString cwsExcludeDescription; // Description of the exclusion rule
  24. CBsString cwsExcludeRule; // The actual exclude pattern
  25. // Compiled match string fields follow:
  26. BOOL bInvalidRule; // If TRUE, rule was deemed invalid by pattern compiler
  27. BOOL bAnyVol; // If TRUE, matches any volume in the system
  28. SFsdVolumeId *psVolId; // If bAnyVol is FALSE, volid of the file system
  29. CBsString cwsDirPath; // Directory path relative to volume mountpoint (no \ at start of string, \ at end of string)
  30. CBsString cwsFileNamePattern; // File name pattern; may include * and ? chars (no \ at start of string)
  31. BOOL bInclSubDirs; // If TRUE, include subdirectories under cwsDirPath
  32. BOOL bWCInFileName; // If TRUE, Wildcard chars in the file name
  33. CVssDLList< CBsString > cExcludedFileList; // List of files excluded by this rule
  34. SFsdExcludeRule() : bAnyVol( FALSE ),
  35. bInclSubDirs( FALSE ),
  36. bWCInFileName( FALSE ),
  37. psVolId( NULL ),
  38. bInvalidRule( FALSE ) {}
  39. virtual ~SFsdExcludeRule();
  40. VOID PrintRule(
  41. IN FILE *fpOut,
  42. IN BOOL bInvalidRulePrint
  43. );
  44. };
  45. class CFsdFileSystemExcludeProcessor;
  46. //
  47. // Class that maintains the complete list of exclusion rules. There should be one of
  48. // these objects per base mountpoint. This object will manage mountpoints within that
  49. // mountpoint.
  50. //
  51. class CFsdExclusionManager
  52. {
  53. public:
  54. CFsdExclusionManager(
  55. IN CDumpParameters *pcDumpParameters
  56. );
  57. virtual ~CFsdExclusionManager();
  58. VOID GetFileSystemExcludeProcessor(
  59. IN CBsString cwsVolumePath,
  60. IN SFsdVolumeId *psVolId,
  61. OUT CFsdFileSystemExcludeProcessor **ppcFSExcludeProcessor
  62. );
  63. VOID PrintExclusionInformation();
  64. private:
  65. VOID ProcessRegistryExcludes(
  66. IN HKEY hKey,
  67. IN LPCWSTR pwszFromSource
  68. );
  69. VOID ProcessExcludeFiles(
  70. IN const CBsString& cwsPathToExcludeFiles
  71. );
  72. BOOL ProcessOneExcludeFile(
  73. IN const CBsString& cwsExcludeFileName
  74. );
  75. VOID CompileExclusionRules();
  76. CDumpParameters *m_pcParams;
  77. CVssDLList< SFsdExcludeRule * > m_cCompleteExcludeList; // pointers cleaned up in destructor
  78. };
  79. //
  80. // Class that maintains the list of exclusion rules for one particular file system.
  81. //
  82. class CFsdFileSystemExcludeProcessor
  83. {
  84. friend class CFsdExclusionManager;
  85. public:
  86. CFsdFileSystemExcludeProcessor(
  87. IN CDumpParameters *pcDumpParameters,
  88. IN const CBsString& cwsVolumePath,
  89. IN SFsdVolumeId *psVolId
  90. );
  91. virtual ~CFsdFileSystemExcludeProcessor();
  92. BOOL IsExcludedFile(
  93. IN const CBsString &cwsFullDirPath,
  94. IN DWORD dwEndOfVolMountPointOffset,
  95. IN const CBsString &cwsFileName
  96. );
  97. private:
  98. CDumpParameters *m_pcParams;
  99. CBsString m_cwsVolumePath;
  100. SFsdVolumeId *m_psVolId;
  101. CVssDLList< SFsdExcludeRule * > m_cFSExcludeList;
  102. };
  103. #endif // __H_EXCLPROC_