Commit d2882f96 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

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 405666b7. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51209Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f77d4247
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
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment