RE: exw trap

new topic     » topic index » view thread      » older message » newer message

> From: Pete Lomax [mailto:petelomax at blueyonder.co.uk]

> On Mon, 28 Jul 2003 16:05:03 -0400, George Walters
> <gwalters at sc.rr.com> wrote:
> 
> >Does this mean anything to anybody? I'm using win32 59.1 and EU 2.3
> I agree with Elliot: it means you need 2.4 sad( or smile) ??

Well, you don't *need* 2.4 to trap exceptions.  Include this bit of code,
and you'll be able to see where the problem is (or you could use trace(3)):

-- trap exceptions:

include dll.e
constant 
k32 = open_dll("kernel32.dll"),
xSetUnhandledExceptionFilter = define_c_func( k32,
"SetUnhandledExceptionFilter",
    {C_POINTER}, C_POINTER )
without trace
include get.e
global atom the_ptr, traceback
traceback = 1
the_ptr = 0

constant
EXCEPTION_EXECUTE_HANDLER = 1,
EXCEPTION_CONTINUE_EXECUTION = 0,
EXCEPTION_CONTINUE_SEARCH = -1

function exception( atom ex )
    atom record, context, params

    record = peek4u( ex )
    puts(1,"Exception:\n")
    while record do
 
printf(1,"Code:\t%08x\nFlags:\t%08x\nnext:\t%08x\nAddr:\t%08x\nParams:\t%d\n
",
            peek4u({record,6}))
        params = peek4u(record+16)
        for i = 1 to params do
            printf(1,"param[%d]:\t%08x\n", {i,peek4u( record + 16 + i*4 )})
        end for
        record = peek4u(record+8)
    end while

    context = peek4u( ex + 4 )
    ? peek({context,10})
if the_ptr and 0 then
    for i = 1 to 200 do
        printf(1,"%04d:\t%08x\n",{i-1,peek4u(the_ptr + (i-1)*4)})
    end for
?peek({peek4u(the_ptr+53*4),10})
    printf(1,"%s\n", {peek({peek4u(the_ptr+53*4),10})})
end if
    puts(1,"Press any key to continue\n")
    if wait_key() then end if
if traceback then ? 1/0 end if
    return EXCEPTION_EXECUTE_HANDLER
end function


if c_func( xSetUnhandledExceptionFilter,
{call_back(routine_id("exception"))}) then end if

--typedef struct _EXCEPTION_POINTERS {  
--PEXCEPTION_RECORD ExceptionRecord;  
--PCONTEXT ContextRecord;

--typedef struct _EXCEPTION_RECORD {  
--DWORD ExceptionCode;  
--DWORD ExceptionFlags;  
--struct _EXCEPTION_RECORD* ExceptionRecord;  
--PVOID ExceptionAddress;  
--DWORD NumberParameters;  
--ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu