process termination
Ive just looked to an interesting blog article talking about when a process terminates. http://blog.kalmbachnet.de/?postid=65 It seem that there is a subtle difference between how a console application (the main() CRT function) and a Win32 application (WinMain) is handling the process termination. if you have this: DWORD WINAPI MyThread2(LPVOID) { while(true) { } return 0; } #pragma comment(linker, "/entry:myMain") int WINAPI myMain() { DWORD dwThreadId; CloseHandle(CreateThread(NULL, 0, MyThread2, NULL, 0, &dwThreadId)); return 0; } the application is a windows application (using myMain entrypoint) and it run infinitely. but a similar console application: int t_main() { DWORD dwThreadId; CloseHandle(CreateThread(NULL, 0, MyThread2, NULL, 0, &dwThreadId)); return 0; } will return immediately after the 'return 0;' the difference is this one: the console application uses CRT which, after the user code return from main, it calls ExitProcess which terminates the a...