Commit c460d4ff authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

sxs: Return correct path from IAssemblyCache::QueryAssemblyInfo().

Some applications call IAssemblyCache::QueryAssemblyInfo(), then append DLL name to the returned path, and call GetFileAttributes() to check DLL existence. Signed-off-by: 's avatarDmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 43f822bc
......@@ -122,23 +122,22 @@ static WCHAR *build_assembly_name( const WCHAR *arch, const WCHAR *name, const W
return wcslwr( ret );
}
static WCHAR *build_manifest_path( const WCHAR *arch, const WCHAR *name, const WCHAR *token,
const WCHAR *version )
static WCHAR *build_dll_path( const WCHAR *arch, const WCHAR *name, const WCHAR *token,
const WCHAR *version )
{
static const WCHAR fmtW[] =
{'%','s','m','a','n','i','f','e','s','t','s','\\','%','s','.','m','a','n','i','f','e','s','t',0};
WCHAR *path = NULL, *ret, sxsdir[MAX_PATH];
unsigned int len;
if (!(path = build_assembly_name( arch, name, token, version, &len ))) return NULL;
len += ARRAY_SIZE(fmtW);
len += build_sxs_path( sxsdir );
len += build_sxs_path( sxsdir ) + 1;
if (!(ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
{
HeapFree( GetProcessHeap(), 0, path );
return NULL;
}
swprintf( ret, len, fmtW, sxsdir, path );
lstrcpyW( ret, sxsdir );
lstrcatW( ret, path );
lstrcatW( ret, L"\\" );
HeapFree( GetProcessHeap(), 0, path );
return ret;
}
......@@ -202,7 +201,7 @@ static HRESULT WINAPI cache_QueryAssemblyInfo(
struct cache *cache = impl_from_IAssemblyCache( iface );
IAssemblyName *name_obj;
const WCHAR *arch, *name, *token, *type, *version;
WCHAR *p, *path = NULL;
WCHAR *path = NULL;
unsigned int len;
HRESULT hr;
......@@ -232,7 +231,7 @@ static HRESULT WINAPI cache_QueryAssemblyInfo(
}
cache_lock( cache );
if (!wcscmp( type, win32W )) path = build_manifest_path( arch, name, token, version );
if (!wcscmp( type, win32W )) path = build_dll_path( arch, name, token, version );
else if (!wcscmp( type, win32_policyW )) path = build_policy_path( arch, name, token, version );
else
{
......@@ -250,7 +249,6 @@ static HRESULT WINAPI cache_QueryAssemblyInfo(
info->dwAssemblyFlags = ASSEMBLYINFO_FLAG_INSTALLED;
TRACE("assembly is installed\n");
}
if ((p = wcsrchr( path, '\\' ))) *p = 0;
len = lstrlenW( path ) + 1;
if (info->pszCurrentAssemblyPathBuf)
{
......
......@@ -162,6 +162,8 @@ static void test_QueryAssemblyInfo( void )
ok( !info.uliAssemblySizeInKB.u.LowPart, "got %u\n", info.uliAssemblySizeInKB.u.LowPart );
ok( info.cchBuf == ARRAY_SIZE( path ), "got %u\n", info.cchBuf );
ok( path[0], "empty path\n" );
lstrcatW( path, L"comctl32.dll" );
ok( GetFileAttributesW( path ) != INVALID_FILE_ATTRIBUTES, "%s should exist\n", wine_dbgstr_w( path ));
memset( &info, 0, sizeof(info) );
info.cbAssemblyInfo = sizeof(info);
......
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