Commit c6d34d7b authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

fusion: Install assemblies into correct directory for architecture.

parent eb7c2061
......@@ -91,15 +91,32 @@ static BOOL create_full_path(LPCWSTR path)
return ret;
}
static BOOL get_assembly_directory(LPWSTR dir, DWORD size)
static BOOL get_assembly_directory(LPWSTR dir, DWORD size, BYTE architecture)
{
static const WCHAR gac[] =
{'\\','a','s','s','e','m','b','l','y','\\','G','A','C','_','M','S','I','L',0};
static const WCHAR gac[] = {'\\','a','s','s','e','m','b','l','y','\\','G','A','C',0};
FIXME("Ignoring assembly architecture\n");
static const WCHAR msil[] = {'_','M','S','I','L',0};
static const WCHAR x86[] = {'_','3','2',0};
static const WCHAR amd64[] = {'_','6','4',0};
GetWindowsDirectoryW(dir, size);
strcatW(dir, gac);
switch (architecture)
{
case peMSIL:
strcatW(dir, msil);
break;
case peI386:
strcatW(dir, x86);
break;
case peAMD64:
strcatW(dir, amd64);
break;
}
return TRUE;
}
......@@ -291,7 +308,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
if (FAILED(hr))
goto done;
get_assembly_directory(asmdir, MAX_PATH);
get_assembly_directory(asmdir, MAX_PATH, assembly_get_architecture(assembly));
sprintfW(path, format, asmdir, name, version, token);
......
......@@ -811,6 +811,20 @@ HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version)
return S_OK;
}
BYTE assembly_get_architecture(ASSEMBLY *assembly)
{
if ((assembly->corhdr->MajorRuntimeVersion == 2) && (assembly->corhdr->MinorRuntimeVersion == 0))
return 0; /* .NET 1.x assembly */
if (assembly->nthdr->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
return peAMD64; /* AMD64/IA64 assembly */
if ((assembly->corhdr->Flags & COMIMAGE_FLAGS_ILONLY) && !(assembly->corhdr->Flags & COMIMAGE_FLAGS_32BITREQUIRED))
return peMSIL; /* MSIL assembly */
return peI386; /* x86 assembly */
}
static BYTE *assembly_get_blob(ASSEMBLY *assembly, WORD index, ULONG *size)
{
return GetData(&assembly->blobs[index], size);
......
......@@ -433,6 +433,7 @@ HRESULT assembly_release(ASSEMBLY *assembly);
HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name);
HRESULT assembly_get_path(ASSEMBLY *assembly, LPWSTR *path);
HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version);
BYTE assembly_get_architecture(ASSEMBLY *assembly);
HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token);
static inline LPWSTR strdupW(LPCWSTR src)
......
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