Commit 1b978ead authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

fusion: Return the path from IAssemblyCacheImpl_QueryAssemblyInfo.

parent bb4ba699
......@@ -223,6 +223,8 @@ static HRESULT WINAPI IAssemblyCacheImpl_QueryAssemblyInfo(IAssemblyCache *iface
if (!pAsmInfo)
goto done;
hr = IAssemblyName_GetPath(next, pAsmInfo->pszCurrentAssemblyPathBuf, &pAsmInfo->cchBuf);
pAsmInfo->dwAssemblyFlags = ASSEMBLYINFO_FLAG_INSTALLED;
done:
......
......@@ -287,6 +287,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
WIN32_FIND_DATAW ffd;
WCHAR buf[MAX_PATH];
WCHAR disp[MAX_PATH];
WCHAR asmpath[MAX_PATH];
ASMNAME *asmname;
HANDLE hfind;
LPWSTR ptr;
......@@ -297,9 +298,9 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
static const WCHAR dot[] = {'.',0};
static const WCHAR dotdot[] = {'.','.',0};
static const WCHAR search_fmt[] = {'%','s','\\','*',0};
static const WCHAR parent_fmt[] = {'%','s',',',' ',0};
static const WCHAR dblunder[] = {'_','_',0};
static const WCHAR fmt[] = {'V','e','r','s','i','o','n','=','%','s',',',' ',
static const WCHAR path_fmt[] = {'%','s','\\','%','s','\\','%','s','.','d','l','l',0};
static const WCHAR fmt[] = {'%','s',',',' ','V','e','r','s','i','o','n','=','%','s',',',' ',
'C','u','l','t','u','r','e','=','n','e','u','t','r','a','l',',',' ',
'P','u','b','l','i','c','K','e','y','T','o','k','e','n','=','%','s',0};
static const WCHAR ss_fmt[] = {'%','s','\\','%','s',0};
......@@ -325,17 +326,17 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
else
ptr = ffd.cFileName;
sprintfW(parent, parent_fmt, ptr);
lstrcpyW(parent, ptr);
}
else if (depth == 1)
{
sprintfW(asmpath, path_fmt, path, ffd.cFileName, parent);
ptr = strstrW(ffd.cFileName, dblunder);
*ptr = '\0';
ptr += 2;
sprintfW(buf, fmt, ffd.cFileName, ptr);
lstrcpyW(disp, parent);
lstrcatW(disp, buf);
sprintfW(disp, fmt, parent, ffd.cFileName, ptr);
asmname = HeapAlloc(GetProcessHeap(), 0, sizeof(ASMNAME));
if (!asmname)
......@@ -352,6 +353,14 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
break;
}
hr = IAssemblyName_SetPath(asmname->name, asmpath);
if (FAILED(hr))
{
IAssemblyName_Release(asmname->name);
HeapFree(GetProcessHeap(), 0, asmname);
break;
}
insert_assembly(assemblies, asmname);
continue;
}
......
......@@ -19,6 +19,7 @@
*/
#include <stdarg.h>
#include <assert.h>
#define COBJMACROS
#define INITGUID
......@@ -40,6 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(fusion);
typedef struct {
const IAssemblyNameVtbl *lpIAssemblyNameVtbl;
LPWSTR path;
LPWSTR displayname;
LPWSTR name;
LPWSTR culture;
......@@ -104,6 +107,7 @@ static ULONG WINAPI IAssemblyNameImpl_Release(IAssemblyName *iface)
if (!refCount)
{
HeapFree(GetProcessHeap(), 0, This->path);
HeapFree(GetProcessHeap(), 0, This->displayname);
HeapFree(GetProcessHeap(), 0, This->name);
HeapFree(GetProcessHeap(), 0, This->culture);
......@@ -425,6 +429,43 @@ static const IAssemblyNameVtbl AssemblyNameVtbl = {
IAssemblyNameImpl_Clone
};
/* Internal methods */
HRESULT IAssemblyName_SetPath(IAssemblyName *iface, LPCWSTR path)
{
IAssemblyNameImpl *name = (IAssemblyNameImpl *)iface;
assert(name->lpIAssemblyNameVtbl == &AssemblyNameVtbl);
name->path = strdupW(path);
if (!name->path)
return E_OUTOFMEMORY;
return S_OK;
}
HRESULT IAssemblyName_GetPath(IAssemblyName *iface, LPWSTR buf, ULONG *len)
{
ULONG buffer_size = *len;
IAssemblyNameImpl *name = (IAssemblyNameImpl *)iface;
assert(name->lpIAssemblyNameVtbl == &AssemblyNameVtbl);
if (!name->path)
return S_OK;
if (!buf)
buffer_size = 0;
*len = lstrlenW(name->path) + 1;
if (*len <= buffer_size)
lstrcpyW(buf, name->path);
else
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
return S_OK;
}
static HRESULT parse_version(IAssemblyNameImpl *name, LPWSTR version)
{
LPWSTR beg, end;
......
......@@ -436,6 +436,9 @@ HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version);
BYTE assembly_get_architecture(ASSEMBLY *assembly);
HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token);
extern HRESULT IAssemblyName_SetPath(IAssemblyName *iface, LPCWSTR path);
extern HRESULT IAssemblyName_GetPath(IAssemblyName *iface, LPWSTR buf, ULONG *len);
static inline LPWSTR strdupW(LPCWSTR src)
{
LPWSTR dest;
......
......@@ -1091,13 +1091,10 @@ static void test_QueryAssemblyInfo(void)
"Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
ok(info.uliAssemblySizeInKB.u.LowPart == 0,
"Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
todo_wine
{
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
"Wrong assembly path returned\n");
ok(info.cchBuf == lstrlenW(asmpath) + 1,
"Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
}
/* pwzCachePath is full filename */
INIT_ASM_INFO();
......@@ -1139,13 +1136,10 @@ static void test_QueryAssemblyInfo(void)
"Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
ok(info.uliAssemblySizeInKB.u.LowPart == 0,
"Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
todo_wine
{
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
"Wrong assembly path returned\n");
ok(info.cchBuf == lstrlenW(asmpath) + 1,
"Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
}
/* info.cbAssemblyInfo is 1 */
INIT_ASM_INFO();
......@@ -1197,11 +1191,11 @@ static void test_QueryAssemblyInfo(void)
ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
broken(info.uliAssemblySizeInKB.u.LowPart == 32),
"Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
}
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
"Wrong assembly path returned\n");
ok(info.cchBuf == lstrlenW(asmpath) + 1,
"Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
}
/* QUERYASMINFO_FLAG_GETSIZE and QUERYASMINFO_FLAG_VALIDATE */
INIT_ASM_INFO();
......@@ -1220,11 +1214,11 @@ static void test_QueryAssemblyInfo(void)
ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
broken(info.uliAssemblySizeInKB.u.LowPart == 32),
"Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
}
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
"Wrong assembly path returned\n");
ok(info.cchBuf == lstrlenW(asmpath) + 1,
"Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
}
/* info.pszCurrentAssemblyPathBuf is NULL */
INIT_ASM_INFO();
......@@ -1237,17 +1231,17 @@ static void test_QueryAssemblyInfo(void)
"Expected ASSEMBLYINFO_FLAG_INSTALLED, got %08x\n", info.dwAssemblyFlags);
ok(info.uliAssemblySizeInKB.u.HighPart == 0,
"Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
todo_wine
{
ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),
"Expected HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), got %08x\n", hr);
todo_wine
{
/* win9x: 32 */
ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
broken(info.uliAssemblySizeInKB.u.LowPart == 32),
"Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
}
ok(info.cchBuf == lstrlenW(asmpath) + 1,
"Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
}
/* info.cchBuf is exactly size of asmpath */
INIT_ASM_INFO();
......@@ -1262,17 +1256,17 @@ static void test_QueryAssemblyInfo(void)
"Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
"Assembly path was changed\n");
todo_wine
{
ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),
"Expected HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), got %08x\n", hr);
todo_wine
{
/* win9x: 32 */
ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
broken(info.uliAssemblySizeInKB.u.LowPart == 32),
"Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
}
ok(info.cchBuf == lstrlenW(asmpath) + 1,
"Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
}
/* info.cchBuf has room for NULL-terminator */
INIT_ASM_INFO();
......@@ -1294,9 +1288,9 @@ static void test_QueryAssemblyInfo(void)
ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
broken(info.uliAssemblySizeInKB.u.LowPart == 32),
"Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
}
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
"Wrong assembly path returned\n");
}
/* display name is "wine, Version=1.0.0.0" */
INIT_ASM_INFO();
......@@ -1318,11 +1312,11 @@ static void test_QueryAssemblyInfo(void)
ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
broken(info.uliAssemblySizeInKB.u.LowPart == 32),
"Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
}
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
"Wrong assembly path returned\n");
ok(info.cchBuf == lstrlenW(asmpath) + 1,
"Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
}
/* display name is "wine, Version=1.0.0.00000" */
INIT_ASM_INFO();
......@@ -1344,11 +1338,11 @@ static void test_QueryAssemblyInfo(void)
ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
broken(info.uliAssemblySizeInKB.u.LowPart == 32),
"Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
}
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
"Wrong assembly path returned\n");
ok(info.cchBuf == lstrlenW(asmpath) + 1,
"Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
}
/* display name is "wine, Version=1.0.0.1", versions don't match */
INIT_ASM_INFO();
......@@ -1390,11 +1384,11 @@ static void test_QueryAssemblyInfo(void)
ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
broken(info.uliAssemblySizeInKB.u.LowPart == 32),
"Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
}
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
"Wrong assembly path returned\n");
ok(info.cchBuf == lstrlenW(asmpath) + 1,
"Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
}
/* display name is "wine, Culture=en", cultures don't match */
INIT_ASM_INFO();
......@@ -1415,9 +1409,12 @@ static void test_QueryAssemblyInfo(void)
"Expected 0, got %d\n", info.uliAssemblySizeInKB.u.HighPart);
ok(info.uliAssemblySizeInKB.u.LowPart == 0,
"Expected 0, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
todo_wine
{
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, empty),
"Assembly path was changed\n");
ok(info.cchBuf == MAX_PATH, "Expected MAX_PATH, got %d\n", info.cchBuf);
}
/* display name is "wine, PublicKeyTokens=2d03617b1c31e2f5" */
INIT_ASM_INFO();
......@@ -1439,11 +1436,11 @@ static void test_QueryAssemblyInfo(void)
ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
broken(info.uliAssemblySizeInKB.u.LowPart == 32),
"Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
}
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
"Wrong assembly path returned\n");
ok(info.cchBuf == lstrlenW(asmpath) + 1,
"Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
}
/* display name is "wine, PublicKeyToken=aaaaaaaaaaaaaaaa", pubkeys don't match */
INIT_ASM_INFO();
......@@ -1485,11 +1482,11 @@ static void test_QueryAssemblyInfo(void)
ok((info.uliAssemblySizeInKB.u.LowPart == 4) ||
broken(info.uliAssemblySizeInKB.u.LowPart == 32),
"Expected 4, got %d\n", info.uliAssemblySizeInKB.u.LowPart);
}
ok(!lstrcmpW(info.pszCurrentAssemblyPathBuf, asmpath),
"Wrong assembly path returned\n");
ok(info.cchBuf == lstrlenW(asmpath) + 1,
"Expected %d, got %d\n", lstrlenW(asmpath) + 1, info.cchBuf);
}
/* uninstall the assembly from the GAC */
disp = 0xf00dbad;
......
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