Commit 03dbbe21 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32: Support activation context in ProgIDFromCLSID().

parent e02b1687
......@@ -2227,6 +2227,7 @@ HRESULT COM_OpenKeyForAppIdFromCLSID(REFCLSID clsid, REGSAM access, HKEY *subkey
HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID)
{
static const WCHAR wszProgID[] = {'P','r','o','g','I','D',0};
ACTCTX_SECTION_KEYED_DATA data;
HKEY hkey;
HRESULT ret;
LONG progidlen = 0;
......@@ -2238,6 +2239,27 @@ HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID)
}
*ppszProgID = NULL;
data.cbSize = sizeof(data);
if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION,
clsid, &data))
{
struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData;
if (comclass->progid_len)
{
WCHAR *ptrW;
*ppszProgID = CoTaskMemAlloc(comclass->progid_len + sizeof(WCHAR));
if (!*ppszProgID) return E_OUTOFMEMORY;
ptrW = (WCHAR*)((BYTE*)comclass + comclass->progid_offset);
memcpy(*ppszProgID, ptrW, comclass->progid_len + sizeof(WCHAR));
return S_OK;
}
else
return REGDB_E_CLASSNOTREG;
}
ret = COM_OpenKeyForCLSID(clsid, wszProgID, KEY_READ, &hkey);
if (FAILED(ret))
return ret;
......
......@@ -309,19 +309,14 @@ static void test_ProgIDFromCLSID(void)
static const WCHAR customfontW[] = {'C','u','s','t','o','m','F','o','n','t',0};
hr = ProgIDFromCLSID(&CLSID_non_existent, &progid);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
if (hr == S_OK)
{
ok(!lstrcmpiW(progid, progidW), "got %s\n", wine_dbgstr_w(progid));
CoTaskMemFree(progid);
}
ok(!lstrcmpiW(progid, progidW), "got %s\n", wine_dbgstr_w(progid));
CoTaskMemFree(progid);
/* try something registered and redirected */
progid = NULL;
hr = ProgIDFromCLSID(&CLSID_StdFont, &progid);
ok(hr == S_OK, "got 0x%08x\n", hr);
todo_wine
ok(!lstrcmpiW(progid, customfontW), "got wrong progid %s\n", wine_dbgstr_w(progid));
CoTaskMemFree(progid);
......
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