Andrew Eikum : oleaut32: Allow typelib filenames longer than MAX_PATH.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Mar 24 10:00:43 CDT 2015
Module: wine
Branch: master
Commit: 4a7b5856daa5ce09bb52c2baa3d524a5ea1cae1b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4a7b5856daa5ce09bb52c2baa3d524a5ea1cae1b
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Mon Mar 23 09:56:58 2015 -0500
oleaut32: Allow typelib filenames longer than MAX_PATH.
---
dlls/oleaut32/typelib.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 54dbc05..b8325c0 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -3353,18 +3353,27 @@ static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath
h = CreateFileW(pszPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(h != INVALID_HANDLE_VALUE){
- FILE_NAME_INFORMATION *info;
- char data[MAX_PATH * sizeof(WCHAR) + sizeof(info->FileNameLength)];
+ FILE_NAME_INFORMATION size_info;
BOOL br;
- info = (FILE_NAME_INFORMATION*)data;
/* GetFileInformationByHandleEx returns the path of the file without
* WOW64 redirection */
- br = GetFileInformationByHandleEx(h, FileNameInfo, data, sizeof(data));
- if(br){
- info->FileName[info->FileNameLength / sizeof(WCHAR)] = 0;
- lstrcpynW(pszPath + 2, info->FileName, cchPath - 2);
+ br = GetFileInformationByHandleEx(h, FileNameInfo, &size_info, sizeof(size_info));
+ if(br || GetLastError() == ERROR_MORE_DATA){
+ FILE_NAME_INFORMATION *info;
+ DWORD size = sizeof(*info) + size_info.FileNameLength + sizeof(WCHAR);
+
+ info = HeapAlloc(GetProcessHeap(), 0, size);
+
+ br = GetFileInformationByHandleEx(h, FileNameInfo, info, size);
+ if(br){
+ info->FileName[info->FileNameLength / sizeof(WCHAR)] = 0;
+ lstrcpynW(pszPath + 2, info->FileName, cchPath - 2);
+ }
+
+ HeapFree(GetProcessHeap(), 0, info);
}
+
CloseHandle(h);
}
More information about the wine-cvs
mailing list