ole32: Support activation context in CLSIDFromProgID().

This commit is contained in:
Nikolay Sivov 2013-10-24 22:49:20 +04:00 committed by Alexandre Julliard
parent f96631e110
commit 0af3bd8365
2 changed files with 22 additions and 7 deletions

View file

@ -135,6 +135,13 @@ struct ifacepsredirect_data
ULONG name_offset;
};
struct progidredirect_data
{
ULONG size;
DWORD reserved;
ULONG clsid_offset;
};
struct class_reg_data
{
union
@ -2331,12 +2338,24 @@ HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID)
*/
HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
{
ACTCTX_SECTION_KEYED_DATA data;
if (!progid || !clsid)
{
ERR("neither progid (%p) nor clsid (%p) are optional\n", progid, clsid);
return E_INVALIDARG;
}
data.cbSize = sizeof(data);
if (FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION,
progid, &data))
{
struct progidredirect_data *progiddata = (struct progidredirect_data*)data.lpData;
CLSID *alias = (CLSID*)((BYTE*)data.lpSectionBase + progiddata->clsid_offset);
*clsid = *alias;
return S_OK;
}
return clsid_from_string_reg(progid, clsid);
}

View file

@ -379,12 +379,9 @@ static void test_CLSIDFromProgID(void)
clsid = CLSID_NULL;
hr = CLSIDFromProgID(progidW, &clsid);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
if (hr == S_OK)
/* it returns generated CLSID here */
ok(!IsEqualCLSID(&clsid, &CLSID_non_existent) && !IsEqualCLSID(&clsid, &CLSID_NULL),
"got wrong clsid %s\n", debugstr_guid(&clsid));
/* it returns generated CLSID here */
ok(!IsEqualCLSID(&clsid, &CLSID_non_existent) && !IsEqualCLSID(&clsid, &CLSID_NULL),
"got wrong clsid %s\n", debugstr_guid(&clsid));
/* duplicate progid present in context - returns generated guid here too */
clsid = CLSID_NULL;
@ -393,7 +390,6 @@ todo_wine
clsid1 = CLSID_StdFont;
/* that's where it differs from StdFont */
clsid1.Data4[7] = 0x52;
todo_wine
ok(!IsEqualCLSID(&clsid, &CLSID_StdFont) && !IsEqualCLSID(&clsid, &CLSID_NULL) && !IsEqualCLSID(&clsid, &clsid1),
"got %s\n", debugstr_guid(&clsid));