The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: V Coder on November 14, 2005, 03:43:31 AM

Title: ebp and exitting a thread
Post by: V Coder on November 14, 2005, 03:43:31 AM
My program launches a thread (in the WM_CREATE) handler.

When this thread exits naturally, if it changes the value of ebp before exitting, then the program terminates, without apparently processing WM_CLOSE or WM_DESTROY. If on the other hand the thread ends with ebp intact, the program waits for closure (click the x) and exits with WM_CLOSE and WM_DESTROY.

Why does this happen please?

Also, does exitting a thread automatically give any signal to the main program? Or does one need to send the message in another way? Thanks.
Title: Re: ebp and exitting a thread
Post by: Petroizki on November 14, 2005, 05:40:29 AM
You must follow the basic rules of register usage in Windows. You can change eax, ecx and edx, but any other register you use, must be preserved.