set krc to wxKILL_OK on success
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20115 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
19bb2f5bbe
commit
b1a28eef7c
@ -652,8 +652,6 @@ bool wxSetEnv(const wxString& var, const wxChar *value)
|
|||||||
// process management
|
// process management
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __WIN32__
|
|
||||||
|
|
||||||
// structure used to pass parameters from wxKill() to wxEnumFindByPidProc()
|
// structure used to pass parameters from wxKill() to wxEnumFindByPidProc()
|
||||||
struct wxFindByPidParams
|
struct wxFindByPidParams
|
||||||
{
|
{
|
||||||
@ -689,11 +687,8 @@ BOOL CALLBACK wxEnumFindByPidProc(HWND hwnd, LPARAM lParam)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __WIN32__
|
|
||||||
|
|
||||||
int wxKill(long pid, wxSignal sig, wxKillError *krc)
|
int wxKill(long pid, wxSignal sig, wxKillError *krc)
|
||||||
{
|
{
|
||||||
#ifdef __WIN32__
|
|
||||||
// get the process handle to operate on
|
// get the process handle to operate on
|
||||||
HANDLE hProcess = ::OpenProcess(SYNCHRONIZE |
|
HANDLE hProcess = ::OpenProcess(SYNCHRONIZE |
|
||||||
PROCESS_TERMINATE |
|
PROCESS_TERMINATE |
|
||||||
@ -830,25 +825,19 @@ int wxKill(long pid, wxSignal sig, wxKillError *krc)
|
|||||||
|
|
||||||
// the return code is the same as from Unix kill(): 0 if killed
|
// the return code is the same as from Unix kill(): 0 if killed
|
||||||
// successfully or -1 on error
|
// successfully or -1 on error
|
||||||
if ( sig == wxSIGNONE )
|
//
|
||||||
|
// be careful to interpret rc correctly: for wxSIGNONE we return success if
|
||||||
|
// the process exists, for all the other sig values -- if it doesn't
|
||||||
|
if ( ok &&
|
||||||
|
((sig == wxSIGNONE) == (rc == STILL_ACTIVE)) )
|
||||||
{
|
{
|
||||||
if ( ok && rc == STILL_ACTIVE )
|
if ( krc )
|
||||||
{
|
{
|
||||||
// there is such process => success
|
*krc = wxKILL_OK;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else // not SIGNONE
|
|
||||||
{
|
|
||||||
if ( ok && rc != STILL_ACTIVE )
|
|
||||||
{
|
|
||||||
// killed => success
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else // Win16
|
|
||||||
wxFAIL_MSG( _T("not implemented") );
|
|
||||||
#endif // Win32/Win16
|
|
||||||
|
|
||||||
// error
|
// error
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user