Don't create thunk for CreateThread16 proc, call it directly.
diff --git a/scheduler/thread.c b/scheduler/thread.c
index 16ecbc9..a53a23c 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -27,6 +27,7 @@
#include "server.h"
#include "services.h"
#include "stackframe.h"
+#include "builtin16.h"
#include "debugtools.h"
#include "queue.h"
#include "hook.h"
@@ -307,6 +308,30 @@
return handle;
}
+/***********************************************************************
+ * CreateThread16 (KERNEL.441)
+ */
+static DWORD CALLBACK THREAD_StartThread16( LPVOID threadArgs )
+{
+ FARPROC16 start = ((FARPROC16 *)threadArgs)[0];
+ DWORD param = ((DWORD *)threadArgs)[1];
+ HeapFree( GetProcessHeap(), 0, threadArgs );
+
+ ((LPDWORD)CURRENT_STACK16)[-1] = param;
+ return CallTo16Long( start, sizeof(DWORD) );
+}
+HANDLE WINAPI CreateThread16( SECURITY_ATTRIBUTES *sa, DWORD stack,
+ FARPROC16 start, SEGPTR param,
+ DWORD flags, LPDWORD id )
+{
+ DWORD *threadArgs = HeapAlloc( GetProcessHeap(), 0, 2*sizeof(DWORD) );
+ if (!threadArgs) return INVALID_HANDLE_VALUE;
+ threadArgs[0] = (DWORD)start;
+ threadArgs[1] = (DWORD)param;
+
+ return CreateThread( sa, stack, THREAD_StartThread16, threadArgs, flags, id );
+}
+
/***********************************************************************
* ExitThread [KERNEL32.215] Ends a thread