Source code of Windows XP (NT5)
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.

205 lines
5.0 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. ftasr.cpp
  5. Abstract:
  6. Declaration of class CFtasrDlg
  7. This class provides a GUI interface for the FTASR process.
  8. It also implements the 3 main FTASR operations:
  9. "register" - register FTASR as a BackupRestore command
  10. "backup" - save the current FT hierarchy state in dr_state.sif file
  11. "restore" - restore the FT hierarchy as it is in dr_state.sif file
  12. Author:
  13. Cristian Teodorescu 3-March-1999
  14. Notes:
  15. Revision History:
  16. --*/
  17. #if !defined(AFX_FTASRDLG_H__A507D049_3854_11D2_87D7_006008A71E8F__INCLUDED_)
  18. #define AFX_FTASRDLG_H__A507D049_3854_11D2_87D7_006008A71E8F__INCLUDED_
  19. #if _MSC_VER > 1000
  20. #pragma once
  21. #endif // _MSC_VER > 1000
  22. #include <ftapi.h>
  23. #include <winioctl.h>
  24. #define DISPLAY_HELP 0
  25. #define BACKUP_STATE 1
  26. #define RESTORE_STATE 2
  27. #define REGISTER_STATE 3
  28. #define MAX_STACK_DEPTH 100
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CFtasrDlg dialog
  31. class CFtasrDlg : public CDialog
  32. {
  33. enum
  34. {
  35. WM_WORKER_THREAD_DONE = WM_USER + 1,
  36. WM_UPDATE_STATUS_TEXT,
  37. } ;
  38. // Construction
  39. public:
  40. CFtasrDlg(CWnd* pParent = NULL); // standard constructor
  41. // Dialog Data
  42. //{{AFX_DATA(CFtasrDlg)
  43. enum { IDD = IDD_FTASR_DIALOG };
  44. CProgressCtrl m_Progress;
  45. //}}AFX_DATA
  46. // ClassWizard generated virtual function overrides
  47. //{{AFX_VIRTUAL(CFtasrDlg)
  48. protected:
  49. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  50. //}}AFX_VIRTUAL
  51. // Implementation
  52. protected:
  53. // Generated message map functions
  54. //{{AFX_MSG(CFtasrDlg)
  55. virtual BOOL OnInitDialog();
  56. //}}AFX_MSG
  57. static long DoWork(CFtasrDlg *_this) ;
  58. UINT ParseCommandLine();
  59. // Main operations
  60. long DoBackup();
  61. long DoRestore() ;
  62. long DoRegister();
  63. // Methods used in the Backup process:
  64. long AddToCommands(
  65. IN FILE* Output
  66. );
  67. long PrintOutVolumeNames(
  68. IN FILE* Output,
  69. IN FT_LOGICAL_DISK_ID RootLogicalDiskId
  70. );
  71. long PrintOutDiskInfo(
  72. IN FILE* Output,
  73. IN FT_LOGICAL_DISK_ID LogicalDiskId
  74. );
  75. #ifdef CHECK_UNSUPPORTED_CONFIG
  76. // Methods used to check for FT configurations not supported by FTASR
  77. long CheckForUnsupportedConfig(
  78. IN DWORD NumDisks,
  79. IN PFT_LOGICAL_DISK_ID DiskId
  80. );
  81. long IsSystemOrBootVolume(
  82. IN FT_LOGICAL_DISK_ID DiskId,
  83. OUT PBOOL IsSystem,
  84. OUT PBOOL IsBoot
  85. );
  86. long GetDiskGeometry(
  87. ULONG DiskNumber,
  88. PDISK_GEOMETRY Geometry
  89. );
  90. #endif // #ifdef CHECK_UNSUPPORTED_CONFIG
  91. // Methods used in the Restore process:
  92. long Restore(
  93. IN FILE* Input
  94. );
  95. VOID LinkVolumeNamesToLogicalDisk(
  96. IN PWCHAR* VolumeNames,
  97. IN DWORD NumNames,
  98. IN FT_LOGICAL_DISK_ID LogicalDiskId
  99. );
  100. FT_LOGICAL_DISK_ID BuildFtDisk(
  101. IN FILE* Input,
  102. IN OUT PFT_LOGICAL_DISK_ID ExpectedPath,
  103. IN WORD ExpectedPathSize,
  104. IN BOOL AllowBreak,
  105. OUT PBOOL Existing, /* OPTIONAL */
  106. OUT PBOOL Overwriteable /* OPTIONAL */
  107. );
  108. FT_LOGICAL_DISK_ID CreateFtPartition(
  109. IN ULONG Signature,
  110. IN LONGLONG Offset,
  111. IN LONGLONG Length,
  112. OUT PBOOL Overwriteable
  113. );
  114. BOOL QueryPartitionInformation(
  115. IN HANDLE Handle,
  116. OUT PDWORD Signature,
  117. OUT PLONGLONG Offset,
  118. OUT PLONGLONG Length
  119. );
  120. BOOL GetPathFromLogicalDiskToRoot(
  121. IN FT_LOGICAL_DISK_ID LogicalDiskId,
  122. OUT PFT_LOGICAL_DISK_ID Path,
  123. OUT PWORD PathSize
  124. );
  125. BOOL GetParentLogicalDiskInVolume(
  126. IN FT_LOGICAL_DISK_ID VolumeId,
  127. IN FT_LOGICAL_DISK_ID LogicalDiskId,
  128. OUT PFT_LOGICAL_DISK_ID ParentId
  129. );
  130. BOOL FtGetParentLogicalDisk(
  131. IN FT_LOGICAL_DISK_ID LogicalDiskId,
  132. OUT PFT_LOGICAL_DISK_ID ParentId
  133. );
  134. // Display error messages
  135. void DisplayError (const CString& ErrorMsg);
  136. void DisplaySystemError (DWORD ErrorCode);
  137. void DisplayResourceError (DWORD ErrorId);
  138. void DisplayResourceSystemError (DWORD ErrorId, DWORD ErrorCode);
  139. void DisplayResourceResourceError (DWORD ErrorId1, DWORD ErrorId2);
  140. protected:
  141. HICON m_hIcon;
  142. HANDLE m_Thread ;
  143. DWORD m_EndStatusCode;
  144. CString m_StatusText;
  145. DECLARE_MESSAGE_MAP()
  146. // manually added message-handler
  147. afx_msg LRESULT OnWorkerThreadDone( WPARAM wparam, LPARAM lparam ) ;
  148. afx_msg LRESULT OnUpdateStatusText( WPARAM wparam, LPARAM lparam ) ;
  149. };
  150. //{{AFX_INSERT_LOCATION}}
  151. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  152. #endif // !defined(AFX_FTASRDLG_H__A507D049_3854_11D2_87D7_006008A71E8F__INCLUDED_)