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.

201 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 1996-1998 Microsoft Corporation
  3. Module Name:
  4. newdisks.h
  5. Abstract:
  6. Definitions exported by newdisks.c
  7. and used by disks.c
  8. Author:
  9. Gor Nishanov (GorN) 31-July-1998
  10. Revision History:
  11. --*/
  12. DWORD
  13. DisksOnlineThread(
  14. IN PCLUS_WORKER Worker,
  15. IN PDISK_RESOURCE ResourceEntry
  16. );
  17. /*++
  18. Routine Description:
  19. Brings a disk resource online.
  20. Arguments:
  21. Worker - Supplies the cluster worker context
  22. ResourceEntry - A pointer to the DISK_RESOURCE block for this resource.
  23. Returns:
  24. ERROR_SUCCESS if successful.
  25. Win32 error code on failure.
  26. --*/
  27. DWORD
  28. DisksOpenResourceFileHandle(
  29. IN PDISK_RESOURCE ResourceEntry,
  30. IN PWCHAR InfoString,
  31. OUT PHANDLE fileHandle OPTIONAL
  32. );
  33. /*++
  34. Routine Description:
  35. Open a file handle for the resource.
  36. It performs the following steps:
  37. 1. Read Disk signature from cluster registry
  38. 2. Attaches clusdisk driver to a disk with this signature
  39. 3. Gets Harddrive no from ClusDisk driver registry
  40. 4. Opens \\.\PhysicalDrive%d device and returns open handle
  41. Arguments:
  42. ResourceEntry - A pointer to the DISK_RESOURCE block for this resource.
  43. InfoString - Supplies a label to be printed with error messages
  44. fileHandle - receives file handle
  45. Returns:
  46. ERROR_SUCCESS if successful.
  47. Win32 error code on failure.
  48. --*/
  49. enum {
  50. OFFLINE = FALSE,
  51. TERMINATE = TRUE
  52. };
  53. DWORD
  54. DisksOfflineOrTerminate(
  55. IN PDISK_RESOURCE ResourceEntry,
  56. IN BOOL Terminate
  57. );
  58. /*++
  59. Routine Description:
  60. Used by DisksOffline and DisksTerminate.
  61. Routine performs the following steps:
  62. 1. ClusWorkerTerminate (Terminate only)
  63. 2. Then For all of the partitions on the drive...
  64. a. Flush the file buffers. (Offline only)
  65. b. Lock the volume to purge all in memory contents of the volume. (Offline only)
  66. c. Dismount the volume
  67. 3. Removes default network shares (C$, F$, etc)
  68. Arguments:
  69. ResourceEntry - A pointer to the DISK_RESOURCE block for this resource.
  70. Terminate - Set it to TRUE to cause Termination Behavior
  71. Returns:
  72. ERROR_SUCCESS if successful.
  73. Win32 error code on failure.
  74. --*/
  75. enum {
  76. MOUNTIE_VALID = 0x1,
  77. MOUNTIE_THREAD = 0x2,
  78. MOUNTIE_QUIET = 0x4,
  79. };
  80. DWORD
  81. DiskspSsyncDiskInfo(
  82. IN PWCHAR InfoLabel,
  83. IN PDISK_RESOURCE ResourceEntry,
  84. IN DWORD Options
  85. );
  86. /*++
  87. Routine Description:
  88. Restores the disk registry information
  89. if necessary.
  90. Arguments:
  91. InfoLabel - Supplies a label to be printed with error messages
  92. ResourceEntry - Supplies the disk resource structure.
  93. Options - 0 or combination of the following:
  94. MOUNTIE_VALID: ResourceEntry contains up to date MountieInfo.
  95. If this flag is not set, MountieInfo will be recomputed
  96. MOUNTIE_THREAD: If ERROR_SHARING_PAUSED prevents updating cluster registry,
  97. launch a thread to do it later
  98. MOUNTIE_QUIET: Quiet mode. Less noise in logs.
  99. Return Value:
  100. ERROR_SUCCESS if successful
  101. Win32 error code otherwise
  102. --*/
  103. DWORD
  104. DisksIsVolumeDirty(
  105. IN PWCHAR DeviceName,
  106. IN PDISK_RESOURCE ResourceEntry,
  107. OUT PBOOL Dirty
  108. );
  109. DWORD
  110. DiskspCheckPath(
  111. IN LPWSTR VolumeName,
  112. IN PDISK_RESOURCE ResourceEntry,
  113. IN BOOL OpenFiles,
  114. IN BOOL LogFileNotFound
  115. );
  116. /////////////////////////////////////////////////////////////////
  117. //
  118. // Import the following from disks.c
  119. //
  120. extern CRITICAL_SECTION DisksLock;
  121. extern RESUTIL_PROPERTY_ITEM DiskResourcePrivateProperties[];
  122. extern HANDLE DisksTerminateEvent;
  123. extern LIST_ENTRY DisksListHead;
  124. extern PWCHAR DEVICE_HARDDISK_PARTITION_FMT; // L"\\Device\\Harddisk%u\\Partition%u";
  125. DWORD
  126. DisksFixCorruption(
  127. IN PWCHAR VolumeName,
  128. IN PDISK_RESOURCE ResourceEntry,
  129. IN DWORD CorruptStatus
  130. );