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;
......
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