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.

123 lines
3.7 KiB

  1. //
  2. // ATL debugging support turned on at debug version
  3. // BUGBUG: the ATL thunking support is not enable yet in IA64
  4. // When this will be enabled then enable it here also!
  5. //
  6. #ifdef _DEBUG
  7. #ifdef _M_IX86
  8. #define _ATL_DEBUG_INTERFACES
  9. #define _ATL_DEBUG_QI
  10. #define _ATL_DEBUG_REFCOUNT
  11. #endif
  12. #endif // _DEBUG
  13. class CTestVssWriter : public CVssWriter
  14. {
  15. public:
  16. enum
  17. {
  18. x_bitWaitIdentify = 1,
  19. x_bitWaitPrepareForBackup = 2,
  20. x_bitWaitPostSnapshot = 4,
  21. x_bitWaitBackupComplete = 8,
  22. x_bitWaitPreRestore = 16,
  23. x_bitWaitPostRestore = 32,
  24. x_bitWaitPrepareSnapshot = 64,
  25. x_bitWaitFreeze = 128,
  26. x_bitWaitThaw = 256,
  27. x_bitWaitAbort = 512,
  28. x_RestoreTestOptions_RestoreIfNotThere = 1
  29. };
  30. CTestVssWriter(bool bRestoreTest, bool bTestNewInterfaces, LONG lWait, LONG lRestoreTestOptions) :
  31. m_lWait(lWait),
  32. m_bRestoreTest(bRestoreTest),
  33. m_bTestNewInterfaces(bTestNewInterfaces),
  34. m_lRestoreTestOptions(lRestoreTestOptions),
  35. m_rghOpen(NULL),
  36. m_chOpen(0),
  37. m_chOpenMax(0)
  38. {
  39. }
  40. ~CTestVssWriter()
  41. {
  42. for(UINT ih = 0; ih < m_chOpen; ih++)
  43. CloseHandle(m_rghOpen[ih]);
  44. delete m_rghOpen;
  45. }
  46. void Initialize();
  47. virtual bool STDMETHODCALLTYPE OnIdentify(IN IVssCreateWriterMetadata *pMetadata);
  48. virtual bool STDMETHODCALLTYPE OnPrepareBackup(IN IVssWriterComponents *pComponent);
  49. virtual bool STDMETHODCALLTYPE OnPrepareSnapshot();
  50. virtual bool STDMETHODCALLTYPE OnFreeze();
  51. virtual bool STDMETHODCALLTYPE OnThaw();
  52. virtual bool STDMETHODCALLTYPE OnAbort();
  53. virtual bool STDMETHODCALLTYPE OnPostSnapshot(IN IVssWriterComponents *pComponent);
  54. virtual bool STDMETHODCALLTYPE OnBackupComplete(IN IVssWriterComponents *pComponent);
  55. virtual bool STDMETHODCALLTYPE OnBackupShutdown(IN VSS_ID SnapshotSetId);
  56. virtual bool STDMETHODCALLTYPE OnPreRestore(IN IVssWriterComponents *pComponent);
  57. virtual bool STDMETHODCALLTYPE OnPostRestore(IN IVssWriterComponents *pComponent);
  58. private:
  59. bool DoNewInterfacesTestIdentify(IVssCreateWriterMetadata* pMetadata);
  60. bool DoRestoreTestIdentify(IN IVssCreateWriterMetadata *pMetadata);
  61. bool DoRestoreTestPrepareBackup(IN IVssWriterComponents *pComponents);
  62. bool DoRestoreTestPreRestore(IN IVssWriterComponents *pComponents);
  63. bool DoRestoreTestPostRestore(IN IVssWriterComponents *pComponents);
  64. void DoAddComponent
  65. (
  66. IVssCreateWriterMetadata *pMetadata,
  67. LPCWSTR wszComponentName,
  68. LPCWSTR wszRootDirectory,
  69. LPCWSTR wszSubdirectory,
  70. LPCWSTR wszFilespec,
  71. LPCWSTR wszAlternateDirectory,
  72. bool selectable,
  73. bool selectableForRestore,
  74. LONG attributes
  75. );
  76. void CreateDirectoryName(LPWSTR buf);
  77. void CreateComponentFilesA(LPCWSTR buf, bool bKeepOpen);
  78. void CreateComponentFilesB(LPCWSTR buf, bool bKeepOpen);
  79. void CreateComponentFilesC(LPCWSTR buf, bool bKeepOpen);
  80. void VerifyComponentFilesA(LPCWSTR buf);
  81. void VerifyComponentFilesB(LPCWSTR buf);
  82. void VerifyComponentFilesC(LPCWSTR buf);
  83. void DoCreateFile
  84. (
  85. LPCWSTR wszPath,
  86. LPCWSTR wszFilename,
  87. DWORD length,
  88. bool bKeepOpen
  89. );
  90. void DoVerifyFile(LPCWSTR wszPath, LPCWSTR wszFilename, DWORD length);
  91. LONG m_lWait;
  92. LONG m_lRestoreTestOptions;
  93. bool m_bRestoreTest;
  94. bool m_bTestNewInterfaces;
  95. HANDLE *m_rghOpen;
  96. UINT m_chOpen;
  97. UINT m_chOpenMax;
  98. };