GoWinApi

package module
v0.0.0-...-f8dbd7a Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: MIT Imports: 9 Imported by: 0

README


Markdownify
Go-WinAPI

A Golang Wrapper For The Windows API.

GitHub release (latest by date) GitHub go.mod Go version GitHub go.mod Go version GitHub go.mod Go version GitHub go.mod Go version GitHub go.mod Go version GitHub go.mod Go version Go Report Card

What is Go-WinApi?How To UseContributingCreditsRelatedLicense

screenshot

What is Go WinApi?

Go-WinApi is a golang wrapper for the windows api. Unlike other wrappers though it parses the data provided by the API into human readable and immediately in application.

How to use

Install a ()[]

git clone https://github.com/michaeldcanady/Go-WinApi.git

Contributing

Credit

License

N/A


Documentation

Index

Constants

View Source
const (
	MAX_PATH = 260

	MaxVolumeNameLength = 50
	MAXDWORD            = 4294967295
	NUL                 = 0x0000

	INVALID_HANDLE_VALUE HANDLE = 18446744073709551615
	//DRIVE_UNKNOWN The drive type cannot be determined.
	DRIVE_UNKNOWN DriveType = 0

	//DRIVE_NO_ROOT_DIR The root path is invalid; for example, there is no volume mounted at the specified path.
	DRIVE_NO_ROOT_DIR DriveType = 1

	//DRIVE_REMOVABLE The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.
	DRIVE_REMOVABLE DriveType = 2

	//DRIVE_FIXED The drive has fixed media; for example, a hard disk drive or flash drive.
	DRIVE_FIXED DriveType = 3

	//DRIVE_REMOTE The drive is a remote (network) drive.
	DRIVE_REMOTE DriveType = 4

	//DRIVE_CDROM The drive is a CD-ROM drive.
	DRIVE_CDROM DriveType = 5

	//DRIVE_RAMDISK The drive is a RAM disk.
	DRIVE_RAMDISK DriveType = 6

	//FILE_ATTRIBUTE_READONLY The file is read only. Applications can read the file, but cannot write to or delete it.
	FILE_ATTRIBUTE_READONLY SecurityAttribute = 1

	//FILE_ATTRIBUTE_HIDDEN The file is hidden. Do not include it in an ordinary directory listing.
	FILE_ATTRIBUTE_HIDDEN SecurityAttribute = 2

	//FILE_ATTRIBUTE_SYSTEM The file is part of or used exclusively by an operating system.
	FILE_ATTRIBUTE_SYSTEM SecurityAttribute = 4

	FILE_ATTRIBUTE_ARCHIVE SecurityAttribute = 32

	//FILE_ATTRIBUTE_NORMAL The file does not have other attributes set. This attribute is valid only if used alone.
	//
	//Only Used Alone.
	FILE_ATTRIBUTE_NORMAL SecurityAttribute = 128

	//FILE_ATTRIBUTE_TEMPORARY The file is being used for temporary storage.
	//
	//For more information, see the Caching Behavior section of this topic.
	FILE_ATTRIBUTE_TEMPORARY SecurityAttribute = 256

	//FILE_ATTRIBUTE_OFFLINE The data of a file is not immediately available. This attribute indicates that file data is physically moved to offline storage.
	//This attribute is used by Remote Storage, the hierarchical storage management software. Applications should not arbitrarily change this attribute.
	FILE_ATTRIBUTE_OFFLINE SecurityAttribute = 4096

	//FILE_ATTRIBUTE_ENCRYPTED The file or directory is encrypted. For a file, this means that all data in the file is encrypted.
	//For a directory, this means that encryption is the default for newly created files and subdirectories. For more information, see File Encryption.
	//
	//This flag has no effect if FILE_ATTRIBUTE_SYSTEM is also specified.
	//
	//This flag is not supported on Home, Home Premium, Starter, or ARM editions of Windows.
	FILE_ATTRIBUTE_ENCRYPTED SecurityAttribute = 16384

	//FIND_FIRST_EX_CASE_SENSITIVE Searches are case-sensitive.
	FIND_FIRST_EX_CASE_SENSITIVE AdditionalFlags = 1

	//FIND_FIRST_EX_LARGE_FETCH Uses a larger buffer for directory queries, which can increase performance of the find operation.
	//Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:  This value is not supported until Windows Server 2008 R2 and Windows 7.
	FIND_FIRST_EX_LARGE_FETCH AdditionalFlags = 2

	//FIND_FIRST_EX_ON_DISK_ENTRIES_ONLY Limits the results to files that are physically on disk. This flag is only relevant when a file virtualization filter is present.
	FIND_FIRST_EX_ON_DISK_ENTRIES_ONLY AdditionalFlags = 4
	//FINDEX_INFO_STANDARD The FindFirstFileEx function retrieves a
	//standard set of attribute information. The data is returned in a
	//WIN32_FIND_DATA structure.
	FINDEX_INFO_STANDARD InfoLevel = 0
	//FINDEX_INFO_BASIC The FindFirstFileEx function does not query the short file name, improving overall enumeration speed. The data is returned in a
	//WIN32_FIND_DATA structure, and the cAlternateFileName
	//member is always a NULL string.
	FINDEX_INFO_BASIC InfoLevel = 1
	//FINDEX_INFO_MAX_INFO_LEVEL This value is used for validation. Supported values are less than this value.
	FINDEX_INFO_MAX_INFO_LEVEL InfoLevel = 2
	//FINDEX_SEARCH_NAME_MATCH The search for a file that matches a specified file name.
	//
	//The lpSearchFilter parameter of
	//FindFirstFileEx must be
	//NULL when this search operation is used.
	FINDEX_SEARCH_NAME_MATCH SearchOps = 1

	//FINDEX_SEARCH_LIMIT_TO_DIRECTORIES This is an advisory flag. If the file system supports directory filtering, the function searches for a file that matches the specified name
	//and is also a directory. If the file system does not support directory filtering, this flag is silently ignored.
	//
	//The lpSearchFilter parameter of the FindFirstFileEx function must be NULL when this search value is used.
	//If directory filtering is desired, this flag can be used on all file systems, but because it is an advisory flag and only affects file systems that support it,
	//the application must examine the file attribute data stored in the lpFindFileData parameter of the FindFirstFileEx function to determine whether the function has returned a
	//handle to a directory.
	FINDEX_SEARCH_LIMIT_TO_DIRECTORIES SearchOps = 2

	//FINDEX_SEARCH_LIMIT_TO_DEVICES This filtering type is not available.
	//
	//For more information, see
	//Device Interface Classes.
	FINDEX_SEARCH_LIMIT_TO_DEVICES SearchOps = 3

	//FINDEX_SEARCH_MAX_SEARCH_OP Undefined by documentation.
	FINDEX_SEARCH_MAX_SEARCH_OP SearchOps = 4

	//FILE_TYPE_UNKNOWN Either the type of the specified file is unknown, or the function failed.
	FILE_TYPE_UNKNOWN FileType = 0x0000

	//FILE_TYPE_DISK The specified file is a disk file.
	FILE_TYPE_DISK FileType = 0x0001

	//FILE_TYPE_CHAR The specified file is a character file, typically an LPT device or a console.
	FILE_TYPE_CHAR FileType = 0x0002

	//FILE_TYPE_PIPE The specified file is a socket, a named pipe, or an anonymous pipe.
	FILE_TYPE_PIPE FileType = 0x0003

	//FILE_TYPE_REMOTE Unused.
	FILE_TYPE_REMOTE FileType = 0x8000

	//CREATE_NEW Creates a new file, only if it does not already exist.
	//
	//If the specified file exists, the function fails and the last-error code is set to ERROR_FILE_EXISTS (80).
	//
	//If the specified file does not exist and is a valid path to a writable location, a new file is created.
	CREATE_NEW CreationDisposition = 1

	//CREATE_ALWAYS Creates a new file, always.
	//
	//If the specified file exists and is writable, the function overwrites the file, the function succeeds, and last-error code is set to ERROR_ALREADY_EXISTS (183).
	//
	//If the specified file does not exist and is a valid path, a new file is created, the function succeeds, and the last-error code is set to zero.
	//
	//For more information, see the Remarks section of this topic.
	CREATE_ALWAYS CreationDisposition = 2

	//OPEN_EXISTING Opens a file or device, only if it exists.
	//
	//If the specified file or device does not exist, the function fails and the last-error code is set to ERROR_FILE_NOT_FOUND (2).
	//
	//For more information about devices, see the Remarks section.
	OPEN_EXISTING CreationDisposition = 3

	//OPEN_ALWAYS Opens a file, always.
	//
	//If the specified file exists, the function succeeds and the last-error code is set to ERROR_ALREADY_EXISTS (183).
	//
	//If the specified file does not exist and is a valid path to a writable location, the function creates a file and the last-error code is set to zero.
	OPEN_ALWAYS CreationDisposition = 4

	//TRUNCATE_EXISTING Opens a file and truncates it so that its size is zero bytes, only if it exists.
	//If the specified file does not exist, the function fails and the last-error code is set to ERROR_FILE_NOT_FOUND (2).
	//
	//The calling process must open the file with the GENERIC_WRITE bit set as part of the dwDesiredAccess parameter.
	TRUNCATE_EXISTING CreationDisposition = 5

	//DO_NOT_FILE_SHARE Prevents other processes from opening a file or device if they request delete, read, or write access.
	DO_NOT_FILE_SHARE = 0x00000000

	//FILE_SHARE_READ Enables subsequent open operations on a file or device to request delete access.
	//
	//Otherwise, other processes cannot open the file or device if they request delete access.
	//
	//If this flag is not specified, but the file or device has been opened for delete access, the function fails.
	//
	//Note  Delete access allows both delete and rename operations.
	FILE_SHARE_READ = 0x00000001

	//FILE_SHARE_WRITE Enables subsequent open operations on a file or device to request read access.
	//Otherwise, other processes cannot open the file or device if they request read access.
	//
	//If this flag is not specified, but the file or device has been opened for read access, the function fails.
	FILE_SHARE_WRITE = 0x00000002

	//FILE_SHARE_DELETE Enables subsequent open operations on a file or device to request write access. Otherwise, other processes cannot open the file or device if they request write access.
	//If this flag is not specified, but the file or device has been opened for write access or has a file mapping with write access, the function fails.
	FILE_SHARE_DELETE = 0x00000004

	//GENERIC_READ
	GENERIC_READ = 2147483648

	//FILE_FLAG_BACKUP_SEMANTICS
	FILE_FLAG_BACKUP_SEMANTICS = 2147483648
)
View Source
const (
	//ACPI The ACPI firmware table provider.
	ACPI FirmwareTable = 1094930505
	//FIRM The raw firmware table provider. Not supported for UEFI systems; use 'RSMB' instead.
	FIRM FirmwareTable = 1179210317
	//RSMB The raw SMBIOS firmware table provider.
	RSMB FirmwareTable = 1381190978

	FACP FirmwareTableId = 1178682192
	PCAF FirmwareTableId = 1346584902
	MSDM FirmwareTableId = 1296323405
)

