Commit b0aca40d authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

fusion: Add support for ASM_NAME_ARCHITECTURE in IAssemblyNameImpl_GetProperty.

parent fac2e9a2
......@@ -55,6 +55,8 @@ typedef struct {
BYTE pubkey[8];
BOOL haspubkey;
PEKIND pekind;
LONG ref;
} IAssemblyNameImpl;
......@@ -232,6 +234,17 @@ static HRESULT WINAPI IAssemblyNameImpl_GetProperty(IAssemblyName *iface,
}
break;
case ASM_NAME_ARCHITECTURE:
*pcbProperty = 0;
if (name->pekind != peNone)
{
*pcbProperty = sizeof(PEKIND);
if (size < *pcbProperty)
return STRSAFE_E_INSUFFICIENT_BUFFER;
*((PEKIND *)pvProperty) = name->pekind;
}
break;
default:
*pcbProperty = 0;
break;
......@@ -616,6 +629,30 @@ static HRESULT parse_pubkey(IAssemblyNameImpl *name, LPCWSTR pubkey)
return S_OK;
}
static HRESULT parse_procarch(IAssemblyNameImpl *name, LPCWSTR procarch)
{
static const WCHAR msilW[] = {'m','s','i','l',0};
static const WCHAR x86W[] = {'x','8','6',0};
static const WCHAR ia64W[] = {'i','a','6','4',0};
static const WCHAR amd64W[] = {'a','m','d','6','4',0};
if (!lstrcmpiW(procarch, msilW))
name->pekind = peMSIL;
else if (!lstrcmpiW(procarch, x86W))
name->pekind = peI386;
else if (!lstrcmpiW(procarch, ia64W))
name->pekind = peIA64;
else if (!lstrcmpiW(procarch, amd64W))
name->pekind = peAMD64;
else
{
ERR("unrecognized architecture: %s\n", wine_dbgstr_w(procarch));
return FUSION_E_INVALID_NAME;
}
return S_OK;
}
static WCHAR *parse_value( const WCHAR *str, unsigned int len )
{
WCHAR *ret;
......@@ -726,6 +763,8 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
{
name->procarch = value;
value = NULL;
hr = parse_procarch( name, name->procarch );
}
HeapFree( GetProcessHeap(), 0, value );
......
......@@ -397,6 +397,7 @@ static void test_CreateAssemblyNameObject(void)
WCHAR str[MAX_PATH];
WCHAR namestr[MAX_PATH];
DWORD size, hi, lo;
PEKIND arch;
HRESULT hr;
static const WCHAR empty[] = {0};
......@@ -794,6 +795,12 @@ static void test_CreateAssemblyNameObject(void)
ok_aw("wine, processorArchitecture=x86", str);
ok(size == 32, "Expected 32, got %d\n", size);
size = sizeof(arch);
hr = IAssemblyName_GetProperty(name, ASM_NAME_ARCHITECTURE, &arch, &size);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(arch == peI386, "Expected peI386, got %d\n", arch);
ok(size == sizeof(arch), "Wrong size %d\n", size);
IAssemblyName_Release(name);
/* amd64 */
......@@ -808,6 +815,12 @@ static void test_CreateAssemblyNameObject(void)
ok_aw("wine, processorArchitecture=AMD64", str);
ok(size == 34, "Expected 34, got %d\n", size);
size = sizeof(arch);
hr = IAssemblyName_GetProperty(name, ASM_NAME_ARCHITECTURE, &arch, &size);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(arch == peAMD64, "Expected peAMD64, got %d\n", arch);
ok(size == sizeof(arch), "Wrong size %d\n", size);
IAssemblyName_Release(name);
/* ia64 */
......@@ -822,6 +835,12 @@ static void test_CreateAssemblyNameObject(void)
ok_aw("wine, processorArchitecture=IA64", str);
ok(size == 33, "Expected 33, got %d\n", size);
size = sizeof(arch);
hr = IAssemblyName_GetProperty(name, ASM_NAME_ARCHITECTURE, &arch, &size);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(arch == peIA64, "Expected peIA64, got %d\n", arch);
ok(size == sizeof(arch), "Wrong size %d\n", size);
IAssemblyName_Release(name);
/* msil */
......@@ -836,6 +855,12 @@ static void test_CreateAssemblyNameObject(void)
ok_aw("wine, processorArchitecture=MSIL", str);
ok(size == 33, "Expected 33, got %d\n", size);
size = sizeof(arch);
hr = IAssemblyName_GetProperty(name, ASM_NAME_ARCHITECTURE, &arch, &size);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(arch == peMSIL, "Expected peMSIL, got %d\n", arch);
ok(size == sizeof(arch), "Wrong size %d\n", size);
IAssemblyName_Release(name);
}
......
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