⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defragment.h

📁 ReactOS是一些高手根据Windows XP的内核编写出的类XP。内核实现机理和API函数调用几乎相同。甚至可以兼容XP的程序。喜欢研究系统内核的人可以看一看。
💻 H
字号:
/*****************************************************************************

  Defragment

*****************************************************************************/


#ifndef DEFRAGMENT_H
#define DEFRAGMENT_H


#include "Unfrag.h"
#include "DriveVolume.h"
#include "Mutex.h"


extern int FitName (wchar_t *destination, const wchar_t *path, const wchar_t *filename, uint32 totalWidth);


typedef struct DefragReport
{
    wstring    RootPath;
    uint64    DiskSizeBytes;
    uint64    DirsCount;
    uint64    FilesCount;
    uint64    FilesSizeBytes;
    uint64    FilesSizeOnDisk;
    uint64    FilesSizeClusters;
    uint64    FilesSlackBytes;
    uint32    FilesFragments;
    double    AverageFragments;  // = FilesFragments / FilesCount
    double    PercentFragged;
    double    PercentSlack;

    vector<uint32> FraggedFiles;
    vector<uint32> UnfraggedFiles;
    vector<uint32> UnmovableFiles;
} DefragReport;


class Defragment
{
public:
    Defragment (wstring Name, DefragType DefragMethod);
    ~Defragment ();

    // Commands
    void Start       (void);
    void TogglePause (void);
    void Stop        (void);

    // Info
    bool          IsDoneYet (void);
    bool          HasError (void);
    wstring        GetStatusString  (void);
    double         GetStatusPercent (void);
    DefragType    GetDefragType    (void)  { return (Method); }
    DefragReport &GetDefragReport  (void)  { return (Report); }
    DriveVolume  &GetVolume        (void)  { return (Volume); }

    // Mutex
    void Lock (void)   { DefragMutex.Lock ();   }
    void Unlock (void) { DefragMutex.Unlock (); }

    // Limit length of status string to 70 chars?
    bool GetDoLimitLength (void)   { return (DoLimitLength); }
    void SetDoLimitLength (bool L) { DoLimitLength = L; }

private:
    void FastDefrag (void);
    void ExtensiveDefrag (void);
    void SetStatusString (wstring NewStatus);

    DWORD        LastBMPUpdate; // Last time volume bitmap was updated
    DefragReport Report;
    bool         DoLimitLength;
    DefragType   Method;
    wstring       DriveName;
    DriveVolume  Volume;
    wstring       StatusString;
    wstring       ErrorString;
    double        StatusPercent;
    Mutex        DefragMutex;
    bool         Error;
    bool         Done;
    bool         PleaseStop;
    bool         PleasePause;
    DefragType   DefragMethod;
};


#endif // DEFRAGMENT_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -