winio

package
v1.42.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT, MIT Imports: 7 Imported by: 0

README

go-winio Build Status

This repository contains utilities for efficiently performing Win32 IO operations in Go. Currently, this is focused on accessing named pipes and other file handles, and for using named pipes as a net transport.

This code relies on IO completion ports to avoid blocking IO on system threads, allowing Go to reuse the thread to schedule another goroutine. This limits support to Windows Vista and newer operating systems. This is similar to the implementation of network sockets in Go's net package.

Please see the LICENSE file for licensing information.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

We also require that contributors sign their commits using git commit -s or git commit --signoff to certify they either authored the work themselves or otherwise have permission to use it in this project. Please see https://developercertificate.org/ for more info, as well as to make sure that you can attest to the rules listed. Our CI uses the DCO Github app to ensure that all commits in a given PR are signed-off.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Special Thanks

Thanks to natefinch for the inspiration for this library. See https://github.com/natefinch/npipe for another named pipe implementation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeExtendedAttributes

func EncodeExtendedAttributes(eas []ExtendedAttribute) ([]byte, error)

EncodeExtendedAttributes encodes a list of EAs into a FILE_FULL_EA_INFORMATION buffer for use with BackupWrite, ZwSetEaFile, etc.

func EncodeReparsePoint

func EncodeReparsePoint(rp *ReparsePoint) []byte

EncodeReparsePoint encodes a Win32 REPARSE_DATA_BUFFER structure describing a symlink or mount point.

Types

type ExtendedAttribute

type ExtendedAttribute struct {
	Name  string
	Value []byte
	Flags uint8
}

ExtendedAttribute represents a single Windows EA.

func DecodeExtendedAttributes

func DecodeExtendedAttributes(b []byte) (eas []ExtendedAttribute, err error)

DecodeExtendedAttributes decodes a list of EAs from a FILE_FULL_EA_INFORMATION buffer retrieved from BackupRead, ZwQueryEaFile, etc.

type ReparsePoint

type ReparsePoint struct {
	Target       string
	IsMountPoint bool
}

ReparsePoint describes a Win32 symlink or mount point.

func DecodeReparsePoint

func DecodeReparsePoint(b []byte) (*ReparsePoint, error)

DecodeReparsePoint decodes a Win32 REPARSE_DATA_BUFFER structure containing either a symlink or a mount point.

func DecodeReparsePointData

func DecodeReparsePointData(tag uint32, b []byte) (*ReparsePoint, error)

type UnsupportedReparsePointError

type UnsupportedReparsePointError struct {
	Tag uint32
}

UnsupportedReparsePointError is returned when trying to decode a non-symlink or mount point reparse point.

func (*UnsupportedReparsePointError) Error

Jump to

Keyboard shortcuts

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