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.

83 lines
2.3 KiB

  1. /*++
  2. Copyright (C) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. RepositoryPackager.h
  5. Abstract:
  6. Recursively packages the contents of the repository directory into a single file,
  7. and unpackages it.
  8. History:
  9. paulall 07/26/00 Created.
  10. a-shawnb 07/27/00 Finished.
  11. --*/
  12. #ifndef __REPOSITORYPACKAGER_H_
  13. #define __REPOSITORYPACKAGER_H_
  14. #define PACKAGE_TYPE_NAMESPACE_START 1
  15. #define PACKAGE_TYPE_NAMESPACE_END 2
  16. #define PACKAGE_TYPE_FILE 3
  17. #define PACKAGE_TYPE_END_OF_FILE 4
  18. typedef struct _PACKAGE_HEADER
  19. {
  20. char szSignature[10];
  21. } PACKAGE_HEADER;
  22. typedef struct _PACKAGE_SPACER
  23. {
  24. DWORD dwSpacerType;
  25. } PACKAGE_SPACER;
  26. typedef struct _PACKAGER_SPACER_NAMESPACE : _PACKAGE_SPACER
  27. {
  28. wchar_t wszNamespaceName[MAX_PATH+1];
  29. } PACKAGE_SPACER_NAMESPACE;
  30. typedef struct _PACKAGER_SPACER_FILE : _PACKAGE_SPACER
  31. {
  32. wchar_t wszFileName[MAX_PATH+1];
  33. DWORD dwFileSize;
  34. } PACKAGE_SPACER_FILE;
  35. class CRepositoryPackager
  36. {
  37. static wchar_t * backupFiles_[];
  38. static wchar_t * repDirectory_;
  39. private:
  40. bool needBackup(const wchar_t*) const;
  41. HRESULT GetRepositoryDirectory(wchar_t wszRepositoryDirectory[MAX_PATH+1]);
  42. HRESULT PackageHeader(HANDLE hFile);
  43. HRESULT PackageAllFiles(HANDLE hFile, const wchar_t *wszRepositoryDirectory);
  44. HRESULT PackageContentsOfDirectory(HANDLE hFile, const wchar_t *wszRepositoryDirectory);
  45. HRESULT PackageDirectory(HANDLE hFile, const wchar_t *wszParentDirectory, wchar_t *wszSubDirectory);
  46. HRESULT PackageFile(HANDLE hFile, const wchar_t *wszParentDirectory, wchar_t *wszFilename);
  47. HRESULT PackageTrailer(HANDLE hFile);
  48. HRESULT UnPackageHeader(HANDLE hFile);
  49. HRESULT UnPackageContentsOfDirectory(HANDLE hFile, const wchar_t *wszRepositoryDirectory);
  50. HRESULT UnPackageDirectory(HANDLE hFile, const wchar_t *wszParentDirectory);
  51. HRESULT UnPackageFile(HANDLE hFile, const wchar_t *wszParentDirectory);
  52. HRESULT DeleteContentsOfDirectory(const wchar_t *wszRepositoryDirectory);
  53. HRESULT PackageDeleteDirectory(const wchar_t *wszParentDirectory, wchar_t *wszSubDirectory);
  54. public:
  55. CRepositoryPackager() {}
  56. ~CRepositoryPackager() {}
  57. HRESULT PackageRepository(const wchar_t *wszFilename);
  58. HRESULT UnpackageRepository(const wchar_t *wszFilename);
  59. HRESULT DeleteRepository();
  60. };
  61. #endif // __REPOSITORYPACKAGER_H_