From 0af3bd8365c9b975261a9cd9ddb23b7f791bc095 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 24 Oct 2013 22:49:20 +0400 Subject: [PATCH] ole32: Support activation context in CLSIDFromProgID(). --- dlls/ole32/compobj.c | 19 +++++++++++++++++++ dlls/ole32/tests/compobj.c | 10 +++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 4d791f4d54c..8f3f30378ab 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -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); } diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c index 81f099c30b4..3deedf3c4fe 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -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));