Variables

View Source
var (
	FileNameFlags = map[int64]string{
		0x0: "FILE_NAME_NORMALIZED",
		0x8: "FILE_NAME_OPENED",
	}
)
View Source
var (
	SystemTimeToFileTimeProc = kernel32.NewProc("SystemTimeToFileTime")
)

Functions

func AreFileApisANSI

func AreFileApisANSI() bool

AreFileApisANSI If the set of file I/O functions is using the ANSI code page, the return value is true. If the set of file I/O functions is using the OEM code page, the return value is false.

func CloseHandle

func CloseHandle(handle syscall.Handle) (err error)

CloseHandle Closes an open object handle.

func CompareObjectHandles

func CompareObjectHandles(firstObjectHandel, secondObjectHandel syscall.Handle) bool

CompareObjectHandles Compares two object handles to determine if they refer to the same underlying kernel object.

func CreateDirectoryW

func CreateDirectoryW(pathName string, SecurityAttributes SecurityAttribute) error

func DeleteFileW

func DeleteFileW(fileName string) error

DeleteFileW Deletes an existing file.

To perform this operation as a transacted operation, use the DeleteFileTransacted function.

func DeleteVolumeMountPointW

func DeleteVolumeMountPointW(volumeMountPoint string) error

DeleteVolumeMountPointW Deletes a drive letter or mounted folder.

