2 * Win32 WOW Generic Thunk API
4 * Copyright 1999 Ulrich Weigand
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/port.h"
26 #include "wine/winbase16.h"
36 #include "stackframe.h"
37 #include "wine/exception.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(thunk
);
41 WINE_DECLARE_DEBUG_CHANNEL(relay
);
44 * These are the 16-bit side WOW routines. They reside in wownt16.h
45 * in the SDK; since we don't support Win16 source code anyway, I've
46 * placed them here for compilation with Wine ...
49 DWORD WINAPI
GetVDMPointer32W16(SEGPTR
,UINT16
);
51 DWORD WINAPI
LoadLibraryEx32W16(LPCSTR
,DWORD
,DWORD
);
52 DWORD WINAPI
GetProcAddress32W16(DWORD
,LPCSTR
);
53 DWORD WINAPI
FreeLibrary32W16(DWORD
);
55 #define CPEX_DEST_STDCALL 0x00000000L
56 #define CPEX_DEST_CDECL 0x80000000L
58 DWORD WINAPI
CallProcExW16(VOID
);
59 DWORD WINAPI
CallProcEx32W16(VOID
);
61 /* thunk for 16-bit CreateThread */
68 static DWORD CALLBACK
start_thread16( LPVOID threadArgs
)
70 struct thread_args args
= *(struct thread_args
*)threadArgs
;
71 HeapFree( GetProcessHeap(), 0, threadArgs
);
72 return K32WOWCallback16( (DWORD
)args
.proc
, args
.param
);
77 /* symbols exported from relay16.s */
78 extern DWORD WINAPI
wine_call_to_16( FARPROC16 target
, DWORD cbArgs
, PEXCEPTION_HANDLER handler
);
79 extern void WINAPI
wine_call_to_16_regs( CONTEXT86
*context
, DWORD cbArgs
, PEXCEPTION_HANDLER handler
);
80 extern void Call16_Ret_Start(), Call16_Ret_End();
81 extern void CallTo16_Ret();
82 extern void CALL32_CBClient_Ret();
83 extern void CALL32_CBClientEx_Ret();
84 extern DWORD CallTo16_DataSelector
;
85 extern SEGPTR CALL32_CBClient_RetAddr
;
86 extern SEGPTR CALL32_CBClientEx_RetAddr
;
88 static SEGPTR call16_ret_addr
; /* segptr to CallTo16_Ret routine */
91 /***********************************************************************
94 BOOL
WOWTHUNK_Init(void)
97 /* allocate the code selector for CallTo16 routines */
98 WORD codesel
= SELECTOR_AllocBlock( (void *)Call16_Ret_Start
,
99 (char *)Call16_Ret_End
- (char *)Call16_Ret_Start
,
100 WINE_LDT_FLAGS_CODE
| WINE_LDT_FLAGS_32BIT
);
101 if (!codesel
) return FALSE
;
103 /* Patch the return addresses for CallTo16 routines */
105 CallTo16_DataSelector
= wine_get_ds();
106 call16_ret_addr
= MAKESEGPTR( codesel
, (char*)CallTo16_Ret
- (char*)Call16_Ret_Start
);
107 CALL32_CBClient_RetAddr
=
108 MAKESEGPTR( codesel
, (char*)CALL32_CBClient_Ret
- (char*)Call16_Ret_Start
);
109 CALL32_CBClientEx_RetAddr
=
110 MAKESEGPTR( codesel
, (char*)CALL32_CBClientEx_Ret
- (char*)Call16_Ret_Start
);
116 /*************************************************************
119 * Handler for exceptions occurring in 16-bit code.
121 static DWORD
call16_handler( EXCEPTION_RECORD
*record
, EXCEPTION_FRAME
*frame
,
122 CONTEXT
*context
, EXCEPTION_FRAME
**pdispatcher
)
124 if (record
->ExceptionFlags
& (EH_UNWINDING
| EH_EXIT_UNWIND
))
126 /* unwinding: restore the stack pointer in the TEB, and leave the Win16 mutex */
127 STACK32FRAME
*frame32
= (STACK32FRAME
*)((char *)frame
- offsetof(STACK32FRAME
,frame
));
128 NtCurrentTeb()->cur_stack
= frame32
->frame16
;
131 else if (!IS_SELECTOR_SYSTEM(context
->SegCs
)) /* check for Win16 __GP handler */
133 SEGPTR gpHandler
= HasGPHandler16( MAKESEGPTR( context
->SegCs
, context
->Eip
) );
136 WORD
*stack
= wine_ldt_get_ptr( context
->SegSs
, context
->Esp
);
137 *--stack
= context
->SegCs
;
138 *--stack
= context
->Eip
;
140 if (!IS_SELECTOR_32BIT(context
->SegSs
))
141 context
->Esp
= MAKELONG( LOWORD(context
->Esp
- 2*sizeof(WORD
)),
142 HIWORD(context
->Esp
) );
144 context
->Esp
-= 2*sizeof(WORD
);
146 context
->SegCs
= SELECTOROF( gpHandler
);
147 context
->Eip
= OFFSETOF( gpHandler
);
148 return ExceptionContinueExecution
;
151 return ExceptionContinueSearch
;
156 * 32-bit WOW routines (in WOW32, but actually forwarded to KERNEL32)
159 /**********************************************************************
160 * K32WOWGetDescriptor (KERNEL32.70)
162 BOOL WINAPI
K32WOWGetDescriptor( SEGPTR segptr
, LPLDT_ENTRY ldtent
)
164 return GetThreadSelectorEntry( GetCurrentThread(),
165 segptr
>> 16, ldtent
);
168 /**********************************************************************
169 * K32WOWGetVDMPointer (KERNEL32.56)
171 LPVOID WINAPI
K32WOWGetVDMPointer( DWORD vp
, DWORD dwBytes
, BOOL fProtectedMode
)
173 /* FIXME: add size check too */
175 if ( fProtectedMode
)
178 return DOSMEM_MapRealToLinear( vp
);
181 /**********************************************************************
182 * K32WOWGetVDMPointerFix (KERNEL32.68)
184 LPVOID WINAPI
K32WOWGetVDMPointerFix( DWORD vp
, DWORD dwBytes
, BOOL fProtectedMode
)
187 * Hmmm. According to the docu, we should call:
189 * GlobalFix16( SELECTOROF(vp) );
191 * But this is unnecessary under Wine, as we never move global
192 * memory segments in linear memory anyway.
194 * (I'm not so sure what we are *supposed* to do if
195 * fProtectedMode is TRUE, anyway ...)
198 return K32WOWGetVDMPointer( vp
, dwBytes
, fProtectedMode
);
201 /**********************************************************************
202 * K32WOWGetVDMPointerUnfix (KERNEL32.69)
204 VOID WINAPI
K32WOWGetVDMPointerUnfix( DWORD vp
)
207 * See above why we don't call:
209 * GlobalUnfix16( SELECTOROF(vp) );
214 /**********************************************************************
215 * K32WOWGlobalAlloc16 (KERNEL32.59)
217 WORD WINAPI
K32WOWGlobalAlloc16( WORD wFlags
, DWORD cb
)
219 return (WORD
)GlobalAlloc16( wFlags
, cb
);
222 /**********************************************************************
223 * K32WOWGlobalFree16 (KERNEL32.62)
225 WORD WINAPI
K32WOWGlobalFree16( WORD hMem
)
227 return (WORD
)GlobalFree16( (HGLOBAL16
)hMem
);
230 /**********************************************************************
231 * K32WOWGlobalUnlock16 (KERNEL32.61)
233 BOOL WINAPI
K32WOWGlobalUnlock16( WORD hMem
)
235 return (BOOL
)GlobalUnlock16( (HGLOBAL16
)hMem
);
238 /**********************************************************************
239 * K32WOWGlobalAllocLock16 (KERNEL32.63)
241 DWORD WINAPI
K32WOWGlobalAllocLock16( WORD wFlags
, DWORD cb
, WORD
*phMem
)
243 WORD hMem
= K32WOWGlobalAlloc16( wFlags
, cb
);
244 if (phMem
) *phMem
= hMem
;
246 return K32WOWGlobalLock16( hMem
);
249 /**********************************************************************
250 * K32WOWGlobalLockSize16 (KERNEL32.65)
252 DWORD WINAPI
K32WOWGlobalLockSize16( WORD hMem
, PDWORD pcb
)
255 *pcb
= GlobalSize16( (HGLOBAL16
)hMem
);
257 return K32WOWGlobalLock16( hMem
);
260 /**********************************************************************
261 * K32WOWGlobalUnlockFree16 (KERNEL32.64)
263 WORD WINAPI
K32WOWGlobalUnlockFree16( DWORD vpMem
)
265 if ( !K32WOWGlobalUnlock16( HIWORD(vpMem
) ) )
268 return K32WOWGlobalFree16( HIWORD(vpMem
) );
272 /**********************************************************************
273 * K32WOWYield16 (KERNEL32.66)
275 VOID WINAPI
K32WOWYield16( void )
278 * This does the right thing for both Win16 and Win32 tasks.
279 * More or less, at least :-/
284 /**********************************************************************
285 * K32WOWDirectedYield16 (KERNEL32.67)
287 VOID WINAPI
K32WOWDirectedYield16( WORD htask16
)
290 * Argh. Our scheduler doesn't like DirectedYield by Win32
291 * tasks at all. So we do hope that this routine is indeed
292 * only ever called by Win16 tasks that have thunked up ...
294 DirectedYield16( (HTASK16
)htask16
);
298 /***********************************************************************
299 * K32WOWHandle32 (KERNEL32.57)
301 HANDLE WINAPI
K32WOWHandle32( WORD handle
, WOW_HANDLE_TYPE type
)
312 case WOW_TYPE_HBITMAP
:
313 case WOW_TYPE_HBRUSH
:
314 case WOW_TYPE_HPALETTE
:
316 case WOW_TYPE_HACCEL
:
317 return (HANDLE
)(ULONG_PTR
)handle
;
319 case WOW_TYPE_HMETAFILE
:
320 FIXME( "conversion of metafile handles not supported yet\n" );
321 return (HANDLE
)(ULONG_PTR
)handle
;
324 return (HANDLE
)((TDB
*)GlobalLock16(handle
))->teb
->tid
;
326 case WOW_TYPE_FULLHWND
:
327 FIXME( "conversion of full window handles not supported yet\n" );
328 return (HANDLE
)(ULONG_PTR
)handle
;
331 ERR( "handle 0x%04x of unknown type %d\n", handle
, type
);
332 return (HANDLE
)(ULONG_PTR
)handle
;
336 /***********************************************************************
337 * K32WOWHandle16 (KERNEL32.58)
339 WORD WINAPI
K32WOWHandle16( HANDLE handle
, WOW_HANDLE_TYPE type
)
350 case WOW_TYPE_HBITMAP
:
351 case WOW_TYPE_HBRUSH
:
352 case WOW_TYPE_HPALETTE
:
354 case WOW_TYPE_HACCEL
:
355 case WOW_TYPE_FULLHWND
:
356 if ( HIWORD(handle
) )
357 ERR( "handle %p of type %d has non-zero HIWORD\n", handle
, type
);
358 return LOWORD(handle
);
360 case WOW_TYPE_HMETAFILE
:
361 FIXME( "conversion of metafile handles not supported yet\n" );
362 return LOWORD(handle
);
365 return TASK_GetTaskFromThread( (DWORD
)handle
);
368 ERR( "handle %p of unknown type %d\n", handle
, type
);
369 return LOWORD(handle
);
373 /**********************************************************************
374 * K32WOWCallback16Ex (KERNEL32.55)
376 BOOL WINAPI
K32WOWCallback16Ex( DWORD vpfn16
, DWORD dwFlags
,
377 DWORD cbArgs
, LPVOID pArgs
, LPDWORD pdwRetCode
)
381 * Arguments must be prepared in the correct order by the caller
382 * (both for PASCAL and CDECL calling convention), so we simply
383 * copy them to the 16-bit stack ...
385 WORD
*stack
= (WORD
*)CURRENT_STACK16
- cbArgs
/ sizeof(WORD
);
387 memcpy( stack
, pArgs
, cbArgs
);
389 if (dwFlags
& (WCB16_REGS
|WCB16_REGS_LONG
))
391 CONTEXT
*context
= (CONTEXT
*)pdwRetCode
;
395 DWORD count
= cbArgs
/ sizeof(WORD
);
397 DPRINTF("%04lx:CallTo16(func=%04lx:%04x,ds=%04lx",
398 GetCurrentThreadId(),
399 context
->SegCs
, LOWORD(context
->Eip
), context
->SegDs
);
400 while (count
) DPRINTF( ",%04x", stack
[--count
] );
401 DPRINTF(") ss:sp=%04x:%04x",
402 SELECTOROF(NtCurrentTeb()->cur_stack
), OFFSETOF(NtCurrentTeb()->cur_stack
) );
403 DPRINTF(" ax=%04x bx=%04x cx=%04x dx=%04x si=%04x di=%04x bp=%04x es=%04x fs=%04x\n",
404 (WORD
)context
->Eax
, (WORD
)context
->Ebx
, (WORD
)context
->Ecx
,
405 (WORD
)context
->Edx
, (WORD
)context
->Esi
, (WORD
)context
->Edi
,
406 (WORD
)context
->Ebp
, (WORD
)context
->SegEs
, (WORD
)context
->SegFs
);
407 SYSLEVEL_CheckNotLevel( 2 );
410 /* push return address */
411 if (dwFlags
& WCB16_REGS_LONG
)
413 *((DWORD
*)stack
- 1) = HIWORD(call16_ret_addr
);
414 *((DWORD
*)stack
- 2) = LOWORD(call16_ret_addr
);
415 cbArgs
+= 2 * sizeof(DWORD
);
419 *((SEGPTR
*)stack
- 1) = call16_ret_addr
;
420 cbArgs
+= sizeof(SEGPTR
);
424 wine_call_to_16_regs( context
, cbArgs
, call16_handler
);
429 DPRINTF("%04lx:RetFrom16() ss:sp=%04x:%04x ",
430 GetCurrentThreadId(), SELECTOROF(NtCurrentTeb()->cur_stack
),
431 OFFSETOF(NtCurrentTeb()->cur_stack
));
432 DPRINTF(" ax=%04x bx=%04x cx=%04x dx=%04x bp=%04x sp=%04x\n",
433 (WORD
)context
->Eax
, (WORD
)context
->Ebx
, (WORD
)context
->Ecx
,
434 (WORD
)context
->Edx
, (WORD
)context
->Ebp
, (WORD
)context
->Esp
);
435 SYSLEVEL_CheckNotLevel( 2 );
444 DWORD count
= cbArgs
/ sizeof(WORD
);
446 DPRINTF("%04lx:CallTo16(func=%04x:%04x,ds=%04x",
447 GetCurrentThreadId(), HIWORD(vpfn16
), LOWORD(vpfn16
),
448 SELECTOROF(NtCurrentTeb()->cur_stack
) );
449 while (count
) DPRINTF( ",%04x", stack
[--count
] );
450 DPRINTF(") ss:sp=%04x:%04x\n",
451 SELECTOROF(NtCurrentTeb()->cur_stack
), OFFSETOF(NtCurrentTeb()->cur_stack
) );
452 SYSLEVEL_CheckNotLevel( 2 );
455 /* push return address */
456 *((SEGPTR
*)stack
- 1) = call16_ret_addr
;
457 cbArgs
+= sizeof(SEGPTR
);
460 * Actually, we should take care whether the called routine cleans up
461 * its stack or not. Fortunately, our wine_call_to_16 core doesn't rely on
462 * the callee to do so; after the routine has returned, the 16-bit
463 * stack pointer is always reset to the position it had before.
466 ret
= wine_call_to_16( (FARPROC16
)vpfn16
, cbArgs
, call16_handler
);
467 if (pdwRetCode
) *pdwRetCode
= ret
;
472 DPRINTF("%04lx:RetFrom16() ss:sp=%04x:%04x retval=%08lx\n",
473 GetCurrentThreadId(), SELECTOROF(NtCurrentTeb()->cur_stack
),
474 OFFSETOF(NtCurrentTeb()->cur_stack
), ret
);
475 SYSLEVEL_CheckNotLevel( 2 );
479 assert(0); /* cannot call to 16-bit on non-Intel architectures */
480 #endif /* __i386__ */
482 return TRUE
; /* success */
485 /**********************************************************************
486 * K32WOWCallback16 (KERNEL32.54)
488 DWORD WINAPI
K32WOWCallback16( DWORD vpfn16
, DWORD dwParam
)
492 if ( !K32WOWCallback16Ex( vpfn16
, WCB16_PASCAL
,
493 sizeof(DWORD
), &dwParam
, &ret
) )
501 * 16-bit WOW routines (in KERNEL)
504 /**********************************************************************
505 * GetVDMPointer32W (KERNEL.516)
507 DWORD WINAPI
GetVDMPointer32W16( SEGPTR vp
, UINT16 fMode
)
509 GlobalPageLock16(GlobalHandle16(SELECTOROF(vp
)));
510 return (DWORD
)K32WOWGetVDMPointer( vp
, 0, (DWORD
)fMode
);
513 /***********************************************************************
514 * LoadLibraryEx32W (KERNEL.513)
516 DWORD WINAPI
LoadLibraryEx32W16( LPCSTR lpszLibFile
, DWORD hFile
, DWORD dwFlags
)
519 DOS_FULL_NAME full_name
;
521 UNICODE_STRING libfileW
;
523 static const WCHAR dllW
[] = {'.','D','L','L',0};
527 SetLastError(ERROR_INVALID_PARAMETER
);
531 if (!RtlCreateUnicodeStringFromAsciiz(&libfileW
, lpszLibFile
))
533 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
537 /* if the file can not be found, call LoadLibraryExA anyway, since it might be
538 a buildin module. This case is handled in MODULE_LoadLibraryExA */
540 filenameW
= libfileW
.Buffer
;
541 if ( DIR_SearchPath( NULL
, filenameW
, dllW
, &full_name
, FALSE
) )
542 filenameW
= full_name
.short_name
;
544 ReleaseThunkLock( &mutex_count
);
545 hModule
= LoadLibraryExW( filenameW
, (HANDLE
)hFile
, dwFlags
);
546 RestoreThunkLock( mutex_count
);
548 RtlFreeUnicodeString(&libfileW
);
550 return (DWORD
)hModule
;
553 /***********************************************************************
554 * GetProcAddress32W (KERNEL.515)
556 DWORD WINAPI
GetProcAddress32W16( DWORD hModule
, LPCSTR lpszProc
)
558 return (DWORD
)GetProcAddress( (HMODULE
)hModule
, lpszProc
);
561 /***********************************************************************
562 * FreeLibrary32W (KERNEL.514)
564 DWORD WINAPI
FreeLibrary32W16( DWORD hLibModule
)
569 ReleaseThunkLock( &mutex_count
);
570 retv
= FreeLibrary( (HMODULE
)hLibModule
);
571 RestoreThunkLock( mutex_count
);
576 /**********************************************************************
579 static DWORD
WOW_CallProc32W16( BOOL Ex
)
581 DWORD nrofargs
, argconvmask
;
589 ReleaseThunkLock( &mutex_count
);
591 VA_START16( valist
);
592 nrofargs
= VA_ARG16( valist
, DWORD
);
593 argconvmask
= VA_ARG16( valist
, DWORD
);
594 proc32
= VA_ARG16( valist
, FARPROC
);
595 TRACE("(%ld,%ld,%p, Ex%d args[",nrofargs
,argconvmask
,proc32
,Ex
);
596 args
= (DWORD
*)HeapAlloc( GetProcessHeap(), 0, sizeof(DWORD
)*nrofargs
);
597 if(args
== NULL
) proc32
= NULL
; /* maybe we should WARN here? */
598 /* CallProcEx doesn't need its args reversed */
599 for (i
=0;i
<nrofargs
;i
++) {
603 aix
= nrofargs
- i
- 1;
605 if (argconvmask
& (1<<i
))
607 SEGPTR ptr
= VA_ARG16( valist
, SEGPTR
);
608 if (args
) args
[aix
] = (DWORD
)MapSL(ptr
);
609 if (TRACE_ON(thunk
)) DPRINTF("%08lx(%p),",ptr
,MapSL(ptr
));
613 DWORD arg
= VA_ARG16( valist
, DWORD
);
614 if (args
) args
[aix
] = arg
;
615 if (TRACE_ON(thunk
)) DPRINTF("%ld,", arg
);
618 if (TRACE_ON(thunk
)) DPRINTF("])\n");
622 * FIXME: If ( nrofargs & CPEX_DEST_CDECL ) != 0, we should call a
623 * 32-bit CDECL routine ...
626 if (!proc32
) ret
= 0;
627 else switch (nrofargs
)
629 case 0: ret
= proc32();
631 case 1: ret
= proc32(args
[0]);
633 case 2: ret
= proc32(args
[0],args
[1]);
635 case 3: ret
= proc32(args
[0],args
[1],args
[2]);
637 case 4: ret
= proc32(args
[0],args
[1],args
[2],args
[3]);
639 case 5: ret
= proc32(args
[0],args
[1],args
[2],args
[3],args
[4]);
641 case 6: ret
= proc32(args
[0],args
[1],args
[2],args
[3],args
[4],args
[5]);
643 case 7: ret
= proc32(args
[0],args
[1],args
[2],args
[3],args
[4],args
[5],args
[6]);
645 case 8: ret
= proc32(args
[0],args
[1],args
[2],args
[3],args
[4],args
[5],args
[6],args
[7]);
647 case 9: ret
= proc32(args
[0],args
[1],args
[2],args
[3],args
[4],args
[5],args
[6],args
[7],args
[8]);
649 case 10:ret
= proc32(args
[0],args
[1],args
[2],args
[3],args
[4],args
[5],args
[6],args
[7],args
[8],args
[9]);
651 case 11:ret
= proc32(args
[0],args
[1],args
[2],args
[3],args
[4],args
[5],args
[6],args
[7],args
[8],args
[9],args
[10]);
653 case 12:ret
= proc32(args
[0],args
[1],args
[2],args
[3],args
[4],args
[5],args
[6],args
[7],args
[8],args
[9],args
[10],args
[11]);
655 case 13:ret
= proc32(args
[0],args
[1],args
[2],args
[3],args
[4],args
[5],args
[6],args
[7],args
[8],args
[9],args
[10],args
[11],args
[12]);
657 case 14:ret
= proc32(args
[0],args
[1],args
[2],args
[3],args
[4],args
[5],args
[6],args
[7],args
[8],args
[9],args
[10],args
[11],args
[12],args
[13]);
659 case 15:ret
= proc32(args
[0],args
[1],args
[2],args
[3],args
[4],args
[5],args
[6],args
[7],args
[8],args
[9],args
[10],args
[11],args
[12],args
[13],args
[14]);
662 /* FIXME: should go up to 32 arguments */
663 ERR("Unsupported number of arguments %ld, please report.\n",nrofargs
);
668 /* POP nrofargs DWORD arguments and 3 DWORD parameters */
669 if (!Ex
) stack16_pop( (3 + nrofargs
) * sizeof(DWORD
) );
671 TRACE("returns %08lx\n",ret
);
672 HeapFree( GetProcessHeap(), 0, args
);
674 RestoreThunkLock( mutex_count
);
678 /**********************************************************************
679 * CallProc32W (KERNEL.517)
681 * DWORD PASCAL CallProc32W( DWORD p1, ... , DWORD lpProcAddress,
682 * DWORD fAddressConvert, DWORD cParams );
684 DWORD WINAPI
CallProc32W16( void )
686 return WOW_CallProc32W16( FALSE
);
689 /**********************************************************************
690 * _CallProcEx32W (KERNEL.518)
692 * DWORD CallProcEx32W( DWORD cParams, DWORD fAddressConvert,
693 * DWORD lpProcAddress, DWORD p1, ... );
695 DWORD WINAPI
CallProcEx32W16( void )
697 return WOW_CallProc32W16( TRUE
);
701 /**********************************************************************
702 * WOW16Call (KERNEL.500)
707 DWORD WINAPI
WOW16Call(WORD x
,WORD y
,WORD z
)
712 FIXME("(0x%04x,0x%04x,%d),calling (",x
,y
,z
);
715 for (i
=0;i
<x
/2;i
++) {
716 WORD a
= VA_ARG16(args
,WORD
);
719 calladdr
= VA_ARG16(args
,DWORD
);
721 stack16_pop( x
+ sizeof(DWORD
) );
722 DPRINTF(") calling address was 0x%08lx\n",calladdr
);
727 /***********************************************************************
728 * CreateThread16 (KERNEL.441)
730 HANDLE WINAPI
CreateThread16( SECURITY_ATTRIBUTES
*sa
, DWORD stack
,
731 FARPROC16 start
, SEGPTR param
,
732 DWORD flags
, LPDWORD id
)
734 struct thread_args
*args
= HeapAlloc( GetProcessHeap(), 0, sizeof(*args
) );
735 if (!args
) return INVALID_HANDLE_VALUE
;
738 return CreateThread( sa
, stack
, start_thread16
, args
, flags
, id
);