Module: wine Branch: master Commit: d2882f96d6f0f166adaecdbc1ded047cec331b62 URL: https://source.winehq.org/git/wine.git/?a=commit;h=d2882f96d6f0f166adaecdbc1...
Author: Zhiyi Zhang zzhang@codeweavers.com Date: Wed Jun 2 10:54:13 2021 +0800
appwiz.cpl: Canonicalize paths before passing them to GetFileAttributesW().
Fix a regression that wine-mono installer packages in the parent folder of build trees can not be found since 405666b.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51209 Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/appwiz.cpl/Makefile.in | 2 +- dlls/appwiz.cpl/addons.c | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/dlls/appwiz.cpl/Makefile.in b/dlls/appwiz.cpl/Makefile.in index e07149a30c9..44053de8ece 100644 --- a/dlls/appwiz.cpl/Makefile.in +++ b/dlls/appwiz.cpl/Makefile.in @@ -1,5 +1,5 @@ MODULE = appwiz.cpl -IMPORTS = uuid urlmon advpack comctl32 advapi32 shell32 ole32 user32 comdlg32 bcrypt +IMPORTS = uuid urlmon advpack comctl32 advapi32 shell32 ole32 user32 comdlg32 bcrypt kernelbase DELAYIMPORTS = msi
EXTRADLLFLAGS = -mno-cygwin diff --git a/dlls/appwiz.cpl/addons.c b/dlls/appwiz.cpl/addons.c index 28c30197ebb..3f094d37ef4 100644 --- a/dlls/appwiz.cpl/addons.c +++ b/dlls/appwiz.cpl/addons.c @@ -33,6 +33,7 @@ #include "commctrl.h" #include "advpub.h" #include "wininet.h" +#include "pathcch.h" #include "shellapi.h" #include "urlmon.h" #include "msi.h" @@ -197,10 +198,11 @@ static enum install_res install_file(const WCHAR *file_name)
static enum install_res install_from_dos_file(const WCHAR *dir, const WCHAR *subdir, const WCHAR *file_name) { - WCHAR *path; + WCHAR *path, *canonical_path; enum install_res ret; int len = lstrlenW( dir ); int size = len + 1; + HRESULT hr;
size += lstrlenW( subdir ) + lstrlenW( file_name ) + 2; if (!(path = heap_alloc( size * sizeof(WCHAR) ))) return INSTALL_FAILED; @@ -213,16 +215,25 @@ static enum install_res install_from_dos_file(const WCHAR *dir, const WCHAR *sub lstrcatW( path, L"\" ); lstrcatW( path, file_name );
- if (GetFileAttributesW( path ) == INVALID_FILE_ATTRIBUTES) + hr = PathAllocCanonicalize( path, PATHCCH_ALLOW_LONG_PATHS, &canonical_path ); + if (FAILED( hr )) { - TRACE( "%s not found\n", debugstr_w(path) ); + ERR( "Failed to canonicalize %s, hr %#x\n", debugstr_w(path), hr ); heap_free( path ); return INSTALL_NEXT; } + heap_free( path ); + + if (GetFileAttributesW( canonical_path ) == INVALID_FILE_ATTRIBUTES) + { + TRACE( "%s not found\n", debugstr_w(canonical_path) ); + LocalFree( canonical_path ); + return INSTALL_NEXT; + }
- ret = install_file( path ); + ret = install_file( canonical_path );
- heap_free( path ); + LocalFree( canonical_path ); return ret; }