Register functions with no arguments should still be called as stdcall
[wine.git] / dlls / kernel / relay16.c
blobcf41c9ddce3aea09202288c07039a503327ef6aa
1 /*
2 * Copyright 1993 Robert J. Amstadt
3 * Copyright 1995 Alexandre Julliard
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include "config.h"
21 #include "wine/port.h"
23 #include <assert.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <stdarg.h>
27 #include <stdio.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wine/winbase16.h"
32 #include "winternl.h"
33 #include "kernel_private.h"
34 #include "kernel16_private.h"
35 #include "wine/unicode.h"
36 #include "wine/library.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(relay);
41 #ifdef __i386__
43 static const WCHAR **debug_relay_excludelist;
44 static const WCHAR **debug_relay_includelist;
45 static const WCHAR **debug_snoop_excludelist;
46 static const WCHAR **debug_snoop_includelist;
48 /* compare an ASCII and a Unicode string without depending on the current codepage */
49 inline static int strcmpiAW( const char *strA, const WCHAR *strW )
51 while (*strA && (toupperW((unsigned char)*strA) == toupperW(*strW))) { strA++; strW++; }
52 return toupperW((unsigned char)*strA) - toupperW(*strW);
55 /* compare an ASCII and a Unicode string without depending on the current codepage */
56 inline static int strncmpiAW( const char *strA, const WCHAR *strW, int n )
58 int ret = 0;
59 for ( ; n > 0; n--, strA++, strW++)
60 if ((ret = toupperW((unsigned char)*strA) - toupperW(*strW)) || !*strA) break;
61 return ret;
64 /***********************************************************************
65 * build_list
67 * Build a function list from a ';'-separated string.
69 static const WCHAR **build_list( const WCHAR *buffer )
71 int count = 1;
72 const WCHAR *p = buffer;
73 const WCHAR **ret;
75 while ((p = strchrW( p, ';' )))
77 count++;
78 p++;
80 /* allocate count+1 pointers, plus the space for a copy of the string */
81 if ((ret = RtlAllocateHeap( GetProcessHeap(), 0,
82 (count+1) * sizeof(WCHAR*) + (strlenW(buffer)+1) * sizeof(WCHAR) )))
84 WCHAR *str = (WCHAR *)(ret + count + 1);
85 WCHAR *p = str;
87 strcpyW( str, buffer );
88 count = 0;
89 for (;;)
91 ret[count++] = p;
92 if (!(p = strchrW( p, ';' ))) break;
93 *p++ = 0;
95 ret[count++] = NULL;
97 return ret;
101 /***********************************************************************
102 * RELAY16_InitDebugLists
104 * Build the relay include/exclude function lists.
106 void RELAY16_InitDebugLists(void)
108 OBJECT_ATTRIBUTES attr;
109 UNICODE_STRING name;
110 char buffer[1024];
111 HANDLE root, hkey;
112 DWORD count;
113 WCHAR *str;
114 static const WCHAR configW[] = {'S','o','f','t','w','a','r','e','\\',
115 'W','i','n','e','\\',
116 'D','e','b','u','g',0};
117 static const WCHAR RelayIncludeW[] = {'R','e','l','a','y','I','n','c','l','u','d','e',0};
118 static const WCHAR RelayExcludeW[] = {'R','e','l','a','y','E','x','c','l','u','d','e',0};
119 static const WCHAR SnoopIncludeW[] = {'S','n','o','o','p','I','n','c','l','u','d','e',0};
120 static const WCHAR SnoopExcludeW[] = {'S','n','o','o','p','E','x','c','l','u','d','e',0};
122 RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
123 attr.Length = sizeof(attr);
124 attr.RootDirectory = root;
125 attr.ObjectName = &name;
126 attr.Attributes = 0;
127 attr.SecurityDescriptor = NULL;
128 attr.SecurityQualityOfService = NULL;
129 RtlInitUnicodeString( &name, configW );
131 /* @@ Wine registry key: HKCU\Software\Wine\Debug */
132 if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) hkey = 0;
133 NtClose( root );
134 if (!hkey) return;
136 str = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)buffer)->Data;
137 RtlInitUnicodeString( &name, RelayIncludeW );
138 if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
140 debug_relay_includelist = build_list( str );
143 RtlInitUnicodeString( &name, RelayExcludeW );
144 if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
146 debug_relay_excludelist = build_list( str );
149 RtlInitUnicodeString( &name, SnoopIncludeW );
150 if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
152 debug_snoop_includelist = build_list( str );
155 RtlInitUnicodeString( &name, SnoopExcludeW );
156 if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
158 debug_snoop_excludelist = build_list( str );
160 NtClose( hkey );
164 /***********************************************************************
165 * check_list
167 * Check if a given module and function is in the list.
169 static BOOL check_list( const char *module, int ordinal, const char *func, const WCHAR **list )
171 char ord_str[10];
173 sprintf( ord_str, "%d", ordinal );
174 for(; *list; list++)
176 const WCHAR *p = strrchrW( *list, '.' );
177 if (p && p > *list) /* check module and function */
179 int len = p - *list;
180 if (strncmpiAW( module, *list, len-1 ) || module[len]) continue;
181 if (p[1] == '*' && !p[2]) return TRUE;
182 if (!strcmpiAW( ord_str, p + 1 )) return TRUE;
183 if (func && !strcmpiAW( func, p + 1 )) return TRUE;
185 else /* function only */
187 if (func && !strcmpiAW( func, *list )) return TRUE;
190 return FALSE;
194 /***********************************************************************
195 * RELAY_ShowDebugmsgRelay
197 * Simple function to decide if a particular debugging message is
198 * wanted.
200 static BOOL RELAY_ShowDebugmsgRelay(const char *module, int ordinal, const char *func)
202 if (debug_relay_excludelist && check_list( module, ordinal, func, debug_relay_excludelist ))
203 return FALSE;
204 if (debug_relay_includelist && !check_list( module, ordinal, func, debug_relay_includelist ))
205 return FALSE;
206 return TRUE;
210 /***********************************************************************
211 * SNOOP16_ShowDebugmsgSnoop
213 * Simple function to decide if a particular debugging message is
214 * wanted.
216 int SNOOP16_ShowDebugmsgSnoop(const char *module, int ordinal, const char *func)
218 if (debug_snoop_excludelist && check_list( module, ordinal, func, debug_snoop_excludelist ))
219 return FALSE;
220 if (debug_snoop_includelist && !check_list( module, ordinal, func, debug_snoop_includelist ))
221 return FALSE;
222 return TRUE;
226 /***********************************************************************
227 * get_entry_point
229 * Return the ordinal, name, and type info corresponding to a CS:IP address.
231 static const CALLFROM16 *get_entry_point( STACK16FRAME *frame, LPSTR module, LPSTR func, WORD *pOrd )
233 WORD i, max_offset;
234 register BYTE *p;
235 NE_MODULE *pModule;
236 ET_BUNDLE *bundle;
237 ET_ENTRY *entry;
239 if (!(pModule = NE_GetPtr( FarGetOwner16( GlobalHandle16( frame->module_cs ) ))))
240 return NULL;
242 max_offset = 0;
243 *pOrd = 0;
244 bundle = (ET_BUNDLE *)((BYTE *)pModule + pModule->ne_enttab);
247 entry = (ET_ENTRY *)((BYTE *)bundle+6);
248 for (i = bundle->first + 1; i <= bundle->last; i++)
250 if ((entry->offs < frame->entry_ip)
251 && (entry->segnum == 1) /* code segment ? */
252 && (entry->offs >= max_offset))
254 max_offset = entry->offs;
255 *pOrd = i;
257 entry++;
259 } while ( (bundle->next)
260 && (bundle = (ET_BUNDLE *)((BYTE *)pModule+bundle->next)));
262 /* Search for the name in the resident names table */
263 /* (built-in modules have no non-resident table) */
265 p = (BYTE *)pModule + pModule->ne_restab;
266 memcpy( module, p + 1, *p );
267 module[*p] = 0;
269 while (*p)
271 p += *p + 1 + sizeof(WORD);
272 if (*(WORD *)(p + *p + 1) == *pOrd) break;
274 memcpy( func, p + 1, *p );
275 func[*p] = 0;
277 /* Retrieve entry point call structure */
278 p = MapSL( MAKESEGPTR( frame->module_cs, frame->callfrom_ip ) );
279 /* p now points to lret, get the start of CALLFROM16 structure */
280 return (CALLFROM16 *)(p - (BYTE *)&((CALLFROM16 *)0)->lret);
284 typedef int (*CDECL_PROC)();
285 typedef int (WINAPI *STDCALL_PROC)();
287 /***********************************************************************
288 * call_cdecl_function
290 static int call_cdecl_function( CDECL_PROC func, int nb_args, const int *args )
292 int ret;
293 switch(nb_args)
295 case 0: ret = func(); break;
296 case 1: ret = func(args[0]); break;
297 case 2: ret = func(args[0],args[1]); break;
298 case 3: ret = func(args[0],args[1],args[2]); break;
299 case 4: ret = func(args[0],args[1],args[2],args[3]); break;
300 case 5: ret = func(args[0],args[1],args[2],args[3],args[4]); break;
301 case 6: ret = func(args[0],args[1],args[2],args[3],args[4],
302 args[5]); break;
303 case 7: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
304 args[6]); break;
305 case 8: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
306 args[6],args[7]); break;
307 case 9: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
308 args[6],args[7],args[8]); break;
309 case 10: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
310 args[6],args[7],args[8],args[9]); break;
311 case 11: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
312 args[6],args[7],args[8],args[9],args[10]); break;
313 case 12: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
314 args[6],args[7],args[8],args[9],args[10],
315 args[11]); break;
316 case 13: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
317 args[6],args[7],args[8],args[9],args[10],args[11],
318 args[12]); break;
319 case 14: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
320 args[6],args[7],args[8],args[9],args[10],args[11],
321 args[12],args[13]); break;
322 case 15: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
323 args[6],args[7],args[8],args[9],args[10],args[11],
324 args[12],args[13],args[14]); break;
325 case 16: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
326 args[6],args[7],args[8],args[9],args[10],args[11],
327 args[12],args[13],args[14],args[15]); break;
328 case 17: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
329 args[6],args[7],args[8],args[9],args[10],args[11],
330 args[12],args[13],args[14],args[15],args[16]); break;
331 case 18: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
332 args[6],args[7],args[8],args[9],args[10],args[11],
333 args[12],args[13],args[14],args[15],args[16],
334 args[17]); break;
335 default:
336 ERR( "Unsupported nb of args %d\n", nb_args );
337 assert(FALSE);
338 ret = 0;
339 break;
341 return ret;
345 /***********************************************************************
346 * call_stdcall_function
348 static inline int call_stdcall_function( STDCALL_PROC func, int nb_args, const int *args )
350 int ret;
351 switch(nb_args)
353 case 0: ret = func(); break;
354 case 1: ret = func(args[0]); break;
355 case 2: ret = func(args[0],args[1]); break;
356 case 3: ret = func(args[0],args[1],args[2]); break;
357 case 4: ret = func(args[0],args[1],args[2],args[3]); break;
358 case 5: ret = func(args[0],args[1],args[2],args[3],args[4]); break;
359 case 6: ret = func(args[0],args[1],args[2],args[3],args[4],
360 args[5]); break;
361 case 7: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
362 args[6]); break;
363 case 8: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
364 args[6],args[7]); break;
365 case 9: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
366 args[6],args[7],args[8]); break;
367 case 10: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
368 args[6],args[7],args[8],args[9]); break;
369 case 11: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
370 args[6],args[7],args[8],args[9],args[10]); break;
371 case 12: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
372 args[6],args[7],args[8],args[9],args[10],
373 args[11]); break;
374 case 13: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
375 args[6],args[7],args[8],args[9],args[10],args[11],
376 args[12]); break;
377 case 14: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
378 args[6],args[7],args[8],args[9],args[10],args[11],
379 args[12],args[13]); break;
380 case 15: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
381 args[6],args[7],args[8],args[9],args[10],args[11],
382 args[12],args[13],args[14]); break;
383 case 16: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
384 args[6],args[7],args[8],args[9],args[10],args[11],
385 args[12],args[13],args[14],args[15]); break;
386 case 17: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
387 args[6],args[7],args[8],args[9],args[10],args[11],
388 args[12],args[13],args[14],args[15],args[16]); break;
389 case 18: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
390 args[6],args[7],args[8],args[9],args[10],args[11],
391 args[12],args[13],args[14],args[15],args[16],
392 args[17]); break;
393 default:
394 ERR( "Unsupported nb of args %d\n", nb_args );
395 assert(FALSE);
396 ret = 0;
397 break;
399 return ret;
403 /***********************************************************************
404 * relay_call_from_16_no_debug
406 * Same as relay_call_from_16 but doesn't print any debug information.
408 static int relay_call_from_16_no_debug( void *entry_point, unsigned char *args16, CONTEXT86 *context,
409 const CALLFROM16 *call )
411 int i, is_cdecl, nb_args, args32[20];
413 nb_args = 0;
414 is_cdecl = (call->lret == 0xcb66);
415 if (is_cdecl)
417 for (i = 0; i < 20; i++, nb_args++)
419 int type = (call->arg_types[i / 10] >> (3 * (i % 10))) & 7;
421 if (type == ARG_NONE) break;
422 switch(type)
424 case ARG_WORD:
425 args32[nb_args] = *(WORD *)args16;
426 args16 += sizeof(WORD);
427 break;
428 case ARG_SWORD:
429 args32[nb_args] = *(short *)args16;
430 args16 += sizeof(WORD);
431 break;
432 case ARG_LONG:
433 case ARG_SEGSTR:
434 args32[nb_args] = *(int *)args16;
435 args16 += sizeof(int);
436 break;
437 case ARG_PTR:
438 case ARG_STR:
439 args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
440 args16 += sizeof(SEGPTR);
441 break;
442 case ARG_VARARG:
443 args32[nb_args] = (int)args16;
444 break;
445 default:
446 break;
450 else /* not cdecl */
452 /* Start with the last arg */
453 args16 += call->nArgs;
454 for (i = 0; i < 20; i++, nb_args++)
456 int type = (call->arg_types[i / 10] >> (3 * (i % 10))) & 7;
458 if (type == ARG_NONE) break;
459 switch(type)
461 case ARG_WORD:
462 args16 -= sizeof(WORD);
463 args32[nb_args] = *(WORD *)args16;
464 break;
465 case ARG_SWORD:
466 args16 -= sizeof(WORD);
467 args32[nb_args] = *(short *)args16;
468 break;
469 case ARG_LONG:
470 case ARG_SEGSTR:
471 args16 -= sizeof(int);
472 args32[nb_args] = *(int *)args16;
473 break;
474 case ARG_PTR:
475 case ARG_STR:
476 args16 -= sizeof(SEGPTR);
477 args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
478 break;
479 default:
480 break;
485 if (call->arg_types[0] & ARG_REGISTER)
487 if (!nb_args) is_cdecl = 0; /* register funcs are stdcall by default */
488 args32[nb_args++] = (int)context;
491 SYSLEVEL_CheckNotLevel( 2 );
493 if (is_cdecl)
494 return call_cdecl_function( entry_point, nb_args, args32 );
495 else
496 return call_stdcall_function( entry_point, nb_args, args32 );
500 /***********************************************************************
501 * relay_call_from_16
503 * Replacement for the 16-bit relay functions when relay debugging is on.
505 int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT86 *context )
507 STACK16FRAME *frame;
508 WORD ordinal;
509 int i, is_cdecl, ret_val, nb_args, args32[20];
510 char module[10], func[64];
511 const CALLFROM16 *call;
513 frame = CURRENT_STACK16;
514 call = get_entry_point( frame, module, func, &ordinal );
515 if (!TRACE_ON(relay) || !RELAY_ShowDebugmsgRelay( module, ordinal, func ))
516 return relay_call_from_16_no_debug( entry_point, args16, context, call );
518 DPRINTF( "%04lx:Call %s.%d: %s(",GetCurrentThreadId(), module, ordinal, func );
520 nb_args = 0;
521 is_cdecl = (call->lret == 0xcb66);
522 if (is_cdecl)
524 for (i = 0; i < 20; i++, nb_args++)
526 int type = (call->arg_types[i / 10] >> (3 * (i % 10))) & 7;
528 if (type == ARG_NONE) break;
529 if (i) DPRINTF( "," );
530 switch(type)
532 case ARG_WORD:
533 DPRINTF( "%04x", *(WORD *)args16 );
534 args32[nb_args] = *(WORD *)args16;
535 args16 += sizeof(WORD);
536 break;
537 case ARG_SWORD:
538 DPRINTF( "%04x", *(WORD *)args16 );
539 args32[nb_args] = *(short *)args16;
540 args16 += sizeof(WORD);
541 break;
542 case ARG_LONG:
543 DPRINTF( "%08x", *(int *)args16 );
544 args32[nb_args] = *(int *)args16;
545 args16 += sizeof(int);
546 break;
547 case ARG_PTR:
548 DPRINTF( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
549 args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
550 args16 += sizeof(SEGPTR);
551 break;
552 case ARG_STR:
553 DPRINTF( "%08x %s", *(int *)args16,
554 debugstr_a( MapSL(*(SEGPTR *)args16 )));
555 args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
556 args16 += sizeof(int);
557 break;
558 case ARG_SEGSTR:
559 DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16,
560 debugstr_a( MapSL(*(SEGPTR *)args16 )) );
561 args32[nb_args] = *(SEGPTR *)args16;
562 args16 += sizeof(SEGPTR);
563 break;
564 case ARG_VARARG:
565 DPRINTF( "..." );
566 args32[nb_args] = (int)args16;
567 break;
568 default:
569 break;
573 else /* not cdecl */
575 /* Start with the last arg */
576 args16 += call->nArgs;
577 for (i = 0; i < 20; i++, nb_args++)
579 int type = (call->arg_types[i / 10] >> (3 * (i % 10))) & 7;
581 if (type == ARG_NONE) break;
582 if (i) DPRINTF( "," );
583 switch(type)
585 case ARG_WORD:
586 args16 -= sizeof(WORD);
587 args32[nb_args] = *(WORD *)args16;
588 DPRINTF( "%04x", *(WORD *)args16 );
589 break;
590 case ARG_SWORD:
591 args16 -= sizeof(WORD);
592 args32[nb_args] = *(short *)args16;
593 DPRINTF( "%04x", *(WORD *)args16 );
594 break;
595 case ARG_LONG:
596 args16 -= sizeof(int);
597 args32[nb_args] = *(int *)args16;
598 DPRINTF( "%08x", *(int *)args16 );
599 break;
600 case ARG_PTR:
601 args16 -= sizeof(SEGPTR);
602 args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
603 DPRINTF( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
604 break;
605 case ARG_STR:
606 args16 -= sizeof(int);
607 args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
608 DPRINTF( "%08x %s", *(int *)args16,
609 debugstr_a( MapSL(*(SEGPTR *)args16 )));
610 break;
611 case ARG_SEGSTR:
612 args16 -= sizeof(SEGPTR);
613 args32[nb_args] = *(SEGPTR *)args16;
614 DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16,
615 debugstr_a( MapSL(*(SEGPTR *)args16 )) );
616 break;
617 case ARG_VARARG:
618 DPRINTF( "..." );
619 args32[nb_args] = (int)args16;
620 break;
621 default:
622 break;
627 DPRINTF( ") ret=%04x:%04x ds=%04x\n", frame->cs, frame->ip, frame->ds );
629 if (call->arg_types[0] & ARG_REGISTER)
631 if (!nb_args) is_cdecl = 0; /* register funcs are stdcall by default */
632 args32[nb_args++] = (int)context;
633 DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
634 (WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
635 (WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
636 (WORD)context->SegEs, context->EFlags );
639 SYSLEVEL_CheckNotLevel( 2 );
641 if (is_cdecl)
642 ret_val = call_cdecl_function( entry_point, nb_args, args32 );
643 else
644 ret_val = call_stdcall_function( entry_point, nb_args, args32 );
646 SYSLEVEL_CheckNotLevel( 2 );
648 DPRINTF( "%04lx:Ret %s.%d: %s() ",GetCurrentThreadId(), module, ordinal, func );
649 if (call->arg_types[0] & ARG_REGISTER)
651 DPRINTF("retval=none ret=%04x:%04x ds=%04x\n",
652 (WORD)context->SegCs, LOWORD(context->Eip), (WORD)context->SegDs);
653 DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
654 (WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
655 (WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
656 (WORD)context->SegEs, context->EFlags );
658 else
660 frame = CURRENT_STACK16; /* might have be changed by the entry point */
661 if (call->arg_types[0] & ARG_RET16)
662 DPRINTF( "retval=%04x ret=%04x:%04x ds=%04x\n",
663 ret_val & 0xffff, frame->cs, frame->ip, frame->ds );
664 else
665 DPRINTF( "retval=%08x ret=%04x:%04x ds=%04x\n",
666 ret_val, frame->cs, frame->ip, frame->ds );
668 return ret_val;
671 #else /* __i386__ */
674 * Stubs for the CallTo16/CallFrom16 routines on non-Intel architectures
675 * (these will never be called but need to be present to satisfy the linker ...)
678 /***********************************************************************
679 * __wine_call_from_16_word (KERNEL32.@)
681 WORD __wine_call_from_16_word()
683 assert( FALSE );
686 /***********************************************************************
687 * __wine_call_from_16_long (KERNEL32.@)
689 LONG __wine_call_from_16_long()
691 assert( FALSE );
694 /***********************************************************************
695 * __wine_call_from_16_regs (KERNEL32.@)
697 void __wine_call_from_16_regs()
699 assert( FALSE );
702 DWORD WINAPI CALL32_CBClient( FARPROC proc, LPWORD args, DWORD *esi )
703 { assert( FALSE ); }
705 DWORD WINAPI CALL32_CBClientEx( FARPROC proc, LPWORD args, DWORD *esi, INT *nArgs )
706 { assert( FALSE ); }
708 #endif /* __i386__ */