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.

138 lines
3.8 KiB

  1. /**************************************************************************************************
  2. FILENAME: DfrgFat.h
  3. COPYRIGHT 2001 Microsoft Corporation and Executive Software International, Inc.
  4. DESCRIPTION:
  5. This contains the prototypes for routines in the FAT file system
  6. defragmentation central module.
  7. **************************************************************************************************/
  8. // If ESI_MESSAGE_WINDOW is defined, then the Message() routine is set active otherwise it is set
  9. // to NULL so there is no overhead costs.
  10. #ifdef ESI_MESSAGE_WINDOW
  11. #define DisplayFatFileSpecs() DisplayFatFileSpecsFunction()
  12. #else
  13. #define DisplayFatFileSpecs()
  14. #endif
  15. /*************************************************************************************************/
  16. /////////////////////////////////
  17. // ACPI Support
  18. /////////////////////////////////
  19. #define STATUS_AC_POWER_OFFLINE 0
  20. #define STATUS_BATTERY_POWER_LOW 2
  21. #define STATUS_BATTERY_POWER_CRITICAL 4
  22. #define STATUS_POWER_UNKNOWN 255
  23. #define BOOT_OPTIMIZE_REGISTRY_PATH TEXT("SOFTWARE\\Microsoft\\Dfrg\\BootOptimizeFunction")
  24. #define BOOT_OPTIMIZE_REGISTRY_LCNSTARTLOCATION TEXT("LcnStartLocation")
  25. #define BOOT_OPTIMIZE_REGISTRY_LCNENDLOCATION TEXT("LcnEndLocation")
  26. //This is the WndProc for Dfrg.
  27. LRESULT CALLBACK
  28. MainWndProc(
  29. IN HWND hWnd,
  30. IN UINT uMsg,
  31. IN WPARAM wParam,
  32. IN LPARAM lParam
  33. );
  34. //This initializes DCOM and the message window.
  35. BOOL Initialize();
  36. //This gets data about the volume and initializes variables and so forth for the Dfrg engine.
  37. BOOL InitializeDrive(IN PTCHAR pCommandLine);
  38. //Initializes defrag specific stuff before defragging, and after scanning.
  39. BOOL InitializeDefrag();
  40. //Sends status data to the UI.
  41. VOID SendStatusData();
  42. //Send the report text data to the UI.
  43. VOID SendReportData();
  44. //Sends the graphical data to the UI.
  45. void SendGraphicsData();
  46. //Notifies the UI there is not enough memory for graphics.
  47. void SendGraphicsMemoryErr();
  48. // send error to client to display for user
  49. VOID SendErrData(PTCHAR pErrText, DWORD ErrCode = ENGERR_UNKNOWN);
  50. //This is the exit routine that cleans up after being called by WM_CLOSE.
  51. VOID Exit();
  52. //This gets the MFT bitmap which has one bit set for each file record that is in use.
  53. BOOL GetMftBitmap();
  54. //This gets the names of the pagefiles on a given drive and stores them in a list.
  55. BOOL
  56. GetPagefileNames(
  57. TCHAR cDrive,
  58. HANDLE* phPageFileNames,
  59. TCHAR** ppPageFileNames
  60. );
  61. //Checks a file to see if it is a pagefile.
  62. BOOL CheckForPagefileFat();
  63. //Checks a given file name to see if it matches that of one of the pagefiles on a drive.
  64. BOOL
  65. CheckPagefileNameMatch(
  66. IN TCHAR* pCompareName,
  67. IN TCHAR* pPageFileNames
  68. );
  69. //Display various statistics about the volume.
  70. VOID DisplayFatVolumeStats();
  71. //Displays the data about a given file on a FAT volume.
  72. VOID DisplayFatFileSpecsFunction();
  73. //This is the analyze thread's main routine.
  74. BOOL AnalyzeThread();
  75. //Determines how big the file lists will have to be.
  76. BOOL PreScanFat();
  77. //Fills in the file lists.
  78. BOOL ScanFat();
  79. //This is the defrag thread's main routine.
  80. BOOL DefragThread();
  81. //This defrags all the files in the file lists.
  82. BOOL DefragFat();
  83. //Tells the caller to end the current pass if there was no space to move a file into.
  84. BOOL EndPassIfNoSpaces();
  85. BOOL NextFileIfFalse();
  86. BOOL BeepNowIfFileNotMoved();
  87. //When a file cannot be fully defragmented, this routine will partially defragment it.
  88. BOOL PartialDefragFat();
  89. //Once a spot has been found for a file, this will move it there.
  90. BOOL MoveFatFile();
  91. //Allocate memory for the file lists.
  92. BOOL AllocateFileLists();
  93. //Free up the memory allocated for the file lists.
  94. BOOL DeallocateFileLists();
  95. BOOL UpdateDiskView();
  96. //Sends the most fragged list to the UI.
  97. BOOL SendMostFraggedList();