1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
usa 2015-04-20 14:48:09 +00:00
parent 2f8134fd8d
commit b38a8d287c
2 changed files with 28 additions and 12 deletions

View file

@ -1,3 +1,8 @@
Mon Apr 20 23:46:53 2015 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (rb_w32_wreadlink): follow the official format of
REPARSE_DATA_BUFFER structure.
Mon Apr 20 20:23:04 2015 NAKAMURA Usaku <usa@ruby-lang.org>
* common.mk ($(arch)-fake.rb): revert r50354 because bsdmake seems not

View file

@ -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'/');