mirror of
https://github.com/dominicusin/zfs-win
synced 2025-08-22 01:58:20 +00:00
using dokan 6
This commit is contained in:
parent
87e159d39c
commit
35eb1100ba
@ -40,19 +40,22 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// The current Dokan version (ver 0.6.0). Please set this constant on DokanOptions->Version.
|
||||
#define DOKAN_VERSION 600
|
||||
|
||||
#define DOKAN_OPTION_DEBUG 1 // ouput debug message
|
||||
#define DOKAN_OPTION_STDERR 2 // ouput debug message to stderr
|
||||
#define DOKAN_OPTION_ALT_STREAM 4 // use alternate stream
|
||||
#define DOKAN_OPTION_KEEP_ALIVE 8 // use auto unmount
|
||||
#define DOKAN_OPTION_NETWORK 16 // use network drive
|
||||
#define DOKAN_OPTION_NETWORK 16 // use network drive, you need to install Dokan network provider.
|
||||
#define DOKAN_OPTION_REMOVABLE 32 // use removable drive
|
||||
|
||||
typedef struct _DOKAN_OPTIONS {
|
||||
WCHAR DriveLetter; // drive letter to be mounted
|
||||
USHORT Version; // Supported Dokan Version, ex. "530" (Dokan ver 0.5.3)
|
||||
USHORT ThreadCount; // number of threads to be used
|
||||
ULONG Options; // combination of DOKAN_OPTIONS_*
|
||||
ULONG64 GlobalContext; // FileSystem can use this variable
|
||||
LPCWSTR MountPoint; // mount point "M:\" (drive letter) or "C:\mount\dokan" (path in NTFS)
|
||||
} DOKAN_OPTIONS, *PDOKAN_OPTIONS;
|
||||
|
||||
typedef struct _DOKAN_FILE_INFO {
|
||||
@ -94,7 +97,6 @@ typedef struct _DOKAN_OPERATIONS {
|
||||
DWORD, // ShareMode
|
||||
DWORD, // CreationDisposition
|
||||
DWORD, // FlagsAndAttributes
|
||||
//HANDLE, // TemplateFile
|
||||
PDOKAN_FILE_INFO);
|
||||
|
||||
int (DOKAN_CALLBACK *OpenDirectory) (
|
||||
@ -173,11 +175,12 @@ typedef struct _DOKAN_OPERATIONS {
|
||||
|
||||
// You should not delete file on DeleteFile or DeleteDirectory.
|
||||
// When DeleteFile or DeleteDirectory, you must check whether
|
||||
// you can delete or not, and return 0 (when you can delete it)
|
||||
// you can delete the file or not, and return 0 (when you can delete it)
|
||||
// or appropriate error codes such as -ERROR_DIR_NOT_EMPTY,
|
||||
// -ERROR_SHARING_VIOLATION.
|
||||
// When you return 0 (ERROR_SUCCESS), you get Cleanup with
|
||||
// FileInfo->DeleteOnClose set TRUE, you delete the file.
|
||||
// FileInfo->DeleteOnClose set TRUE and you have to delete the
|
||||
// file in Close.
|
||||
int (DOKAN_CALLBACK *DeleteFile) (
|
||||
LPCWSTR, // FileName
|
||||
PDOKAN_FILE_INFO);
|
||||
@ -248,6 +251,24 @@ typedef struct _DOKAN_OPERATIONS {
|
||||
int (DOKAN_CALLBACK *Unmount) (
|
||||
PDOKAN_FILE_INFO);
|
||||
|
||||
|
||||
// Suported since 0.6.0. You must specify the version at DOKAN_OPTIONS.Version.
|
||||
int (DOKAN_CALLBACK *GetFileSecurity) (
|
||||
LPCWSTR, // FileName
|
||||
PSECURITY_INFORMATION, // A pointer to SECURITY_INFORMATION value being requested
|
||||
PSECURITY_DESCRIPTOR, // A pointer to SECURITY_DESCRIPTOR buffer to be filled
|
||||
ULONG, // length of Security descriptor buffer
|
||||
PULONG, // LengthNeeded
|
||||
PDOKAN_FILE_INFO);
|
||||
|
||||
int (DOKAN_CALLBACK *SetFileSecurity) (
|
||||
LPCWSTR, // FileName
|
||||
PSECURITY_INFORMATION,
|
||||
PSECURITY_DESCRIPTOR, // SecurityDescriptor
|
||||
ULONG, // SecurityDescriptor length
|
||||
PDOKAN_FILE_INFO);
|
||||
|
||||
|
||||
} DOKAN_OPERATIONS, *PDOKAN_OPERATIONS;
|
||||
|
||||
|
||||
@ -258,8 +279,8 @@ typedef struct _DOKAN_OPERATIONS {
|
||||
#define DOKAN_DRIVE_LETTER_ERROR -2 /* Bad Drive letter */
|
||||
#define DOKAN_DRIVER_INSTALL_ERROR -3 /* Can't install driver */
|
||||
#define DOKAN_START_ERROR -4 /* Driver something wrong */
|
||||
#define DOKAN_MOUNT_ERROR -5 /* Can't assign a drive letter */
|
||||
|
||||
#define DOKAN_MOUNT_ERROR -5 /* Can't assign a drive letter or mount point */
|
||||
#define DOKAN_MOUNT_POINT_ERROR -6 /* Mount point is invalid */
|
||||
|
||||
int DOKANAPI
|
||||
DokanMain(
|
||||
@ -269,7 +290,11 @@ DokanMain(
|
||||
|
||||
BOOL DOKANAPI
|
||||
DokanUnmount(
|
||||
WCHAR DriveLetter);
|
||||
WCHAR DriveLetter);
|
||||
|
||||
BOOL DOKANAPI
|
||||
DokanRemoveMountPoint(
|
||||
LPCWSTR MountPoint);
|
||||
|
||||
|
||||
// DokanIsNameInExpression
|
||||
@ -295,28 +320,12 @@ DokanResetTimeout(
|
||||
ULONG Timeout, // timeout in millisecond
|
||||
PDOKAN_FILE_INFO DokanFileInfo);
|
||||
|
||||
|
||||
|
||||
// for internal use
|
||||
// don't call
|
||||
BOOL DOKANAPI
|
||||
DokanServiceInstall(
|
||||
LPCWSTR ServiceName,
|
||||
DWORD ServiceType,
|
||||
LPCWSTR ServiceFullPath);
|
||||
|
||||
BOOL DOKANAPI
|
||||
DokanServiceDelete(
|
||||
LPCWSTR ServiceName);
|
||||
|
||||
BOOL DOKANAPI
|
||||
DokanNetworkProviderInstall();
|
||||
|
||||
BOOL DOKANAPI
|
||||
DokanNetworkProviderUninstall();
|
||||
|
||||
BOOL DOKANAPI
|
||||
DokanSetDebugMode(ULONG Mode);
|
||||
// Get the handle to Access Token
|
||||
// This method needs be called in CreateFile, OpenDirectory or CreateDirectly callback.
|
||||
// The caller must call CloseHandle for the returned handle.
|
||||
HANDLE DOKANAPI
|
||||
DokanOpenRequestorToken(
|
||||
PDOKAN_FILE_INFO DokanFileInfo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
BIN
dokan/dokan.lib
BIN
dokan/dokan.lib
Binary file not shown.
@ -213,6 +213,8 @@ namespace ZFS
|
||||
|
||||
if(m_handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
wprintf(L"Cannot open device %s\n", path);
|
||||
|
||||
m_handle = NULL;
|
||||
|
||||
return false;
|
||||
@ -229,6 +231,13 @@ namespace ZFS
|
||||
}
|
||||
}
|
||||
|
||||
if(wcsstr(path, L".vdi") != NULL)
|
||||
{
|
||||
m_start += 0x2000;
|
||||
m_size -= 0x2000;
|
||||
}
|
||||
else
|
||||
|
||||
for(int i = 0; i < 2; i++, partition >>= 8)
|
||||
{
|
||||
uint8_t mbr[0x200];
|
||||
|
@ -693,11 +693,11 @@ static void usage()
|
||||
"ZFS for Windows\n"
|
||||
"\n"
|
||||
"usage:\n"
|
||||
" mount <drive> <dataset> <pool ..>\n"
|
||||
" mount <mountpoint> <dataset> <pool ..>\n"
|
||||
" list <pool ..>\n"
|
||||
"\n"
|
||||
"examples:\n"
|
||||
" zfs-win.exe mount m \"rpool/ROOT/opensolaris\" \"\\\\.\\PhysicalDrive1\" \"\\\\.\\PhysicalDrive2\"\n"
|
||||
" zfs-win.exe mount \"m:\\\" \"rpool/ROOT/opensolaris\" \"\\\\.\\PhysicalDrive1\" \"\\\\.\\PhysicalDrive2\"\n"
|
||||
" zfs-win.exe list \"Virtual Machine-flat.vmdk\"\n"
|
||||
);
|
||||
|
||||
@ -785,7 +785,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
if(argc < 2) {usage(); return -1;}
|
||||
|
||||
wchar_t drive = 0;
|
||||
std::wstring mp;
|
||||
std::list<std::wstring> paths;
|
||||
std::wstring pool;
|
||||
std::wstring dataset;
|
||||
@ -795,7 +795,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
if(argc < 5) {usage(); return -1;}
|
||||
|
||||
drive = argv[2][0];
|
||||
mp = argv[2];
|
||||
|
||||
std::list<std::wstring> sl;
|
||||
|
||||
@ -864,10 +864,11 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
memset(&options, 0, sizeof(DOKAN_OPTIONS));
|
||||
|
||||
options.DriveLetter = drive;
|
||||
options.Version = DOKAN_VERSION;
|
||||
options.GlobalContext = (ULONG64)&ctx;
|
||||
options.ThreadCount = 1; // TODO
|
||||
options.Options = DOKAN_OPTION_KEEP_ALIVE;
|
||||
options.MountPoint = mp.c_str();
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user