How do I write an exception filter?
winesku at googlemail.com
Thu Jul 10 14:30:40 CDT 2008
I would like to know what the proper way is to write an exception
filter function for WINE code. Most of the WINE exception filtering
seems to be done with the __EXCEPT_PAGE_FAULT macro, for whatever
reason. In all other places I see the macro __EXCEPT with a filter
function of this prototype
LONG WINAPI filter(EXCEPTION_POINTERS *);
However, I have the need to implement a filter function that takes
additional formal parameters such as the values of local parameters of
the function where the SEH frame resides. Alternatively, I would like
to do something like the following (in MSVC parlance), where the
exception filter is a simple boolean expression:
PDWORD pdwCommStatus = ....;
PDWORD pdwFaultStatus = ....;
__except( (pdwCommStatus||pdwFaultStatus) ? EXCEPTION_EXECUTE_HANDLER
: EXCEPTION_CONTINUE_SEARCH )
// handle the exception
In include/wine/exception.h, a comment from AJ says that
"__EXCEPT(filter_func,param)" is the proper way to do it but "param"
is not explained at all and "filter_func must be defined with the
WINE_EXCEPTION_FILTER macro", as the comment says. However, a search
for WINE_EXCEPTION_FILTER yields no results.
So, how do I do these things in WINE properly? Did I overlook something obvious?
More information about the wine-devel