1. RE: Windows exception handler

Ed,

Here is the code I posted:

-- start code
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
--end code

Matt Lewis

> -----Original Message-----
> From: Ed Davis [mailto:ed_davis2 at yahoo.com]
> Sent: Friday, February 28, 2003 11:03 AM
> To: EUforum
> Subject: Windows exception handler
> 
> 
> 
> In the last week (or two or three or four?), someone posted some code 
> (to the mailing list) about handling exceptions in a Windows 
> environment.
> 
> However, I can no longer find the message.  I've searched topica for 
> "exception", but still could not find the message.
> 
> Perhaps I dreamed it?  I don't know...
> 
> If someone else saw this message, can you let me know the subject and 
> date of the message?
> 
> 
> 
> TOPICA - Start your own email discussion group. FREE!
>

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu