Author: akhaldi
Date: Fri Apr 10 10:49:56 2015
New Revision: 67134
URL:
http://svn.reactos.org/svn/reactos?rev=67134&view=rev
Log:
[CRT] Adopt Wine Staging 1.7.37 _cwait() implementation. CORE-8214 CORE-9246
Modified:
trunk/reactos/lib/sdk/crt/process/_cwait.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/lib/sdk/crt/process/_cwait.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/process/_cwait…
==============================================================================
--- trunk/reactos/lib/sdk/crt/process/_cwait.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/process/_cwait.c [iso-8859-1] Fri Apr 10 10:49:56 2015
@@ -3,30 +3,39 @@
* PROJECT: ReactOS system libraries
* FILE: lib/msvcrt/process/cwait.c
* PURPOSE: Waits for a process to exit
- * PROGRAMER: Ariadne
- * UPDATE HISTORY:
- * 04/03/99: Created
*/
#include <precomp.h>
+/* Taken from Wine msvcrt/process.c */
+
/*
* @implemented
*/
-int _cwait(int* pnStatus, int hProc, int nAction)
+intptr_t CDECL _cwait(int *status, intptr_t pid, int action)
{
- DWORD ExitCode;
+ HANDLE hPid = (HANDLE)pid;
+ int doserrno;
- nAction = 0;
- if (WaitForSingleObject((void*)ULongToPtr(hProc), INFINITE) != WAIT_OBJECT_0) {
- _set_errno(ECHILD);
- return -1;
- }
+ if (!WaitForSingleObject(hPid, INFINITE))
+ {
+ if (status)
+ {
+ DWORD stat;
+ GetExitCodeProcess(hPid, &stat);
+ *status = (int)stat;
+ }
+ return pid;
+ }
+ doserrno = GetLastError();
- if (!GetExitCodeProcess((void*)ULongToPtr(hProc), &ExitCode))
- return -1;
- if (pnStatus != NULL)
- *pnStatus = (int)ExitCode;
- CloseHandle((HANDLE)ULongToPtr(hProc));
- return hProc;
+ if (doserrno == ERROR_INVALID_HANDLE)
+ {
+ *_errno() = ECHILD;
+ *__doserrno() = doserrno;
+ }
+ else
+ _dosmaperr(doserrno);
+
+ return status ? *status = -1 : -1;
}
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Apr 10 10:49:56 2015
@@ -290,6 +290,7 @@
msvcrt -
reactos/lib/sdk/crt/except/cpp.c # Synced at 20080528
reactos/lib/sdk/crt/except/cppexcept.c # Synced at 20071111
+ reactos/lib/sdk/crt/process/_cwait.c # Synced to WineStaging-1.7.37
reactos/lib/sdk/crt/signal/xcptinfo.c # Synced to Wine-1.7.17
reactos/lib/sdk/crt/string/scanf.c/h # Synced to Wine-1.7.17
reactos/lib/sdk/crt/strings/wcs.c # Synced at 20080611