2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/sdk/crt/process/_cwait.c
5 * PURPOSE: Waits for a process to exit
10 /* Taken from Wine msvcrt/process.c */
15 intptr_t CDECL
_cwait(int *status
, intptr_t pid
, int action
)
17 HANDLE hPid
= (HANDLE
)pid
;
20 if (!WaitForSingleObject(hPid
, INFINITE
))
25 GetExitCodeProcess(hPid
, &stat
);
30 doserrno
= GetLastError();
32 if (doserrno
== ERROR_INVALID_HANDLE
)
35 *__doserrno() = doserrno
;
40 return status
? *status
= -1 : -1;