ole32: Expose ManualResetEvent as registered class.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-08-12 11:12:32 +03:00 committed by Alexandre Julliard
parent b59b5da856
commit 964a8c909d
4 changed files with 24 additions and 3 deletions

View File

@ -922,12 +922,12 @@ static const ISynchronizeHandleVtbl SynchronizeHandleVtbl = {
SynchronizeHandle_GetHandle 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)); MREImpl *This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MREImpl));
HRESULT hr; HRESULT hr;
if(punkouter) if (outer)
FIXME("Aggregation not implemented.\n"); FIXME("Aggregation not implemented.\n");
This->ref = 1; This->ref = 1;
@ -3004,7 +3004,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx(
} }
if (IsEqualCLSID(&clsid, &CLSID_ManualResetEvent)) { 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)) if (FAILED(hres))
return hres; return hres;
return return_multi_qi(unk, cmq, pResults, TRUE); return return_multi_qi(unk, cmq, pResults, TRUE);

View File

@ -322,6 +322,9 @@ extern IClassFactory GlobalOptionsCF DECLSPEC_HIDDEN;
extern HRESULT WINAPI GlobalInterfaceTable_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, extern HRESULT WINAPI GlobalInterfaceTable_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid,
void **obj) DECLSPEC_HIDDEN; void **obj) DECLSPEC_HIDDEN;
extern IClassFactory GlobalInterfaceTableCF 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 */ /* Exported non-interface Data Advise Holder functions */
HRESULT DataAdviseHolder_OnConnect(IDataAdviseHolder *iface, IDataObject *pDelegate) DECLSPEC_HIDDEN; HRESULT DataAdviseHolder_OnConnect(IDataAdviseHolder *iface, IDataObject *pDelegate) DECLSPEC_HIDDEN;

View File

@ -170,6 +170,17 @@ static const IClassFactoryVtbl GlobalInterfaceTableCFVtbl =
IClassFactory GlobalInterfaceTableCF = { &GlobalInterfaceTableCFVtbl }; IClassFactory GlobalInterfaceTableCF = { &GlobalInterfaceTableCFVtbl };
static const IClassFactoryVtbl ManualResetEventCFVtbl =
{
ClassFactory_QueryInterface,
ClassFactory_AddRef,
ClassFactory_Release,
ManualResetEvent_CreateInstance,
ClassFactory_LockServer
};
IClassFactory ManualResetEventCF = { &ManualResetEventCFVtbl };
/*********************************************************************** /***********************************************************************
* DllGetClassObject [OLE32.@] * DllGetClassObject [OLE32.@]
*/ */
@ -186,6 +197,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
return MARSHAL_GetStandardMarshalCF(ppv); return MARSHAL_GetStandardMarshalCF(ppv);
if (IsEqualCLSID(rclsid, &CLSID_StdGlobalInterfaceTable)) if (IsEqualCLSID(rclsid, &CLSID_StdGlobalInterfaceTable))
return IClassFactory_QueryInterface(&GlobalInterfaceTableCF, iid, ppv); return IClassFactory_QueryInterface(&GlobalInterfaceTableCF, iid, ppv);
if (IsEqualCLSID(rclsid, &CLSID_ManualResetEvent))
return IClassFactory_QueryInterface(&ManualResetEventCF, iid, ppv);
if (IsEqualCLSID(rclsid, &CLSID_FileMoniker)) if (IsEqualCLSID(rclsid, &CLSID_FileMoniker))
return IClassFactory_QueryInterface(&FileMonikerCF, iid, ppv); return IClassFactory_QueryInterface(&FileMonikerCF, iid, ppv);
if (IsEqualCLSID(rclsid, &CLSID_ItemMoniker)) if (IsEqualCLSID(rclsid, &CLSID_ItemMoniker))

View File

@ -4006,11 +4006,16 @@ static void test_manualresetevent(void)
{ {
ISynchronizeHandle *sync_handle; ISynchronizeHandle *sync_handle;
ISynchronize *psync1, *psync2; ISynchronize *psync1, *psync2;
IClassFactory *factory;
IUnknown *punk; IUnknown *punk;
HANDLE handle; HANDLE handle;
LONG ref; LONG ref;
HRESULT hr; 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); hr = CoCreateInstance(&CLSID_ManualResetEvent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&punk);
ok(hr == S_OK, "Got 0x%08x\n", hr); ok(hr == S_OK, "Got 0x%08x\n", hr);
ok(!!punk, "Got NULL.\n"); ok(!!punk, "Got NULL.\n");