Don't create thunk for CreateThread16 proc, call it directly.

This commit is contained in:
Ulrich Weigand 1999-09-20 18:45:28 +00:00 committed by Alexandre Julliard
parent f4edf2378e
commit f0a1c2f741

View File

@ -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 @@ HANDLE WINAPI CreateThread( SECURITY_ATTRIBUTES *sa, DWORD stack,
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