Improve Compatibility TerminateProcess to fail if called from another process

git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5678 4407c894-4637-0410-b4f5-ada5f102cad1
This commit is contained in:
Jean-Baptiste Kempf 2013-03-20 12:40:50 +00:00
parent 8457321bba
commit 20e171e2f8

View File

@ -32,8 +32,13 @@
BOOL WINAPI TerminateProcess(HANDLE hProcess, UINT uExitCode)
{
_exit(uExitCode);
return uExitCode;
if (hProcess == GetCurrentProcess()) {
_exit(uExitCode);
return uExitCode;
} else {
SetLastError(ERROR_ACCESS_DENIED);
return 0;
}
}
BOOL WINAPI (*__MINGW_IMP_SYMBOL(TerminateProcess))(HANDLE, UINT) asm("__imp__TerminateProcess@8") = TerminateProcess;