func EnumSystemFirmwareTables

func EnumSystemFirmwareTables(firmwareTableProviderSignature FirmwareTable) (tables []string, err error)

EnumSystemFirmwareTables Enumerates all system firmware tables of the specified type.

func FileTimeToSystemTime

func FileTimeToSystemTime(lpFileTime FileTime) (time.Time, error)

FileTimeToSystemTime Converts a file time to system time format. System time is based on Coordinated Universal Time (UTC).

func FindClose

func FindClose(hFindFile HANDLE) error

FindClose Closes a file search handle opened by the FindFirstFile, FindFirstFileEx, FindFirstFileNameW, FindFirstFileNameTransactedW, FindFirstFileTransacted, FindFirstStreamTransactedW, or FindFirstStreamW functions.

func FindFirstFileExW

func FindFirstFileExW(FileName string, fInfoLevelId int32, fSearchOp int32, dwAdditionalFlags AdditionalFlags) (HANDLE, Win32FindDataW, error)

FindFirstFileExW Searches a directory for a file or subdirectory with a name and attributes that match those specified. For the most basic version of this function, see FindFirstFile. To perform this operation as a transacted operation, use the FindFirstFileTransacted function.

func FindFirstFileNameW

func FindFirstFileNameW(fileName string)

TODO Figure out how to get string length to work

func FindFirstFileW

func FindFirstFileW(fileName string) (HANDLE, Win32FindDataW, error)

FindFirstFileW Searches a directory for a file or subdirectory with a name that matches a specific name (or partial name if wildcards are used).

To specify additional attributes to use in a search, use the FindFirstFileEx function.

To perform this operation as a transacted operation, use the FindFirstFileTransacted function.

func FindFirstStreamW

func FindFirstStreamW(fileName string) (HANDLE, Win32FindDataW, error)

FindFirstStreamW Enumerates the first stream with a ::$DATA stream type in the specified file or directory.

To perform this operation as a transacted operation, use the FindFirstStreamTransactedW function.

func FindNextStreamW

func FindNextStreamW(hFindFile HANDLE) (HANDLE, Win32FindDataW, error)

FindNextStreamW Continues a stream search started by a previous call to the FindFirstStreamW function.

func FindNextVolume

func FindNextVolume(handle HANDLE) (string, bool, error)

FindNextVolume Continues a volume search started by a call to the FindFirstVolume function. FindNextVolume finds one volume per call.

func FindVolumeClose

func FindVolumeClose(handle HANDLE) error

FindVolumeClose Closes the specified volume search handle. The FindFirstVolume and FindNextVolume functions use this search handle to locate volumes.

func GetDiskFreeSpaceExW

func GetDiskFreeSpaceExW(directoryName string) (int64, int64, int64, error)

GetDiskFreeSpaceExW Retrieves information about the amount of space that is available on a disk volume, which is the total amount of space, the total amount of free space, and the total amount of free space available to the user that is associated with the calling thread.

func GetDiskFreeSpaceW

func GetDiskFreeSpaceW(lpDirectoryName string) (lpSectorsPerCluster uint32, lpBytesPerSector uint32, lpNumberOfFreeClusters uint32, lpTotalNumberOfClusters uint32, err error)

GetDiskFreeSpaceW Retrieves information about the specified disk, including the amount of free space on the disk.

func GetDriveTypeW

func GetDriveTypeW(PathName string) (string, error)

GetDriveTypeW Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.

To determine whether a drive is a USB-type drive, call SetupDiGetDeviceRegistryProperty and specify the SPDRP_REMOVAL_POLICY property.

