diff options
Diffstat (limited to 'libgo/go/internal/syscall/windows/reparse_windows.go')
-rw-r--r-- | libgo/go/internal/syscall/windows/reparse_windows.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libgo/go/internal/syscall/windows/reparse_windows.go b/libgo/go/internal/syscall/windows/reparse_windows.go index 7c6ad8fb7e0..610b733c4a9 100644 --- a/libgo/go/internal/syscall/windows/reparse_windows.go +++ b/libgo/go/internal/syscall/windows/reparse_windows.go @@ -4,6 +4,11 @@ package windows +import ( + "syscall" + "unsafe" +) + const ( FSCTL_SET_REPARSE_POINT = 0x000900A4 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003 @@ -15,6 +20,13 @@ const ( // in https://msdn.microsoft.com/en-us/library/cc232007.aspx // and https://msdn.microsoft.com/en-us/library/cc232006.aspx. +type REPARSE_DATA_BUFFER struct { + ReparseTag uint32 + ReparseDataLength uint16 + Reserved uint16 + DUMMYUNIONNAME byte +} + // REPARSE_DATA_BUFFER_HEADER is a common part of REPARSE_DATA_BUFFER structure. type REPARSE_DATA_BUFFER_HEADER struct { ReparseTag uint32 @@ -46,6 +58,12 @@ type SymbolicLinkReparseBuffer struct { PathBuffer [1]uint16 } +// Path returns path stored in rb. +func (rb *SymbolicLinkReparseBuffer) Path() string { + p := (*[0xffff]uint16)(unsafe.Pointer(&rb.PathBuffer[0])) + return syscall.UTF16ToString(p[rb.SubstituteNameOffset/2 : (rb.SubstituteNameOffset+rb.SubstituteNameLength)/2]) +} + type MountPointReparseBuffer struct { // The integer that contains the offset, in bytes, // of the substitute name string in the PathBuffer array, @@ -62,3 +80,9 @@ type MountPointReparseBuffer struct { PrintNameLength uint16 PathBuffer [1]uint16 } + +// Path returns path stored in rb. +func (rb *MountPointReparseBuffer) Path() string { + p := (*[0xffff]uint16)(unsafe.Pointer(&rb.PathBuffer[0])) + return syscall.UTF16ToString(p[rb.SubstituteNameOffset/2 : (rb.SubstituteNameOffset+rb.SubstituteNameLength)/2]) +} |