Nikolay Sivov : ole32: Expose ManualResetEvent as registered class.
Alexandre Julliard
julliard at winehq.org
Wed Aug 12 16:28:39 CDT 2020
Module: wine
Branch: master
Commit: 964a8c909d48419390cb6e28a8f1c826ab8af862
URL: https://source.winehq.org/git/wine.git/?a=commit;h=964a8c909d48419390cb6e28a8f1c826ab8af862
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Aug 12 11:12:32 2020 +0300
ole32: Expose ManualResetEvent as registered class.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ole32/compobj.c | 6 +++---
dlls/ole32/compobj_private.h | 3 +++
dlls/ole32/oleproxy.c | 13 +++++++++++++
dlls/ole32/tests/marshal.c | 5 +++++
4 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 32283e6d95..8e78519dc8 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -922,12 +922,12 @@ static const ISynchronizeHandleVtbl SynchronizeHandleVtbl = {
SynchronizeHandle_GetHandle
};
-static HRESULT ManualResetEvent_Construct(IUnknown *punkouter, REFIID iid, void **ppv)
+HRESULT WINAPI ManualResetEvent_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **ppv)
{
MREImpl *This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MREImpl));
HRESULT hr;
- if(punkouter)
+ if (outer)
FIXME("Aggregation not implemented.\n");
This->ref = 1;
@@ -3004,7 +3004,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx(
}
if (IsEqualCLSID(&clsid, &CLSID_ManualResetEvent)) {
- hres = ManualResetEvent_Construct(pUnkOuter, pResults[0].pIID, (void**)&unk);
+ hres = ManualResetEvent_CreateInstance(&ManualResetEventCF, pUnkOuter, pResults[0].pIID, (void**)&unk);
if (FAILED(hres))
return hres;
return return_multi_qi(unk, cmq, pResults, TRUE);
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h
index 3156f86f89..974c230ddc 100644
--- a/dlls/ole32/compobj_private.h
+++ b/dlls/ole32/compobj_private.h
@@ -322,6 +322,9 @@ extern IClassFactory GlobalOptionsCF DECLSPEC_HIDDEN;
extern HRESULT WINAPI GlobalInterfaceTable_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid,
void **obj) DECLSPEC_HIDDEN;
extern IClassFactory GlobalInterfaceTableCF DECLSPEC_HIDDEN;
+extern HRESULT WINAPI ManualResetEvent_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid,
+ void **obj) DECLSPEC_HIDDEN;
+extern IClassFactory ManualResetEventCF DECLSPEC_HIDDEN;
/* Exported non-interface Data Advise Holder functions */
HRESULT DataAdviseHolder_OnConnect(IDataAdviseHolder *iface, IDataObject *pDelegate) DECLSPEC_HIDDEN;
diff --git a/dlls/ole32/oleproxy.c b/dlls/ole32/oleproxy.c
index 93ff5b0da8..29cd391e12 100644
--- a/dlls/ole32/oleproxy.c
+++ b/dlls/ole32/oleproxy.c
@@ -170,6 +170,17 @@ static const IClassFactoryVtbl GlobalInterfaceTableCFVtbl =
IClassFactory GlobalInterfaceTableCF = { &GlobalInterfaceTableCFVtbl };
+static const IClassFactoryVtbl ManualResetEventCFVtbl =
+{
+ ClassFactory_QueryInterface,
+ ClassFactory_AddRef,
+ ClassFactory_Release,
+ ManualResetEvent_CreateInstance,
+ ClassFactory_LockServer
+};
+
+IClassFactory ManualResetEventCF = { &ManualResetEventCFVtbl };
+
/***********************************************************************
* DllGetClassObject [OLE32.@]
*/
@@ -186,6 +197,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
return MARSHAL_GetStandardMarshalCF(ppv);
if (IsEqualCLSID(rclsid, &CLSID_StdGlobalInterfaceTable))
return IClassFactory_QueryInterface(&GlobalInterfaceTableCF, iid, ppv);
+ if (IsEqualCLSID(rclsid, &CLSID_ManualResetEvent))
+ return IClassFactory_QueryInterface(&ManualResetEventCF, iid, ppv);
if (IsEqualCLSID(rclsid, &CLSID_FileMoniker))
return IClassFactory_QueryInterface(&FileMonikerCF, iid, ppv);
if (IsEqualCLSID(rclsid, &CLSID_ItemMoniker))
diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c
index e2608ecb76..ef608e66d0 100644
--- a/dlls/ole32/tests/marshal.c
+++ b/dlls/ole32/tests/marshal.c
@@ -4006,11 +4006,16 @@ static void test_manualresetevent(void)
{
ISynchronizeHandle *sync_handle;
ISynchronize *psync1, *psync2;
+ IClassFactory *factory;
IUnknown *punk;
HANDLE handle;
LONG ref;
HRESULT hr;
+ hr = pDllGetClassObject(&CLSID_ManualResetEvent, &IID_IClassFactory, (void **)&factory);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ IClassFactory_Release(factory);
+
hr = CoCreateInstance(&CLSID_ManualResetEvent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&punk);
ok(hr == S_OK, "Got 0x%08x\n", hr);
ok(!!punk, "Got NULL.\n");
More information about the wine-cvs
mailing list