Required by WhatsApp Desktop.
-- v4: vccorlib140: Implement GetIidsFn. vccorlib140: Add stub for GetIidsFn. vccorlib140: Implement GetActivationFactoryByPCWSTR. vccorlib140: Add stub for GetActivationFactoryByPCWSTR.
From: Vibhav Pant vibhavp@gmail.com
--- dlls/vccorlib140/tests/vccorlib.c | 46 +++++++++++++++++++++++++++++++ dlls/vccorlib140/vccorlib.c | 7 +++++ dlls/vccorlib140/vccorlib140.spec | 6 ++-- 3 files changed, 56 insertions(+), 3 deletions(-)
diff --git a/dlls/vccorlib140/tests/vccorlib.c b/dlls/vccorlib140/tests/vccorlib.c index 035cfdb880f..78a1ba94b0d 100644 --- a/dlls/vccorlib140/tests/vccorlib.c +++ b/dlls/vccorlib140/tests/vccorlib.c @@ -20,6 +20,8 @@
#define COBJMACROS
+#include "initguid.h" +#include "activation.h" #include "objbase.h" #include "wine/test.h"
@@ -55,6 +57,7 @@ DEFINE_EXPECT(PostUninitialize);
static HRESULT (__cdecl *pInitializeData)(int); static void (__cdecl *pUninitializeData)(int); +static HRESULT (WINAPI *pGetActivationFactoryByPCWSTR)(const WCHAR *, const GUID *, void **);
static BOOL init(void) { @@ -73,6 +76,19 @@ static BOOL init(void) "?UninitializeData@Details@Platform@@YAXH@Z"); ok(pUninitializeData != NULL, "UninitializeData not available\n");
+#ifdef __arm__ + pGetActivationFactoryByPCWSTR = (void *)GetProcAddress(hmod, + "?GetActivationFactoryByPCWSTR@@YAJPAXAAVGuid@Platform@@PAPAX@Z"); +#else + if (sizeof(void *) == 8) + pGetActivationFactoryByPCWSTR = (void *)GetProcAddress(hmod, + "?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z"); + else + pGetActivationFactoryByPCWSTR = (void *)GetProcAddress(hmod, + "?GetActivationFactoryByPCWSTR@@YGJPAXAAVGuid@Platform@@PAPAX@Z"); +#endif + ok(pGetActivationFactoryByPCWSTR != NULL, "GetActivationFactoryByPCWSTR not available\n"); + return TRUE; }
@@ -212,10 +228,40 @@ static void test_InitializeData(void) ok(hr == S_OK, "CoRevokeInitializeSpy returned %lx\n", hr); }
+static void test_GetActivationFactoryByPCWSTR(void) +{ + static const GUID guid_null = {0}; + HRESULT hr; + void *out; + + hr = pGetActivationFactoryByPCWSTR(L"Wine.Nonexistent.RuntimeClass", &IID_IActivationFactory, &out); + todo_wine ok(hr == CO_E_NOTINITIALIZED, "got hr %#lx\n", hr); + + hr = pInitializeData(1); + ok(hr == S_OK, "got hr %#lx\n", hr); + + hr = pGetActivationFactoryByPCWSTR(L"Wine.Nonexistent.RuntimeClass", &IID_IActivationFactory, &out); + todo_wine ok(hr == REGDB_E_CLASSNOTREG, "got hr %#lx\n", hr); + + hr = pGetActivationFactoryByPCWSTR(L"Windows.Foundation.Metadata.ApiInformation", &IID_IActivationFactory, &out); + todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); + if (SUCCEEDED(hr)) IActivationFactory_Release(out); + + hr = pGetActivationFactoryByPCWSTR(L"Windows.Foundation.Metadata.ApiInformation", &IID_IInspectable, &out); + todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); + if (SUCCEEDED(hr)) IActivationFactory_Release(out); + + hr = pGetActivationFactoryByPCWSTR(L"Windows.Foundation.Metadata.ApiInformation", &guid_null, &out); + todo_wine ok(hr == E_NOINTERFACE, "got hr %#lx\n", hr); + + pUninitializeData(1); +} + START_TEST(vccorlib) { if(!init()) return;
test_InitializeData(); + test_GetActivationFactoryByPCWSTR(); } diff --git a/dlls/vccorlib140/vccorlib.c b/dlls/vccorlib140/vccorlib.c index 6665a5962a5..2d4341ba82f 100644 --- a/dlls/vccorlib140/vccorlib.c +++ b/dlls/vccorlib140/vccorlib.c @@ -40,3 +40,10 @@ void __cdecl UninitializeData(int type)
if (type) RoUninitialize(); } + +HRESULT WINAPI GetActivationFactoryByPCWSTR(const WCHAR *name, const GUID *iid, void **out) +{ + FIXME("(%s, %s, %p) stub\n", debugstr_w(name), debugstr_guid(iid), out); + + return E_NOTIMPL; +} diff --git a/dlls/vccorlib140/vccorlib140.spec b/dlls/vccorlib140/vccorlib140.spec index ecae1e9464a..d0dc38b8acb 100644 --- a/dlls/vccorlib140/vccorlib140.spec +++ b/dlls/vccorlib140/vccorlib140.spec @@ -73,9 +73,9 @@ @ stub -arch=i386 ?GetActivationFactory@Details@Platform@@YGJPAVModuleBase@1WRL@Microsoft@@PAUHSTRING__@@PAPAUIActivationFactory@@@Z @ stub -arch=arm ?GetActivationFactory@Details@Platform@@YAJPAVModuleBase@1WRL@Microsoft@@PAUHSTRING__@@PAPAUIActivationFactory@@@Z @ stub -arch=win64 ?GetActivationFactory@Details@Platform@@YAJPEAVModuleBase@1WRL@Microsoft@@PEAUHSTRING__@@PEAPEAUIActivationFactory@@@Z -@ stub -arch=i386 ?GetActivationFactoryByPCWSTR@@YGJPAXAAVGuid@Platform@@PAPAX@Z -@ stub -arch=arm ?GetActivationFactoryByPCWSTR@@YAJPAXAAVGuid@Platform@@PAPAX@Z -@ stub -arch=win64 ?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z +@ stdcall -arch=i386 ?GetActivationFactoryByPCWSTR@@YGJPAXAAVGuid@Platform@@PAPAX@Z(wstr ptr ptr) GetActivationFactoryByPCWSTR +@ stdcall -arch=arm ?GetActivationFactoryByPCWSTR@@YAJPAXAAVGuid@Platform@@PAPAX@Z(wstr ptr ptr) GetActivationFactoryByPCWSTR +@ stdcall -arch=win64 ?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z(wstr ptr ptr) GetActivationFactoryByPCWSTR @ stub -arch=win32 ??0ClassNotRegisteredException@Platform@@Q$AAA@XZ @ stub -arch=win64 ??0ClassNotRegisteredException@Platform@@QE$AAA@XZ @ stub -arch=win32 ?GetCmdArguments@Details@Platform@@YAPAPA_WPAH@Z
From: Vibhav Pant vibhavp@gmail.com
--- dlls/vccorlib140/tests/vccorlib.c | 14 +++++++------- dlls/vccorlib140/vccorlib.c | 13 +++++++++++-- 2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/dlls/vccorlib140/tests/vccorlib.c b/dlls/vccorlib140/tests/vccorlib.c index 78a1ba94b0d..411b1b7ec09 100644 --- a/dlls/vccorlib140/tests/vccorlib.c +++ b/dlls/vccorlib140/tests/vccorlib.c @@ -235,24 +235,24 @@ static void test_GetActivationFactoryByPCWSTR(void) void *out;
hr = pGetActivationFactoryByPCWSTR(L"Wine.Nonexistent.RuntimeClass", &IID_IActivationFactory, &out); - todo_wine ok(hr == CO_E_NOTINITIALIZED, "got hr %#lx\n", hr); + ok(hr == CO_E_NOTINITIALIZED, "got hr %#lx\n", hr);
hr = pInitializeData(1); ok(hr == S_OK, "got hr %#lx\n", hr);
hr = pGetActivationFactoryByPCWSTR(L"Wine.Nonexistent.RuntimeClass", &IID_IActivationFactory, &out); - todo_wine ok(hr == REGDB_E_CLASSNOTREG, "got hr %#lx\n", hr); + ok(hr == REGDB_E_CLASSNOTREG, "got hr %#lx\n", hr);
hr = pGetActivationFactoryByPCWSTR(L"Windows.Foundation.Metadata.ApiInformation", &IID_IActivationFactory, &out); - todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); - if (SUCCEEDED(hr)) IActivationFactory_Release(out); + ok(hr == S_OK, "got hr %#lx\n", hr); + IActivationFactory_Release(out);
hr = pGetActivationFactoryByPCWSTR(L"Windows.Foundation.Metadata.ApiInformation", &IID_IInspectable, &out); - todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); - if (SUCCEEDED(hr)) IActivationFactory_Release(out); + ok(hr == S_OK, "got hr %#lx\n", hr); + IActivationFactory_Release(out);
hr = pGetActivationFactoryByPCWSTR(L"Windows.Foundation.Metadata.ApiInformation", &guid_null, &out); - todo_wine ok(hr == E_NOINTERFACE, "got hr %#lx\n", hr); + ok(hr == E_NOINTERFACE, "got hr %#lx\n", hr);
pUninitializeData(1); } diff --git a/dlls/vccorlib140/vccorlib.c b/dlls/vccorlib140/vccorlib.c index 2d4341ba82f..533f81d8dd4 100644 --- a/dlls/vccorlib140/vccorlib.c +++ b/dlls/vccorlib140/vccorlib.c @@ -17,6 +17,7 @@ */
#include "roapi.h" +#include "winstring.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(vccorlib); @@ -43,7 +44,15 @@ void __cdecl UninitializeData(int type)
HRESULT WINAPI GetActivationFactoryByPCWSTR(const WCHAR *name, const GUID *iid, void **out) { - FIXME("(%s, %s, %p) stub\n", debugstr_w(name), debugstr_guid(iid), out); + HSTRING_HEADER hdr; + HSTRING str; + HRESULT hr;
- return E_NOTIMPL; + TRACE("(%s, %s, %p)\n", debugstr_w(name), debugstr_guid(iid), out); + + /* Use a fast-pass string to avoid an allocation. */ + hr = WindowsCreateStringReference(name, wcslen(name), &hdr, &str); + if (FAILED(hr)) return hr; + + return RoGetActivationFactory(str, iid, out); }
From: Vibhav Pant vibhavp@gmail.com
--- dlls/vccorlib140/tests/vccorlib.c | 39 ++++++++++++++++++++++++++++++- dlls/vccorlib140/vccorlib.c | 8 +++++++ dlls/vccorlib140/vccorlib140.spec | 6 ++--- 3 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/dlls/vccorlib140/tests/vccorlib.c b/dlls/vccorlib140/tests/vccorlib.c index 411b1b7ec09..a6e78a7c387 100644 --- a/dlls/vccorlib140/tests/vccorlib.c +++ b/dlls/vccorlib140/tests/vccorlib.c @@ -2,6 +2,7 @@ * Unit tests for miscellaneous vccorlib functions * * Copyright 2025 Piotr Caban + * Copyright 2025 Vibhav Pant * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -58,6 +59,7 @@ DEFINE_EXPECT(PostUninitialize); static HRESULT (__cdecl *pInitializeData)(int); static void (__cdecl *pUninitializeData)(int); static HRESULT (WINAPI *pGetActivationFactoryByPCWSTR)(const WCHAR *, const GUID *, void **); +static HRESULT (WINAPI *pGetIidsFn)(UINT32, UINT32 *, const GUID *, GUID **);
static BOOL init(void) { @@ -79,15 +81,23 @@ static BOOL init(void) #ifdef __arm__ pGetActivationFactoryByPCWSTR = (void *)GetProcAddress(hmod, "?GetActivationFactoryByPCWSTR@@YAJPAXAAVGuid@Platform@@PAPAX@Z"); + pGetIidsFn = (void *)GetProcAddress(hmod, "?GetIidsFn@@YAJHPAKPBU__s_GUID@@PAPAVGuid@Platform@@@Z"); #else if (sizeof(void *) == 8) + { pGetActivationFactoryByPCWSTR = (void *)GetProcAddress(hmod, "?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z"); + pGetIidsFn = (void *)GetProcAddress(hmod, "?GetIidsFn@@YAJHPEAKPEBU__s_GUID@@PEAPEAVGuid@Platform@@@Z"); + } else + { pGetActivationFactoryByPCWSTR = (void *)GetProcAddress(hmod, "?GetActivationFactoryByPCWSTR@@YGJPAXAAVGuid@Platform@@PAPAX@Z"); + pGetIidsFn = (void *)GetProcAddress(hmod, "?GetIidsFn@@YGJHPAKPBU__s_GUID@@PAPAVGuid@Platform@@@Z"); + } #endif ok(pGetActivationFactoryByPCWSTR != NULL, "GetActivationFactoryByPCWSTR not available\n"); + ok(pGetIidsFn != NULL, "GetIidsFn not available\n");
return TRUE; } @@ -228,9 +238,10 @@ static void test_InitializeData(void) ok(hr == S_OK, "CoRevokeInitializeSpy returned %lx\n", hr); }
+static const GUID guid_null = {0}; + static void test_GetActivationFactoryByPCWSTR(void) { - static const GUID guid_null = {0}; HRESULT hr; void *out;
@@ -257,6 +268,31 @@ static void test_GetActivationFactoryByPCWSTR(void) pUninitializeData(1); }
+static void test_GetIidsFn(void) +{ + static const GUID guids_src[] = {IID_IUnknown, IID_IInspectable, IID_IAgileObject, IID_IMarshal, guid_null}; + GUID *guids_dest; + UINT32 copied; + HRESULT hr; + + guids_dest = NULL; + copied = 0xdeadbeef; + hr = pGetIidsFn(0, &copied, NULL, &guids_dest); + todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(copied == 0, "got copied %I32u\n", copied); + todo_wine ok(guids_dest != NULL, "got guids_dest %p\n", guids_dest); + CoTaskMemFree(guids_dest); + + guids_dest = NULL; + copied = 0; + hr = pGetIidsFn(ARRAY_SIZE(guids_src), &copied, guids_src, &guids_dest); + todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(copied == ARRAY_SIZE(guids_src), "got copied %I32u\n", copied); + todo_wine ok(guids_dest != NULL, "got guids_dest %p\n", guids_dest); + ok(!memcmp(guids_src, guids_dest, sizeof(*guids_dest) * copied), "unexpected guids_dest value.\n"); + CoTaskMemFree(guids_dest); +} + START_TEST(vccorlib) { if(!init()) @@ -264,4 +300,5 @@ START_TEST(vccorlib)
test_InitializeData(); test_GetActivationFactoryByPCWSTR(); + test_GetIidsFn(); } diff --git a/dlls/vccorlib140/vccorlib.c b/dlls/vccorlib140/vccorlib.c index 533f81d8dd4..acbd140fa5b 100644 --- a/dlls/vccorlib140/vccorlib.c +++ b/dlls/vccorlib140/vccorlib.c @@ -1,5 +1,6 @@ /* * Copyright 2025 Piotr Caban + * Copyright 2025 Vibhav Pant * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -56,3 +57,10 @@ HRESULT WINAPI GetActivationFactoryByPCWSTR(const WCHAR *name, const GUID *iid,
return RoGetActivationFactory(str, iid, out); } + +HRESULT WINAPI GetIidsFn(unsigned int count, unsigned int *copied, const GUID *src, GUID **dest) +{ + FIXME("(%u, %p, %p, %p) stub\n", count, copied, src, dest); + + return E_NOTIMPL; +} diff --git a/dlls/vccorlib140/vccorlib140.spec b/dlls/vccorlib140/vccorlib140.spec index d0dc38b8acb..503b2771ee7 100644 --- a/dlls/vccorlib140/vccorlib140.spec +++ b/dlls/vccorlib140/vccorlib140.spec @@ -136,9 +136,9 @@ @ stub -arch=i386 ?GetIBoxVtable@Details@Platform@@YGPAXPAX@Z @ stub -arch=arm ?GetIBoxVtable@Details@Platform@@YAPAXPAX@Z @ stub -arch=win64 ?GetIBoxVtable@Details@Platform@@YAPEAXPEAX@Z -@ stub -arch=i386 ?GetIidsFn@@YGJHPAKPBU__s_GUID@@PAPAVGuid@Platform@@@Z -@ stub -arch=arm ?GetIidsFn@@YAJHPAKPBU__s_GUID@@PAPAVGuid@Platform@@@Z -@ stub -arch=win64 ?GetIidsFn@@YAJHPEAKPEBU__s_GUID@@PEAPEAVGuid@Platform@@@Z +@ stdcall -arch=i386 ?GetIidsFn@@YGJHPAKPBU__s_GUID@@PAPAVGuid@Platform@@@Z(long ptr ptr ptr) GetIidsFn +@ stdcall -arch=arm ?GetIidsFn@@YAJHPAKPBU__s_GUID@@PAPAVGuid@Platform@@@Z(long ptr ptr ptr) GetIidsFn +@ stdcall -arch=win64 ?GetIidsFn@@YAJHPEAKPEBU__s_GUID@@PEAPEAVGuid@Platform@@@Z(long ptr ptr ptr) GetIidsFn @ stub -arch=i386 ?GetObjectContext@Details@Platform@@YGPAUIUnknown@@XZ @ stub -arch=arm ?GetObjectContext@Details@Platform@@YAPAUIUnknown@@XZ @ stub -arch=win64 ?GetObjectContext@Details@Platform@@YAPEAUIUnknown@@XZ
From: Vibhav Pant vibhavp@gmail.com
--- dlls/vccorlib140/tests/vccorlib.c | 12 ++++++------ dlls/vccorlib140/vccorlib.c | 13 +++++++++++-- 2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/dlls/vccorlib140/tests/vccorlib.c b/dlls/vccorlib140/tests/vccorlib.c index a6e78a7c387..890472f0b46 100644 --- a/dlls/vccorlib140/tests/vccorlib.c +++ b/dlls/vccorlib140/tests/vccorlib.c @@ -278,17 +278,17 @@ static void test_GetIidsFn(void) guids_dest = NULL; copied = 0xdeadbeef; hr = pGetIidsFn(0, &copied, NULL, &guids_dest); - todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); - todo_wine ok(copied == 0, "got copied %I32u\n", copied); - todo_wine ok(guids_dest != NULL, "got guids_dest %p\n", guids_dest); + ok(hr == S_OK, "got hr %#lx\n", hr); + ok(copied == 0, "got copied %I32u\n", copied); + ok(guids_dest != NULL, "got guids_dest %p\n", guids_dest); CoTaskMemFree(guids_dest);
guids_dest = NULL; copied = 0; hr = pGetIidsFn(ARRAY_SIZE(guids_src), &copied, guids_src, &guids_dest); - todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); - todo_wine ok(copied == ARRAY_SIZE(guids_src), "got copied %I32u\n", copied); - todo_wine ok(guids_dest != NULL, "got guids_dest %p\n", guids_dest); + ok(hr == S_OK, "got hr %#lx\n", hr); + ok(copied == ARRAY_SIZE(guids_src), "got copied %I32u\n", copied); + ok(guids_dest != NULL, "got guids_dest %p\n", guids_dest); ok(!memcmp(guids_src, guids_dest, sizeof(*guids_dest) * copied), "unexpected guids_dest value.\n"); CoTaskMemFree(guids_dest); } diff --git a/dlls/vccorlib140/vccorlib.c b/dlls/vccorlib140/vccorlib.c index acbd140fa5b..23310ec542e 100644 --- a/dlls/vccorlib140/vccorlib.c +++ b/dlls/vccorlib140/vccorlib.c @@ -60,7 +60,16 @@ HRESULT WINAPI GetActivationFactoryByPCWSTR(const WCHAR *name, const GUID *iid,
HRESULT WINAPI GetIidsFn(unsigned int count, unsigned int *copied, const GUID *src, GUID **dest) { - FIXME("(%u, %p, %p, %p) stub\n", count, copied, src, dest); + TRACE("(%u, %p, %p, %p)\n", count, copied, src, dest);
- return E_NOTIMPL; + if (!(*dest = CoTaskMemAlloc(count * sizeof(*src)))) + { + *copied = 0; + return E_OUTOFMEMORY; + } + + *copied = count; + memcpy(*dest, src, count * sizeof(*src)); + + return S_OK; }
This merge request was approved by Piotr Caban.