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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
02687cd74f
commit
f0ead75ff1
@ -433,12 +433,13 @@ get_special_folder(int n, WCHAR *buf, size_t len)
|
|||||||
func = (get_path_func)
|
func = (get_path_func)
|
||||||
get_proc_address("shell32", "SHGetPathFromIDListEx", NULL);
|
get_proc_address("shell32", "SHGetPathFromIDListEx", NULL);
|
||||||
}
|
}
|
||||||
|
if (!func && len < 260) return FALSE;
|
||||||
|
|
||||||
if (SHGetSpecialFolderLocation(NULL, n, &pidl) == 0) {
|
if (SHGetSpecialFolderLocation(NULL, n, &pidl) == 0) {
|
||||||
if (func) {
|
if (func) {
|
||||||
f = func(pidl, buf, len, 0);
|
f = func(pidl, buf, len, 0);
|
||||||
}
|
}
|
||||||
else if (len >= 260) {
|
else {
|
||||||
f = SHGetPathFromIDListW(pidl, buf);
|
f = SHGetPathFromIDListW(pidl, buf);
|
||||||
}
|
}
|
||||||
SHGetMalloc(&alloc);
|
SHGetMalloc(&alloc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user