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.

176 lines
3.3 KiB

  1. #ifndef _INC_ASR_FMT__DR_STATE_H_
  2. #define _INC_ASR_FMT__DR_STATE_H_
  3. #define ASRFMT_WSZ_DOS_DEVICES_PREFIX L"\\DosDevices\\"
  4. #define ASRFMT_CB_DOS_DEVICES_PREFIX 24
  5. #define ASRFMT_LOOKS_LIKE_DOS_DEVICE(name, length) \
  6. ((length > ASRFMT_CB_DOS_DEVICES_PREFIX) && \
  7. (!memcmp(name, ASRFMT_WSZ_DOS_DEVICES_PREFIX, ASRFMT_CB_DOS_DEVICES_PREFIX)))
  8. #define ASRFMT_WSZ_VOLUME_GUID_PREFIX L"\\??\\Volume{"
  9. #define ASRFMT_CB_VOLUME_GUID_PREFIX 22
  10. #define ASRFMT_LOOKS_LIKE_VOLUME_GUID(name, length) \
  11. ((length > ASRFMT_CB_VOLUME_GUID_PREFIX) && \
  12. (!memcmp(name, ASRFMT_WSZ_VOLUME_GUID_PREFIX, ASRFMT_CB_VOLUME_GUID_PREFIX)))
  13. #define ASRFMT_CCH_VOLUME_GUID 64
  14. #define ASRFMT_CCH_DOS_PATH 1024
  15. #define ASRFMT_CCH_FS_NAME 16
  16. #define ASRFMT_CCH_VOLUME_LABEL 256
  17. #define ASRFMT_CCH_DEVICE_PATH 1024
  18. typedef struct _ASRFMT_VOLUME_INFO {
  19. struct _ASRFMT_VOLUME_INFO *pNext;
  20. DWORD dwIndex;
  21. WCHAR szGuid[ASRFMT_CCH_VOLUME_GUID];
  22. WCHAR szDosPath[ASRFMT_CCH_DOS_PATH];
  23. WCHAR szFsName[ASRFMT_CCH_FS_NAME];
  24. WCHAR szLabel[ASRFMT_CCH_VOLUME_LABEL];
  25. DWORD dwClusterSize;
  26. BOOL IsDosPathAssigned;
  27. } ASRFMT_VOLUME_INFO, *PASRFMT_VOLUME_INFO;
  28. typedef struct _ASRFMT_REMOVABLE_MEDIA_INFO {
  29. struct _ASRFMT_REMOVABLE_MEDIA_INFO *pNext;
  30. DWORD dwIndex;
  31. WCHAR szDevicePath[ASRFMT_CCH_DEVICE_PATH];
  32. WCHAR szVolumeGuid[ASRFMT_CCH_VOLUME_GUID];
  33. WCHAR szDosPath[ASRFMT_CCH_DOS_PATH];
  34. } ASRFMT_REMOVABLE_MEDIA_INFO, *PASRFMT_REMOVABLE_MEDIA_INFO;
  35. typedef struct _ASRFMT_STATE_INFO {
  36. PASRFMT_VOLUME_INFO pVolume;
  37. DWORD countVolume;
  38. PASRFMT_REMOVABLE_MEDIA_INFO pRemovableMedia;
  39. DWORD countMedia;
  40. } ASRFMT_STATE_INFO, *PASRFMT_STATE_INFO;
  41. typedef enum __AsrfmtpMessageSeverity {
  42. _SeverityInfo = 0,
  43. _SeverityWarning,
  44. _SeverityError
  45. } _AsrfmtpMessageSeverity;
  46. // Public functions
  47. //
  48. // From format.cpp
  49. //
  50. extern BOOL g_bFormatInProgress;
  51. extern BOOL g_bFormatSuccessful;
  52. extern INT g_iFormatPercentComplete;
  53. BOOL
  54. FormatInitialise();
  55. BOOL
  56. IsFsTypeOkay(
  57. IN PASRFMT_VOLUME_INFO pVolume,
  58. OUT PBOOL pIsLabelIntact
  59. );
  60. BOOL
  61. IsVolumeIntact(
  62. IN PASRFMT_VOLUME_INFO pVolume
  63. );
  64. BOOL
  65. FormatVolume(
  66. PASRFMT_VOLUME_INFO pVolume
  67. );
  68. BOOL
  69. FormatCleanup();
  70. VOID
  71. MountFileSystem(
  72. IN PASRFMT_VOLUME_INFO pVolume
  73. );
  74. //
  75. // dr_state.cpp
  76. //
  77. BOOL
  78. BuildStateInfo(
  79. IN PASRFMT_STATE_INFO pState
  80. );
  81. VOID
  82. FreeStateInfo(
  83. IN OUT PASRFMT_STATE_INFO *ppState
  84. );
  85. BOOL
  86. ReadStateInfo(
  87. IN PCWSTR lpwszFilePath,
  88. OUT PASRFMT_STATE_INFO *ppState
  89. );
  90. BOOL
  91. SetDosName(
  92. IN PWSTR lpVolumeGuid,
  93. IN PWSTR lpDosPath
  94. );
  95. BOOL
  96. SetRemovableMediaGuid(
  97. IN PWSTR lpDeviceName,
  98. IN PWSTR lpGuid
  99. );
  100. BOOL
  101. WriteStateInfo(
  102. IN DWORD_PTR AsrContext, // AsrContext to pass in to AsrAddSifEntry
  103. IN PASRFMT_STATE_INFO pState // data to write.
  104. );
  105. //
  106. // Functions for logging error messages
  107. //
  108. VOID
  109. AsrfmtpInitialiseErrorFile();
  110. VOID
  111. AsrfmtpCloseErrorFile();
  112. VOID
  113. AsrfmtpLogErrorMessage(
  114. IN _AsrfmtpMessageSeverity Severity,
  115. IN const LPCTSTR Message
  116. );
  117. #endif // ifndef _INC_ASR_FMT__DR_STATE_H_