func GetFileAttributesW

func GetFileAttributesW(fileName string) ([]string, error)

GetFileAttributesW Retrieves file system attributes for a specified file or directory.

To get more attribute information, use the GetFileAttributesEx function.

To perform this operation as a transacted operation, use the GetFileAttributesTransacted function.

func GetFileSize

func GetFileSize(hFile HANDLE) (int64, error)

GetFileSize Retrieves the size of the specified file, in bytes.

It is recommended that you use GetFileSizeEx.

func GetFileSizeEx

func GetFileSizeEx(hFile HANDLE) (int64, error)

GetFileSizeEx Retrieves the size of the specified file.

func GetFileTime

func GetFileTime(hFile HANDLE) (time.Time, time.Time, time.Time, error)

GetFileTime Retrieves the date and time that a file or directory was created, last accessed, and last modified.

func GetFileType

func GetFileType(hFile HANDLE) (string, error)

GetFileType Retrieves the file type of the specified file.

func GetFinalPathNameByHandleW

func GetFinalPathNameByHandleW(hFile HANDLE) (string, string, error)

GetFinalPathNameByHandleW Retrieves the final path for the specified file.

For more information about file and path names, see Naming a File.

func GetFullPathNameW

func GetFullPathNameW(lpFileName string) (string, error)

GetFullPathNameW Retrieves the full path and file name of the specified file.

To perform this operation as a transacted operation, use the GetFullPathNameTransacted function.

For more information about file and path names, see File Names, Paths, and Namespaces.

func GetLogicalDriveStringsW

func GetLogicalDriveStringsW() (string, error)

GetLogicalDriveStringsW Fills a buffer with strings that specify valid drives in the system.

func GetLogicalDrives

func GetLogicalDrives() ([]string, error)

GetLogicalDrives returns a list of all logical drives on the host machine

func GetLongPathNameW

func GetLongPathNameW(shortPath string) (string, error)

GetLongPathNameW Converts the specified path to its long form.

To perform this operation as a transacted operation, use the GetLongPathNameTransacted function.

For more information about file and path names, see Naming Files, Paths, and Namespaces.

func GetShortPathNameW

func GetShortPathNameW(longPath string) (string, error)

GetShortPathNameW Retrieves the short path form of the specified path.

For more information about file and path names, see Naming Files, Paths, and Namespaces.

func GetSystemFirmwareTable

func GetSystemFirmwareTable(firmwareTableProviderSignature FirmwareTable, FirmwareTableID FirmwareTableId)

GetSystemFirmwareTable Retrieves the specified firmware table from the firmware table provider.

func GetVolumeNameForVolumeMountPointW

func GetVolumeNameForVolumeMountPointW(volumeMountPoint string) (string, error)

GetVolumeNameForVolumeMountPointW Retrieves a volume GUID path for the volume that is associated with the specified volume mount point ( drive letter, volume GUID path, or mounted folder).

func GetVolumePathNamesForVolumeNameW

func GetVolumePathNamesForVolumeNameW(volName []string) ([]string, error)

GetVolumePathNamesForVolumeNameW Retrieves a list of drive letters and mounted folder paths for the specified volume.

func LPSTRsToStrings

func LPSTRsToStrings(in [][]uint16) []string

func NewSecurityAttribtute

func NewSecurityAttribtute(nLength uint32, lpSecurityDescriptor uintptr, bInheritHandle bool) _SECURITY_ATTRIBUTES

func ReadFile

func ReadFile(hFile HANDLE) (string, error)

ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device.

This function is designed for both synchronous and asynchronous operations. For a similar function designed solely for asynchronous operation, see ReadFileEx.

func ReadFileEx

func ReadFileEx(hFile HANDLE) (string, error)

ReadFileEx Reads data from the specified file or input/output (I/O) device. It reports its completion status asynchronously, calling the specified completion routine when reading is completed or canceled and the calling thread is in an alertable wait state.

func SeperateFlags

func SeperateFlags(SystemFlags uint32, flagDefinitions map[int64]string) (flags []string)

SeperateFlags takes SystemFlags as hex, converts them to binary to determine each flag Then converts back into an int64 for later usage

func SetFileTime

func SetFileTime(hFile HANDLE, lpCreationTime, lpLastAccessTime, lpLastWriteTime FileTime) error

SetFileTime Sets the date and time that the specified file or directory was created, last accessed, or last modified.

func SystemTimeToFileTime

func SystemTimeToFileTime()

SystemTimeToFileTime Converts a system time to file time format. System time is based on Coordinated Universal Time (UTC).

func UintptrFromString

func UintptrFromString(s string) uintptr

UintptrFromString Converts a string to a uintptr

func WriteFile

func WriteFile(hFile HANDLE, data string) error

WriteFile Writes data to the specified file or input/output (I/O) device.

This function is designed for both synchronous and asynchronous operation. For a similar function designed solely for asynchronous operation, see WriteFileEx.

Types

type AdditionalFlags

type AdditionalFlags int64

AdditionalFlags

func (AdditionalFlags) String

func (a AdditionalFlags) String() string

type CreationDisposition

type CreationDisposition int64

CreationDisposition

func (CreationDisposition) String

func (c CreationDisposition) String() string

String

type DriveError

type DriveError struct {
	// contains filtered or unexported fields
}

func NewDriveError

func NewDriveError(msg string) DriveError

func (DriveError) Error

func (D DriveError) Error() string

type DriveType

type DriveType int64

DriveType

func (DriveType) String

func (d DriveType) String() string

type FileTime

type FileTime struct {
	DwLowDateTime  uint32
	DwHighDateTime uint32
}

FileTime Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).

func FileTimeToLocalFileTime

func FileTimeToLocalFileTime(lpFileTime FileTime) (lpLocalFileTime FileTime, err error)

FileTimeToLocalFileTime Converts a file time to a local file time.

func LocalFileTimeToFileTime

func LocalFileTimeToFileTime(in FileTime) (out FileTime, err error)

LocalFileTimeToFileTime Converts a local file time to a file time based on the Coordinated Universal Time (UTC).

func (FileTime) ToUintPtr

func (F FileTime) ToUintPtr() uintptr

type FileType

type FileType int64

FileType

type FirmwareTable

type FirmwareTable int64

type FirmwareTableId

type FirmwareTableId int64

type HANDLE

type HANDLE syscall.Handle

func CreateFile2

func CreateFile2(fileName string, dwDesiredAccess, dwShareMode, dwCreationDisposition uint32) (handle HANDLE, err error)

CreateFile2 Creates or opens a file or I/O device. The most commonly used I/O devices are as follows: file, file stream, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, and pipe. The function returns a handle that can be used to access the file or device for various types of I/O depending on the file or device and the flags and attributes specified.

When called from a Windows Store app, CreateFile2 is simplified. You can open only files or directories inside the ApplicationData.LocalFolder or Package. InstalledLocation directories. You can't open named pipes or mailslots or create encrypted files (FILE_ATTRIBUTE_ENCRYPTED).

func CreateFileW

func CreateFileW(fileName string, dwDesiredAccess, dwShareMode, lpSecurityAttributes SecurityAttribute, dwCreationDisposition, dwFlagsAndAttributes uint32, dhTemplateFile HANDLE) (HANDLE, error)

CreateFileW Creates or opens a file or I/O device. The most commonly used I/O devices are as follows: file, file stream, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, and pipe. The function returns a handle that can be used to access the file or device for various types of I/O depending on the file or device and the flags and attributes specified. To perform this operation as a transacted operation, which results in a handle that can be used for transacted I/O, use the CreateFileTransacted function.

func FindFirstVolume

func FindFirstVolume() (HANDLE, string, error)

FindFirstVolume Retrieves the name of a volume on a computer. FindFirstVolume is used to begin scanning the volumes of a computer.

func (HANDLE) ToUintPtr

func (H HANDLE) ToUintPtr() uintptr

type InfoLevel

type InfoLevel int64

