types

package
v0.0.0-...-b664000 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package types contains definitions for generic file system strings: - Drive - Mount point - Path - Virtual disk - Volume

Methods of these types do not verify object existence and do not call into OS-specific APIs related to a certain type of object.

Index

Constants

View Source
const IntPtrZero = uintptr(0)
View Source
const InvalidVDiskHandle = VDiskHandle(windows.InvalidHandle)

Variables

View Source
var ErrorRetryLimitExceeded = errors.New("retry limit exceeded")
View Source
var ErrorTyping = errors.New("invalid type")
View Source
var PathSeparator = fmt.Sprintf("%c", os.PathSeparator)

Functions

This section is empty.

Types

type Device

type Device Path

Device The returned string is an object under `\GLOBAL??`. Examples: - VHDX: `\\?\scsi#drives&ven_msft&prod_virtual_disk#2&1f4adffe&0&000001#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}` - NVMe drives: `\\?\scsi#drives&ven_msft&prod_virtual_disk#2&1f4adffe&0&000001#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}`

func (Device) AsFileNameW

func (d Device) AsFileNameW() (*uint16, error)

func (Device) AsObjectPathW

func (d Device) AsObjectPathW() (*uint16, error)

type Directory

type Directory interface {
	// AsDirectoryW returns a pointer to a UTF-16 string which contains the directory path representation of this object.
	AsDirectoryW() (*uint16, error)
}

type Drive

type Drive Path

Drive path in the format of `\\.\PhysicalDrive0`.

func DriveFromId

func DriveFromId(id uint32) Drive

func (Drive) AsFileNameW

func (d Drive) AsFileNameW() (*uint16, error)

func (Drive) AsId

func (d Drive) AsId() (uint32, error)

func (Drive) AsObjectPathW

func (d Drive) AsObjectPathW() (*uint16, error)

type File

type File interface {
	// AsFileNameW returns a pointer to a UTF-16 string which can be used as the first argument to CreateFileW.
	AsFileNameW() (*uint16, error)
}

type KernelObject

type KernelObject interface {
	// AsObjectPathW returns a pointer to a UTF-16 string which is the object's kernel path.
	AsObjectPathW() (*uint16, error)
}

type MountPoint

type MountPoint Path

MountPoint is a reparse point. Examples: - `\\.\C:` - `\\.\C:\xxx\yyy`

func (MountPoint) AsDirectoryW

func (mp MountPoint) AsDirectoryW() (*uint16, error)

func (MountPoint) AsFileNameW

func (mp MountPoint) AsFileNameW() (*uint16, error)

type Path

type Path string

Path represents a generic Windows path in the paths system, without assumption of its kind or existence.

func PathFromUTF16

func PathFromUTF16(s []uint16) Path

func (Path) AsDirectory

func (p Path) AsDirectory() string

func (Path) AsFileName

func (p Path) AsFileName() string

func (Path) AsFileNameW

func (p Path) AsFileNameW() (*uint16, error)

func (Path) Segments

func (p Path) Segments() (ret []Path)

type VDiskHandle

type VDiskHandle windows.Handle

type Volume

type Volume Path

Volume GUID path in the format of `\\?\Volume{00000000-0000-0000-0000-00000000000}\`. Note that a volume's path always end with `\`. https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-volume

func (Volume) AsFileNameW

func (v Volume) AsFileNameW() (*uint16, error)

func (Volume) AsObjectPathW

func (v Volume) AsObjectPathW() (*uint16, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL