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"
27 #include "wine/winbase16.h"
38 #include "stackframe.h"
39 #include "kernel_private.h"
40 #include "wine/exception.h"
41 #include "wine/debug.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(thunk);
44 WINE_DECLARE_DEBUG_CHANNEL(relay);
47 * These are the 16-bit side WOW routines. They reside in wownt16.h
48 * in the SDK; since we don't support Win16 source code anyway, I've
49 * placed them here for compilation with Wine ...
52 DWORD WINAPI GetVDMPointer32W16(SEGPTR,UINT16);
54 DWORD WINAPI LoadLibraryEx32W16(LPCSTR,DWORD,DWORD);
55 DWORD WINAPI GetProcAddress32W16(DWORD,LPCSTR);
56 DWORD WINAPI FreeLibrary32W16(DWORD);
58 #define CPEX_DEST_STDCALL 0x00000000L
59 #define CPEX_DEST_CDECL 0x80000000L
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 );
78 /* symbols exported from relay16.s */
79 extern DWORD WINAPI wine_call_to_16( FARPROC16 target, DWORD cbArgs, PEXCEPTION_HANDLER handler );
80 extern void WINAPI wine_call_to_16_regs( CONTEXT86 *context, DWORD cbArgs, PEXCEPTION_HANDLER handler );
81 extern void Call16_Ret_Start(), Call16_Ret_End();
82 extern void CallTo16_Ret();
83 extern void CALL32_CBClient_Ret();
84 extern void CALL32_CBClientEx_Ret();
85 extern DWORD CallTo16_DataSelector;
86 extern SEGPTR CALL32_CBClient_RetAddr;
87 extern SEGPTR CALL32_CBClientEx_RetAddr;
88 extern BYTE Call16_Start;
89 extern BYTE Call16_End;
91 static SEGPTR call16_ret_addr; /* segptr to CallTo16_Ret routine */
93 /***********************************************************************
96 BOOL WOWTHUNK_Init(void)
98 /* allocate the code selector for CallTo16 routines */
99 WORD codesel = SELECTOR_AllocBlock( (void *)Call16_Ret_Start,
100 (char *)Call16_Ret_End - (char *)Call16_Ret_Start,
101 WINE_LDT_FLAGS_CODE | WINE_LDT_FLAGS_32BIT );
102 if (!codesel) return FALSE;
104 /* Patch the return addresses for CallTo16 routines */
106 CallTo16_DataSelector = wine_get_ds();
107 call16_ret_addr = MAKESEGPTR( codesel, (char*)CallTo16_Ret - (char*)Call16_Ret_Start );
108 CALL32_CBClient_RetAddr =
109 MAKESEGPTR( codesel, (char*)CALL32_CBClient_Ret - (char*)Call16_Ret_Start );
110 CALL32_CBClientEx_RetAddr =
111 MAKESEGPTR( codesel, (char*)CALL32_CBClientEx_Ret - (char*)Call16_Ret_Start );
116 /*************************************************************
119 * Fix a selector load that caused an exception if it's in the
122 static BOOL fix_selector( CONTEXT *context )
125 BYTE *instr = (BYTE *)context->Eip;
127 if (instr < &Call16_Start || instr >= &Call16_End) return FALSE;
130 while (*instr == 0x66 || *instr == 0x67) instr++;
134 case 0x07: /* pop es */
135 case 0x17: /* pop ss */
136 case 0x1f: /* pop ds */
138 case 0x0f: /* extended instruction */
141 case 0xa1: /* pop fs */
142 case 0xa9: /* pop gs */
151 stack = wine_ldt_get_ptr( context->SegSs, context->Esp );
152 TRACE( "fixing up selector %x for pop instruction\n", *stack );
158 /*************************************************************
161 * Handler for exceptions occurring in 16-bit code.
163 static DWORD call16_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RECORD *frame,
164 CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **pdispatcher )
166 if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND))
168 /* unwinding: restore the stack pointer in the TEB, and leave the Win16 mutex */
169 STACK32FRAME *frame32 = (STACK32FRAME *)((char *)frame - offsetof(STACK32FRAME,frame));
170 NtCurrentTeb()->cur_stack = frame32->frame16;
173 else if (record->ExceptionCode == EXCEPTION_ACCESS_VIOLATION ||
174 record->ExceptionCode == EXCEPTION_PRIV_INSTRUCTION)
176 if (IS_SELECTOR_SYSTEM(context->SegCs))
178 if (fix_selector( context )) return ExceptionContinueExecution;
183 DWORD ret = INSTR_EmulateInstruction( record, context );
185 if (ret != ExceptionContinueSearch) return ret;
187 /* check for Win16 __GP handler */
188 if ((gpHandler = HasGPHandler16( MAKESEGPTR( context->SegCs, context->Eip ) )))
190 WORD *stack = wine_ldt_get_ptr( context->SegSs, context->Esp );
191 *--stack = context->SegCs;
192 *--stack = context->Eip;
194 if (!IS_SELECTOR_32BIT(context->SegSs))
195 context->Esp = MAKELONG( LOWORD(context->Esp - 2*sizeof(WORD)),
196 HIWORD(context->Esp) );
198 context->Esp -= 2*sizeof(WORD);
200 context->SegCs = SELECTOROF( gpHandler );
201 context->Eip = OFFSETOF( gpHandler );
202 return ExceptionContinueExecution;
206 return ExceptionContinueSearch;
210 /*************************************************************
213 * Handler for exceptions occurring in vm86 code.
215 static DWORD vm86_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RECORD *frame,
216 CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **pdispatcher )
218 if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND))
219 return ExceptionContinueSearch;
221 if (record->ExceptionCode == EXCEPTION_ACCESS_VIOLATION ||
222 record->ExceptionCode == EXCEPTION_PRIV_INSTRUCTION)
224 return INSTR_EmulateInstruction( record, context );
227 return ExceptionContinueSearch;
233 BOOL WOWTHUNK_Init(void)
238 #endif /* __i386__ */
242 * 32-bit WOW routines (in WOW32, but actually forwarded to KERNEL32)
245 /**********************************************************************
246 * K32WOWGetDescriptor (KERNEL32.70)
248 BOOL WINAPI K32WOWGetDescriptor( SEGPTR segptr, LPLDT_ENTRY ldtent )
250 return GetThreadSelectorEntry( GetCurrentThread(),
251 segptr >> 16, ldtent );
254 /**********************************************************************
255 * K32WOWGetVDMPointer (KERNEL32.56)
257 LPVOID WINAPI K32WOWGetVDMPointer( DWORD vp, DWORD dwBytes, BOOL fProtectedMode )
259 /* FIXME: add size check too */
261 if ( fProtectedMode )
264 return DOSMEM_MapRealToLinear( vp );
267 /**********************************************************************
268 * K32WOWGetVDMPointerFix (KERNEL32.68)
270 LPVOID WINAPI K32WOWGetVDMPointerFix( DWORD vp, DWORD dwBytes, BOOL fProtectedMode )
273 * Hmmm. According to the docu, we should call:
275 * GlobalFix16( SELECTOROF(vp) );
277 * But this is unnecessary under Wine, as we never move global
278 * memory segments in linear memory anyway.
280 * (I'm not so sure what we are *supposed* to do if
281 * fProtectedMode is TRUE, anyway ...)
284 return K32WOWGetVDMPointer( vp, dwBytes, fProtectedMode );
287 /**********************************************************************
288 * K32WOWGetVDMPointerUnfix (KERNEL32.69)
290 VOID WINAPI K32WOWGetVDMPointerUnfix( DWORD vp )
293 * See above why we don't call:
295 * GlobalUnfix16( SELECTOROF(vp) );
300 /**********************************************************************
301 * K32WOWGlobalAlloc16 (KERNEL32.59)
303 WORD WINAPI K32WOWGlobalAlloc16( WORD wFlags, DWORD cb )
305 return (WORD)GlobalAlloc16( wFlags, cb );
308 /**********************************************************************
309 * K32WOWGlobalFree16 (KERNEL32.62)
311 WORD WINAPI K32WOWGlobalFree16( WORD hMem )
313 return (WORD)GlobalFree16( (HGLOBAL16)hMem );
316 /**********************************************************************
317 * K32WOWGlobalUnlock16 (KERNEL32.61)
319 BOOL WINAPI K32WOWGlobalUnlock16( WORD hMem )
321 return (BOOL)GlobalUnlock16( (HGLOBAL16)hMem );
324 /**********************************************************************
325 * K32WOWGlobalAllocLock16 (KERNEL32.63)
327 DWORD WINAPI K32WOWGlobalAllocLock16( WORD wFlags, DWORD cb, WORD *phMem )
329 WORD hMem = K32WOWGlobalAlloc16( wFlags, cb );
330 if (phMem) *phMem = hMem;
332 return K32WOWGlobalLock16( hMem );
335 /**********************************************************************
336 * K32WOWGlobalLockSize16 (KERNEL32.65)
338 DWORD WINAPI K32WOWGlobalLockSize16( WORD hMem, PDWORD pcb )
341 *pcb = GlobalSize16( (HGLOBAL16)hMem );
343 return K32WOWGlobalLock16( hMem );
346 /**********************************************************************
347 * K32WOWGlobalUnlockFree16 (KERNEL32.64)
349 WORD WINAPI K32WOWGlobalUnlockFree16( DWORD vpMem )
351 if ( !K32WOWGlobalUnlock16( HIWORD(vpMem) ) )
354 return K32WOWGlobalFree16( HIWORD(vpMem) );
358 /**********************************************************************
359 * K32WOWYield16 (KERNEL32.66)
361 VOID WINAPI K32WOWYield16( void )
364 * This does the right thing for both Win16 and Win32 tasks.
365 * More or less, at least :-/
370 /**********************************************************************
371 * K32WOWDirectedYield16 (KERNEL32.67)
373 VOID WINAPI K32WOWDirectedYield16( WORD htask16 )
376 * Argh. Our scheduler doesn't like DirectedYield by Win32
377 * tasks at all. So we do hope that this routine is indeed
378 * only ever called by Win16 tasks that have thunked up ...
380 DirectedYield16( (HTASK16)htask16 );
384 /***********************************************************************
385 * K32WOWHandle32 (KERNEL32.57)
387 HANDLE WINAPI K32WOWHandle32( WORD handle, WOW_HANDLE_TYPE type )
398 case WOW_TYPE_HBITMAP:
399 case WOW_TYPE_HBRUSH:
400 case WOW_TYPE_HPALETTE:
402 case WOW_TYPE_HACCEL:
403 return (HANDLE)(ULONG_PTR)handle;
405 case WOW_TYPE_HMETAFILE:
406 FIXME( "conversion of metafile handles not supported yet\n" );
407 return (HANDLE)(ULONG_PTR)handle;
410 return ((TDB *)GlobalLock16(handle))->teb->ClientId.UniqueThread;
412 case WOW_TYPE_FULLHWND:
413 FIXME( "conversion of full window handles not supported yet\n" );
414 return (HANDLE)(ULONG_PTR)handle;
417 ERR( "handle 0x%04x of unknown type %d\n", handle, type );
418 return (HANDLE)(ULONG_PTR)handle;
422 /***********************************************************************
423 * K32WOWHandle16 (KERNEL32.58)
425 WORD WINAPI K32WOWHandle16( HANDLE handle, WOW_HANDLE_TYPE type )
436 case WOW_TYPE_HBITMAP:
437 case WOW_TYPE_HBRUSH:
438 case WOW_TYPE_HPALETTE:
440 case WOW_TYPE_HACCEL:
441 case WOW_TYPE_FULLHWND:
442 if ( HIWORD(handle ) )
443 ERR( "handle %p of type %d has non-zero HIWORD\n", handle, type );
444 return LOWORD(handle);
446 case WOW_TYPE_HMETAFILE:
447 FIXME( "conversion of metafile handles not supported yet\n" );
448 return LOWORD(handle);
451 return TASK_GetTaskFromThread( (DWORD)handle );
454 ERR( "handle %p of unknown type %d\n", handle, type );
455 return LOWORD(handle);
459 /**********************************************************************
460 * K32WOWCallback16Ex (KERNEL32.55)
462 BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
463 DWORD cbArgs, LPVOID pArgs, LPDWORD pdwRetCode )
467 * Arguments must be prepared in the correct order by the caller
468 * (both for PASCAL and CDECL calling convention), so we simply
469 * copy them to the 16-bit stack ...
471 WORD *stack = (WORD *)CURRENT_STACK16 - cbArgs / sizeof(WORD);
473 memcpy( stack, pArgs, cbArgs );
475 if (dwFlags & (WCB16_REGS|WCB16_REGS_LONG))
477 CONTEXT *context = (CONTEXT *)pdwRetCode;
481 DWORD count = cbArgs / sizeof(WORD);
483 DPRINTF("%04lx:CallTo16(func=%04lx:%04x,ds=%04lx",
484 GetCurrentThreadId(),
485 context->SegCs, LOWORD(context->Eip), context->SegDs );
486 while (count) DPRINTF( ",%04x", stack[--count] );
487 DPRINTF(") ss:sp=%04x:%04x",
488 SELECTOROF(NtCurrentTeb()->cur_stack), OFFSETOF(NtCurrentTeb()->cur_stack) );
489 DPRINTF(" ax=%04x bx=%04x cx=%04x dx=%04x si=%04x di=%04x bp=%04x es=%04x fs=%04x\n",
490 (WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
491 (WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
492 (WORD)context->Ebp, (WORD)context->SegEs, (WORD)context->SegFs );
493 SYSLEVEL_CheckNotLevel( 2 );
498 EXCEPTION_REGISTRATION_RECORD frame;
499 frame.Handler = vm86_handler;
500 __wine_push_frame( &frame );
501 __wine_enter_vm86( context );
502 __wine_pop_frame( &frame );
506 /* push return address */
507 if (dwFlags & WCB16_REGS_LONG)
509 *((DWORD *)stack - 1) = HIWORD(call16_ret_addr);
510 *((DWORD *)stack - 2) = LOWORD(call16_ret_addr);
511 cbArgs += 2 * sizeof(DWORD);
515 *((SEGPTR *)stack - 1) = call16_ret_addr;
516 cbArgs += sizeof(SEGPTR);
520 wine_call_to_16_regs( context, cbArgs, call16_handler );
526 DPRINTF("%04lx:RetFrom16() ss:sp=%04x:%04x ",
527 GetCurrentThreadId(), SELECTOROF(NtCurrentTeb()->cur_stack),
528 OFFSETOF(NtCurrentTeb()->cur_stack));
529 DPRINTF(" ax=%04x bx=%04x cx=%04x dx=%04x bp=%04x sp=%04x\n",
530 (WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
531 (WORD)context->Edx, (WORD)context->Ebp, (WORD)context->Esp );
532 SYSLEVEL_CheckNotLevel( 2 );
541 DWORD count = cbArgs / sizeof(WORD);
543 DPRINTF("%04lx:CallTo16(func=%04x:%04x,ds=%04x",
544 GetCurrentThreadId(), HIWORD(vpfn16), LOWORD(vpfn16),
545 SELECTOROF(NtCurrentTeb()->cur_stack) );
546 while (count) DPRINTF( ",%04x", stack[--count] );
547 DPRINTF(") ss:sp=%04x:%04x\n",
548 SELECTOROF(NtCurrentTeb()->cur_stack), OFFSETOF(NtCurrentTeb()->cur_stack) );
549 SYSLEVEL_CheckNotLevel( 2 );
552 /* push return address */
553 *((SEGPTR *)stack - 1) = call16_ret_addr;
554 cbArgs += sizeof(SEGPTR);
557 * Actually, we should take care whether the called routine cleans up
558 * its stack or not. Fortunately, our wine_call_to_16 core doesn't rely on
559 * the callee to do so; after the routine has returned, the 16-bit
560 * stack pointer is always reset to the position it had before.
563 ret = wine_call_to_16( (FARPROC16)vpfn16, cbArgs, call16_handler );
564 if (pdwRetCode) *pdwRetCode = ret;
569 DPRINTF("%04lx:RetFrom16() ss:sp=%04x:%04x retval=%08lx\n",
570 GetCurrentThreadId(), SELECTOROF(NtCurrentTeb()->cur_stack),
571 OFFSETOF(NtCurrentTeb()->cur_stack), ret);
572 SYSLEVEL_CheckNotLevel( 2 );
576 assert(0); /* cannot call to 16-bit on non-Intel architectures */
577 #endif /* __i386__ */
579 return TRUE; /* success */
582 /**********************************************************************
583 * K32WOWCallback16 (KERNEL32.54)
585 DWORD WINAPI K32WOWCallback16( DWORD vpfn16, DWORD dwParam )
589 if ( !K32WOWCallback16Ex( vpfn16, WCB16_PASCAL,
590 sizeof(DWORD), &dwParam, &ret ) )
598 * 16-bit WOW routines (in KERNEL)
601 /**********************************************************************
602 * GetVDMPointer32W (KERNEL.516)
604 DWORD WINAPI GetVDMPointer32W16( SEGPTR vp, UINT16 fMode )
606 GlobalPageLock16(GlobalHandle16(SELECTOROF(vp)));
607 return (DWORD)K32WOWGetVDMPointer( vp, 0, (DWORD)fMode );
610 /***********************************************************************
611 * LoadLibraryEx32W (KERNEL.513)
613 DWORD WINAPI LoadLibraryEx32W16( LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags )
616 DOS_FULL_NAME full_name;
618 UNICODE_STRING libfileW;
620 static const WCHAR dllW[] = {'.','D','L','L',0};
624 SetLastError(ERROR_INVALID_PARAMETER);
628 if (!RtlCreateUnicodeStringFromAsciiz(&libfileW, lpszLibFile))
630 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
634 /* if the file can not be found, call LoadLibraryExA anyway, since it might be
635 a buildin module. This case is handled in MODULE_LoadLibraryExA */
637 filenameW = libfileW.Buffer;
638 if ( DIR_SearchPath( NULL, filenameW, dllW, &full_name, FALSE ) )
639 filenameW = full_name.short_name;
641 ReleaseThunkLock( &mutex_count );
642 hModule = LoadLibraryExW( filenameW, (HANDLE)hFile, dwFlags );
643 RestoreThunkLock( mutex_count );
645 RtlFreeUnicodeString(&libfileW);
647 return (DWORD)hModule;
650 /***********************************************************************
651 * GetProcAddress32W (KERNEL.515)
653 DWORD WINAPI GetProcAddress32W16( DWORD hModule, LPCSTR lpszProc )
655 return (DWORD)GetProcAddress( (HMODULE)hModule, lpszProc );
658 /***********************************************************************
659 * FreeLibrary32W (KERNEL.514)
661 DWORD WINAPI FreeLibrary32W16( DWORD hLibModule )
666 ReleaseThunkLock( &mutex_count );
667 retv = FreeLibrary( (HMODULE)hLibModule );
668 RestoreThunkLock( mutex_count );
673 /**********************************************************************
676 static DWORD WOW_CallProc32W16( FARPROC proc32, DWORD nrofargs, DWORD *args )
681 ReleaseThunkLock( &mutex_count );
684 * FIXME: If ( nrofargs & CPEX_DEST_CDECL ) != 0, we should call a
685 * 32-bit CDECL routine ...
688 if (!proc32) ret = 0;
689 else switch (nrofargs)
691 case 0: ret = proc32();
693 case 1: ret = proc32(args[0]);
695 case 2: ret = proc32(args[0],args[1]);
697 case 3: ret = proc32(args[0],args[1],args[2]);
699 case 4: ret = proc32(args[0],args[1],args[2],args[3]);
701 case 5: ret = proc32(args[0],args[1],args[2],args[3],args[4]);
703 case 6: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5]);
705 case 7: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);
707 case 8: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
709 case 9: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]);
711 case 10:ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9]);
713 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]);
715 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]);
717 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]);
719 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]);
721 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]);
724 /* FIXME: should go up to 32 arguments */
725 ERR("Unsupported number of arguments %ld, please report.\n",nrofargs);
730 RestoreThunkLock( mutex_count );
732 TRACE("returns %08lx\n",ret);
736 /**********************************************************************
737 * CallProc32W (KERNEL.517)
739 DWORD WINAPIV CallProc32W16( DWORD nrofargs, DWORD argconvmask, FARPROC proc32, VA_LIST16 valist )
744 TRACE("(%ld,%ld,%p args[",nrofargs,argconvmask,proc32);
746 for (i=0;i<nrofargs;i++)
748 if (argconvmask & (1<<i))
750 SEGPTR ptr = VA_ARG16( valist, SEGPTR );
751 /* pascal convention, have to reverse the arguments order */
752 args[nrofargs - i - 1] = (DWORD)MapSL(ptr);
753 TRACE("%08lx(%p),",ptr,MapSL(ptr));
757 DWORD arg = VA_ARG16( valist, DWORD );
758 /* pascal convention, have to reverse the arguments order */
759 args[nrofargs - i - 1] = arg;
765 /* POP nrofargs DWORD arguments and 3 DWORD parameters */
766 stack16_pop( (3 + nrofargs) * sizeof(DWORD) );
768 return WOW_CallProc32W16( proc32, nrofargs, args );
771 /**********************************************************************
772 * _CallProcEx32W (KERNEL.518)
774 DWORD WINAPIV CallProcEx32W16( DWORD nrofargs, DWORD argconvmask, FARPROC proc32, VA_LIST16 valist )
779 TRACE("(%ld,%ld,%p args[",nrofargs,argconvmask,proc32);
781 for (i=0;i<nrofargs;i++)
783 if (argconvmask & (1<<i))
785 SEGPTR ptr = VA_ARG16( valist, SEGPTR );
786 args[i] = (DWORD)MapSL(ptr);
787 TRACE("%08lx(%p),",ptr,MapSL(ptr));
791 DWORD arg = VA_ARG16( valist, DWORD );
797 return WOW_CallProc32W16( proc32, nrofargs, args );
801 /**********************************************************************
802 * WOW16Call (KERNEL.500)
807 DWORD WINAPIV WOW16Call(WORD x, WORD y, WORD z, VA_LIST16 args)
811 FIXME("(0x%04x,0x%04x,%d),calling (",x,y,z);
813 for (i=0;i<x/2;i++) {
814 WORD a = VA_ARG16(args,WORD);
817 calladdr = VA_ARG16(args,DWORD);
818 stack16_pop( 3*sizeof(WORD) + x + sizeof(DWORD) );
819 DPRINTF(") calling address was 0x%08lx\n",calladdr);
824 /***********************************************************************
825 * CreateThread16 (KERNEL.441)
827 HANDLE WINAPI CreateThread16( SECURITY_ATTRIBUTES *sa, DWORD stack,
828 FARPROC16 start, SEGPTR param,
829 DWORD flags, LPDWORD id )
831 struct thread_args *args = HeapAlloc( GetProcessHeap(), 0, sizeof(*args) );
832 if (!args) return INVALID_HANDLE_VALUE;
835 return CreateThread( sa, stack, start_thread16, args, flags, id );