From 827a69f8cac635f5ecb8344ccba6b7e81fa6e299 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 16 May 2005 14:20:16 +0000 Subject: [PATCH] Avoid referencing stackframe.h from outside kernel32. --- dlls/dbghelp/stack.c | 2 +- dlls/user/winproc.c | 45 +++++++++++++++++++++------------------- dlls/user/wnd16.c | 4 ++-- programs/winedbg/stack.c | 2 +- tools/winebuild/relay.c | 2 +- tools/winebuild/spec16.c | 2 +- 6 files changed, 30 insertions(+), 27 deletions(-) diff --git a/dlls/dbghelp/stack.c b/dlls/dbghelp/stack.c index a95e4b2c5c0..cb18576d926 100644 --- a/dlls/dbghelp/stack.c +++ b/dlls/dbghelp/stack.c @@ -32,8 +32,8 @@ #include "ntstatus.h" #include "thread.h" /* FIXME: must be included before winternl.h */ #include "winternl.h" +#include "wine/winbase16.h" #include "wine/debug.h" -#include "stackframe.h" WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); diff --git a/dlls/user/winproc.c b/dlls/user/winproc.c index 1e1467094aa..dcc00c9d648 100644 --- a/dlls/user/winproc.c +++ b/dlls/user/winproc.c @@ -31,7 +31,6 @@ #include "wownt32.h" #include "wine/winbase16.h" #include "wine/winuser16.h" -#include "stackframe.h" #include "controls.h" #include "win.h" #include "winproc.h" @@ -432,9 +431,17 @@ static LRESULT WINAPI WINPROC_CallWndProc16( WNDPROC16 proc, HWND16 hwnd, LPARAM lParam ) { CONTEXT86 context; - LRESULT ret; - WORD args[5]; - DWORD offset = 0; + size_t size = 0; + struct + { + WORD params[5]; + union + { + CREATESTRUCT16 cs16; + DRAWITEMSTRUCT16 dis16; + COMPAREITEMSTRUCT16 cis16; + } u; + } args; USER_CheckNotLock(); @@ -461,30 +468,26 @@ static LRESULT WINAPI WINPROC_CallWndProc16( WNDPROC16 proc, HWND16 hwnd, { case WM_CREATE: case WM_NCCREATE: - offset = sizeof(CREATESTRUCT16); break; + size = sizeof(CREATESTRUCT16); break; case WM_DRAWITEM: - offset = sizeof(DRAWITEMSTRUCT16); break; + size = sizeof(DRAWITEMSTRUCT16); break; case WM_COMPAREITEM: - offset = sizeof(COMPAREITEMSTRUCT16); break; + size = sizeof(COMPAREITEMSTRUCT16); break; } - if (offset) + if (size) { - void *s = MapSL(lParam); - lParam = stack16_push( offset ); - memcpy( MapSL(lParam), s, offset ); + memcpy( &args.u, MapSL(lParam), size ); + lParam = (SEGPTR)NtCurrentTeb()->WOW32Reserved - size; } } - args[4] = hwnd; - args[3] = msg; - args[2] = wParam; - args[1] = HIWORD(lParam); - args[0] = LOWORD(lParam); - WOWCallback16Ex( 0, WCB16_REGS, sizeof(args), args, (DWORD *)&context ); - ret = MAKELONG( LOWORD(context.Eax), LOWORD(context.Edx) ); - - if (offset) stack16_pop( offset ); - return ret; + args.params[4] = hwnd; + args.params[3] = msg; + args.params[2] = wParam; + args.params[1] = HIWORD(lParam); + args.params[0] = LOWORD(lParam); + WOWCallback16Ex( 0, WCB16_REGS, sizeof(args.params) + size, &args, (DWORD *)&context ); + return MAKELONG( LOWORD(context.Eax), LOWORD(context.Edx) ); } diff --git a/dlls/user/wnd16.c b/dlls/user/wnd16.c index 1042a5a6cde..20a09022705 100644 --- a/dlls/user/wnd16.c +++ b/dlls/user/wnd16.c @@ -22,7 +22,6 @@ #include "wownt32.h" #include "win.h" #include "winproc.h" -#include "stackframe.h" #include "user_private.h" /* handle <--> handle16 conversions */ @@ -357,7 +356,8 @@ HWND16 WINAPI GetParent16( HWND16 hwnd ) */ BOOL16 WINAPI IsWindow16( HWND16 hwnd ) { - CURRENT_STACK16->es = USER_HeapSel; + STACK16FRAME *frame = MapSL( (SEGPTR)NtCurrentTeb()->WOW32Reserved ); + frame->es = USER_HeapSel; /* don't use WIN_Handle32 here, we don't care about the full handle */ return IsWindow( HWND_32(hwnd) ); } diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c index b41fe605116..a7645561931 100644 --- a/programs/winedbg/stack.c +++ b/programs/winedbg/stack.c @@ -25,8 +25,8 @@ #include #include "debugger.h" -#include "stackframe.h" #include "winbase.h" +#include "wine/winbase16.h" #include "wine/debug.h" #include "tlhelp32.h" diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c index 8805b8b95b6..0747da4cfc5 100644 --- a/tools/winebuild/relay.c +++ b/tools/winebuild/relay.c @@ -28,7 +28,7 @@ #include #include "thread.h" -#include "stackframe.h" +#include "wine/winbase16.h" #include "build.h" diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c index e9584b5f569..41395dcc0fe 100644 --- a/tools/winebuild/spec16.c +++ b/tools/winebuild/spec16.c @@ -29,7 +29,7 @@ #include #include "wine/exception.h" -#include "stackframe.h" +#include "wine/winbase16.h" #include "module.h" #include "build.h"