[ros-kernel] Suggested implementation ideas for the variousWndProc, CallWndProc etc fixes

Skywing skywing at valhallalegends.com
Mon Nov 10 08:43:04 CET 2003


I haven't encountered kernel memory leaks if a Win32 app is terminated
abruptly for NT.  I definitely do not think it's fine to not clean up that
memory.

-----Original Message-----
From: ros-kernel-bounces at reactos.com [mailto:ros-kernel-bounces at reactos.com]
On Behalf Of Jonathan Wilson
Sent: Monday, November 10, 2003 4:52 AM
To: ReactOS Kernel List
Subject: Re: [ros-kernel] Suggested implementation ideas for the
variousWndProc, CallWndProc etc fixes

One problem with this is that we need to free these structures at some
point.
 From further analysis (and from reading MSDN), the best time to delete 
these structures from their storage in win32k is when the app that called 
the function that created the structure, i.e. SetWindowLong, SetClassLong 
or RegisterClassEx terminates, since this is when the handle would become 
invalid due to the WNDPROC disappearing from memory when the app terminates 
and the code is unloaded from memory (because a Window Procedure handle).

Given that the pointer passed to SetClassLong, SetWindowLong and 
RegisterClassEx and so on is a pointer thats relative to the local address 
space of the app, when the app disappears, the code will disappear and the 
pointer we store in the structure is now pointing to god knows what.
MSDN explicitly says that you can only subclass a window if you are the 
owner of that window and that you can only superclass a window class if it 
is a system class or if it is a class you registered.

So, we need to store the "process ID" (whatever ROS/windows has that passes 
for one) in the structure. And we need to implement clean-up code when the 
module is unloaded and/or the app terminates to remove all the "owned by 
this process" structures. Of course, should the process terminate wierdly 
and not call the usual cleanups, it will leak. However, my experience shows 
that even a dead simple program will leak memory on real windows if 
teminated unexpectedly so we should be fine here. (unless someone wants to 
suggest a work-around)

Lets get these implementation details (like figuring out how to store the 
data and when to delete the memory we are storing the data in) worked out 
ASAP so that someone (probobly me unless someone else gets to it first) can 
get this thing coded.


_______________________________________________
Ros-kernel mailing list
Ros-kernel at reactos.com
http://reactos.geldorp.nl:8080/mailman/listinfo/ros-kernel




More information about the Ros-kernel mailing list