vrclient: Update cxx.h to latest msvcrt version.

This commit is contained in:
Rémi Bernon 2025-01-16 21:55:27 +01:00 committed by Arkadiusz Hiler
parent a41f9b8288
commit e91fadea51
5 changed files with 56 additions and 23 deletions

View File

@ -16,10 +16,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_CXX_H
#define __WINE_CXX_H
#include "windef.h"
#include "winternl.h"
#include "rtlsupportapi.h"
#include "wine/asm.h"
#ifdef __i386__
#undef RTTI_USE_RVA
#else
#define RTTI_USE_RVA 1
#endif
#ifdef _WIN64
#define VTABLE_ADD_FUNC(name) "\t.quad " THISCALL_NAME(name) "\n"
@ -46,7 +53,7 @@
#endif /* _WIN64 */
#ifndef __x86_64__
#ifndef RTTI_USE_RVA
#define DEFINE_RTTI_BASE(name, base_classes_no, mangled_name) \
static type_info name ## _type_info = { \
@ -101,7 +108,7 @@ static const cxx_type_info type ## _cxx_type_info = { \
& type ##_type_info, \
{ 0, -1, 0 }, \
sizeof(type), \
(cxx_copy_ctor)THISCALL(type ##_copy_ctor) \
THISCALL(type ##_copy_ctor) \
};
#define DEFINE_CXX_DATA(type, base_no, cl1, cl2, cl3, cl4, dtor) \
@ -118,9 +125,9 @@ static const cxx_type_info_table type ## _cxx_type_table = { \
} \
}; \
\
static const cxx_exception_type type ## _cxx_type = { \
static const cxx_exception_type type ## _exception_type = { \
0, \
(cxx_copy_ctor)THISCALL(dtor), \
THISCALL(dtor), \
NULL, \
& type ## _cxx_type_table \
};
@ -232,7 +239,7 @@ static cxx_type_info_table type ## _cxx_type_table = { \
} \
}; \
\
static cxx_exception_type type ##_cxx_type = { \
static cxx_exception_type type ##_exception_type = { \
0, \
0xdeadbeef, \
0, \
@ -247,8 +254,8 @@ static void init_ ## type ## _cxx(char *base) \
type ## _cxx_type_table.info[2] = (char *)cl2 - base; \
type ## _cxx_type_table.info[3] = (char *)cl3 - base; \
type ## _cxx_type_table.info[4] = (char *)cl4 - base; \
type ## _cxx_type.destructor = (char *)dtor - base; \
type ## _cxx_type.type_info_table = (char *)&type ## _cxx_type_table - base; \
type ## _exception_type.destructor = (char *)dtor - base; \
type ## _exception_type.type_info_table = (char *)&type ## _cxx_type_table - base; \
}
#endif
@ -324,8 +331,6 @@ typedef struct __type_info
char mangled[128]; /* Variable length, but we declare it large enough for static RTTI */
} type_info;
extern const vtable_ptr type_info_vtable;
/* offsets for computing the this pointer */
typedef struct
{
@ -334,10 +339,7 @@ typedef struct
int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */
} this_ptr_offsets;
/* dlls/msvcrt/cppexcept.h */
typedef void (*cxx_copy_ctor)(void);
#ifndef __x86_64__
#ifndef RTTI_USE_RVA
typedef struct _rtti_base_descriptor
{
@ -375,7 +377,7 @@ typedef struct
const type_info *type_info;
this_ptr_offsets offsets;
unsigned int size;
cxx_copy_ctor copy_ctor;
void *copy_ctor;
} cxx_type_info;
typedef struct
@ -387,8 +389,8 @@ typedef struct
typedef struct
{
UINT flags;
void (*destructor)(void);
void* /*cxx_exc_custom_handler*/ custom_handler;
void *destructor;
void *custom_handler;
const cxx_type_info_table *type_info_table;
} cxx_exception_type;
@ -450,6 +452,35 @@ typedef struct
#endif
extern const vtable_ptr type_info_vtable;
#ifdef RTTI_USE_RVA
static inline uintptr_t rtti_rva_base( const void *ptr )
{
void *base;
return (uintptr_t)RtlPcToFileHeader( (void *)ptr, &base );
}
static inline void *rtti_rva( unsigned int rva, uintptr_t base )
{
return (void *)(base + rva);
}
#else
static inline uintptr_t rtti_rva_base( const void *ptr )
{
return 0;
}
static inline void *rtti_rva( const void *ptr, uintptr_t base )
{
return (void *)ptr;
}
#endif
#define CREATE_TYPE_INFO_VTABLE \
DEFINE_THISCALL_WRAPPER(type_info_vector_dtor,8) \
void * __thiscall type_info_vector_dtor(type_info * _this, unsigned int flags) \
@ -476,5 +507,3 @@ __ASM_BLOCK_BEGIN(type_info_vtables) \
__ASM_VTABLE(type_info, \
VTABLE_ADD_FUNC(type_info_vector_dtor)); \
__ASM_BLOCK_END
#endif

View File

@ -5,7 +5,6 @@
#include "windef.h"
#include "winbase.h"
#include "cxx.h"
#include "flatapi.h"
#ifdef __i386__

View File

@ -1,8 +1,9 @@
/* asm thunks for the flat (FnTable) API */
#include "vrclient_private.h"
#ifdef __i386__
#include "cxx.h"
#include "pshpack1.h"
struct thunk
{

View File

@ -1124,7 +1124,6 @@ def generate_flatapi_c():
#include "windef.h"
#include "winbase.h"
#include "cxx.h"
#include "flatapi.h"
#ifdef __i386__

View File

@ -1,3 +1,6 @@
#ifndef __VRCLIENT_PRIVATE_H
#define __VRCLIENT_PRIVATE_H
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
@ -123,3 +126,5 @@ extern w_Texture_t vrclient_translate_texture_d3d12( const w_Texture_t *texture,
#include "vrclient_generated.h"
#endif /* __cplusplus */
#endif /* __VRCLIENT_PRIVATE_H */