| 1 | // Copyright 2016 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package windows |
| 6 | |
| 7 | const ( |
| 8 | FSCTL_SET_REPARSE_POINT = 0x000900A4 |
| 9 | IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003 |
| 10 | |
| 11 | SYMLINK_FLAG_RELATIVE = 1 |
| 12 | ) |
| 13 | |
| 14 | // These structures are described |
| 15 | // in https://msdn.microsoft.com/en-us/library/cc232007.aspx |
| 16 | // and https://msdn.microsoft.com/en-us/library/cc232006.aspx. |
| 17 | |
| 18 | // REPARSE_DATA_BUFFER_HEADER is a common part of REPARSE_DATA_BUFFER structure. |
| 19 | type REPARSE_DATA_BUFFER_HEADER struct { |
| 20 | ReparseTag uint32 |
| 21 | // The size, in bytes, of the reparse data that follows |
| 22 | // the common portion of the REPARSE_DATA_BUFFER element. |
| 23 | // This value is the length of the data starting at the |
| 24 | // SubstituteNameOffset field. |
| 25 | ReparseDataLength uint16 |
| 26 | Reserved uint16 |
| 27 | } |
| 28 | |
| 29 | type SymbolicLinkReparseBuffer struct { |
| 30 | // The integer that contains the offset, in bytes, |
| 31 | // of the substitute name string in the PathBuffer array, |
| 32 | // computed as an offset from byte 0 of PathBuffer. Note that |
| 33 | // this offset must be divided by 2 to get the array index. |
| 34 | SubstituteNameOffset uint16 |
| 35 | // The integer that contains the length, in bytes, of the |
| 36 | // substitute name string. If this string is null-terminated, |
| 37 | // SubstituteNameLength does not include the Unicode null character. |
| 38 | SubstituteNameLength uint16 |
| 39 | // PrintNameOffset is similar to SubstituteNameOffset. |
| 40 | PrintNameOffset uint16 |
| 41 | // PrintNameLength is similar to SubstituteNameLength. |
| 42 | PrintNameLength uint16 |
| 43 | // Flags specifies whether the substitute name is a full path name or |
| 44 | // a path name relative to the directory containing the symbolic link. |
| 45 | Flags uint32 |
| 46 | PathBuffer [1]uint16 |
| 47 | } |
| 48 | |
| 49 | type MountPointReparseBuffer struct { |
| 50 | // The integer that contains the offset, in bytes, |
| 51 | // of the substitute name string in the PathBuffer array, |
| 52 | // computed as an offset from byte 0 of PathBuffer. Note that |
| 53 | // this offset must be divided by 2 to get the array index. |
| 54 | SubstituteNameOffset uint16 |
| 55 | // The integer that contains the length, in bytes, of the |
| 56 | // substitute name string. If this string is null-terminated, |
| 57 | // SubstituteNameLength does not include the Unicode null character. |
| 58 | SubstituteNameLength uint16 |
| 59 | // PrintNameOffset is similar to SubstituteNameOffset. |
| 60 | PrintNameOffset uint16 |
| 61 | // PrintNameLength is similar to SubstituteNameLength. |
| 62 | PrintNameLength uint16 |
| 63 | PathBuffer [1]uint16 |
| 64 | } |