aboutsummaryrefslogtreecommitdiff
path: root/src/zenvfs/projfsproviderinterface.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-09-20 15:22:03 +0200
committerGitHub <[email protected]>2023-09-20 15:22:03 +0200
commit14d7568f9c7d970b7bbf7b6463a0a8530f98bb6f (patch)
treebf24ac15759385cea339f7e1cf5380f984f5699a /src/zenvfs/projfsproviderinterface.cpp
parentchangelog version bump (diff)
downloadzen-14d7568f9c7d970b7bbf7b6463a0a8530f98bb6f.tar.xz
zen-14d7568f9c7d970b7bbf7b6463a0a8530f98bb6f.zip
VFS implementation for local storage service (#396)
currently, only Windows (using Projected File System) is supported
Diffstat (limited to 'src/zenvfs/projfsproviderinterface.cpp')
-rw-r--r--src/zenvfs/projfsproviderinterface.cpp98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/zenvfs/projfsproviderinterface.cpp b/src/zenvfs/projfsproviderinterface.cpp
new file mode 100644
index 000000000..ca4b91382
--- /dev/null
+++ b/src/zenvfs/projfsproviderinterface.cpp
@@ -0,0 +1,98 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#include "projfsproviderinterface.h"
+
+#if ZEN_WITH_VFS
+
+namespace zen {
+
+HRESULT
+ProjFsProviderInterface::Notify(const PRJ_CALLBACK_DATA* CallbackData,
+ BOOLEAN IsDirectory,
+ PRJ_NOTIFICATION NotificationType,
+ PCWSTR DestinationFileName,
+ PRJ_NOTIFICATION_PARAMETERS* NotificationParameters)
+{
+ ZEN_UNUSED(CallbackData, IsDirectory, NotificationType, DestinationFileName, NotificationParameters);
+ return S_OK;
+}
+
+HRESULT
+ProjFsProviderInterface::QueryFileName(const PRJ_CALLBACK_DATA* CallbackData)
+{
+ ZEN_UNUSED(CallbackData);
+ return S_OK;
+}
+
+void
+ProjFsProviderInterface::CancelCommand(const PRJ_CALLBACK_DATA* CallbackData)
+{
+ ZEN_UNUSED(CallbackData);
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Forwarding functions for all ProjFS callbacks - these simply call the
+// corresponding member function on the active provider
+//
+
+HRESULT
+ProjFsProviderInterface::StartDirEnumCallback_C(_In_ const PRJ_CALLBACK_DATA* CallbackData, _In_ const GUID* EnumerationId)
+{
+ return reinterpret_cast<ProjFsProviderInterface*>(CallbackData->InstanceContext)->StartDirEnum(CallbackData, EnumerationId);
+}
+
+HRESULT
+ProjFsProviderInterface::EndDirEnumCallback_C(_In_ const PRJ_CALLBACK_DATA* CallbackData, _In_ const GUID* EnumerationId)
+{
+ return reinterpret_cast<ProjFsProviderInterface*>(CallbackData->InstanceContext)->EndDirEnum(CallbackData, EnumerationId);
+}
+
+HRESULT
+ProjFsProviderInterface::GetDirEnumCallback_C(_In_ const PRJ_CALLBACK_DATA* CallbackData,
+ _In_ const GUID* EnumerationId,
+ _In_opt_ PCWSTR SearchExpression,
+ _In_ PRJ_DIR_ENTRY_BUFFER_HANDLE DirEntryBufferHandle)
+{
+ return reinterpret_cast<ProjFsProviderInterface*>(CallbackData->InstanceContext)
+ ->GetDirEnum(CallbackData, EnumerationId, SearchExpression, DirEntryBufferHandle);
+}
+
+HRESULT
+ProjFsProviderInterface::GetPlaceholderInfoCallback_C(_In_ const PRJ_CALLBACK_DATA* CallbackData)
+{
+ return reinterpret_cast<ProjFsProviderInterface*>(CallbackData->InstanceContext)->GetPlaceholderInfo(CallbackData);
+}
+
+HRESULT
+ProjFsProviderInterface::GetFileDataCallback_C(_In_ const PRJ_CALLBACK_DATA* CallbackData, _In_ UINT64 ByteOffset, _In_ UINT32 Length)
+{
+ return reinterpret_cast<ProjFsProviderInterface*>(CallbackData->InstanceContext)->GetFileData(CallbackData, ByteOffset, Length);
+}
+
+HRESULT
+ProjFsProviderInterface::NotificationCallback_C(_In_ const PRJ_CALLBACK_DATA* CallbackData,
+ _In_ BOOLEAN IsDirectory,
+ _In_ PRJ_NOTIFICATION NotificationType,
+ _In_opt_ PCWSTR DestinationFileName,
+ _Inout_ PRJ_NOTIFICATION_PARAMETERS* NotificationParameters)
+{
+ return reinterpret_cast<ProjFsProviderInterface*>(CallbackData->InstanceContext)
+ ->Notify(CallbackData, IsDirectory, NotificationType, DestinationFileName, NotificationParameters);
+}
+
+HRESULT
+ProjFsProviderInterface::QueryFileName_C(_In_ const PRJ_CALLBACK_DATA* CallbackData)
+{
+ return reinterpret_cast<ProjFsProviderInterface*>(CallbackData->InstanceContext)->QueryFileName(CallbackData);
+}
+
+void
+ProjFsProviderInterface::CancelCommand_C(_In_ const PRJ_CALLBACK_DATA* CallbackData)
+{
+ return reinterpret_cast<ProjFsProviderInterface*>(CallbackData->InstanceContext)->CancelCommand(CallbackData);
+}
+
+} // namespace zen
+
+#endif