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>
This commit is contained in:
Zhiyi Zhang 2021-06-02 10:54:13 +08:00 committed by Alexandre Julliard
parent f77d42471e
commit d2882f96d6
2 changed files with 18 additions and 7 deletions

View file

@ -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

View file

@ -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;
}
ret = install_file( path );
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( canonical_path );
LocalFree( canonical_path );
return ret;
}