88 wchar_t SerialText[10];
94 swprintf (SerialText,
L"%x-%x", (VolSN & 0xffff0000) >> 16,
138 DWORD SectorsPerCluster;
139 DWORD BytesPerSector;
195 sizeof (StartingLCN),
215 if (reallBitmap ==
NULL)
218 wprintf(
L"\nNot enough memory to read volume bitmap\n");
229 sizeof (StartingLCN),
240 wprintf (
L"\nCouldn't properly read volume bitmap\n");
274 return ((
BitmapDetail[Cluster / 32] & (1 << (Cluster % 32))) ?
true :
false);
309 Info.QuitMonitor = &QuitMonitor;
311 Info.ClusterProgress = 0;
312 Info.Percent = &Percent;
316 if (QuitMonitor ==
true)
359 return (
Files[Indice]);
365 return (
Files.size());
373 it =
Files.begin() + Indice;
383 wstring SearchString;
388 SearchString = DirPrefix;
389 SearchString +=
L"*.*";
405 Info.Name = FindData.cFileName;
413 Info.DirIndice = DirIndice;
427 Info.Attributes.AccessDenied = 0;
428 Info.Attributes.Unmovable = 0;
429 Info.Attributes.Process = 1;
436 for (
size_t i = 0;
i <
Info.Fragments.size();
i++)
438 TotalClusters +=
Info.Fragments[
i].Length;
441 Info.Clusters = TotalClusters;
445 Info.Attributes.Unmovable = 1;
446 Info.Attributes.Process = 0;
449 if (
Info.Attributes.Process == 1)
462 if (
Info.Attributes.Directory == 1)
532 Info.Attributes.AccessDenied = 1;
542 Info.Attributes.AccessDenied = 1;
571 if (Retrieval !=
NULL)
581 sizeof (StartingVCN),
593 Info.Attributes.AccessDenied = 1;
594 Info.Attributes.Process = 0;
595 Info.Fragments.clear ();
612 Info.Fragments.clear ();
623 Info.Fragments.push_back (Add);
641 for (
i = StartLCN;
i <
Max;
i++)
654 for (
j = (
i + 1);
j < (
i + ReqLength - 2);
j++)
679 bool ReturnVal =
false;
793 j <
Info.Fragments[
i].Length;
802 CurrentLCN +=
Info.Fragments[
i].Length;
803 CurrentVCN +=
Info.Fragments[
i].Length;
bool BuildDBCallback(FileInfo &Info, HANDLE &FileHandle, void *UserData)
bool(* ScanCallback)(FileInfo &Info, HANDLE &FileHandle, void *UserData)
#define IOCTL_DISK_GET_DRIVE_GEOMETRY
FileInfo & GetDBFile(uint32 Indice)
bool ScanDirectory(wstring DirPrefix, ScanCallback Callback, void *UserData)
bool IsClusterUsed(uint64 Cluster)
bool ShouldProcess(FileAttr Attr)
vector< wstring > Directories
VolumeInfo GetVolumeInfo(void)
uint32 GetDBFileCount(void)
wstring & GetDBDir(uint32 Indice)
bool BuildFileList(bool &QuitMonitor, double &Progress)
friend bool BuildDBCallback(FileInfo &Info, HANDLE &FileHandle, void *UserData)
bool GetClusterInfo(FileInfo &Info, HANDLE &HandleResult)
uint32 GetDBDirCount(void)
bool MoveFileDumb(uint32 FileIndice, uint64 NewLCN)
bool FindFreeRange(uint64 StartLCN, uint64 ReqLength, uint64 &LCNResult)
uint32 RemoveDBFile(uint32 Indice)
void SetClusterUsed(uint64 Cluster, bool Used)
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
BOOL WINAPI GetDiskFreeSpaceExW(IN LPCWSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
BOOL WINAPI GetDiskFreeSpaceW(IN LPCWSTR lpRootPathName, OUT LPDWORD lpSectorsPerCluster, OUT LPDWORD lpBytesPerSector, OUT LPDWORD lpNumberOfFreeClusters, OUT LPDWORD lpTotalNumberOfClusters)
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI FindClose(HANDLE hFindFile)
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
NTSTATUS FreeClusters(PNTFS_VCB Vcb, PNTFS_ATTR_CONTEXT AttrContext, ULONG AttrOffset, PFILE_RECORD_HEADER FileRecord, ULONG ClustersToFree)
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
HLOCAL NTAPI LocalFree(HLOCAL hMem)
double __cdecl nan(const char *tagp)
#define memcpy(s1, s2, n)
#define FILE_FLAG_BACKUP_SEMANTICS
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
#define FILE_ATTRIBUTE_READONLY
#define FILE_ATTRIBUTE_COMPRESSED
#define FILE_ATTRIBUTE_HIDDEN
#define FILE_ATTRIBUTE_SYSTEM
#define FILE_ATTRIBUTE_OFFLINE
#define FILE_ATTRIBUTE_ARCHIVE
#define FILE_ATTRIBUTE_DIRECTORY
#define FILE_ATTRIBUTE_TEMPORARY
#define FILE_ATTRIBUTE_ENCRYPTED
#define FILE_ATTRIBUTE_SPARSE_FILE
#define FILE_ATTRIBUTE_REPARSE_POINT
#define FSCTL_GET_RETRIEVAL_POINTERS
#define FSCTL_GET_VOLUME_BITMAP
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
vector< Extent > Fragments
LARGE_INTEGER StartingLcn
LARGE_INTEGER StartingVcn
struct RETRIEVAL_POINTERS_BUFFER::@3323 Extents[1]
LARGE_INTEGER StartingVcn
void push_back(const _Tp &__x=_STLP_DEFAULT_CONSTRUCTED(_Tp))
void resize(size_type __new_size, const _Tp &__x=_STLP_DEFAULT_CONSTRUCTED(_Tp))
union _LARGE_INTEGER LARGE_INTEGER
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesReturned
DWORD WINAPI GetLastError(void)
#define FORMAT_MESSAGE_FROM_SYSTEM
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList