[ros-kernel] Handling of user mode exceptions in ros

Anich Gregor blight at blight.eu.org
Sat Apr 17 15:14:28 CEST 2004

On Saturday 17 April 2004 11:47, Thomas Weidenmueller wrote:
> I'm having a few concerns about memory leaks and instability due to
> usermode exceptions (especially while in callbacks from kernel mode).
> Let's imagine the following scenario:
> Application X runs and calls a kmode win32k function, let's say
> NtUserY(). This function allocates memory and does a callback to
> usermode in context of the same process. After it returned from the
> callback, it frees up some memory and finally returns back to user mode.

I have seen and implemented a few such functions ;)

> What if the process crashes inside the callback?
> What i'd need expect ros to do in case of a usermode exception is to
> return from the callback so NtUserY() is at least finished (freeing
> memory etc.) and after that the thread/process cleanup routine cleans up
> Application X.
> Is it done this way or another way?

I was looking at a function which Royce has written... it works like this:

1) Does a syscall to the "real" function which tells how much memory it needs
2) Allocates that memory
3) Does the same syscall, this time passing in the buffer which in turn is 
filled by the function.
4) Calls the callback
5) Frees that memory

I think this is a good way to do it (what do you think? :)

Also Hyperion i think was it who told me that SEH couldnt be used with macros 
on anything other than x86 so just putting all stuff into SEH won't be 
portable i guess

> Regards
> Thomas


More information about the Ros-kernel mailing list