oleaut32: Allow typelib filenames longer than MAX_PATH.
This commit is contained in:
parent
5e5adcffb5
commit
4a7b5856da
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue