Diciamola tutta in modo preciso. La documentazione di CreateThread dice:Originariamente inviato da shodan
Intanto usare CreateThread può causare problemi di memory leak.
In C/C++ è meglio usare _beginthreadex come consigliato su vari testi e manuali per ovviare a questo problema, in quanto alloca delle strutture interne alla libreria del C/C++ che CreateThread non fa.
A thread in an executable that calls the C run-time library (CRT) should use the _beginthreadex and _endthreadex functions for thread management rather than CreateThread and ExitThread; this requires the use of the multi-threaded version of the CRT. If a thread created using CreateThread calls the CRT, the CRT may terminate the process in low-memory conditions.