Skip to content

windows: expose reparse buffer types #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions windows/types_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,7 @@ type TCPKeepalive struct {
Interval uint32
}

type symbolicLinkReparseBuffer struct {
type SymbolicLinkReparseBuffer struct {
SubstituteNameOffset uint16
SubstituteNameLength uint16
PrintNameOffset uint16
Expand All @@ -1905,15 +1905,28 @@ type symbolicLinkReparseBuffer struct {
PathBuffer [1]uint16
}

type mountPointReparseBuffer struct {
// Path returns path stored in rb.
func (rb *SymbolicLinkReparseBuffer) Path() string {
n1 := rb.SubstituteNameOffset / 2
n2 := (rb.SubstituteNameOffset + rb.SubstituteNameLength) / 2
return syscall.UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(&rb.PathBuffer[0]))[n1:n2:n2])
}

type MountPointReparseBuffer struct {
SubstituteNameOffset uint16
SubstituteNameLength uint16
PrintNameOffset uint16
PrintNameLength uint16
PathBuffer [1]uint16
}

type reparseDataBuffer struct {
type ReparseDataBufferHeader struct {
ReparseTag uint32
ReparseDataLength uint16
Reserved uint16
}

type ReparseDataBuffer struct {
ReparseTag uint32
ReparseDataLength uint16
Reserved uint16
Expand Down Expand Up @@ -1974,6 +1987,7 @@ const (
IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003
IO_REPARSE_TAG_SYMLINK = 0xA000000C
SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1
SYMBOLIC_LINK_FLAG_RELATIVE = 1
)

const (
Expand Down