27#include <rtl/strbuf.hxx>
28#include <rtl/ustrbuf.hxx>
30#include <osl/mutex.hxx>
32#include <com/sun/star/uno/Any.hxx>
33#include <unordered_map>
41void * ObjectFunction::operator
new (
size_t nSize )
43 void * pMem = std::malloc( nSize );
48 VirtualProtect(pMem, nSize, PAGE_EXECUTE_READWRITE, &old_protect);
50 assert(success &&
"VirtualProtect() failed!");
55void ObjectFunction::operator
delete (
void * pMem )
61 : _pTypeDescr( pTypeDescr )
63 ::typelib_typedescription_acquire( _pTypeDescr );
65 unsigned char * pCode = (
unsigned char *)somecode;
67 assert((
void *)
this == (
void *)pCode);
71 *(
void **)pCode =
this;
72 pCode +=
sizeof(
void *);
75 *(sal_Int32 *)pCode = ((
unsigned char *)fpFunc) - pCode -
sizeof(sal_Int32);
86 ::uno_copyData(pExcThis, pSource, pThis->_pTypeDescr, uno::cpp_acquire);
93 ::uno_destructData(pExcThis, pThis->_pTypeDescr, uno::cpp_release);
129 , _n4( pTypeDescr->nSize )
149 static_assert(
sizeof(sal_Int32) ==
sizeof(
ExceptionType *),
"### pointer size differs from sal_Int32!");
151 typelib_CompoundTypeDescription * pCompTypeDescr;
155 for ( pCompTypeDescr = (typelib_CompoundTypeDescription*)pTypeDescr;
156 pCompTypeDescr; pCompTypeDescr = pCompTypeDescr->pBaseTypeDescription )
162 _types = std::malloc(
sizeof(sal_Int32) + (
sizeof(
ExceptionType *) * nLen) );
163 *(sal_Int32 *)_types = nLen;
168 for ( pCompTypeDescr = (typelib_CompoundTypeDescription*)pTypeDescr;
169 pCompTypeDescr; pCompTypeDescr = pCompTypeDescr->pBaseTypeDescription )
178 for ( sal_Int32 nTypes = *(sal_Int32 *)
_types; nTypes--; )
180 delete ppTypes[nTypes];
static type_info * get(OUString const &rUNOname, int *len=nullptr) noexcept
struct _typelib_TypeDescription typelib_TypeDescription
static void *__cdecl destruct(void *pExcThis, typelib_TypeDescription *pTD) noexcept
static void *__cdecl copyConstruct(void *pExcThis, void *pSource, typelib_TypeDescription *pTD) noexcept
static void *__cdecl __destruct(void *pExcThis, ObjectFunction *pThis)
static void *__cdecl __copyConstruct(void *pExcThis, void *pSource, ObjectFunction *pThis)
static __declspec(naked) void copyConstruct()
const wchar_t *typedef BOOL
ExceptionType(unsigned char *pCode, sal_uInt64 pCodeBase, typelib_TypeDescription *pTD) noexcept
ObjectFunction(typelib_TypeDescription *pTypeDescr, void *fpFunc)
typelib_TypeDescription * _pTypeDescr
RaiseInfo(typelib_TypeDescription *pTD) noexcept