I'm making a little program that reads certain addresses from memory. If it reads an illegal address I want the program thread to hang in an infinite loop.

To do this, I have created code like this:

<setting up SEH frame on the stack and fs:[0], handler is set to label exception_handler>
<performing bunch of memory reads from different addresses>
; We will get here if no illegal address was read
jmp end_program
; This infinite loop should be entered as soon as an illegal address is read
jmp exception_handler

The problem is that this works great on Windows 98 SE, but it refuses to work on Windows 2000 and Windows XP? :confused: As soon as an illegal address is encountered in Windows 2000 or XP, the program instead crashes, not having passed my exception handler (execution seems to jump somewhere else before the crash though, probably to some other exception handling related code).

What could be causing this? The SEH frames and fs:[0] pointer should work the same in all Windows operating systems, right?

Any tips would be greatly appreciated.

Posted on 2003-06-25 08:01:40 by dELTA
while ago i start to write some macros to symplify seh works.
I haven't complete it. But i use it from time to time and it works for me under 98, w2k, xp, 2003.
Just run seh.exe, if it works may be you did something wrong. Just explore the sources.

As for seh handling under different oses - it's exactly the same.

PS: You can find some other macros like mine on this board or somewhere else.
I simply did it by myself because of i wanted it to be as i want.
Posted on 2003-06-25 09:17:50 by Four-F
Thanks Four-F, I'll take a look at them!

I'd still appreciate any input or tips about my specific code above though, since it can be hard to understand what went wrong by only using someone else's working code, and I'd really like to understand what happened in my program.

Posted on 2003-06-25 17:40:12 by dELTA
I'm only afraid it's difficult to say something looking at the code-snippet above.
Posted on 2003-06-26 04:53:22 by Four-F