Help debugging a problem!

James Hawkins truiken at gmail.com
Tue Sep 27 19:05:49 CDT 2005


On 9/27/05, Ann & Jason Edmeades <us at edmeades.me.uk> wrote:
>
> If I change this to
>     fred = RegisterClassEx16( &wcex );
>     TRACE("Here... %d\n", fred);
>     return fred;
>
> it all works.....!
>

This sounds like the stack is getting trashed.  That is usually the
case when randomly added functions make it not crash.  You want to
look for places where local variables (on the stack of course) are
being overwritten.  A good example of this is copying a larger string
into a smaller local char array.  When looking for a stack crasher, I
comment out huge sections of code until it doesn't crash anymore, and
then piece by piece uncomment the next function.  For example,

void foo()
{
#if 0
    a();
    b();
    c();
#endif
}

doesn't crash, but

void foo()
{
    a();
#if 0
    b();
    c();
#endif
}

does crash, then your culprit is in a().  Then you recurse into a()
and repeat the process all over again till you find the stack crasher.

--
James Hawkins



More information about the wine-devel mailing list