summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-20 14:48:09 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-20 14:48:09 +0000
commitb38a8d287c265b6428fec76163e43f2f3cd60a7d (patch)
tree8ff92bd07467da87d3ef5ffbcbf301dde23674e1 /win32
parent2f8134fd8d53ffb0b5df68c3858b1091aeb5071f (diff)
* win32/win32.c (rb_w32_wreadlink): follow the official format of
REPARSE_DATA_BUFFER structure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 1259360..21d59d4 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4686,14 +4686,23 @@ rb_w32_wreadlink(const WCHAR *path, WCHAR *buf, size_t bufsize)
ULONG ReparseTag;
USHORT ReparseDataLength;
USHORT Reserved;
- struct {
- USHORT SubstituteNameOffset;
- USHORT SubstituteNameLength;
- USHORT PrintNameOffset;
- USHORT PrintNameLength;
- ULONG Flags;
- WCHAR PathBuffer[MAXPATHLEN * 2];
- } SymbolicLinkReparseBuffer;
+ union {
+ struct {
+ USHORT SubstituteNameOffset;
+ USHORT SubstituteNameLength;
+ USHORT PrintNameOffset;
+ USHORT PrintNameLength;
+ ULONG Flags;
+ WCHAR PathBuffer[MAXPATHLEN * 2];
+ } SymbolicLinkReparseBuffer;
+ struct {
+ USHORT SubstituteNameOffset;
+ USHORT SubstituteNameLength;
+ USHORT PrintNameOffset;
+ USHORT PrintNameLength;
+ WCHAR PathBuffer[MAXPATHLEN * 2];
+ } MountPointReparseBuffer;
+ };
} rp;
HANDLE f;
DWORD ret;
@@ -4738,10 +4747,12 @@ rb_w32_wreadlink(const WCHAR *path, WCHAR *buf, size_t bufsize)
ret = rp.SymbolicLinkReparseBuffer.PrintNameLength;
}
else { /* IO_REPARSE_TAG_MOUNT_POINT */
- /* +4/-4 mean to drop "?\" */
- name = ((char *)rp.SymbolicLinkReparseBuffer.PathBuffer +
- rp.SymbolicLinkReparseBuffer.SubstituteNameOffset + 4);
- ret = rp.SymbolicLinkReparseBuffer.SubstituteNameLength - 4;
+ /* +4/-4 means to drop "\??\" */
+ name = ((char *)rp.MountPointReparseBuffer.PathBuffer +
+ rp.MountPointReparseBuffer.SubstituteNameOffset +
+ 4 * sizeof(WCHAR));
+ ret = rp.MountPointReparseBuffer.SubstituteNameLength -
+ 4 * sizeof(WCHAR);
}
((WCHAR *)name)[ret/sizeof(WCHAR)] = L'\0';
translate_wchar(name, L'\\', L'/');