branch update for HEAD-2003050101
[reactos.git] / lib / msvcrt / process / threadx.c
index 12a63f6..3d92997 100644 (file)
@@ -14,13 +14,30 @@ unsigned long _beginthreadex(
     unsigned initflag,
     unsigned* thrdaddr)
 {
+  HANDLE NewThread;
+
+  /*
+   * Just call the API function. Any CRT specific processing is done in
+   * DllMain DLL_THREAD_ATTACH
+   */
+  NewThread = CreateThread(security, stack_size, start_address, arglist, initflag, thrdaddr);
+  if (NULL == NewThread)
+    {
+    /* FIXME map GetLastError() to errno */
     errno = ENOSYS;
-    return (unsigned long)-1;
+    }
+
+  return (unsigned long) NewThread;
 }
 
 
 void _endthreadex(unsigned retval)
 {
+  /*
+   * Just call the API function. Any CRT specific processing is done in
+   * DllMain DLL_THREAD_DETACH
+   */
+  ExitThread(retval);
 }
 
 /* EOF */