News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Effect of stack imbalance on EnumChildWindows

Started by xmetal, February 17, 2008, 04:03:13 PM

Previous topic - Next topic

xmetal

An MDI application of mine was exibiting a bug that seemed to be dependent on the number of MDI child windows. It took me longer than neccessary to discover that one of the callback procedures for EnumChildWindows was not cleaning up the stack properly. This surprised me, since in my experience, stack imbalances have always been rather unforgiving.

I put together a test application to find out the "tolerance" of EnumChildWindows with respect to the number of windows and the amount of stack cleanup.

The results on my Windows XP SP2 are:


Number of  Stack cleanup
windows    tolerance(*4)

    1          0-7
    2          0-4
   3-5         0-3
    >5         0-2


In the attatched test application, one can click in the parent window's client region to create a new child button. The edit box can be used to specify the amount of stack cleanup. It is automatically multiplied by four. There is a predicate in the callback procedure for skipping the edit child window, so that initially there is effectively only one child window.

[attachment deleted by admin]

MichaelW

Under Windows 2000 SP4 I get:

1   0-6
2   0-4
3   0-3
4   0-3
>4  0-2


If I understand your code correctly, it would seem that Windows is doing something unusual in the code that calls the EnumChildProc callback.
eschew obfuscation