Commit 50996679 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

fusion: Implement IAssemblyName::IsEqual.

parent 97d86f77
......@@ -407,10 +407,37 @@ static HRESULT WINAPI IAssemblyNameImpl_GetVersion(IAssemblyName *iface,
static HRESULT WINAPI IAssemblyNameImpl_IsEqual(IAssemblyName *iface,
IAssemblyName *pName,
DWORD dwCmpFlags)
DWORD flags)
{
FIXME("(%p, %p, %d) stub!\n", iface, pName, dwCmpFlags);
return E_NOTIMPL;
IAssemblyNameImpl *name1 = impl_from_IAssemblyName(iface);
IAssemblyNameImpl *name2 = impl_from_IAssemblyName(pName);
TRACE("(%p, %p, 0x%08x)\n", iface, pName, flags);
if (!pName) return S_FALSE;
if (flags & ~ASM_CMPF_IL_ALL) FIXME("unsupported flags\n");
if ((flags & ASM_CMPF_NAME) && strcmpW(name1->name, name2->name)) return S_FALSE;
if (name1->versize && name2->versize)
{
if ((flags & ASM_CMPF_MAJOR_VERSION) &&
name1->version[0] != name2->version[0]) return S_FALSE;
if ((flags & ASM_CMPF_MINOR_VERSION) &&
name1->version[1] != name2->version[1]) return S_FALSE;
if ((flags & ASM_CMPF_BUILD_NUMBER) &&
name1->version[2] != name2->version[2]) return S_FALSE;
if ((flags & ASM_CMPF_REVISION_NUMBER) &&
name1->version[3] != name2->version[3]) return S_FALSE;
}
if ((flags & ASM_CMPF_PUBLIC_KEY_TOKEN) &&
name1->haspubkey && name2->haspubkey &&
memcmp(name1->pubkey, name2->pubkey, sizeof(name1->pubkey))) return S_FALSE;
if ((flags & ASM_CMPF_CULTURE) &&
name1->culture && name2->culture &&
strcmpW(name1->culture, name2->culture)) return S_FALSE;
return S_OK;
}
static HRESULT WINAPI IAssemblyNameImpl_Clone(IAssemblyName *iface,
......
......@@ -893,6 +893,81 @@ static void test_CreateAssemblyNameObject(void)
ok(name == (IAssemblyName *)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", name);
}
static void test_IAssemblyName_IsEqual(void)
{
static const WCHAR wine1[] =
{'w','i','n','e',0};
static const WCHAR wine2[] =
{'w','i','n','e',',','v','e','r','s','i','o','n','=','1','.','0','.','0','.','0',0};
static const WCHAR wine3[] =
{'w','i','n','e',',','v','e','r','s','i','o','n','=','1','.','0','.','0','.','0',',',
'c','u','l','t','u','r','e','=','n','e','u','t','r','a','l',0};
static const WCHAR wine4[] =
{'w','i','n','e',',','v','e','r','s','i','o','n','=','1','.','0','.','0','.','0',',',
'c','u','l','t','u','r','e','=','e','n',0};
static const WCHAR wine5[] =
{'w','i','n','e',',','v','e','r','s','i','o','n','=','1','.','0','.','0','.','0',',',
'p','u','b','l','i','c','K','e','y','T','o','k','e','n','=','1','2','3','4','5','6',
'7','8','9','0','a','b','c','d','e','f',0};
HRESULT hr;
IAssemblyName *name1, *name2;
hr = pCreateAssemblyNameObject( &name1, wine1, CANOF_PARSE_DISPLAY_NAME, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = pCreateAssemblyNameObject( &name2, wine1, CANOF_PARSE_DISPLAY_NAME, NULL );
ok( hr == S_OK, "got %08x\n", hr );
if (0) { /* crashes on some old version */
hr = IAssemblyName_IsEqual( name1, NULL, 0 );
ok( hr == S_FALSE, "got %08x\n", hr );
hr = IAssemblyName_IsEqual( name1, NULL, ASM_CMPF_IL_ALL );
ok( hr == S_FALSE, "got %08x\n", hr );
}
hr = IAssemblyName_IsEqual( name1, name1, ASM_CMPF_IL_ALL );
ok( hr == S_OK, "got %08x\n", hr );
hr = IAssemblyName_IsEqual( name1, name2, ASM_CMPF_IL_ALL );
ok( hr == S_OK, "got %08x\n", hr );
IAssemblyName_Release( name2 );
hr = pCreateAssemblyNameObject( &name2, wine2, CANOF_PARSE_DISPLAY_NAME, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = IAssemblyName_IsEqual( name1, name2, ASM_CMPF_IL_ALL );
ok( hr == S_OK, "got %08x\n", hr );
IAssemblyName_Release( name2 );
hr = pCreateAssemblyNameObject( &name2, wine3, CANOF_PARSE_DISPLAY_NAME, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = IAssemblyName_IsEqual( name1, name2, ASM_CMPF_IL_ALL );
ok( hr == S_OK, "got %08x\n", hr );
IAssemblyName_Release( name1 );
hr = pCreateAssemblyNameObject( &name1, wine4, CANOF_PARSE_DISPLAY_NAME, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = IAssemblyName_IsEqual( name1, name2, ASM_CMPF_IL_ALL );
todo_wine ok( hr == S_FALSE, "got %08x\n", hr );
IAssemblyName_Release( name1 );
hr = pCreateAssemblyNameObject( &name1, wine1, CANOF_PARSE_DISPLAY_NAME, NULL );
ok( hr == S_OK, "got %08x\n", hr );
IAssemblyName_Release( name2 );
hr = pCreateAssemblyNameObject( &name2, wine5, CANOF_PARSE_DISPLAY_NAME, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = IAssemblyName_IsEqual( name1, name2, ASM_CMPF_IL_ALL );
ok( hr == S_OK, "got %08x\n", hr );
IAssemblyName_Release( name1 );
IAssemblyName_Release( name2 );
}
START_TEST(asmname)
{
if (!init_functionpointers())
......@@ -902,4 +977,5 @@ START_TEST(asmname)
}
test_CreateAssemblyNameObject();
test_IAssemblyName_IsEqual();
}
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