Documentation
¶
Index ¶
- Constants
- Variables
- func DriverVersion() (uint32, error)
- func Init() error
- func NotifyCreate(instance MountHandle, filePath string, isDirectory bool) error
- func NotifyDelete(instance MountHandle, filePath string, isDirectory bool) error
- func NotifyRename(instance MountHandle, oldPath, newPath string, isDirectory bool) error
- func NotifyUpdate(instance MountHandle, filePath string) error
- func NotifyXAttrUpdate(instance MountHandle, filePath string) error
- func Shutdown() error
- func UTF16FromString(s string) ([]uint16, error)
- func UTF16PtrFromString(s string) (*uint16, error)
- func Version() (uint32, error)
- type ByHandleFileInfo
- type Disk
- type DokanOperations
- type DokanOptions
- type FileHandle
- type FileInfo
- type FileTime
- type MountHandle
- type MountInfo
- func (mi *MountInfo) Close() error
- func (m *MountInfo) Disk() Disk
- func (m *MountInfo) NotifyCreate(path string, isDir bool) error
- func (m *MountInfo) NotifyDelete(path string, isDir bool) error
- func (m *MountInfo) NotifyRename(oldPath, newPath string, isDir bool) error
- func (m *MountInfo) NotifyUpdate(path string) error
- func (m *MountInfo) NotifyXAttrUpdate(path string) error
- func (m *MountInfo) OpenedFileCount() int
- type MountPointInfo
- type NTStatus
- type VolumeInformation
- type WIN32_FIND_DATAW
Constants ¶
View Source
const ( DOKAN_OPTION_DEBUG = 1 DOKAN_OPTION_STDERR = 2 DOKAN_OPTION_ALT_STREAM = 4 DOKAN_OPTION_WRITE_PROTECT = 8 DOKAN_OPTION_NETWORK = 16 DOKAN_OPTION_REMOVABLE = 32 DOKAN_OPTION_MOUNT_MANAGER = 64 DOKAN_OPTION_CURRENT_SESSION = 128 DOKAN_OPTION_FILELOCK_USER_MODE = 256 )
DokanOptions
View Source
const ( STATUS_SUCCESS = NTStatus(0) STATUS_INVALID_PARAMETER = NTStatus(0xC000000D) STATUS_END_OF_FILE = NTStatus(0xC0000011) STATUS_ACCESS_DENIED = NTStatus(0xC0000022) STATUS_OBJECT_NAME_NOT_FOUND = NTStatus(0xC0000034) STATUS_OBJECT_NAME_COLLISION = NTStatus(0xC0000035) STATUS_OBJECT_PATH_NOT_FOUND = NTStatus(0xC000003A) STATUS_FILE_IS_A_DIRECTORY = NTStatus(0xC00000BA) STATUS_NOT_SAME_DEVICE = NTStatus(0xC00000D4) STATUS_NOT_SUPPORTED = NTStatus(0xC00000BB) STATUS_DIRECTORY_NOT_EMPTY = NTStatus(0xC0000101) STATUS_NOT_A_DIRECTORY = NTStatus(0xC0000103) )
NTSTATUS
View Source
const ( FILE_ATTRIBUTE_READONLY = 1 FILE_ATTRIBUTE_HIDDEN = 2 FILE_ATTRIBUTE_SYSTEM = 4 FILE_ATTRIBUTE_DIRECTORY = 16 FILE_ATTRIBUTE_ARCHIVE = 32 FILE_ATTRIBUTE_NORMAL = 128 )
File attribute
View Source
const ( // options FILE_DIRECTORY_FILE = 0x01 FILE_WRITE_THROUGH = 0x02 FILE_SEQUENTIAL_ONLY = 0x04 FILE_NON_DIRECTORY_FILE = 0x40 FILE_DELETE_ON_CLOSE = 0x000010 // disposition FILE_SUPERSEDE = 0 FILE_OPEN = 1 FILE_CREATE = 2 FILE_OPEN_IF = 3 FILE_OVERWRITE = 4 FILE_OVERWRITE_IF = 5 // access FILE_READ_DATA = 1 FILE_WRITE_DATA = 2 FILE_APPEND_DATA = 4 FILE_READ_EA = 8 FILE_WRITE_EA = 0x10 FILE_EXECUTE = 0x20 FILE_DELETE_CHILD = 0x40 FILE_READ_ATTRIBUTES = 0x80 FILE_WRITE_ATTRIBUTES = 0x100 )
ZwCreateFile options https://docs.microsoft.com/en-us/windows/win32/api/winternl/nf-winternl-ntcreatefile
View Source
const DOKAN_MINIMUM_COMPATIBLE_VERSION = 200
View Source
const MAX_PATH = 260
View Source
const UnixTimeOffset = 116444736000000000
UnixTime epoch from 16001-01-01 (UTC) in 0.1us.
View Source
const VOLUME_SECURITY_DESCRIPTOR_MAX_SIZE = (1024 * 16)
Variables ¶
View Source
var ErrBadDriveLetter = errors.New("Bad drive letter")
View Source
var ErrBadMountPoint = errors.New("Mount point is invalid")
View Source
var ErrDokan = errors.New("Failed to mount")
View Source
var ErrDokanVersion = errors.New("Version error")
View Source
var ErrDriverInstall = errors.New("Dokan install error")
View Source
var ErrFailedToLoadDokan = errors.New("Failed to load dokan2.dll")
View Source
var ErrMount = errors.New("Dokan mount failed")
View Source
var ErrStart = errors.New("Dokan start error")
Functions ¶
func NotifyCreate ¶
func NotifyCreate(instance MountHandle, filePath string, isDirectory bool) error
notify
func NotifyDelete ¶
func NotifyDelete(instance MountHandle, filePath string, isDirectory bool) error
func NotifyRename ¶
func NotifyRename(instance MountHandle, oldPath, newPath string, isDirectory bool) error
func NotifyUpdate ¶
func NotifyUpdate(instance MountHandle, filePath string) error
func NotifyXAttrUpdate ¶
func NotifyXAttrUpdate(instance MountHandle, filePath string) error
func UTF16FromString ¶ added in v0.1.4
func UTF16PtrFromString ¶ added in v0.1.4
Types ¶
type ByHandleFileInfo ¶
type Disk ¶ added in v0.1.2
type Disk interface {
GetVolumeInformation(finfo *FileInfo) (VolumeInformation, NTStatus)
GetDiskFreeSpace(availableBytes *uint64, totalBytes *uint64, freeBytes *uint64, finfo *FileInfo) NTStatus
CreateFile(name string, secCtx uintptr, access, attrs, share, disposition, options uint32, finfo *FileInfo) (FileHandle, NTStatus)
}
type DokanOperations ¶
type DokanOperations struct {
ZwCreateFile uintptr
Cleanup uintptr
CloseFile uintptr
ReadFile uintptr
WriteFile uintptr
FlushFileBuffers uintptr
GetFileInformation uintptr
FindFiles uintptr
FindFilesWithPattern uintptr
SetFileAttributes uintptr
SetFileTime uintptr
DeleteFile uintptr
DeleteDirectory uintptr
MoveFile uintptr
SetEndOfFile uintptr
SetAllocationSize uintptr
LockFile uintptr
UnlockFile uintptr
GetDiskFreeSpace uintptr
GetVolumeInformation uintptr
Mounted uintptr
Unmounted uintptr
GetFileSecurity uintptr
SetFileSecurity uintptr
FindStreams uintptr
}
type DokanOptions ¶
type DokanOptions struct {
Version uint16
SingleThread uint8
Options uint32
GlobalContext unsafe.Pointer
MountPoint unsafe.Pointer // LPCWSTR
UNCName unsafe.Pointer // LPCWSTR
Timeout uint32
AllocationUnitSize uint32
SectorSize uint32
VolumeSecurityDescriptorLength uint32
VolumeSecurityDescriptor [VOLUME_SECURITY_DESCRIPTOR_MAX_SIZE]byte
}
type FileHandle ¶ added in v0.1.2
type FileHandle interface {
FindFiles(fillFindDataCallBack func(fi *WIN32_FIND_DATAW) (buffferFull bool, err error), finfo *FileInfo) NTStatus
GetFileInformation(fi *ByHandleFileInfo, finfo *FileInfo) NTStatus
ReadFile(buf []byte, read *int32, offset int64, finfo *FileInfo) NTStatus
WriteFile(buf []byte, written *int32, offset int64, finfo *FileInfo) NTStatus
SetEndOfFile(offset int64, finfo *FileInfo) NTStatus
MoveFile(newname string, replaceIfExisting bool, finfo *FileInfo) NTStatus
DeleteFile(finfo *FileInfo) NTStatus
DeleteDirectory(finfo *FileInfo) NTStatus
Cleanup(finfo *FileInfo) NTStatus
CloseFile(*FileInfo)
}
type FileInfo ¶ added in v0.1.2
type FileInfo struct {
Context unsafe.Pointer
DokanContext uint64
DokanOptions *DokanOptions
ProcessingContext uintptr
ProcessId uint32
IsDirectory uint8
DeleteOnClose uint8
PagingIo uint8
SynchronousIo uint8
Nocache uint8
WriteToEndOfFile uint8
}
func (*FileInfo) IsDeleteOnClose ¶ added in v0.1.2
type FileTime ¶
type FileTime [2]uint32 // {LowDateTime, HighDateTime}
func UnixNanoToFileTime ¶ added in v0.1.3
type MountHandle ¶ added in v0.1.2
type MountHandle uintptr
func CreateFileSystem ¶
func CreateFileSystem(options *DokanOptions, operations *DokanOperations) (MountHandle, error)
func (MountHandle) Close ¶ added in v0.1.2
func (mh MountHandle) Close() error
type MountInfo ¶ added in v0.1.2
type MountInfo struct {
// contains filtered or unexported fields
}
func (*MountInfo) Close ¶ added in v0.1.2
Close close MountInfo to unmount this filesystem. MountInfo must be closed when it is no longer needed.
func (*MountInfo) NotifyCreate ¶ added in v0.1.2
NotifyCreate notify file create event.
func (*MountInfo) NotifyDelete ¶ added in v0.1.2
NotifyDelete notify file delete event.
func (*MountInfo) NotifyRename ¶ added in v0.1.2
NotifyRename notify file rename event.
func (*MountInfo) NotifyUpdate ¶ added in v0.1.2
NotifyUpdate notify attributes update event.
func (*MountInfo) NotifyXAttrUpdate ¶ added in v0.1.2
NotifyXAttrUpdate notify extended attributes update event.
func (*MountInfo) OpenedFileCount ¶ added in v0.1.2
OpenedFileCount returns number of files currently open in this filesystem.
type MountPointInfo ¶
type MountPointInfo struct {
Type uint32
MountPoint string
UNCName string
DeviceName string
SessionID uint32
MountOptions uint32
}
func MountPoints ¶
func MountPoints() ([]*MountPointInfo, error)
type NTStatus ¶ added in v0.1.2
type NTStatus uintptr
func ErrorToNTStatus ¶
ErrorToNTStatus map typical IO errrors to NTStatus
type VolumeInformation ¶ added in v0.1.2
type WIN32_FIND_DATAW ¶
Click to show internal directories.
Click to hide internal directories.