combase: Move CoRegisterMessageFilter().
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:
parent
e56061bb4c
commit
00f9dff02d
|
@ -1684,3 +1684,40 @@ HRESULT WINAPI CoWaitForMultipleHandles(DWORD flags, DWORD timeout, ULONG handle
|
|||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* CoRegisterMessageFilter (combase.@)
|
||||
*/
|
||||
HRESULT WINAPI CoRegisterMessageFilter(IMessageFilter *filter, IMessageFilter **ret_filter)
|
||||
{
|
||||
IMessageFilter *old_filter;
|
||||
struct apartment *apt;
|
||||
|
||||
TRACE("%p, %p\n", filter, ret_filter);
|
||||
|
||||
apt = com_get_current_apt();
|
||||
|
||||
/* Can't set a message filter in a multi-threaded apartment */
|
||||
if (!apt || apt->multi_threaded)
|
||||
{
|
||||
WARN("Can't set message filter in MTA or uninitialized apt\n");
|
||||
return CO_E_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (filter)
|
||||
IMessageFilter_AddRef(filter);
|
||||
|
||||
EnterCriticalSection(&apt->cs);
|
||||
|
||||
old_filter = apt->filter;
|
||||
apt->filter = filter;
|
||||
|
||||
LeaveCriticalSection(&apt->cs);
|
||||
|
||||
if (ret_filter)
|
||||
*ret_filter = old_filter;
|
||||
else if (old_filter)
|
||||
IMessageFilter_Release(old_filter);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
@ stdcall CoRegisterClassObject(ptr ptr long long ptr) ole32.CoRegisterClassObject
|
||||
@ stdcall CoRegisterInitializeSpy(ptr ptr)
|
||||
@ stdcall CoRegisterMallocSpy(ptr)
|
||||
@ stdcall CoRegisterMessageFilter(ptr ptr) ole32.CoRegisterMessageFilter
|
||||
@ stdcall CoRegisterMessageFilter(ptr ptr)
|
||||
@ stdcall CoRegisterPSClsid(ptr ptr) ole32.CoRegisterPSClsid
|
||||
@ stdcall CoRegisterSurrogate(ptr) ole32.CoRegisterSurrogate
|
||||
@ stdcall CoRegisterSurrogateEx(ptr ptr) ole32.CoRegisterSurrogateEx
|
||||
|
|
|
@ -3146,65 +3146,6 @@ HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* CoRegisterMessageFilter [OLE32.@]
|
||||
*
|
||||
* Registers a message filter.
|
||||
*
|
||||
* PARAMS
|
||||
* lpMessageFilter [I] Pointer to interface.
|
||||
* lplpMessageFilter [O] Indirect pointer to prior instance if non-NULL.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: S_OK.
|
||||
* Failure: HRESULT code.
|
||||
*
|
||||
* NOTES
|
||||
* Both lpMessageFilter and lplpMessageFilter are optional. Passing in a NULL
|
||||
* lpMessageFilter removes the message filter.
|
||||
*
|
||||
* If lplpMessageFilter is not NULL the previous message filter will be
|
||||
* returned in the memory pointer to this parameter and the caller is
|
||||
* responsible for releasing the object.
|
||||
*
|
||||
* The current thread be in an apartment otherwise the function will crash.
|
||||
*/
|
||||
HRESULT WINAPI CoRegisterMessageFilter(
|
||||
LPMESSAGEFILTER lpMessageFilter,
|
||||
LPMESSAGEFILTER *lplpMessageFilter)
|
||||
{
|
||||
struct apartment *apt;
|
||||
IMessageFilter *lpOldMessageFilter;
|
||||
|
||||
TRACE("(%p, %p)\n", lpMessageFilter, lplpMessageFilter);
|
||||
|
||||
apt = COM_CurrentApt();
|
||||
|
||||
/* can't set a message filter in a multi-threaded apartment */
|
||||
if (!apt || apt->multi_threaded)
|
||||
{
|
||||
WARN("can't set message filter in MTA or uninitialized apt\n");
|
||||
return CO_E_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (lpMessageFilter)
|
||||
IMessageFilter_AddRef(lpMessageFilter);
|
||||
|
||||
EnterCriticalSection(&apt->cs);
|
||||
|
||||
lpOldMessageFilter = apt->filter;
|
||||
apt->filter = lpMessageFilter;
|
||||
|
||||
LeaveCriticalSection(&apt->cs);
|
||||
|
||||
if (lplpMessageFilter)
|
||||
*lplpMessageFilter = lpOldMessageFilter;
|
||||
else if (lpOldMessageFilter)
|
||||
IMessageFilter_Release(lpOldMessageFilter);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CoIsOle1Class [OLE32.@]
|
||||
*
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
@ stdcall CoRegisterClassObject(ptr ptr long long ptr)
|
||||
@ stdcall CoRegisterInitializeSpy(ptr ptr) combase.CoRegisterInitializeSpy
|
||||
@ stdcall CoRegisterMallocSpy(ptr) combase.CoRegisterMallocSpy
|
||||
@ stdcall CoRegisterMessageFilter(ptr ptr)
|
||||
@ stdcall CoRegisterMessageFilter(ptr ptr) combase.CoRegisterMessageFilter
|
||||
@ stdcall CoRegisterPSClsid(ptr ptr)
|
||||
@ stdcall CoRegisterSurrogate(ptr)
|
||||
@ stdcall CoRegisterSurrogateEx(ptr ptr)
|
||||
|
|
Loading…
Reference in New Issue