Kevin Puetz : oleaut32: Use GetFinalPathNameByHandle to canonicalize file path.

Alexandre Julliard julliard at winehq.org
Mon Feb 3 15:06:07 CST 2020


Module: wine
Branch: master
Commit: fa0491f23924d17e6b4f84df1c2706d15e8ab0f7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=fa0491f23924d17e6b4f84df1c2706d15e8ab0f7

Author: Kevin Puetz <PuetzKevinA at JohnDeere.com>
Date:   Mon Feb  3 18:46:04 2020 +0100

oleaut32: Use GetFinalPathNameByHandle to canonicalize file path.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleaut32/typelib.c | 22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 451753e23b..788d853f63 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -3335,27 +3335,7 @@ static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath
 
     h = CreateFileW(pszPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
     if(h != INVALID_HANDLE_VALUE){
-        FILE_NAME_INFORMATION size_info;
-        BOOL br;
-
-        /* GetFileInformationByHandleEx returns the path of the file without
-         * WOW64 redirection */
-        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);
-        }
-
+        GetFinalPathNameByHandleW(h, pszPath, cchPath, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
         CloseHandle(h);
     }
 




More information about the wine-cvs mailing list