diff --git a/dlls/kernel/atom16.c b/dlls/kernel/atom16.c index ff9521e7fe9..d38ea547911 100644 --- a/dlls/kernel/atom16.c +++ b/dlls/kernel/atom16.c @@ -42,7 +42,6 @@ #include "wine/unicode.h" #include "wine/winbase16.h" #include "kernel_private.h" -#include "stackframe.h" #include "wine/debug.h" diff --git a/dlls/kernel/debugger.c b/dlls/kernel/debugger.c index 8a6af21fb84..a648ccb922a 100644 --- a/dlls/kernel/debugger.c +++ b/dlls/kernel/debugger.c @@ -25,7 +25,7 @@ #include "wine/winbase16.h" #include "wine/server.h" #include "ntstatus.h" -#include "stackframe.h" +#include "kernel_private.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(debugstr); diff --git a/dlls/kernel/error16.c b/dlls/kernel/error16.c index 64aab0cb8b6..ceaed5b83e8 100644 --- a/dlls/kernel/error16.c +++ b/dlls/kernel/error16.c @@ -25,7 +25,7 @@ #include "windef.h" #include "winbase.h" -#include "stackframe.h" +#include "wine/winbase16.h" #include "wine/debug.h" diff --git a/dlls/kernel/global16.c b/dlls/kernel/global16.c index cb79d394f88..7ca503a7a8e 100644 --- a/dlls/kernel/global16.c +++ b/dlls/kernel/global16.c @@ -40,7 +40,6 @@ #include "wine/winbase16.h" #include "ntstatus.h" #include "toolhelp.h" -#include "stackframe.h" #include "kernel_private.h" #include "wine/debug.h" #include "winerror.h" diff --git a/dlls/kernel/kernel_main.c b/dlls/kernel/kernel_main.c index 727296fc090..9389ce58817 100644 --- a/dlls/kernel/kernel_main.c +++ b/dlls/kernel/kernel_main.c @@ -40,7 +40,6 @@ #include "wine/library.h" #include "module.h" #include "thread.h" -#include "stackframe.h" #include "wincon.h" #include "toolhelp.h" #include "kernel_private.h" diff --git a/dlls/kernel/kernel_private.h b/dlls/kernel/kernel_private.h index db82db3656c..de96d856ba7 100644 --- a/dlls/kernel/kernel_private.h +++ b/dlls/kernel/kernel_private.h @@ -21,6 +21,9 @@ #ifndef __WINE_KERNEL_PRIVATE_H #define __WINE_KERNEL_PRIVATE_H +#include "wine/winbase16.h" +#include "thread.h" + HANDLE WINAPI OpenConsoleW(LPCWSTR, DWORD, BOOL, DWORD); BOOL WINAPI VerifyConsoleIoHandle(HANDLE); HANDLE WINAPI DuplicateConsoleHandle(HANDLE, DWORD, BOOL, DWORD); @@ -44,6 +47,26 @@ static inline HANDLE console_handle_unmap(HANDLE h) return h != INVALID_HANDLE_VALUE ? (HANDLE)((DWORD)h ^ 3) : INVALID_HANDLE_VALUE; } +#define CURRENT_STACK16 ((STACK16FRAME*)MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved)) +#define CURRENT_DS (CURRENT_STACK16->ds) + +/* push bytes on the 16-bit stack of a thread; return a segptr to the first pushed byte */ +static inline SEGPTR stack16_push( int size ) +{ + STACK16FRAME *frame = CURRENT_STACK16; + memmove( (char*)frame - size, frame, sizeof(*frame) ); + NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved - size; + return (SEGPTR)((char *)NtCurrentTeb()->WOW32Reserved + sizeof(*frame)); +} + +/* pop bytes from the 16-bit stack of a thread */ +static inline void stack16_pop( int size ) +{ + STACK16FRAME *frame = CURRENT_STACK16; + memmove( (char*)frame + size, frame, sizeof(*frame) ); + NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved + size; +} + extern HMODULE kernel32_handle; /* Size of per-process table of DOS handles */ diff --git a/dlls/kernel/local16.c b/dlls/kernel/local16.c index eb205d9a7d0..c993207a792 100644 --- a/dlls/kernel/local16.c +++ b/dlls/kernel/local16.c @@ -36,7 +36,6 @@ #include "wine/winbase16.h" #include "wownt32.h" #include "module.h" -#include "stackframe.h" #include "toolhelp.h" #include "kernel_private.h" #include "wine/debug.h" diff --git a/dlls/kernel/ne_module.c b/dlls/kernel/ne_module.c index b3d0c90e3aa..95869dd6525 100644 --- a/dlls/kernel/ne_module.c +++ b/dlls/kernel/ne_module.c @@ -37,8 +37,8 @@ #include "wownt32.h" #include "module.h" #include "toolhelp.h" -#include "stackframe.h" #include "excpt.h" +#include "kernel_private.h" #include "wine/exception.h" #include "wine/debug.h" diff --git a/dlls/kernel/ne_segment.c b/dlls/kernel/ne_segment.c index 546724cf3ad..37e540576bb 100644 --- a/dlls/kernel/ne_segment.c +++ b/dlls/kernel/ne_segment.c @@ -38,7 +38,6 @@ #include "wine/library.h" #include "kernel_private.h" #include "module.h" -#include "stackframe.h" #include "toolhelp.h" #include "wine/debug.h" diff --git a/dlls/kernel/relay16.c b/dlls/kernel/relay16.c index 0dad6a0c3a1..2c2f5ff64f5 100644 --- a/dlls/kernel/relay16.c +++ b/dlls/kernel/relay16.c @@ -30,7 +30,6 @@ #include "winbase.h" #include "wine/winbase16.h" #include "module.h" -#include "stackframe.h" #include "kernel_private.h" #include "wine/unicode.h" #include "wine/library.h" diff --git a/dlls/kernel/snoop16.c b/dlls/kernel/snoop16.c index fdc2d121cd0..449fece5583 100644 --- a/dlls/kernel/snoop16.c +++ b/dlls/kernel/snoop16.c @@ -32,7 +32,6 @@ #include "wine/library.h" #include "kernel_private.h" #include "module.h" -#include "stackframe.h" #include "toolhelp.h" #include "wine/debug.h" diff --git a/dlls/kernel/system.c b/dlls/kernel/system.c index f3c7436ff08..b21c9132cd5 100644 --- a/dlls/kernel/system.c +++ b/dlls/kernel/system.c @@ -28,7 +28,7 @@ #include "wine/winbase16.h" #include "wine/winuser16.h" #include "wownt32.h" -#include "stackframe.h" +#include "kernel_private.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(system); diff --git a/dlls/kernel/task.c b/dlls/kernel/task.c index 3cfdba9738d..6adf0ba9ed5 100644 --- a/dlls/kernel/task.c +++ b/dlls/kernel/task.c @@ -40,7 +40,6 @@ #include "module.h" #include "winternl.h" #include "wine/server.h" -#include "stackframe.h" #include "thread.h" #include "toolhelp.h" #include "kernel_private.h" diff --git a/dlls/kernel/thunk.c b/dlls/kernel/thunk.c index 1b0d8fcced2..c6592d82e17 100644 --- a/dlls/kernel/thunk.c +++ b/dlls/kernel/thunk.c @@ -42,7 +42,6 @@ #include "wine/debug.h" #include "wine/library.h" #include "module.h" -#include "stackframe.h" #include "kernel_private.h" WINE_DEFAULT_DEBUG_CHANNEL(thunk); diff --git a/dlls/kernel/toolhelp.c b/dlls/kernel/toolhelp.c index b29c5be18b5..105d761787d 100644 --- a/dlls/kernel/toolhelp.c +++ b/dlls/kernel/toolhelp.c @@ -32,6 +32,7 @@ #include "winbase.h" #include "wine/winbase16.h" #include "winerror.h" +#include "thread.h" #include "local.h" #include "tlhelp32.h" #include "toolhelp.h" diff --git a/dlls/kernel/wowthunk.c b/dlls/kernel/wowthunk.c index 86eff3e766a..d23e6c816f1 100644 --- a/dlls/kernel/wowthunk.c +++ b/dlls/kernel/wowthunk.c @@ -33,7 +33,6 @@ #include "winreg.h" #include "winternl.h" #include "module.h" -#include "stackframe.h" #include "kernel_private.h" #include "wine/exception.h" #include "wine/debug.h" diff --git a/include/local.h b/include/local.h index b3fc9f95b04..df24101cb84 100644 --- a/include/local.h +++ b/include/local.h @@ -24,7 +24,10 @@ #include #include #include -#include +#include +#include + +#define CURRENT_DS (((STACK16FRAME*)MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved))->ds) /* These function are equivalent to the Local* API functions, */ /* excepted that they need DS as the first parameter. This */ diff --git a/include/stackframe.h b/include/stackframe.h deleted file mode 100644 index 4b051716ae4..00000000000 --- a/include/stackframe.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 16-bit and 32-bit mode stack frame layout - * - * Copyright 1995, 1998 Alexandre Julliard - * - * 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 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __WINE_STACKFRAME_H -#define __WINE_STACKFRAME_H - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#define CURRENT_STACK16 ((STACK16FRAME*)MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved)) -#define CURRENT_DS (CURRENT_STACK16->ds) - -/* Push bytes on the 16-bit stack of a thread; - * return a segptr to the first pushed byte - */ -static inline SEGPTR stack16_push( int size ) -{ - STACK16FRAME *frame = CURRENT_STACK16; - memmove( (char*)frame - size, frame, sizeof(*frame) ); - NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved - size; - return (SEGPTR)((char *)NtCurrentTeb()->WOW32Reserved + sizeof(*frame)); -} - -/* Pop bytes from the 16-bit stack of a thread */ -static inline void stack16_pop( int size ) -{ - STACK16FRAME *frame = CURRENT_STACK16; - memmove( (char*)frame + size, frame, sizeof(*frame) ); - NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved + size; -} - -#endif /* __WINE_STACKFRAME_H */