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.

222 lines
7.9 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. uninstall.h
  5. Abstract:
  6. General uninstall-related functions and structure.
  7. Author:
  8. Aghajanyan Souren 27-Mar-2001
  9. Revision History:
  10. sourenag 27-Mar-2001 persistence support
  11. --*/
  12. #if (_WIN32_WINNT >= 0x500)
  13. #ifndef _UNINSTALL_GENERAL_
  14. #define _UNINSTALL_GENERAL_
  15. #include "winioctl.h"
  16. #define MAX_DRIVE_NUMBER ('Z' - 'A' + 1)
  17. typedef enum{
  18. DiskInfoCmp_Equal,
  19. DiskInfoCmp_DifferentLetter,
  20. DiskInfoCmp_FileSystemHasChanged,
  21. DiskInfoCmp_GeometryHasChanged,
  22. DiskInfoCmp_WrongParameters,
  23. DiskInfoCmp_DriveMountPointHasChanged,
  24. DiskInfoCmp_PartitionPlaceHasChanged,
  25. DiskInfoCmp_PartitionLengthHasChanged,
  26. DiskInfoCmp_PartitionTypeHasChanged,
  27. DiskInfoCmp_PartitionStyleHasChanged,
  28. DiskInfoCmp_PartitionCountHasChanged,
  29. DiskInfoCmp_PartitionNumberHasChanged,
  30. DiskInfoCmp_RewritePartitionHasChanged,
  31. DiskInfoCmp_PartitionAttributesHasChanged
  32. }DISKINFO_COMPARATION_STATUS, *PDISKINFO_COMPARATION_STATUS;
  33. typedef struct {
  34. DISK_GEOMETRY DiskGeometry;
  35. DRIVE_LAYOUT_INFORMATION_EX * DiskLayout;
  36. } DISKINFO, *PDISKINFO;
  37. typedef struct {
  38. WCHAR Drive;
  39. PCWSTR FileSystemName;
  40. DWORD FileSystemFlags;
  41. PCWSTR VolumeNTPath;
  42. } DRIVEINFO, *PDRIVEINFO;
  43. typedef struct {
  44. PCWSTR FileName;
  45. BOOL IsCab;
  46. ULARGE_INTEGER FileSize;
  47. } FILEINTEGRITYINFO, *PFILEINTEGRITYINFO;
  48. typedef struct {
  49. ULARGE_INTEGER BootFilesDiskSpace;
  50. ULARGE_INTEGER BackupFilesDiskSpace;
  51. ULARGE_INTEGER UndoFilesDiskSpace;
  52. UINT NumberOfDrives;
  53. PDRIVEINFO DrivesInfo;
  54. UINT NumberOfDisks;
  55. PDISKINFO DisksInfo;
  56. UINT NumberOfFiles;
  57. PFILEINTEGRITYINFO FilesInfo;
  58. } BACKUPIMAGEINFO, *PBACKUPIMAGEINFO;
  59. BOOL
  60. GetDriveInfo(
  61. IN WCHAR Drive,
  62. IN OUT DRIVEINFO * pInfo
  63. );
  64. BOOL
  65. GetDrivesInfo(
  66. IN OUT DRIVEINFO * pInfo,
  67. IN OUT UINT * pDiskInfoRealCount,
  68. IN UINT DiskInfoMaxCount
  69. );
  70. BOOL
  71. GetPhysycalDiskNumber(
  72. OUT UINT * pNumberOfPhysicalDisks
  73. );
  74. BOOL
  75. GetDiskInfo(
  76. IN UINT Drive,
  77. IN OUT DISKINFO * pInfo
  78. );
  79. BOOL
  80. GetDisksInfo(
  81. OUT DISKINFO ** pInfo,
  82. OUT UINT * pNumberOfItem
  83. );
  84. BOOL
  85. GetIntegrityInfoW(
  86. IN PCWSTR FileName,
  87. IN PCWSTR DirPath,
  88. OUT FILEINTEGRITYINFO * IntegrityInfoPtr
  89. );
  90. VOID
  91. FreeDisksInfo(
  92. IN DISKINFO * pInfo,
  93. IN UINT NumberOfItem
  94. );
  95. BOOL
  96. GetDrivesInfo(
  97. IN OUT DRIVEINFO * pInfo,
  98. IN OUT UINT * pDiskInfoRealCount,
  99. IN UINT DiskInfoMaxCount
  100. );
  101. BOOL
  102. GetUndoDrivesInfo(
  103. OUT DRIVEINFO * pInfo,
  104. OUT UINT * pNumberOfDrive,
  105. IN WCHAR BootDrive,
  106. IN WCHAR SystemDrive,
  107. IN WCHAR UndoDrive
  108. );
  109. DISKINFO_COMPARATION_STATUS
  110. CompareDriveInfo(
  111. IN DRIVEINFO * FirstInfo,
  112. IN DRIVEINFO * SecondInfo
  113. );
  114. BOOL
  115. CompareDrivesInfo(
  116. IN DRIVEINFO * FirstInfo,
  117. IN DRIVEINFO * SecondInfo,
  118. IN UINT DriveInfoCount,
  119. OUT PDISKINFO_COMPARATION_STATUS OutDiskCmpStatus, OPTIONAL
  120. OUT UINT * OutIfFailedDiskInfoIndex OPTIONAL
  121. );
  122. DISKINFO_COMPARATION_STATUS
  123. CompareDiskInfo(
  124. IN DISKINFO * FirstInfo,
  125. IN DISKINFO * SecondInfo
  126. );
  127. BOOL
  128. CompareDisksInfo(
  129. IN DISKINFO * FirstInfo,
  130. IN DISKINFO * SecondInfo,
  131. IN UINT DiskInfoCount,
  132. OUT PDISKINFO_COMPARATION_STATUS OutDiskCmpStatus, OPTIONAL
  133. OUT UINT * OutIfFailedDiskInfoIndex OPTIONAL
  134. );
  135. #define BACKUPIMAGEINFO_VERSION 2
  136. #define DRIVE_LAYOUT_INFORMATION_EX_PERSISTENCE \
  137. PERSIST_BEGIN_DECLARE_STRUCT(DRIVE_LAYOUT_INFORMATION_EX, BACKUPIMAGEINFO_VERSION) \
  138. PERSIST_FIELD_BY_VALUE(DRIVE_LAYOUT_INFORMATION_EX, DWORD, PartitionStyle), \
  139. PERSIST_FIELD_BY_VALUE(DRIVE_LAYOUT_INFORMATION_EX, DWORD, PartitionCount), \
  140. PERSIST_FIELD_BY_VALUE(DRIVE_LAYOUT_INFORMATION_EX, DRIVE_LAYOUT_INFORMATION_MBR, Mbr), \
  141. PERSIST_FIELD_BY_VALUE(DRIVE_LAYOUT_INFORMATION_EX, DRIVE_LAYOUT_INFORMATION_GPT, Gpt), \
  142. PERSIST_STRUCT_BY_VALUE_VARIABLE_LENGTH(DRIVE_LAYOUT_INFORMATION_EX, PARTITION_INFORMATION_EX, PartitionEntry, PartitionCount, 1), \
  143. PERSIST_END_DECLARE_STRUCT(DRIVE_LAYOUT_INFORMATION_EX, BACKUPIMAGEINFO_VERSION)
  144. #define DISKINFO_PERSISTENCE PERSIST_BEGIN_DECLARE_STRUCT(DISKINFO, BACKUPIMAGEINFO_VERSION) \
  145. PERSIST_FIELD_BY_VALUE(DISKINFO, DISK_GEOMETRY, DiskGeometry), \
  146. PERSIST_FIELD_NESTED_TYPE(DISKINFO, DRIVE_LAYOUT_INFORMATION_EX, BACKUPIMAGEINFO_VERSION, DiskLayout, BYREF), \
  147. PERSIST_END_DECLARE_STRUCT(DISKINFO, BACKUPIMAGEINFO_VERSION)
  148. #define DRIVEINFO_PERSISTENCE PERSIST_BEGIN_DECLARE_STRUCT(DRIVEINFO, BACKUPIMAGEINFO_VERSION)\
  149. PERSIST_FIELD_BY_VALUE(DRIVEINFO, WCHAR, Drive), \
  150. PERSIST_FIELD_STRINGW(DRIVEINFO, FileSystemName), \
  151. PERSIST_FIELD_BY_VALUE(DRIVEINFO, DWORD, FileSystemFlags), \
  152. PERSIST_FIELD_STRINGW(DRIVEINFO, VolumeNTPath), \
  153. PERSIST_END_DECLARE_STRUCT(DRIVEINFO, BACKUPIMAGEINFO_VERSION)
  154. #define FILEINTEGRITYINFO_PERSISTENCE PERSIST_BEGIN_DECLARE_STRUCT(FILEINTEGRITYINFO, BACKUPIMAGEINFO_VERSION)\
  155. PERSIST_FIELD_STRINGW(FILEINTEGRITYINFO, FileName), \
  156. PERSIST_FIELD_BY_VALUE(FILEINTEGRITYINFO, BOOL, IsCab), \
  157. PERSIST_FIELD_BY_VALUE(FILEINTEGRITYINFO, ULARGE_INTEGER, FileSize), \
  158. PERSIST_END_DECLARE_STRUCT(FILEINTEGRITYINFO, BACKUPIMAGEINFO_VERSION)
  159. #define BACKUPIMAGEINFO_PERSISTENCE PERSIST_BEGIN_DECLARE_STRUCT(BACKUPIMAGEINFO, BACKUPIMAGEINFO_VERSION)\
  160. PERSIST_FIELD_BY_VALUE(BACKUPIMAGEINFO, ULARGE_INTEGER, BootFilesDiskSpace), \
  161. PERSIST_FIELD_BY_VALUE(BACKUPIMAGEINFO, ULARGE_INTEGER, BackupFilesDiskSpace), \
  162. PERSIST_FIELD_BY_VALUE(BACKUPIMAGEINFO, ULARGE_INTEGER, UndoFilesDiskSpace), \
  163. PERSIST_FIELD_BY_VALUE(BACKUPIMAGEINFO, UINT, NumberOfDisks), \
  164. PERSIST_FIELD_NESTED_TYPE_CYCLE(BACKUPIMAGEINFO, DISKINFO, BACKUPIMAGEINFO_VERSION, DisksInfo, BYREF, NumberOfDisks), \
  165. PERSIST_FIELD_BY_VALUE(BACKUPIMAGEINFO, UINT, NumberOfDrives), \
  166. PERSIST_FIELD_NESTED_TYPE_CYCLE(BACKUPIMAGEINFO, DRIVEINFO, BACKUPIMAGEINFO_VERSION, DrivesInfo, BYREF, NumberOfDrives), \
  167. PERSIST_FIELD_BY_VALUE(BACKUPIMAGEINFO, UINT, NumberOfFiles), \
  168. PERSIST_FIELD_NESTED_TYPE_CYCLE(BACKUPIMAGEINFO, FILEINTEGRITYINFO, BACKUPIMAGEINFO_VERSION, FilesInfo, BYREF, NumberOfFiles), \
  169. PERSIST_END_DECLARE_STRUCT(BACKUPIMAGEINFO, BACKUPIMAGEINFO_VERSION)
  170. BOOL
  171. IsFloppyDiskInDrive(
  172. VOID
  173. );
  174. #endif
  175. #endif