volumeapi

package
v0.0.0-...-5cdaeaf Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package volumeapi provides access to the Windows Volume Management API.

Index

Constants

View Source
const (
	// MaxVolumeLabelLength is the maximum number of characters in a volume label.
	MaxVolumeLabelLength = 261

	// MaxVolumeNameLength is the maximum number of characters in a volume name.
	//
	// Volume names are also known as volume GUID paths, and are based on the
	// globally unique identifier of the volume. Volume names are not supplied by
	// or editable by users, unlike volume labels.
	//
	// Volume names will always be of this form:
	//
	//   \\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\
	MaxVolumeNameLength = 50

	// MaxFileSystemNameLength is the maximum number of characters in a file
	// system name.
	MaxFileSystemNameLength = 261
)
View Source
const (
	// ErrMoreData indicates that a buffer was too small to hold the
	// data that is to be recieved.
	ErrMoreData = syscall.Errno(234)
)

Variables

This section is empty.

Functions

func GetVolumeInformationByHandle

func GetVolumeInformationByHandle(handle syscall.Handle) (volumeLabel string, serialNumber uint32, maxComponentLength uint32, flags uint32, fileSystem string, err error)

GetVolumeInformationByHandle retrieves information about the volume represented by the given system handle.

func GetVolumeNameForVolumeMountPoint

func GetVolumeNameForVolumeMountPoint(volumeMountPoint string) (volumeName string, err error)

GetVolumeNameForVolumeMountPoint retrieves the first volume name for the given mount point, which is a path in one of the following forms:

X:\
Y:\MountX\

Volume names are also known as volume GUID paths, and are based on the globally unique identifier of the volume. Volume names are not supplied by or editable by users, unlike volume labels.

Volume names will always be of this form:

\\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\

func GetVolumePathNamesForVolumeName

func GetVolumePathNamesForVolumeName(volumeName string) (pathNames []string, err error)

GetVolumePathNamesForVolumeName returns a complete set of volume paths and mount points for the given volume name, which must be a volume GUID path of this form:

\\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\

func Handle

func Handle(path string, access uint32, mode uint32) (syscall.Handle, error)

Handle attempts to acquire a system handle for the volume represented by path (or upon which path is mounted).

The given path may be in any of these forms:

C:\path\to\directory\
X:\
Y:\MountX\
\\.\X:
\\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\
\\.\PhysicalDrive0

func MountPoint

func MountPoint(s string) (mountPoint, volumeName string, err error)

MountPoint attempts to find the volume mount point for s. If successful, it returns both the volume mount point and the volune name (also known as the volume GUID path).

s may be in any of these forms:

C:\path\to\directory\
X:\
Y:\MountX\
\\.\X:
\\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\
\\.\PhysicalDrive0

If successful, the returned volume name will be of this form:

\\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\

Types

This section is empty.

Jump to

Keyboard shortcuts

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