1
0

More changes

This commit is contained in:
Scott E. Graves
2017-03-15 02:32:34 -05:00
parent c1914a5e21
commit 2da20611cb

View File

@@ -837,6 +837,28 @@ private:
} }
} }
static NTSTATUS DOKAN_CALLBACK Sia_FlushFileBuffers(LPCWSTR FileName, PDOKAN_FILE_INFO DokanFileInfo)
{
String filePath = StdConstructPath(GetCacheLocation(), FileName);
HANDLE handle = reinterpret_cast<HANDLE>(DokanFileInfo->Context);
if (!handle || handle == INVALID_HANDLE_VALUE)
{
return STATUS_SUCCESS;
}
if (::FlushFileBuffers(handle))
{
return STATUS_SUCCESS;
}
else
{
DWORD error = GetLastError();
return DokanNtStatusFromWin32(error);
}
}
public: public:
static void Initialize(CSiaApi* siaApi, CSiaDriveConfig* siaDriveConfig) static void Initialize(CSiaApi* siaApi, CSiaDriveConfig* siaDriveConfig)
{ {
@@ -851,7 +873,7 @@ public:
_dokanOps.FindFiles = Sia_FindFiles; _dokanOps.FindFiles = Sia_FindFiles;
_dokanOps.FindFilesWithPattern = nullptr; _dokanOps.FindFilesWithPattern = nullptr;
_dokanOps.FindStreams = nullptr; _dokanOps.FindStreams = nullptr;
_dokanOps.FlushFileBuffers = nullptr; _dokanOps.FlushFileBuffers = Sia_FlushFileBuffers;
_dokanOps.GetDiskFreeSpaceW = Sia_GetDiskFreeSpaceW; _dokanOps.GetDiskFreeSpaceW = Sia_GetDiskFreeSpaceW;
_dokanOps.GetFileInformation = Sia_GetFileInformation; _dokanOps.GetFileInformation = Sia_GetFileInformation;
_dokanOps.GetFileSecurityW = nullptr; _dokanOps.GetFileSecurityW = nullptr;