InfoLevel

func (InfoLevel) String

func (i InfoLevel) String() string

type LogicalDriveError

type LogicalDriveError struct {
	// contains filtered or unexported fields
}

LogicalDriveError Error given when there is a problem in a function related to logical drives

func NewLogicalDriveError

func NewLogicalDriveError(msg string) LogicalDriveError

NewLogicalDriveError Creates a new LogicalDriveError

func (LogicalDriveError) Error

func (L LogicalDriveError) Error() string

Error returns the LogicalDriveError

type SearchOps

type SearchOps int64

SearchOps

type SecurityAttribute

type SecurityAttribute int64

type SecurityAttributeError

type SecurityAttributeError struct {
	// contains filtered or unexported fields
}

func NewSecurityAttributeError

func NewSecurityAttributeError(msg string) SecurityAttributeError

func (SecurityAttributeError) Error

func (S SecurityAttributeError) Error() string

type ShareMode

type ShareMode int64

ShareMode The requested sharing mode of the file or device, which can be read, write, both, delete, all of these, or none (refer to the following table). Access requests to attributes or extended attributes are not affected by this flag.

If this parameter is zero and CreateFile succeeds, the file or device cannot be shared and cannot be opened again until the handle to the file or device is closed. For more information, see the Remarks section.

You cannot request a sharing mode that conflicts with the access mode that is specified in an existing request that has an open handle. CreateFile would fail and the GetLastError function would return ERROR_SHARING_VIOLATION.

To enable a process to share a file or device while another process has the file or device open, use a compatible combination of one or more of the following values. For more information about valid combinations of this parameter with the dwDesiredAccess parameter, see Creating and Opening Files.

type SystemTime

type SystemTime struct {
	// contains filtered or unexported fields
}

SystemTime Specifies a date and time, using individual members for the month, day, year, weekday, hour, minute, second, and millisecond. The time is either in coordinated universal time (UTC) or local time, depending on the function that is being called.

func (SystemTime) ToDate

func (S SystemTime) ToDate() time.Time

func (SystemTime) ToUintPtr

func (S SystemTime) ToUintPtr() uintptr

type Volume

type Volume struct {
	PathName    string
	VolumeLabel string

	SerialNumber             uint32
	LpMaximumComponentLength uint32
	SystemFlags              []string
	FileSystem               string
	// contains filtered or unexported fields
}

func GetVolumeInformationW

func GetVolumeInformationW(rootPathName string) (volume Volume, err error)

GetVolumeInformationW Retrieves information about the file system and volume associated with the specified root directory.

To specify a handle when retrieving this information, use the GetVolumeInformationByHandleW function.

To retrieve the current compression state of a file or directory, use FSCTL_GET_COMPRESSION.

type WIN32_FIND_DATAA

type WIN32_FIND_DATAA struct {
	// contains filtered or unexported fields
}

type Win32FileAttributeData

type Win32FileAttributeData struct {
	FileAttributes []string
	CreationTime   time.Time
	LastAccessTime time.Time
	LastWriteTime  time.Time
	FileSize       int
}

func GetFileAttributesExW

func GetFileAttributesExW(fileName string) (Win32FileAttributeData, error)

GetFileAttributesExW Retrieves attributes for a specified file or directory.

To perform this operation as a transacted operation, use the GetFileAttributesTransacted function.

type Win32FileAttributeDataA

type Win32FileAttributeDataA struct {
	FileAttributes uint32
	CreationTime   timezoneapi.FILETIME
	LastAccessTime timezoneapi.FILETIME
	LastWriteTime  timezoneapi.FILETIME
	FileSizeHigh   uint32
	FileSizeLow    uint32
}

type Win32FindDataW

type Win32FindDataW struct {
	// contains filtered or unexported fields
}

func FindNextFileW

func FindNextFileW(hFindFile HANDLE) (Win32FindDataW, error)

FindNextFileW Continues a file search from a previous call to the FindFirstFile, FindFirstFileEx, or FindFirstFileTransacted functions.

Jump to

Keyboard shortcuts

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