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

ruby-changes:43195

From: nobu <ko1@a...>
Date: Fri, 3 Jun 2016 22:38:34 +0900 (JST)
Subject: [ruby-changes:43195] nobu:r55269 (trunk): win32.c: fail before getting ITEMIDLIST

nobu	2016-06-03 22:38:27 +0900 (Fri, 03 Jun 2016)

  New Revision: 55269

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

  Log:
    win32.c: fail before getting ITEMIDLIST
    
    * win32/win32.c (get_special_folder): fail before getting
      ITEMIDLIST if the buffer is less than 260 word which
      SHGetPathFromIDListW requires.

  Modified files:
    trunk/win32/win32.c
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 55268)
+++ win32/win32.c	(revision 55269)
@@ -433,12 +433,13 @@ get_special_folder(int n, WCHAR *buf, si https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L433
 	func = (get_path_func)
 	    get_proc_address("shell32", "SHGetPathFromIDListEx", NULL);
     }
+    if (!func && len < 260) return FALSE;
 
     if (SHGetSpecialFolderLocation(NULL, n, &pidl) == 0) {
 	if (func) {
 	    f = func(pidl, buf, len, 0);
 	}
-	else if (len >= 260) {
+	else {
 	    f = SHGetPathFromIDListW(pidl, buf);
 	}
 	SHGetMalloc(&alloc);

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

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