tdf#99643 OLE automation bridge: fix 64-bit pointer conversions
XBridgeSupplier2::createBridge() is always called in-process and should therefore expect and create Anys with native-sized encoded pointers, so use sal_uIntPtr. Change-Id: Ia757ff38568b07de8085a1a9d323d806bcca0f63 Note: Currently all calls in LO code are with source=UNO, target=OLE.
This commit is contained in:
parent
299946676f
commit
c11e60f11f
@ -1035,7 +1035,7 @@ IDispatch* DocumentHolder::GetIDispatch()
|
|||||||
bridge::ModelDependent::OLE );
|
bridge::ModelDependent::OLE );
|
||||||
|
|
||||||
if ( anyResult.getValueTypeClass() ==
|
if ( anyResult.getValueTypeClass() ==
|
||||||
cppu::UnoType<sal_uInt32>::get().getTypeClass() )
|
cppu::UnoType<sal_uIntPtr>::get().getTypeClass() )
|
||||||
{
|
{
|
||||||
VARIANT* pVariant = *(VARIANT**)anyResult.getValue();
|
VARIANT* pVariant = *(VARIANT**)anyResult.getValue();
|
||||||
if ( pVariant->vt == VT_DISPATCH )
|
if ( pVariant->vt == VT_DISPATCH )
|
||||||
|
@ -725,7 +725,7 @@ Any SAL_CALL IUnknownWrapper_Impl::createBridge( const Any& modelDepObject,
|
|||||||
pVariant->punkVal->AddRef();
|
pVariant->punkVal->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.setValue((void*)&pVariant, cppu::UnoType<sal_uInt32>::get());
|
ret.setValue(static_cast<void*>(&pVariant), cppu::UnoType<sal_uIntPtr>::get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ STDMETHODIMP ProviderOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter,
|
|||||||
OLE);
|
OLE);
|
||||||
|
|
||||||
|
|
||||||
if (oleAny.getValueTypeClass() == cppu::UnoType<sal_uInt32>::get().getTypeClass())
|
if (oleAny.getValueTypeClass() == cppu::UnoType<sal_uIntPtr>::get().getTypeClass())
|
||||||
{
|
{
|
||||||
VARIANT* pVariant = *(VARIANT**)oleAny.getValue();
|
VARIANT* pVariant = *(VARIANT**)oleAny.getValue();
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ STDMETHODIMP OneInstanceOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter,
|
|||||||
OLE);
|
OLE);
|
||||||
|
|
||||||
|
|
||||||
if (oleAny.getValueTypeClass() == TypeClass_UNSIGNED_LONG)
|
if (oleAny.getValueTypeClass() == cppu::UnoType<sal_uIntPtr>::get().getTypeClass())
|
||||||
{
|
{
|
||||||
VARIANT* pVariant = *(VARIANT**)oleAny.getValue();
|
VARIANT* pVariant = *(VARIANT**)oleAny.getValue();
|
||||||
|
|
||||||
@ -374,14 +374,14 @@ Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject,
|
|||||||
CoTaskMemFree(pVariant);
|
CoTaskMemFree(pVariant);
|
||||||
throw IllegalArgumentException();
|
throw IllegalArgumentException();
|
||||||
}
|
}
|
||||||
ret.setValue((void*) &pVariant, cppu::UnoType<sal_uInt32>::get());
|
ret.setValue(static_cast<void*>(&pVariant), cppu::UnoType<sal_uIntPtr>::get());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw IllegalArgumentException();
|
throw IllegalArgumentException();
|
||||||
}
|
}
|
||||||
else if (sourceModelType == OLE)
|
else if (sourceModelType == OLE)
|
||||||
{
|
{
|
||||||
if (modelDepObject.getValueType() != cppu::UnoType<sal_uInt32>::get())
|
if (modelDepObject.getValueType() != cppu::UnoType<sal_uIntPtr>::get())
|
||||||
{
|
{
|
||||||
throw IllegalArgumentException();
|
throw IllegalArgumentException();
|
||||||
}
|
}
|
||||||
@ -397,7 +397,7 @@ Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret.setValue((void*) &pVariant, cppu::UnoType<sal_uInt32>::get());
|
ret.setValue(static_cast<void*>(&pVariant), cppu::UnoType<sal_uIntPtr>::get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (destModelType == UNO)
|
else if (destModelType == UNO)
|
||||||
|
@ -244,8 +244,10 @@ bool convertSelfToCom( T& unoInterface, VARIANT * pVar)
|
|||||||
Sequence<sal_Int8> seqId( arId, 16);
|
Sequence<sal_Int8> seqId( arId, 16);
|
||||||
Any anySource;
|
Any anySource;
|
||||||
anySource <<= xInt;
|
anySource <<= xInt;
|
||||||
Any anyDisp= xSupplier->createBridge( anySource, seqId, UNO, OLE);
|
Any anyDisp = xSupplier->createBridge(anySource, seqId, UNO, OLE);
|
||||||
if( anyDisp.getValueTypeClass() == TypeClass_UNSIGNED_LONG)
|
|
||||||
|
// due to global-process-id check this must be in-process pointer
|
||||||
|
if (anyDisp.getValueTypeClass() == cppu::UnoType<sal_uIntPtr>::get().getTypeClass())
|
||||||
{
|
{
|
||||||
VARIANT* pvariant= *(VARIANT**)anyDisp.getValue();
|
VARIANT* pvariant= *(VARIANT**)anyDisp.getValue();
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -92,7 +92,7 @@ Reference<XInvocation> convertComObject( IUnknown* pUnk)
|
|||||||
|
|
||||||
Any any;
|
Any any;
|
||||||
CComVariant var( pUnk);
|
CComVariant var( pUnk);
|
||||||
any <<= ( sal_uInt32)&var;
|
any <<= (sal_uIntPtr) &var;
|
||||||
sal_uInt8 arId[16];
|
sal_uInt8 arId[16];
|
||||||
rtl_getGlobalProcessId( arId);
|
rtl_getGlobalProcessId( arId);
|
||||||
Any target= xSuppl->createBridge( any, Sequence<sal_Int8>( (sal_Int8*)arId, 16), OLE, UNO );
|
Any target= xSuppl->createBridge( any, Sequence<sal_Int8>( (sal_Int8*)arId, 16), OLE, UNO );
|
||||||
|
@ -129,7 +129,7 @@ HRESULT doTest()
|
|||||||
rtl_getGlobalProcessId( arId);
|
rtl_getGlobalProcessId( arId);
|
||||||
Any target= xSuppl->createBridge( any, Sequence<sal_Int8>( (sal_Int8*)arId, 16), UNO, OLE);
|
Any target= xSuppl->createBridge( any, Sequence<sal_Int8>( (sal_Int8*)arId, 16), UNO, OLE);
|
||||||
CComDispatchDriver oletest;
|
CComDispatchDriver oletest;
|
||||||
if (target.getValueTypeClass() == cppu::UnoType<sal_uInt32>::get().getTypeClass())
|
if (target.getValueTypeClass() == cppu::UnoType<sal_uIntPtr>::get().getTypeClass())
|
||||||
{
|
{
|
||||||
VARIANT* pVariant = *(VARIANT**)target.getValue();
|
VARIANT* pVariant = *(VARIANT**)target.getValue();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user