ole32: Use CoGetApartmentType() to implement IComThreadingInfo.
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
c075d5aafd
commit
6fd208b41c
|
@ -4631,7 +4631,6 @@ typedef struct Context
|
||||||
IContextCallback IContextCallback_iface;
|
IContextCallback IContextCallback_iface;
|
||||||
IObjContext IObjContext_iface;
|
IObjContext IObjContext_iface;
|
||||||
LONG refs;
|
LONG refs;
|
||||||
APTTYPE apttype;
|
|
||||||
} Context;
|
} Context;
|
||||||
|
|
||||||
static inline Context *impl_from_IComThreadingInfo( IComThreadingInfo *iface )
|
static inline Context *impl_from_IComThreadingInfo( IComThreadingInfo *iface )
|
||||||
|
@ -4710,21 +4709,26 @@ static ULONG WINAPI Context_CTI_Release(IComThreadingInfo *iface)
|
||||||
|
|
||||||
static HRESULT WINAPI Context_CTI_GetCurrentApartmentType(IComThreadingInfo *iface, APTTYPE *apttype)
|
static HRESULT WINAPI Context_CTI_GetCurrentApartmentType(IComThreadingInfo *iface, APTTYPE *apttype)
|
||||||
{
|
{
|
||||||
Context *This = impl_from_IComThreadingInfo(iface);
|
APTTYPEQUALIFIER qualifier;
|
||||||
|
|
||||||
TRACE("(%p)\n", apttype);
|
TRACE("(%p)\n", apttype);
|
||||||
|
|
||||||
*apttype = This->apttype;
|
return CoGetApartmentType(apttype, &qualifier);
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI Context_CTI_GetCurrentThreadType(IComThreadingInfo *iface, THDTYPE *thdtype)
|
static HRESULT WINAPI Context_CTI_GetCurrentThreadType(IComThreadingInfo *iface, THDTYPE *thdtype)
|
||||||
{
|
{
|
||||||
Context *This = impl_from_IComThreadingInfo(iface);
|
APTTYPEQUALIFIER qualifier;
|
||||||
|
APTTYPE apttype;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = CoGetApartmentType(&apttype, &qualifier);
|
||||||
|
if (FAILED(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
TRACE("(%p)\n", thdtype);
|
TRACE("(%p)\n", thdtype);
|
||||||
|
|
||||||
switch (This->apttype)
|
switch (apttype)
|
||||||
{
|
{
|
||||||
case APTTYPE_STA:
|
case APTTYPE_STA:
|
||||||
case APTTYPE_MAINSTA:
|
case APTTYPE_MAINSTA:
|
||||||
|
@ -4945,12 +4949,6 @@ HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv)
|
||||||
context->IContextCallback_iface.lpVtbl = &Context_Callback_Vtbl;
|
context->IContextCallback_iface.lpVtbl = &Context_Callback_Vtbl;
|
||||||
context->IObjContext_iface.lpVtbl = &Context_Object_Vtbl;
|
context->IObjContext_iface.lpVtbl = &Context_Object_Vtbl;
|
||||||
context->refs = 1;
|
context->refs = 1;
|
||||||
if (apt->multi_threaded)
|
|
||||||
context->apttype = APTTYPE_MTA;
|
|
||||||
else if (apt->main)
|
|
||||||
context->apttype = APTTYPE_MAINSTA;
|
|
||||||
else
|
|
||||||
context->apttype = APTTYPE_STA;
|
|
||||||
|
|
||||||
hr = IComThreadingInfo_QueryInterface(&context->IComThreadingInfo_iface, riid, ppv);
|
hr = IComThreadingInfo_QueryInterface(&context->IComThreadingInfo_iface, riid, ppv);
|
||||||
IComThreadingInfo_Release(&context->IComThreadingInfo_iface);
|
IComThreadingInfo_Release(&context->IComThreadingInfo_iface);
|
||||||
|
|
Loading…
Reference in New Issue