From 359e9466f1abb8225fe50642928b020c9aae211d Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Fri, 3 Mar 2017 00:34:22 -0600 Subject: [PATCH] Future support for used/free space --- SiaDrive.Dokan.Api/SiaDokanDrive.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/SiaDrive.Dokan.Api/SiaDokanDrive.cpp b/SiaDrive.Dokan.Api/SiaDokanDrive.cpp index 6d7916c..15e59cf 100644 --- a/SiaDrive.Dokan.Api/SiaDokanDrive.cpp +++ b/SiaDrive.Dokan.Api/SiaDokanDrive.cpp @@ -440,6 +440,19 @@ private: return STATUS_SUCCESS; } + static NTSTATUS DOKAN_CALLBACK Sia_GetDiskFreeSpaceW( + PULONGLONG FreeBytesAvailable, PULONGLONG TotalNumberOfBytes, + PULONGLONG TotalNumberOfFreeBytes, PDOKAN_FILE_INFO DokanFileInfo) + { + UNREFERENCED_PARAMETER(DokanFileInfo); + + *FreeBytesAvailable = (ULONGLONG)(512 * 1024 * 1024); + *TotalNumberOfBytes = 9223372036854775807; + *TotalNumberOfFreeBytes = 9223372036854775807; + + return STATUS_SUCCESS; + } + static NTSTATUS DOKAN_CALLBACK Sia_GetVolumeInformation( LPWSTR VolumeNameBuffer, DWORD VolumeNameSize, LPDWORD VolumeSerialNumber, LPDWORD MaximumComponentLength, LPDWORD FileSystemFlags, @@ -447,7 +460,7 @@ private: PDOKAN_FILE_INFO DokanFileInfo) { UNREFERENCED_PARAMETER(DokanFileInfo); - wcscpy_s(VolumeNameBuffer, VolumeNameSize, L"SIA"); + wcscpy_s(VolumeNameBuffer, VolumeNameSize, L"SiaDrive"); *VolumeSerialNumber = 0x19831116; *MaximumComponentLength = 256; *FileSystemFlags = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES | @@ -477,7 +490,7 @@ public: _dokanOps.FindFilesWithPattern = nullptr; _dokanOps.FindStreams = nullptr; _dokanOps.FlushFileBuffers = nullptr; - _dokanOps.GetDiskFreeSpaceW = nullptr; + _dokanOps.GetDiskFreeSpaceW = Sia_GetDiskFreeSpaceW; _dokanOps.GetFileInformation = nullptr; _dokanOps.GetFileSecurityW = nullptr; _dokanOps.GetVolumeInformationW = Sia_GetVolumeInformation;