As stated in win API reference for the SetUnhandledExceptionFilter:

"The exception handler specified by lpTopLevelExceptionFilter
is executed in the context of the thread that caused the fault.
This can affect the exception handler's ability to recover
from certain exceptions, such as an invalid stack."

Since I use the ESP as a general purpose reg, my handler
doesn't get called, a standard GPF window is displayed instead.

Anyway to overcome this?
Some mechanism to tell windows the default ESP value?

P.S. I've just started using SEH
Posted on 2008-03-07 07:48:05 by aleksaZR
simple way - dont use esp, you shouldn't use it as a general purpose register.. its not intended for that purpose...
Posted on 2008-03-07 16:20:05 by evlncrn8

simple way - dont use esp, you shouldn't use it as a general purpose register.. its not intended for that purpose...

Nevermind.

I've changed the prog not to use the ESP but the speed
tests shows that SEH really slows down my prog, up to 7 times.

I'm doing about 28million calculations, 1/4 are divisions.

Instead of testing for division by zero with "test reg,reg : jz err"
I've tried SEH, but that is much slower.
Posted on 2008-03-08 04:19:48 by aleksaZR
Exception handlers are slow unless you are testing for a wide variety of failure cases. If its just DIV BY 0 then use test/jz.

If you need help optimizing your algorithm you may want to consider posting it on the forum for pier review.
Posted on 2008-03-11 10:20:31 by r22

Exception handlers are slow unless you are testing for a wide variety of failure cases. If its just DIV BY 0 then use test/jz.

If you need help optimizing your algorithm you may want to consider posting it on the forum for pier review.


Off-topic..

Those 28mil of calculations are to solve the quiz game
on a local TV. The player is presented with 7 numbers.
He/she can use 6 of them to make a math formula that will
produce a number as close as possible to the 7th number.

If you are aware of any similar prog, please let me know.

I know of only one, and it is also made for the same quiz show.
The author says that it can take as long as 5min on a PIII 1GHz.

My prog takes less than 11sec on a PI 233MHz,
which would make me very proud if I didn't know
that the other author is a 16 years old kid......

So, if you are aware of any similar prog, please let me know.

Anyway, my prog is complete (not in english).
If you want it, get it from www.beotel.net/~astancic
click on "slagalica - moj broj.rar"

The fields (edit boxes) can contain numbers only:
field 1: 3 digits, 1 to 999
field 2,3,4,5: 1 digit, 1-9
field 6: 10,15,20
fiels 7: 20,25,50,75,100

Type-in 7 numbers in the 7 fields and press ENTER.
The prog will then try to find the formula that,
using the fields 2-7, will produce the result closest
to the number given in field 1.

The formula can use +-*/() integer math only.

To get the longest possible exec time, search for 999
with all other numbers set to 1.

note: I don't check for allowed numbers at all,
meaning that you can type, say 95, in field 7.
Posted on 2008-03-11 17:15:42 by aleksaZR