On 9/28/05, Ann & Jason Edmeades <us at edmeades.me.uk> wrote:
>> Adding in char temp[8]; before the WNDCLASSEX16 and it still fails
> Adding in char temp[9]; and the program starts working...
> Adding in char temp[9]; after the WNDCLASSEX16 and it still fails
> (Yes, temp is unused...)
>> So that would agree heap corruption of some sort
>
Stack corruption :)
>> Next question... how to pin this down.
>
You can try the method of commenting out large portions of the called
code, then sequentially uncommenting function calls. Also, look for
variables allocated on the stack (especially strings or arrays) and
make sure they never get overwritten.
> I've tried the following
>> 2. Initialize temp to 0x00's (still works @ 9 and fails @ 8). Then adding an
> 'if' statement before the return to query the bytes...
> a. If I put a stream of if statements it always works
>
I wouldn't try this route, adding stack vars or printfs and seeing
what makes it not crash that way. The hard thing about stack or heap
corruption is that it's seemingly random and can crash at any point
(more or less). I would focus on finding which variable is being
overwritten.
--
James Hawkins