[前][次][番号順一覧][スレッド一覧]

ruby-changes:38281

From: usa <ko1@a...>
Date: Mon, 20 Apr 2015 23:48:31 +0900 (JST)
Subject: [ruby-changes:38281] usa:r50362 (trunk): * win32/win32.c (rb_w32_wreadlink): follow the official format of

usa	2015-04-20 23:48:09 +0900 (Mon, 20 Apr 2015)

  New Revision: 50362

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50362

  Log:
    * win32/win32.c (rb_w32_wreadlink): follow the official format of
      REPARSE_DATA_BUFFER structure.

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50361)
+++ ChangeLog	(revision 50362)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Apr 20 23:46:53 2015  NAKAMURA Usaku  <usa@r...>
+
+	* 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@r...>
 
 	* common.mk ($(arch)-fake.rb): revert r50354 because bsdmake seems not
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 50361)
+++ win32/win32.c	(revision 50362)
@@ -4686,14 +4686,23 @@ rb_w32_wreadlink(const WCHAR *path, WCHA https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L4686
 	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, WCHA https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L4747
 	    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'/');

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]