Commit 8592c4b8 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Make pointers to read-only exception descriptors const.

parent a79765ff
...@@ -45,8 +45,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(seh); ...@@ -45,8 +45,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(seh);
DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame, DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame,
PCONTEXT context, EXCEPTION_REGISTRATION_RECORD** dispatch, PCONTEXT context, EXCEPTION_REGISTRATION_RECORD** dispatch,
cxx_function_descr *descr, EXCEPTION_REGISTRATION_RECORD* nested_frame, const cxx_function_descr *descr,
int nested_trylevel ); EXCEPTION_REGISTRATION_RECORD* nested_frame, int nested_trylevel );
/* call a function with a given ebp */ /* call a function with a given ebp */
inline static void *call_ebp_func( void *func, void *ebp ) inline static void *call_ebp_func( void *func, void *ebp )
...@@ -112,7 +112,7 @@ static void dump_exception_type( const cxx_exception_type *type ) ...@@ -112,7 +112,7 @@ static void dump_exception_type( const cxx_exception_type *type )
} }
} }
static void dump_function_descr( const cxx_function_descr *descr, const cxx_exception_type *info ) static void dump_function_descr( const cxx_function_descr *descr )
{ {
UINT i; UINT i;
int j; int j;
...@@ -133,7 +133,7 @@ static void dump_function_descr( const cxx_function_descr *descr, const cxx_exce ...@@ -133,7 +133,7 @@ static void dump_function_descr( const cxx_function_descr *descr, const cxx_exce
descr->tryblock[i].catchblock_count ); descr->tryblock[i].catchblock_count );
for (j = 0; j < descr->tryblock[i].catchblock_count; j++) for (j = 0; j < descr->tryblock[i].catchblock_count; j++)
{ {
catchblock_info *ptr = &descr->tryblock[i].catchblock[j]; const catchblock_info *ptr = &descr->tryblock[i].catchblock[j];
TRACE( " %d: flags %x offset %d handler %p type %p %s\n", TRACE( " %d: flags %x offset %d handler %p type %p %s\n",
j, ptr->flags, ptr->offset, ptr->handler, j, ptr->flags, ptr->offset, ptr->handler,
ptr->type_info, dbgstr_type_info( ptr->type_info ) ); ptr->type_info, dbgstr_type_info( ptr->type_info ) );
...@@ -142,7 +142,8 @@ static void dump_function_descr( const cxx_function_descr *descr, const cxx_exce ...@@ -142,7 +142,8 @@ static void dump_function_descr( const cxx_function_descr *descr, const cxx_exce
} }
/* check if the exception type is caught by a given catch block, and return the type that matched */ /* check if the exception type is caught by a given catch block, and return the type that matched */
static const cxx_type_info *find_caught_type( cxx_exception_type *exc_type, catchblock_info *catchblock ) static const cxx_type_info *find_caught_type( cxx_exception_type *exc_type,
const catchblock_info *catchblock )
{ {
UINT i; UINT i;
...@@ -168,7 +169,7 @@ static const cxx_type_info *find_caught_type( cxx_exception_type *exc_type, catc ...@@ -168,7 +169,7 @@ static const cxx_type_info *find_caught_type( cxx_exception_type *exc_type, catc
/* copy the exception object where the catch block wants it */ /* copy the exception object where the catch block wants it */
static void copy_exception( void *object, cxx_exception_frame *frame, static void copy_exception( void *object, cxx_exception_frame *frame,
catchblock_info *catchblock, const cxx_type_info *type ) const catchblock_info *catchblock, const cxx_type_info *type )
{ {
void **dest_ptr; void **dest_ptr;
...@@ -197,7 +198,7 @@ static void copy_exception( void *object, cxx_exception_frame *frame, ...@@ -197,7 +198,7 @@ static void copy_exception( void *object, cxx_exception_frame *frame,
} }
/* unwind the local function up to a given trylevel */ /* unwind the local function up to a given trylevel */
static void cxx_local_unwind( cxx_exception_frame* frame, cxx_function_descr *descr, int last_level) static void cxx_local_unwind( cxx_exception_frame* frame, const cxx_function_descr *descr, int last_level)
{ {
void (*handler)(); void (*handler)();
int trylevel = frame->trylevel; int trylevel = frame->trylevel;
...@@ -227,7 +228,7 @@ struct catch_func_nested_frame ...@@ -227,7 +228,7 @@ struct catch_func_nested_frame
EXCEPTION_REGISTRATION_RECORD frame; /* standard exception frame */ EXCEPTION_REGISTRATION_RECORD frame; /* standard exception frame */
EXCEPTION_RECORD *prev_rec; /* previous record to restore in thread data */ EXCEPTION_RECORD *prev_rec; /* previous record to restore in thread data */
cxx_exception_frame *cxx_frame; /* frame of parent exception */ cxx_exception_frame *cxx_frame; /* frame of parent exception */
cxx_function_descr *descr; /* descriptor of parent exception */ const cxx_function_descr *descr; /* descriptor of parent exception */
int trylevel; /* current try level */ int trylevel; /* current try level */
EXCEPTION_RECORD *rec; /* rec associated with frame */ EXCEPTION_RECORD *rec; /* rec associated with frame */
}; };
...@@ -276,7 +277,7 @@ static DWORD catch_function_nested_handler( EXCEPTION_RECORD *rec, EXCEPTION_REG ...@@ -276,7 +277,7 @@ static DWORD catch_function_nested_handler( EXCEPTION_RECORD *rec, EXCEPTION_REG
/* find and call the appropriate catch block for an exception */ /* find and call the appropriate catch block for an exception */
/* returns the address to continue execution to after the catch block was called */ /* returns the address to continue execution to after the catch block was called */
inline static void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame *frame, inline static void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame *frame,
cxx_function_descr *descr, int nested_trylevel, const cxx_function_descr *descr, int nested_trylevel,
cxx_exception_type *info ) cxx_exception_type *info )
{ {
UINT i; UINT i;
...@@ -289,7 +290,7 @@ inline static void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame ...@@ -289,7 +290,7 @@ inline static void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame
for (i = 0; i < descr->tryblock_count; i++) for (i = 0; i < descr->tryblock_count; i++)
{ {
tryblock_info *tryblock = &descr->tryblock[i]; const tryblock_info *tryblock = &descr->tryblock[i];
if (trylevel < tryblock->start_level) continue; if (trylevel < tryblock->start_level) continue;
if (trylevel > tryblock->end_level) continue; if (trylevel > tryblock->end_level) continue;
...@@ -297,7 +298,7 @@ inline static void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame ...@@ -297,7 +298,7 @@ inline static void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame
/* got a try block */ /* got a try block */
for (j = 0; j < tryblock->catchblock_count; j++) for (j = 0; j < tryblock->catchblock_count; j++)
{ {
catchblock_info *catchblock = &tryblock->catchblock[j]; const catchblock_info *catchblock = &tryblock->catchblock[j];
if(info) if(info)
{ {
const cxx_type_info *type = find_caught_type( info, catchblock ); const cxx_type_info *type = find_caught_type( info, catchblock );
...@@ -357,7 +358,8 @@ inline static void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame ...@@ -357,7 +358,8 @@ inline static void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame
*/ */
DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame, DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame,
PCONTEXT context, EXCEPTION_REGISTRATION_RECORD** dispatch, PCONTEXT context, EXCEPTION_REGISTRATION_RECORD** dispatch,
cxx_function_descr *descr, EXCEPTION_REGISTRATION_RECORD* nested_frame, const cxx_function_descr *descr,
EXCEPTION_REGISTRATION_RECORD* nested_frame,
int nested_trylevel ) int nested_trylevel )
{ {
cxx_exception_type *exc_type; cxx_exception_type *exc_type;
...@@ -390,7 +392,7 @@ DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame ...@@ -390,7 +392,7 @@ DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame
TRACE("handling C++ exception rec %p frame %p trylevel %d descr %p nested_frame %p\n", TRACE("handling C++ exception rec %p frame %p trylevel %d descr %p nested_frame %p\n",
rec, frame, frame->trylevel, descr, nested_frame ); rec, frame, frame->trylevel, descr, nested_frame );
dump_exception_type( exc_type ); dump_exception_type( exc_type );
dump_function_descr( descr, exc_type ); dump_function_descr( descr );
} }
} }
else else
......
...@@ -53,10 +53,10 @@ typedef struct __cxx_exception_frame ...@@ -53,10 +53,10 @@ typedef struct __cxx_exception_frame
/* info about a single catch {} block */ /* info about a single catch {} block */
typedef struct __catchblock_info typedef struct __catchblock_info
{ {
UINT flags; /* flags (see below) */ UINT flags; /* flags (see below) */
type_info *type_info; /* C++ type caught by this block */ const type_info *type_info; /* C++ type caught by this block */
int offset; /* stack offset to copy exception object to */ int offset; /* stack offset to copy exception object to */
void (*handler)(); /* catch block handler code */ void (*handler)(); /* catch block handler code */
} catchblock_info; } catchblock_info;
#define TYPE_FLAG_CONST 1 #define TYPE_FLAG_CONST 1
#define TYPE_FLAG_VOLATILE 2 #define TYPE_FLAG_VOLATILE 2
...@@ -65,11 +65,11 @@ typedef struct __catchblock_info ...@@ -65,11 +65,11 @@ typedef struct __catchblock_info
/* info about a single try {} block */ /* info about a single try {} block */
typedef struct __tryblock_info typedef struct __tryblock_info
{ {
int start_level; /* start trylevel of that block */ int start_level; /* start trylevel of that block */
int end_level; /* end trylevel of that block */ int end_level; /* end trylevel of that block */
int catch_level; /* initial trylevel of the catch block */ int catch_level; /* initial trylevel of the catch block */
int catchblock_count; /* count of catch blocks in array */ int catchblock_count; /* count of catch blocks in array */
catchblock_info *catchblock; /* array of catch blocks */ const catchblock_info *catchblock; /* array of catch blocks */
} tryblock_info; } tryblock_info;
/* info about the unwind handler for a given trylevel */ /* info about the unwind handler for a given trylevel */
...@@ -82,12 +82,12 @@ typedef struct __unwind_info ...@@ -82,12 +82,12 @@ typedef struct __unwind_info
/* descriptor of all try blocks of a given function */ /* descriptor of all try blocks of a given function */
typedef struct __cxx_function_descr typedef struct __cxx_function_descr
{ {
UINT magic; /* must be CXX_FRAME_MAGIC */ UINT magic; /* must be CXX_FRAME_MAGIC */
UINT unwind_count; /* number of unwind handlers */ UINT unwind_count; /* number of unwind handlers */
unwind_info *unwind_table; /* array of unwind handlers */ const unwind_info *unwind_table; /* array of unwind handlers */
UINT tryblock_count; /* number of try blocks */ UINT tryblock_count; /* number of try blocks */
tryblock_info *tryblock; /* array of try blocks */ const tryblock_info *tryblock; /* array of try blocks */
UINT unknown[3]; UINT unknown[3];
} cxx_function_descr; } cxx_function_descr;
typedef void (*cxx_copy_ctor)(void); typedef void (*cxx_copy_ctor)(void);
...@@ -121,7 +121,7 @@ typedef struct __cxx_type_info_table ...@@ -121,7 +121,7 @@ typedef struct __cxx_type_info_table
typedef DWORD (*cxx_exc_custom_handler)( PEXCEPTION_RECORD, cxx_exception_frame*, typedef DWORD (*cxx_exc_custom_handler)( PEXCEPTION_RECORD, cxx_exception_frame*,
PCONTEXT, EXCEPTION_REGISTRATION_RECORD**, PCONTEXT, EXCEPTION_REGISTRATION_RECORD**,
cxx_function_descr*, int nested_trylevel, const cxx_function_descr*, int nested_trylevel,
EXCEPTION_REGISTRATION_RECORD *nested_frame, DWORD unknown3 ); EXCEPTION_REGISTRATION_RECORD *nested_frame, DWORD unknown3 );
/* type information for an exception object */ /* type information for an exception object */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment