relay16.c 19.2 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1
/*
Alexandre Julliard's avatar
Alexandre Julliard committed
2 3
 * Copyright 1993 Robert J. Amstadt
 * Copyright 1995 Alexandre Julliard
4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Alexandre Julliard's avatar
Alexandre Julliard committed
18
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
19

20 21 22
#include "config.h"
#include "wine/port.h"

Alexandre Julliard's avatar
Alexandre Julliard committed
23
#include <assert.h>
Alexandre Julliard's avatar
Alexandre Julliard committed
24
#include <stdlib.h>
25
#include <string.h>
26
#include <stdarg.h>
27 28
#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"
Alexandre Julliard's avatar
Alexandre Julliard committed
38

39
WINE_DEFAULT_DEBUG_CHANNEL(relay);
40

41 42 43 44 45 46 47
#ifdef __i386__

static const WCHAR **debug_relay_excludelist;
static const WCHAR **debug_relay_includelist;
static const WCHAR **debug_snoop_excludelist;
static const WCHAR **debug_snoop_includelist;

48
/* compare an ASCII and a Unicode string without depending on the current codepage */
49
static inline int strcmpiAW( const char *strA, const WCHAR *strW )
50 51 52 53 54
{
    while (*strA && (toupperW((unsigned char)*strA) == toupperW(*strW))) { strA++; strW++; }
    return toupperW((unsigned char)*strA) - toupperW(*strW);
}

55
/* compare an ASCII and a Unicode string without depending on the current codepage */
56
static inline int strncmpiAW( const char *strA, const WCHAR *strW, int n )
57
{
58 59 60 61
    int ret = 0;
    for ( ; n > 0; n--, strA++, strW++)
        if ((ret = toupperW((unsigned char)*strA) - toupperW(*strW)) || !*strA) break;
    return ret;
62 63 64
}

/***********************************************************************
65 66 67
 *           build_list
 *
 * Build a function list from a ';'-separated string.
68
 */
69
static const WCHAR **build_list( const WCHAR *buffer )
70
{
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
    int count = 1;
    const WCHAR *p = buffer;
    const WCHAR **ret;

    while ((p = strchrW( p, ';' )))
    {
        count++;
        p++;
    }
    /* allocate count+1 pointers, plus the space for a copy of the string */
    if ((ret = RtlAllocateHeap( GetProcessHeap(), 0,
                                (count+1) * sizeof(WCHAR*) + (strlenW(buffer)+1) * sizeof(WCHAR) )))
    {
        WCHAR *str = (WCHAR *)(ret + count + 1);
        WCHAR *p = str;

        strcpyW( str, buffer );
        count = 0;
        for (;;)
        {
            ret[count++] = p;
            if (!(p = strchrW( p, ';' ))) break;
            *p++ = 0;
        }
        ret[count++] = NULL;
    }
    return ret;
98 99
}

100

101
/***********************************************************************
102 103 104
 *           RELAY16_InitDebugLists
 *
 * Build the relay include/exclude function lists.
105
 */
106
void RELAY16_InitDebugLists(void)
107
{
108 109 110
    OBJECT_ATTRIBUTES attr;
    UNICODE_STRING name;
    char buffer[1024];
111
    HANDLE root, hkey;
112 113
    DWORD count;
    WCHAR *str;
114
    static const WCHAR configW[] = {'S','o','f','t','w','a','r','e','\\',
115 116 117 118 119 120 121
                                    'W','i','n','e','\\',
                                    'D','e','b','u','g',0};
    static const WCHAR RelayIncludeW[] = {'R','e','l','a','y','I','n','c','l','u','d','e',0};
    static const WCHAR RelayExcludeW[] = {'R','e','l','a','y','E','x','c','l','u','d','e',0};
    static const WCHAR SnoopIncludeW[] = {'S','n','o','o','p','I','n','c','l','u','d','e',0};
    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 126 127 128 129 130
    attr.ObjectName = &name;
    attr.Attributes = 0;
    attr.SecurityDescriptor = NULL;
    attr.SecurityQualityOfService = NULL;
    RtlInitUnicodeString( &name, configW );

131 132 133 134
    /* @@ Wine registry key: HKCU\Software\Wine\Debug */
    if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) hkey = 0;
    NtClose( root );
    if (!hkey) return;
135 136 137 138 139 140 141

    str = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)buffer)->Data;
    RtlInitUnicodeString( &name, RelayIncludeW );
    if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
    {
        debug_relay_includelist = build_list( str );
    }
142

143 144 145 146 147
    RtlInitUnicodeString( &name, RelayExcludeW );
    if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
    {
        debug_relay_excludelist = build_list( str );
    }
148

149 150 151 152 153
    RtlInitUnicodeString( &name, SnoopIncludeW );
    if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
    {
        debug_snoop_includelist = build_list( str );
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
154

155 156 157 158 159 160
    RtlInitUnicodeString( &name, SnoopExcludeW );
    if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
    {
        debug_snoop_excludelist = build_list( str );
    }
    NtClose( hkey );
161 162
}

163

164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
/***********************************************************************
 *           check_list
 *
 * Check if a given module and function is in the list.
 */
static BOOL check_list( const char *module, int ordinal, const char *func, const WCHAR **list )
{
    char ord_str[10];

    sprintf( ord_str, "%d", ordinal );
    for(; *list; list++)
    {
        const WCHAR *p = strrchrW( *list, '.' );
        if (p && p > *list)  /* check module and function */
        {
            int len = p - *list;
            if (strncmpiAW( module, *list, len-1 ) || module[len]) continue;
            if (p[1] == '*' && !p[2]) return TRUE;
            if (!strcmpiAW( ord_str, p + 1 )) return TRUE;
            if (func && !strcmpiAW( func, p + 1 )) return TRUE;
        }
        else  /* function only */
        {
            if (func && !strcmpiAW( func, *list )) return TRUE;
        }
    }
    return FALSE;
}


194 195 196 197 198 199
/***********************************************************************
 *           RELAY_ShowDebugmsgRelay
 *
 * Simple function to decide if a particular debugging message is
 * wanted.
 */
200
static BOOL RELAY_ShowDebugmsgRelay(const char *module, int ordinal, const char *func)
201
{
202 203 204 205 206
    if (debug_relay_excludelist && check_list( module, ordinal, func, debug_relay_excludelist ))
        return FALSE;
    if (debug_relay_includelist && !check_list( module, ordinal, func, debug_relay_includelist ))
        return FALSE;
    return TRUE;
207
}
Alexandre Julliard's avatar
Alexandre Julliard committed
208

209

210 211 212 213 214 215
/***********************************************************************
 *          SNOOP16_ShowDebugmsgSnoop
 *
 * Simple function to decide if a particular debugging message is
 * wanted.
 */
216
int SNOOP16_ShowDebugmsgSnoop(const char *module, int ordinal, const char *func)
217
{
218 219 220 221 222
    if (debug_snoop_excludelist && check_list( module, ordinal, func, debug_snoop_excludelist ))
        return FALSE;
    if (debug_snoop_includelist && !check_list( module, ordinal, func, debug_snoop_includelist ))
        return FALSE;
    return TRUE;
223 224 225
}


226 227 228 229 230
/***********************************************************************
 *           get_entry_point
 *
 * 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 )
232 233 234 235 236 237 238
{
    WORD i, max_offset;
    register BYTE *p;
    NE_MODULE *pModule;
    ET_BUNDLE *bundle;
    ET_ENTRY *entry;

Mike McCormack's avatar
Mike McCormack committed
239
    *pOrd = 0;
240 241 242 243
    if (!(pModule = NE_GetPtr( FarGetOwner16( GlobalHandle16( frame->module_cs ) ))))
        return NULL;

    max_offset = 0;
244
    bundle = (ET_BUNDLE *)((BYTE *)pModule + pModule->ne_enttab);
245
    do
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
    {
        entry = (ET_ENTRY *)((BYTE *)bundle+6);
	for (i = bundle->first + 1; i <= bundle->last; i++)
        {
	    if ((entry->offs < frame->entry_ip)
	    && (entry->segnum == 1) /* code segment ? */
	    && (entry->offs >= max_offset))
            {
		max_offset = entry->offs;
		*pOrd = i;
            }
	    entry++;
        }
    } while ( (bundle->next)
	   && (bundle = (ET_BUNDLE *)((BYTE *)pModule+bundle->next)));

    /* Search for the name in the resident names table */
    /* (built-in modules have no non-resident table)   */
264

265
    p = (BYTE *)pModule + pModule->ne_restab;
266 267 268
    memcpy( module, p + 1, *p );
    module[*p] = 0;

269 270 271 272 273
    while (*p)
    {
        p += *p + 1 + sizeof(WORD);
        if (*(WORD *)(p + *p + 1) == *pOrd) break;
    }
274 275
    memcpy( func, p + 1, *p );
    func[*p] = 0;
276 277 278 279

    /* Retrieve entry point call structure */
    p = MapSL( MAKESEGPTR( frame->module_cs, frame->callfrom_ip ) );
    /* p now points to lret, get the start of CALLFROM16 structure */
280
    return (CALLFROM16 *)(p - (BYTE *)&((CALLFROM16 *)0)->ret);
281 282 283
}


284 285 286 287
extern int call_entry_point( void *func, int nb_args, const int *args );
__ASM_GLOBAL_FUNC( call_entry_point,
                   "\tpushl %ebp\n"
                   "\tmovl %esp,%ebp\n"
288 289 290 291 292 293 294
                   "\tpushl %esi\n"
                   "\tpushl %edi\n"
                   "\tmovl 12(%ebp),%edx\n"
                   "\tshll $2,%edx\n"
                   "\tjz 1f\n"
                   "\tsubl %edx,%esp\n"
                   "\tandl $~15,%esp\n"
295
                   "\tmovl 12(%ebp),%ecx\n"
296 297 298 299
                   "\tmovl 16(%ebp),%esi\n"
                   "\tmovl %esp,%edi\n"
                   "\tcld\n"
                   "\trep; movsl\n"
300
                   "1:\tcall *8(%ebp)\n"
301 302 303 304
                   "\tleal -8(%ebp),%esp\n"
                   "\tpopl %edi\n"
                   "\tpopl %esi\n"
                   "\tpopl %ebp\n"
305
                   "\tret" )
306 307 308 309 310 311 312 313 314 315


/***********************************************************************
 *           relay_call_from_16_no_debug
 *
 * Same as relay_call_from_16 but doesn't print any debug information.
 */
static int relay_call_from_16_no_debug( void *entry_point, unsigned char *args16, CONTEXT86 *context,
                                        const CALLFROM16 *call )
{
316 317
    unsigned int i, j, nb_args = 0;
    int args32[20];
318

319 320 321 322 323
    /* look for the ret instruction */
    for (j = 0; j < sizeof(call->ret)/sizeof(call->ret[0]); j++)
        if (call->ret[j] == 0xca66 || call->ret[j] == 0xcb66) break;

    if (call->ret[j] == 0xcb66)  /* cdecl */
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
    {
        for (i = 0; i < 20; i++, nb_args++)
        {
            int type = (call->arg_types[i / 10] >> (3 * (i % 10))) & 7;

            if (type == ARG_NONE) break;
            switch(type)
            {
            case ARG_WORD:
                args32[nb_args] = *(WORD *)args16;
                args16 += sizeof(WORD);
                break;
            case ARG_SWORD:
                args32[nb_args] = *(short *)args16;
                args16 += sizeof(WORD);
                break;
            case ARG_LONG:
            case ARG_SEGSTR:
                args32[nb_args] = *(int *)args16;
                args16 += sizeof(int);
                break;
            case ARG_PTR:
            case ARG_STR:
                args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
                args16 += sizeof(SEGPTR);
                break;
            case ARG_VARARG:
                args32[nb_args] = (int)args16;
                break;
            default:
                break;
            }
        }
    }
    else  /* not cdecl */
    {
        /* Start with the last arg */
361
        args16 += call->ret[j + 1];
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
        for (i = 0; i < 20; i++, nb_args++)
        {
            int type = (call->arg_types[i / 10] >> (3 * (i % 10))) & 7;

            if (type == ARG_NONE) break;
            switch(type)
            {
            case ARG_WORD:
                args16 -= sizeof(WORD);
                args32[nb_args] = *(WORD *)args16;
                break;
            case ARG_SWORD:
                args16 -= sizeof(WORD);
                args32[nb_args] = *(short *)args16;
                break;
            case ARG_LONG:
            case ARG_SEGSTR:
                args16 -= sizeof(int);
                args32[nb_args] = *(int *)args16;
                break;
            case ARG_PTR:
            case ARG_STR:
                args16 -= sizeof(SEGPTR);
                args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
                break;
            default:
                break;
            }
        }
    }

393 394
    if (!j)  /* register function */
        args32[nb_args++] = (int)context;
395 396 397

    SYSLEVEL_CheckNotLevel( 2 );

398
    return call_entry_point( entry_point, nb_args, args32 );
399 400 401
}


Alexandre Julliard's avatar
Alexandre Julliard committed
402
/***********************************************************************
403 404 405
 *           relay_call_from_16
 *
 * Replacement for the 16-bit relay functions when relay debugging is on.
Alexandre Julliard's avatar
Alexandre Julliard committed
406
 */
407
int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT86 *context )
Alexandre Julliard's avatar
Alexandre Julliard committed
408
{
Alexandre Julliard's avatar
Alexandre Julliard committed
409
    STACK16FRAME *frame;
Alexandre Julliard's avatar
Alexandre Julliard committed
410
    WORD ordinal;
411 412
    unsigned int i, j, nb_args = 0;
    int ret_val, args32[20];
413
    char module[10], func[64];
414
    const CALLFROM16 *call;
Alexandre Julliard's avatar
Alexandre Julliard committed
415 416

    frame = CURRENT_STACK16;
417
    call = get_entry_point( frame, module, func, &ordinal );
418 419 420
    if (!TRACE_ON(relay) || !RELAY_ShowDebugmsgRelay( module, ordinal, func ))
        return relay_call_from_16_no_debug( entry_point, args16, context, call );

421
    DPRINTF( "%04x:Call %s.%d: %s(",GetCurrentThreadId(), module, ordinal, func );
Alexandre Julliard's avatar
Alexandre Julliard committed
422

423 424 425 426 427
    /* look for the ret instruction */
    for (j = 0; j < sizeof(call->ret)/sizeof(call->ret[0]); j++)
        if (call->ret[j] == 0xca66 || call->ret[j] == 0xcb66) break;

    if (call->ret[j] == 0xcb66)  /* cdecl */
Alexandre Julliard's avatar
Alexandre Julliard committed
428
    {
429
        for (i = 0; i < 20; i++, nb_args++)
Alexandre Julliard's avatar
Alexandre Julliard committed
430
        {
431 432 433 434 435
            int type = (call->arg_types[i / 10] >> (3 * (i % 10))) & 7;

            if (type == ARG_NONE) break;
            if (i) DPRINTF( "," );
            switch(type)
Alexandre Julliard's avatar
Alexandre Julliard committed
436
            {
437
            case ARG_WORD:
438 439 440 441
                DPRINTF( "%04x", *(WORD *)args16 );
                args32[nb_args] = *(WORD *)args16;
                args16 += sizeof(WORD);
                break;
442 443
            case ARG_SWORD:
                DPRINTF( "%04x", *(WORD *)args16 );
444
                args32[nb_args] = *(short *)args16;
445
                args16 += sizeof(WORD);
Alexandre Julliard's avatar
Alexandre Julliard committed
446
                break;
447 448
            case ARG_LONG:
                DPRINTF( "%08x", *(int *)args16 );
449
                args32[nb_args] = *(int *)args16;
450
                args16 += sizeof(int);
Alexandre Julliard's avatar
Alexandre Julliard committed
451
                break;
452
            case ARG_PTR:
Alexandre Julliard's avatar
Alexandre Julliard committed
453
                DPRINTF( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
454
                args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
455
                args16 += sizeof(SEGPTR);
Alexandre Julliard's avatar
Alexandre Julliard committed
456
                break;
457 458
            case ARG_STR:
                DPRINTF( "%08x %s", *(int *)args16,
459
                         debugstr_a( MapSL(*(SEGPTR *)args16 )));
460
                args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
461 462 463
                args16 += sizeof(int);
                break;
            case ARG_SEGSTR:
464
                DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16,
465
                         debugstr_a( MapSL(*(SEGPTR *)args16 )) );
466
                args32[nb_args] = *(SEGPTR *)args16;
467 468
                args16 += sizeof(SEGPTR);
                break;
469 470
            case ARG_VARARG:
                DPRINTF( "..." );
471
                args32[nb_args] = (int)args16;
472
                break;
473
            default:
Alexandre Julliard's avatar
Alexandre Julliard committed
474 475
                break;
            }
Alexandre Julliard's avatar
Alexandre Julliard committed
476 477
        }
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
478
    else  /* not cdecl */
Alexandre Julliard's avatar
Alexandre Julliard committed
479
    {
Alexandre Julliard's avatar
Alexandre Julliard committed
480
        /* Start with the last arg */
481
        args16 += call->ret[j + 1];
482
        for (i = 0; i < 20; i++, nb_args++)
Alexandre Julliard's avatar
Alexandre Julliard committed
483
        {
484
            int type = (call->arg_types[i / 10] >> (3 * (i % 10))) & 7;
Alexandre Julliard's avatar
Alexandre Julliard committed
485

486 487 488
            if (type == ARG_NONE) break;
            if (i) DPRINTF( "," );
            switch(type)
Alexandre Julliard's avatar
Alexandre Julliard committed
489
            {
490
            case ARG_WORD:
491 492 493 494
                args16 -= sizeof(WORD);
                args32[nb_args] = *(WORD *)args16;
                DPRINTF( "%04x", *(WORD *)args16 );
                break;
495 496
            case ARG_SWORD:
                args16 -= sizeof(WORD);
497
                args32[nb_args] = *(short *)args16;
498
                DPRINTF( "%04x", *(WORD *)args16 );
Alexandre Julliard's avatar
Alexandre Julliard committed
499
                break;
500 501
            case ARG_LONG:
                args16 -= sizeof(int);
502
                args32[nb_args] = *(int *)args16;
503
                DPRINTF( "%08x", *(int *)args16 );
Alexandre Julliard's avatar
Alexandre Julliard committed
504
                break;
505 506
            case ARG_PTR:
                args16 -= sizeof(SEGPTR);
507
                args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
Alexandre Julliard's avatar
Alexandre Julliard committed
508
                DPRINTF( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
Alexandre Julliard's avatar
Alexandre Julliard committed
509
                break;
510 511
            case ARG_STR:
                args16 -= sizeof(int);
512
                args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
513
                DPRINTF( "%08x %s", *(int *)args16,
514
                         debugstr_a( MapSL(*(SEGPTR *)args16 )));
Alexandre Julliard's avatar
Alexandre Julliard committed
515
                break;
516 517
            case ARG_SEGSTR:
                args16 -= sizeof(SEGPTR);
518
                args32[nb_args] = *(SEGPTR *)args16;
519
                DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16,
520
                         debugstr_a( MapSL(*(SEGPTR *)args16 )) );
521
                break;
522 523
            case ARG_VARARG:
                DPRINTF( "..." );
524
                args32[nb_args] = (int)args16;
525
                break;
526 527
            default:
                break;
Alexandre Julliard's avatar
Alexandre Julliard committed
528
            }
Alexandre Julliard's avatar
Alexandre Julliard committed
529
        }
Alexandre Julliard's avatar
Alexandre Julliard committed
530
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
531

Alexandre Julliard's avatar
Alexandre Julliard committed
532
    DPRINTF( ") ret=%04x:%04x ds=%04x\n", frame->cs, frame->ip, frame->ds );
Alexandre Julliard's avatar
Alexandre Julliard committed
533

534
    if (!j)  /* register function */
535 536
    {
        args32[nb_args++] = (int)context;
537
        DPRINTF("     AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08x\n",
538 539
                (WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
                (WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
540
                (WORD)context->SegEs, context->EFlags );
541
    }
542 543

    SYSLEVEL_CheckNotLevel( 2 );
Alexandre Julliard's avatar
Alexandre Julliard committed
544

545
    ret_val = call_entry_point( entry_point, nb_args, args32 );
Alexandre Julliard's avatar
Alexandre Julliard committed
546

547
    SYSLEVEL_CheckNotLevel( 2 );
548

549
    DPRINTF( "%04x:Ret  %s.%d: %s() ",GetCurrentThreadId(), module, ordinal, func );
550
    if (!j)  /* register function */
551
    {
Alexandre Julliard's avatar
Alexandre Julliard committed
552
        DPRINTF("retval=none ret=%04x:%04x ds=%04x\n",
553
                (WORD)context->SegCs, LOWORD(context->Eip), (WORD)context->SegDs);
554
        DPRINTF("     AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08x\n",
555 556
                (WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
                (WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
557
                (WORD)context->SegEs, context->EFlags );
Alexandre Julliard's avatar
Alexandre Julliard committed
558
    }
559 560
    else
    {
561
        frame = CURRENT_STACK16;  /* might have be changed by the entry point */
562
        if (j == 1)  /* 16-bit return sequence */
563 564 565 566 567
            DPRINTF( "retval=%04x ret=%04x:%04x ds=%04x\n",
                     ret_val & 0xffff, frame->cs, frame->ip, frame->ds );
        else
            DPRINTF( "retval=%08x ret=%04x:%04x ds=%04x\n",
                     ret_val, frame->cs, frame->ip, frame->ds );
568
    }
569
    return ret_val;
Alexandre Julliard's avatar
Alexandre Julliard committed
570
}
571 572 573 574 575 576 577 578 579 580 581

#else /* __i386__ */

/*
 * Stubs for the CallTo16/CallFrom16 routines on non-Intel architectures
 * (these will never be called but need to be present to satisfy the linker ...)
 */

/***********************************************************************
 *		__wine_call_from_16_regs (KERNEL32.@)
 */
582
void __wine_call_from_16_regs(void)
583 584 585 586 587 588 589 590 591 592 593
{
    assert( FALSE );
}

DWORD WINAPI CALL32_CBClient( FARPROC proc, LPWORD args, DWORD *esi )
{ assert( FALSE ); }

DWORD WINAPI CALL32_CBClientEx( FARPROC proc, LPWORD args, DWORD *esi, INT *nArgs )
{ assert( FALSE ); }

#endif  /* __i386__ */