It seems that WinCE has GetCurrentProcess inlined to return 0x42. Because this is not the case with Win32, TerminateProcess(0x42, ...) fails, cmd.exe returns from a noreturn function, and executes some random code it should not execute, which causes it to crash.
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
HANDLE result = GetCurrentProcess();
printf("%lx\n", (int)result);
return (int)result;
}
It seems that WinCE has
GetCurrentProcess
inlined to return 0x42. Because this is not the case with Win32,TerminateProcess(0x42, ...)
fails,cmd.exe
returns from a noreturn function, and executes some random code it should not execute, which causes it to crash.gets compiled to: