github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/dokan/bridge.h (about) 1 // Copyright 2016-2018 Keybase Inc. All rights reserved. 2 // Use of this source code is governed by a BSD 3 // license that can be found in the LICENSE file. 4 5 #ifndef KBFS_DOKAN_BRIDGE_H__ 6 #define KBFS_DOKAN_BRIDGE_H__ 7 8 #if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__) 9 10 #define UNICODE 1 11 #define _UNICODE 1 12 13 #include <stdint.h> 14 #include <windows.h> 15 #include <ntdef.h> 16 #include <ntstatus.h> 17 18 /* Compatibility for older toolchains */ 19 #define PWIN32_FIND_DATAW LPWIN32_FIND_DATAW 20 typedef struct kbfs_WIN32_FIND_STREAM_DATA_ { 21 LARGE_INTEGER StreamSize; 22 WCHAR cStreamName[MAX_PATH + 36]; 23 } kbfs_WIN32_FIND_STREAM_DATA,*kbfs_PWIN32_FIND_STREAM_DATA; 24 #define PWIN32_FIND_STREAM_DATA kbfs_PWIN32_FIND_STREAM_DATA 25 26 27 #include "dokan_header/dokan.h" 28 29 typedef int32_t error_t; 30 typedef uint32_t go_fs_id; 31 32 struct kbfsLibdokanCtx { 33 DOKAN_OPERATIONS dokan_operations; 34 DOKAN_OPTIONS dokan_options; 35 }; 36 37 struct kbfsLibdokanCtx* kbfsLibdokanAllocCtx(ULONG64 fsslot); 38 error_t kbfsLibdokanFree(struct kbfsLibdokanCtx* ctx); 39 error_t kbfsLibdokanRun(struct kbfsLibdokanCtx* ctx); 40 void kbfsLibdokanSet_path(struct kbfsLibdokanCtx* ctx, void*); 41 42 int kbfsLibdokanFill_find(PFillFindData, PWIN32_FIND_DATAW, PDOKAN_FILE_INFO); 43 44 BOOL kbfsLibdokan_RemoveMountPoint(LPCWSTR MountPoint); 45 // kbfsLibdokanPtr_OpenRequestorToken return value is a HANDLE. 46 void* kbfsLibdokan_OpenRequestorToken(PDOKAN_FILE_INFO DokanFileInfo); 47 48 enum { 49 kbfsLibdokanDebug = DOKAN_OPTION_DEBUG, 50 kbfsLibdokanStderr = DOKAN_OPTION_STDERR, 51 kbfsLibdokanRemovable = DOKAN_OPTION_REMOVABLE, 52 kbfsLibdokanMountManager = DOKAN_OPTION_MOUNT_MANAGER, 53 kbfsLibdokanCurrentSession = DOKAN_OPTION_CURRENT_SESSION, 54 kbfsLibdokanUseFindFilesWithPattern = 1<<24, 55 56 kbfsLibDokan_ERROR = DOKAN_ERROR, 57 kbfsLibDokan_DRIVE_LETTER_ERROR = DOKAN_DRIVE_LETTER_ERROR, 58 kbfsLibDokan_DRIVER_INSTALL_ERROR = DOKAN_DRIVER_INSTALL_ERROR, 59 kbfsLibDokan_START_ERROR = DOKAN_START_ERROR, 60 kbfsLibDokan_MOUNT_ERROR = DOKAN_MOUNT_ERROR, 61 kbfsLibDokan_MOUNT_POINT_ERROR = DOKAN_MOUNT_POINT_ERROR, 62 kbfsLibDokan_VERSION_ERROR = DOKAN_VERSION_ERROR, 63 kbfsLibDokan_DLL_LOAD_ERROR = -99, 64 }; 65 66 extern uintptr_t kbfsLibdokanPtr_RemoveMountPoint; 67 extern uintptr_t kbfsLibdokanPtr_OpenRequestorToken; 68 extern uintptr_t kbfsLibdokanPtr_Main; 69 70 ULONG kbfsLibDokan_GetVersion(uintptr_t proc); 71 72 #endif /* windows check */ 73 74 #endif /* KBFS_DOKAN_BRIDGE_H__ */