Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
f87262ea
Commit
f87262ea
authored
Nov 26, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include: Add CURRENT_SS/SP macros for 16-bit code.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6e1c296e
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
73 additions
and
83 deletions
+73
-83
filedlg.c
dlls/commdlg.dll16/filedlg.c
+2
-2
kernel.c
dlls/krnl386.exe16/kernel.c
+3
-4
kernel16_private.h
dlls/krnl386.exe16/kernel16_private.h
+5
-4
ne_module.c
dlls/krnl386.exe16/ne_module.c
+3
-5
ne_segment.c
dlls/krnl386.exe16/ne_segment.c
+12
-12
task.c
dlls/krnl386.exe16/task.c
+18
-19
thunk.c
dlls/krnl386.exe16/thunk.c
+19
-23
wowthunk.c
dlls/krnl386.exe16/wowthunk.c
+5
-10
system.c
dlls/system.drv16/system.c
+1
-1
message.c
dlls/user.exe16/message.c
+3
-3
winbase16.h
include/wine/winbase16.h
+2
-0
No files found.
dlls/commdlg.dll16/filedlg.c
View file @
f87262ea
...
@@ -221,10 +221,10 @@ static LRESULT call_hook16( WNDPROC16 hook, HWND hwnd, UINT msg, WPARAM wp, LPAR
...
@@ -221,10 +221,10 @@ static LRESULT call_hook16( WNDPROC16 hook, HWND hwnd, UINT msg, WPARAM wp, LPAR
TRACE
(
"%p: %p %08x %lx %lx: stub
\n
"
,
hook
,
hwnd
,
msg
,
wp
,
lp
);
TRACE
(
"%p: %p %08x %lx %lx: stub
\n
"
,
hook
,
hwnd
,
msg
,
wp
,
lp
);
memset
(
&
context
,
0
,
sizeof
(
context
)
);
memset
(
&
context
,
0
,
sizeof
(
context
)
);
context
.
SegDs
=
context
.
SegEs
=
SELECTOROF
(
NtCurrentTeb
()
->
WOW32Reserved
)
;
context
.
SegDs
=
context
.
SegEs
=
CURRENT_SS
;
context
.
SegCs
=
SELECTOROF
(
hook
);
context
.
SegCs
=
SELECTOROF
(
hook
);
context
.
Eip
=
OFFSETOF
(
hook
);
context
.
Eip
=
OFFSETOF
(
hook
);
context
.
Ebp
=
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
context
.
Ebp
=
CURRENT_SP
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
context
.
Eax
=
context
.
SegDs
;
context
.
Eax
=
context
.
SegDs
;
params
[
4
]
=
HWND_16
(
hwnd
);
params
[
4
]
=
HWND_16
(
hwnd
);
...
...
dlls/krnl386.exe16/kernel.c
View file @
f87262ea
...
@@ -46,9 +46,8 @@ static void thread_attach(void)
...
@@ -46,9 +46,8 @@ static void thread_attach(void)
{
{
/* allocate the 16-bit stack (FIXME: should be done lazily) */
/* allocate the 16-bit stack (FIXME: should be done lazily) */
HGLOBAL16
hstack
=
WOWGlobalAlloc16
(
GMEM_FIXED
,
0x10000
);
HGLOBAL16
hstack
=
WOWGlobalAlloc16
(
GMEM_FIXED
,
0x10000
);
kernel_get_thread_data
()
->
stack_sel
=
GlobalHandleToSel16
(
hstack
);
CURRENT_SS
=
kernel_get_thread_data
()
->
stack_sel
=
GlobalHandleToSel16
(
hstack
);
NtCurrentTeb
()
->
WOW32Reserved
=
(
void
*
)
MAKESEGPTR
(
kernel_get_thread_data
()
->
stack_sel
,
CURRENT_SP
=
0x10000
-
sizeof
(
STACK16FRAME
);
0x10000
-
sizeof
(
STACK16FRAME
)
);
memset
(
(
char
*
)
GlobalLock16
(
hstack
)
+
0x10000
-
sizeof
(
STACK16FRAME
),
0
,
sizeof
(
STACK16FRAME
)
);
memset
(
(
char
*
)
GlobalLock16
(
hstack
)
+
0x10000
-
sizeof
(
STACK16FRAME
),
0
,
sizeof
(
STACK16FRAME
)
);
}
}
...
@@ -60,7 +59,7 @@ static void thread_detach(void)
...
@@ -60,7 +59,7 @@ static void thread_detach(void)
{
{
/* free the 16-bit stack */
/* free the 16-bit stack */
WOWGlobalFree16
(
kernel_get_thread_data
()
->
stack_sel
);
WOWGlobalFree16
(
kernel_get_thread_data
()
->
stack_sel
);
NtCurrentTeb
()
->
WOW32Reserved
=
0
;
CURRENT_SS
=
CURRENT_SP
=
0
;
if
(
NtCurrentTeb
()
->
Tib
.
SubSystemTib
)
TASK_ExitTask
();
if
(
NtCurrentTeb
()
->
Tib
.
SubSystemTib
)
TASK_ExitTask
();
}
}
...
...
dlls/krnl386.exe16/kernel16_private.h
View file @
f87262ea
...
@@ -101,7 +101,8 @@ typedef struct
...
@@ -101,7 +101,8 @@ typedef struct
typedef
struct
typedef
struct
{
{
WORD
null
;
/* Always 0 */
WORD
null
;
/* Always 0 */
DWORD
old_ss_sp
;
/* Stack pointer; used by SwitchTaskTo() */
WORD
old_sp
;
/* Stack pointer; used by SwitchTaskTo() */
WORD
old_ss
;
WORD
heap
;
/* Pointer to the local heap information (if any) */
WORD
heap
;
/* Pointer to the local heap information (if any) */
WORD
atomtable
;
/* Pointer to the local atom table (if any) */
WORD
atomtable
;
/* Pointer to the local atom table (if any) */
WORD
stacktop
;
/* Top of the stack */
WORD
stacktop
;
/* Top of the stack */
...
@@ -174,8 +175,8 @@ static inline SEGPTR stack16_push( int size )
...
@@ -174,8 +175,8 @@ static inline SEGPTR stack16_push( int size )
{
{
STACK16FRAME
*
frame
=
CURRENT_STACK16
;
STACK16FRAME
*
frame
=
CURRENT_STACK16
;
memmove
(
(
char
*
)
frame
-
size
,
frame
,
sizeof
(
*
frame
)
);
memmove
(
(
char
*
)
frame
-
size
,
frame
,
sizeof
(
*
frame
)
);
NtCurrentTeb
()
->
WOW32Reserved
=
(
char
*
)
NtCurrentTeb
()
->
WOW32Reserved
-
size
;
CURRENT_SP
-=
size
;
return
(
SEGPTR
)((
char
*
)
NtCurrentTeb
()
->
WOW32Reserved
+
sizeof
(
*
frame
)
);
return
MAKESEGPTR
(
CURRENT_SS
,
CURRENT_SP
+
sizeof
(
*
frame
)
);
}
}
/* pop bytes from the 16-bit stack of a thread */
/* pop bytes from the 16-bit stack of a thread */
...
@@ -183,7 +184,7 @@ static inline void stack16_pop( int size )
...
@@ -183,7 +184,7 @@ static inline void stack16_pop( int size )
{
{
STACK16FRAME
*
frame
=
CURRENT_STACK16
;
STACK16FRAME
*
frame
=
CURRENT_STACK16
;
memmove
(
(
char
*
)
frame
+
size
,
frame
,
sizeof
(
*
frame
)
);
memmove
(
(
char
*
)
frame
+
size
,
frame
,
sizeof
(
*
frame
)
);
NtCurrentTeb
()
->
WOW32Reserved
=
(
char
*
)
NtCurrentTeb
()
->
WOW32Reserved
+
size
;
CURRENT_SP
+=
size
;
}
}
/* dosmem.c */
/* dosmem.c */
...
...
dlls/krnl386.exe16/ne_module.c
View file @
f87262ea
...
@@ -1207,8 +1207,8 @@ DWORD NE_StartTask(void)
...
@@ -1207,8 +1207,8 @@ DWORD NE_StartTask(void)
if
(
!
(
sp
=
OFFSETOF
(
pModule
->
ne_sssp
)))
if
(
!
(
sp
=
OFFSETOF
(
pModule
->
ne_sssp
)))
sp
=
pSegTable
[
SELECTOROF
(
pModule
->
ne_sssp
)
-
1
].
minsize
+
pModule
->
ne_stack
;
sp
=
pSegTable
[
SELECTOROF
(
pModule
->
ne_sssp
)
-
1
].
minsize
+
pModule
->
ne_stack
;
sp
&=
~
1
;
sp
&=
~
1
;
sp
-=
sizeof
(
STACK16FRAME
);
CURRENT_SS
=
GlobalHandleToSel16
(
hInstance
);
NtCurrentTeb
()
->
WOW32Reserved
=
(
void
*
)
MAKESEGPTR
(
GlobalHandleToSel16
(
hInstance
),
sp
);
CURRENT_SP
=
sp
-
sizeof
(
STACK16FRAME
);
/* Registers at initialization must be:
/* Registers at initialization must be:
* ax zero
* ax zero
...
@@ -1235,9 +1235,7 @@ DWORD NE_StartTask(void)
...
@@ -1235,9 +1235,7 @@ DWORD NE_StartTask(void)
/* Now call 16-bit entry point */
/* Now call 16-bit entry point */
TRACE
(
"Starting main program: cs:ip=%04x:%04x ds=%04x ss:sp=%04x:%04x
\n
"
,
TRACE
(
"Starting main program: cs:ip=%04x:%04x ds=%04x ss:sp=%04x:%04x
\n
"
,
context
.
SegCs
,
context
.
Eip
,
context
.
SegDs
,
context
.
SegCs
,
context
.
Eip
,
context
.
SegDs
,
CURRENT_SS
,
CURRENT_SP
);
SELECTOROF
(
NtCurrentTeb
()
->
WOW32Reserved
),
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
);
WOWCallback16Ex
(
0
,
WCB16_REGS
,
0
,
NULL
,
(
DWORD
*
)
&
context
);
WOWCallback16Ex
(
0
,
WCB16_REGS
,
0
,
NULL
,
(
DWORD
*
)
&
context
);
ExitThread
(
LOWORD
(
context
.
Eax
)
);
ExitThread
(
LOWORD
(
context
.
Eax
)
);
...
...
dlls/krnl386.exe16/ne_segment.c
View file @
f87262ea
...
@@ -364,15 +364,14 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
...
@@ -364,15 +364,14 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
{
{
/* Implement self-loading segments */
/* Implement self-loading segments */
SELFLOADHEADER
*
selfloadheader
;
SELFLOADHEADER
*
selfloadheader
;
void
*
oldstack
;
WORD
old_ss
=
CURRENT_SS
,
old_sp
=
CURRENT_SP
;
HFILE16
hFile16
;
HFILE16
hFile16
;
WORD
args
[
3
];
WORD
args
[
3
];
DWORD
ret
;
DWORD
ret
;
selfloadheader
=
MapSL
(
MAKESEGPTR
(
SEL
(
pSegTable
->
hSeg
),
0
)
);
selfloadheader
=
MapSL
(
MAKESEGPTR
(
SEL
(
pSegTable
->
hSeg
),
0
)
);
oldstack
=
NtCurrentTeb
()
->
WOW32Reserved
;
CURRENT_SS
=
pModule
->
self_loading_sel
;
NtCurrentTeb
()
->
WOW32Reserved
=
(
void
*
)
MAKESEGPTR
(
pModule
->
self_loading_sel
,
CURRENT_SP
=
0xff00
-
sizeof
(
STACK16FRAME
);
0xff00
-
sizeof
(
STACK16FRAME
));
hFile16
=
NE_OpenFile
(
pModule
);
hFile16
=
NE_OpenFile
(
pModule
);
TRACE_
(
dll
)(
"Call LoadAppSegProc(hmodule=0x%04x,hf=%x,segnum=%d)
\n
"
,
TRACE_
(
dll
)(
"Call LoadAppSegProc(hmodule=0x%04x,hf=%x,segnum=%d)
\n
"
,
...
@@ -384,7 +383,8 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
...
@@ -384,7 +383,8 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
pSeg
->
hSeg
=
LOWORD
(
ret
);
pSeg
->
hSeg
=
LOWORD
(
ret
);
TRACE_
(
dll
)(
"Ret LoadAppSegProc: hSeg=0x%04x
\n
"
,
pSeg
->
hSeg
);
TRACE_
(
dll
)(
"Ret LoadAppSegProc: hSeg=0x%04x
\n
"
,
pSeg
->
hSeg
);
_lclose16
(
hFile16
);
_lclose16
(
hFile16
);
NtCurrentTeb
()
->
WOW32Reserved
=
oldstack
;
CURRENT_SS
=
old_ss
;
CURRENT_SP
=
old_sp
;
pSeg
->
flags
|=
NE_SEGFLAGS_LOADED
;
pSeg
->
flags
|=
NE_SEGFLAGS_LOADED
;
return
TRUE
;
return
TRUE
;
...
@@ -462,7 +462,7 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
...
@@ -462,7 +462,7 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
/* Handle self-loading modules */
/* Handle self-loading modules */
SELFLOADHEADER
*
selfloadheader
;
SELFLOADHEADER
*
selfloadheader
;
HMODULE16
mod
=
GetModuleHandle16
(
"KERNEL"
);
HMODULE16
mod
=
GetModuleHandle16
(
"KERNEL"
);
void
*
oldstack
;
WORD
old_ss
=
CURRENT_SS
,
old_sp
=
CURRENT_SP
;
WORD
args
[
2
];
WORD
args
[
2
];
TRACE_
(
module
)(
"%.*s is a self-loading module!
\n
"
,
TRACE_
(
module
)(
"%.*s is a self-loading module!
\n
"
,
...
@@ -476,9 +476,8 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
...
@@ -476,9 +476,8 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
sel
=
GlobalAlloc16
(
GMEM_ZEROINIT
,
0xFF00
);
sel
=
GlobalAlloc16
(
GMEM_ZEROINIT
,
0xFF00
);
pModule
->
self_loading_sel
=
SEL
(
sel
);
pModule
->
self_loading_sel
=
SEL
(
sel
);
FarSetOwner16
(
sel
,
pModule
->
self
);
FarSetOwner16
(
sel
,
pModule
->
self
);
oldstack
=
NtCurrentTeb
()
->
WOW32Reserved
;
CURRENT_SS
=
pModule
->
self_loading_sel
;
NtCurrentTeb
()
->
WOW32Reserved
=
(
void
*
)
MAKESEGPTR
(
pModule
->
self_loading_sel
,
CURRENT_SP
=
0xff00
-
sizeof
(
STACK16FRAME
);
0xff00
-
sizeof
(
STACK16FRAME
)
);
hFile16
=
NE_OpenFile
(
pModule
);
hFile16
=
NE_OpenFile
(
pModule
);
TRACE_
(
dll
)(
"CallBootAppProc(hModule=0x%04x,hf=0x%04x)
\n
"
,
TRACE_
(
dll
)(
"CallBootAppProc(hModule=0x%04x,hf=0x%04x)
\n
"
,
...
@@ -488,7 +487,8 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
...
@@ -488,7 +487,8 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
WOWCallback16Ex
(
(
DWORD
)
selfloadheader
->
BootApp
,
WCB16_PASCAL
,
sizeof
(
args
),
args
,
NULL
);
WOWCallback16Ex
(
(
DWORD
)
selfloadheader
->
BootApp
,
WCB16_PASCAL
,
sizeof
(
args
),
args
,
NULL
);
TRACE_
(
dll
)(
"Return from CallBootAppProc
\n
"
);
TRACE_
(
dll
)(
"Return from CallBootAppProc
\n
"
);
_lclose16
(
hFile16
);
_lclose16
(
hFile16
);
NtCurrentTeb
()
->
WOW32Reserved
=
oldstack
;
CURRENT_SS
=
old_ss
;
CURRENT_SP
=
old_sp
;
for
(
i
=
2
;
i
<=
pModule
->
ne_cseg
;
i
++
)
for
(
i
=
2
;
i
<=
pModule
->
ne_cseg
;
i
++
)
if
(
!
NE_LoadSegment
(
pModule
,
i
))
return
FALSE
;
if
(
!
NE_LoadSegment
(
pModule
,
i
))
return
FALSE
;
...
@@ -680,7 +680,7 @@ static BOOL NE_InitDLL( NE_MODULE *pModule )
...
@@ -680,7 +680,7 @@ static BOOL NE_InitDLL( NE_MODULE *pModule )
context
.
SegEs
=
ds
;
/* who knows ... */
context
.
SegEs
=
ds
;
/* who knows ... */
context
.
SegCs
=
SEL
(
pSegTable
[
SELECTOROF
(
pModule
->
ne_csip
)
-
1
].
hSeg
);
context
.
SegCs
=
SEL
(
pSegTable
[
SELECTOROF
(
pModule
->
ne_csip
)
-
1
].
hSeg
);
context
.
Eip
=
OFFSETOF
(
pModule
->
ne_csip
);
context
.
Eip
=
OFFSETOF
(
pModule
->
ne_csip
);
context
.
Ebp
=
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
context
.
Ebp
=
CURRENT_SP
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
pModule
->
ne_csip
=
0
;
/* Don't initialize it twice */
pModule
->
ne_csip
=
0
;
/* Don't initialize it twice */
TRACE_
(
dll
)(
"Calling LibMain for %.*s, cs:ip=%04x:%04x ds=%04x di=%04x cx=%04x
\n
"
,
TRACE_
(
dll
)(
"Calling LibMain for %.*s, cs:ip=%04x:%04x ds=%04x di=%04x cx=%04x
\n
"
,
...
@@ -782,7 +782,7 @@ static void NE_CallDllEntryPoint( NE_MODULE *pModule, DWORD dwReason )
...
@@ -782,7 +782,7 @@ static void NE_CallDllEntryPoint( NE_MODULE *pModule, DWORD dwReason )
context
.
SegEs
=
ds
;
/* who knows ... */
context
.
SegEs
=
ds
;
/* who knows ... */
context
.
SegCs
=
HIWORD
(
entryPoint
);
context
.
SegCs
=
HIWORD
(
entryPoint
);
context
.
Eip
=
LOWORD
(
entryPoint
);
context
.
Eip
=
LOWORD
(
entryPoint
);
context
.
Ebp
=
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
context
.
Ebp
=
CURRENT_SP
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
args
[
7
]
=
HIWORD
(
dwReason
);
args
[
7
]
=
HIWORD
(
dwReason
);
args
[
6
]
=
LOWORD
(
dwReason
);
args
[
6
]
=
LOWORD
(
dwReason
);
...
...
dlls/krnl386.exe16/task.c
View file @
f87262ea
...
@@ -624,7 +624,7 @@ void WINAPI InitTask16( CONTEXT *context )
...
@@ -624,7 +624,7 @@ void WINAPI InitTask16( CONTEXT *context )
/* Initialize the INSTANCEDATA structure */
/* Initialize the INSTANCEDATA structure */
pinstance
=
MapSL
(
MAKESEGPTR
(
CURRENT_DS
,
0
)
);
pinstance
=
MapSL
(
MAKESEGPTR
(
CURRENT_DS
,
0
)
);
pinstance
->
stackmin
=
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
+
sizeof
(
STACK16FRAME
);
pinstance
->
stackmin
=
CURRENT_SP
+
sizeof
(
STACK16FRAME
);
pinstance
->
stackbottom
=
pinstance
->
stackmin
;
/* yup, that's right. Confused me too. */
pinstance
->
stackbottom
=
pinstance
->
stackmin
;
/* yup, that's right. Confused me too. */
pinstance
->
stacktop
=
(
pinstance
->
stackmin
>
LOWORD
(
context
->
Ebx
)
?
pinstance
->
stacktop
=
(
pinstance
->
stackmin
>
LOWORD
(
context
->
Ebx
)
?
pinstance
->
stackmin
-
LOWORD
(
context
->
Ebx
)
:
0
)
+
150
;
pinstance
->
stackmin
-
LOWORD
(
context
->
Ebx
)
:
0
)
+
150
;
...
@@ -1094,17 +1094,15 @@ void WINAPI SwitchStackTo16( WORD seg, WORD ptr, WORD top )
...
@@ -1094,17 +1094,15 @@ void WINAPI SwitchStackTo16( WORD seg, WORD ptr, WORD top )
UINT16
copySize
;
UINT16
copySize
;
if
(
!
(
pData
=
GlobalLock16
(
seg
)))
return
;
if
(
!
(
pData
=
GlobalLock16
(
seg
)))
return
;
TRACE
(
"old=%04x:%04x new=%04x:%04x
\n
"
,
TRACE
(
"old=%04x:%04x new=%04x:%04x
\n
"
,
CURRENT_SS
,
CURRENT_SP
,
seg
,
ptr
);
SELECTOROF
(
NtCurrentTeb
()
->
WOW32Reserved
),
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
),
seg
,
ptr
);
/* Save the old stack */
/* Save the old stack */
oldFrame
=
CURRENT_STACK16
;
oldFrame
=
CURRENT_STACK16
;
/* pop frame + args and push bp */
/* pop frame + args and push bp */
pData
->
old_ss
_sp
=
(
SEGPTR
)
NtCurrentTeb
()
->
WOW32Reserved
+
sizeof
(
STACK16FRAME
)
pData
->
old_ss
=
CURRENT_SS
;
+
2
*
sizeof
(
WORD
);
pData
->
old_sp
=
CURRENT_SP
+
sizeof
(
STACK16FRAME
)
+
2
*
sizeof
(
WORD
);
*
(
WORD
*
)
MapSL
(
pData
->
old_ss_sp
)
=
oldFrame
->
bp
;
*
(
WORD
*
)
MapSL
(
MAKESEGPTR
(
pData
->
old_ss
,
pData
->
old_sp
)
)
=
oldFrame
->
bp
;
pData
->
stacktop
=
top
;
pData
->
stacktop
=
top
;
pData
->
stackmin
=
ptr
;
pData
->
stackmin
=
ptr
;
pData
->
stackbottom
=
ptr
;
pData
->
stackbottom
=
ptr
;
...
@@ -1114,9 +1112,10 @@ void WINAPI SwitchStackTo16( WORD seg, WORD ptr, WORD top )
...
@@ -1114,9 +1112,10 @@ void WINAPI SwitchStackTo16( WORD seg, WORD ptr, WORD top )
/* Note: we need to take the 3 arguments into account; otherwise,
/* Note: we need to take the 3 arguments into account; otherwise,
* the stack will underflow upon return from this function.
* the stack will underflow upon return from this function.
*/
*/
copySize
=
oldFrame
->
bp
-
OFFSETOF
(
pData
->
old_ss_sp
)
;
copySize
=
oldFrame
->
bp
-
pData
->
old_sp
;
copySize
+=
3
*
sizeof
(
WORD
)
+
sizeof
(
STACK16FRAME
);
copySize
+=
3
*
sizeof
(
WORD
)
+
sizeof
(
STACK16FRAME
);
NtCurrentTeb
()
->
WOW32Reserved
=
(
void
*
)
MAKESEGPTR
(
seg
,
ptr
-
copySize
);
CURRENT_SS
=
seg
;
CURRENT_SP
=
ptr
-
copySize
;
newFrame
=
CURRENT_STACK16
;
newFrame
=
CURRENT_STACK16
;
/* Copy the stack frame and the local variables to the new stack */
/* Copy the stack frame and the local variables to the new stack */
...
@@ -1135,29 +1134,29 @@ void WINAPI SwitchStackBack16( CONTEXT *context )
...
@@ -1135,29 +1134,29 @@ void WINAPI SwitchStackBack16( CONTEXT *context )
STACK16FRAME
*
oldFrame
,
*
newFrame
;
STACK16FRAME
*
oldFrame
,
*
newFrame
;
INSTANCEDATA
*
pData
;
INSTANCEDATA
*
pData
;
if
(
!
(
pData
=
GlobalLock16
(
SELECTOROF
(
NtCurrentTeb
()
->
WOW32Reserved
)
)))
if
(
!
(
pData
=
GlobalLock16
(
CURRENT_SS
)))
return
;
return
;
if
(
!
pData
->
old_ss
_sp
)
if
(
!
pData
->
old_ss
)
{
{
WARN
(
"No previous SwitchStackTo
\n
"
);
WARN
(
"No previous SwitchStackTo
\n
"
);
return
;
return
;
}
}
TRACE
(
"restoring stack %04x:%04x
\n
"
,
TRACE
(
"restoring stack %04x:%04x
\n
"
,
pData
->
old_ss
,
pData
->
old_sp
);
SELECTOROF
(
pData
->
old_ss_sp
),
OFFSETOF
(
pData
->
old_ss_sp
)
);
oldFrame
=
CURRENT_STACK16
;
oldFrame
=
CURRENT_STACK16
;
/* Pop bp from the previous stack */
/* Pop bp from the previous stack */
context
->
Ebp
=
(
context
->
Ebp
&
~
0xffff
)
|
*
(
WORD
*
)
MapSL
(
pData
->
old_ss_sp
);
context
->
Ebp
=
(
context
->
Ebp
&
~
0xffff
)
|
*
(
WORD
*
)
MapSL
(
MAKESEGPTR
(
pData
->
old_ss
,
pData
->
old_sp
)
);
pData
->
old_s
s_s
p
+=
sizeof
(
WORD
);
pData
->
old_sp
+=
sizeof
(
WORD
);
/* Switch back to the old stack */
/* Switch back to the old stack */
NtCurrentTeb
()
->
WOW32Reserved
=
(
void
*
)(
pData
->
old_ss_sp
-
sizeof
(
STACK16FRAME
));
CURRENT_SS
=
pData
->
old_ss
;
context
->
SegSs
=
SELECTOROF
(
pData
->
old_ss_sp
);
CURRENT_SP
=
pData
->
old_sp
-
sizeof
(
STACK16FRAME
);
context
->
Esp
=
OFFSETOF
(
pData
->
old_ss_sp
)
-
sizeof
(
DWORD
);
/*ret addr*/
context
->
SegSs
=
pData
->
old_ss
;
pData
->
old_ss_sp
=
0
;
context
->
Esp
=
pData
->
old_sp
-
sizeof
(
DWORD
);
/*ret addr*/
pData
->
old_ss
=
pData
->
old_sp
=
0
;
/* Build a stack frame for the return */
/* Build a stack frame for the return */
...
...
dlls/krnl386.exe16/thunk.c
View file @
f87262ea
...
@@ -429,7 +429,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT *context )
...
@@ -429,7 +429,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT *context )
context16
.
Eip
=
LOWORD
(
context
->
Edx
);
context16
.
Eip
=
LOWORD
(
context
->
Edx
);
/* point EBP to the STACK16FRAME on the stack
/* point EBP to the STACK16FRAME on the stack
* for the call_to_16 to set up the register content on calling */
* for the call_to_16 to set up the register content on calling */
context16
.
Ebp
=
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
context16
.
Ebp
=
CURRENT_SP
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
/*
/*
* used to be (problematic):
* used to be (problematic):
...
@@ -450,8 +450,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT *context )
...
@@ -450,8 +450,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT *context )
/* make sure to update the Win32 ESP, too, in order to throw away
/* make sure to update the Win32 ESP, too, in order to throw away
* the number of parameters that the Win16 function
* the number of parameters that the Win16 function
* accepted (that it popped from the corresponding Win16 stack) */
* accepted (that it popped from the corresponding Win16 stack) */
context
->
Esp
+=
LOWORD
(
context16
.
Esp
)
-
context
->
Esp
+=
LOWORD
(
context16
.
Esp
)
-
(
CURRENT_SP
-
argsize
);
(
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
-
argsize
);
}
}
DEFINE_REGS_ENTRYPOINT
(
QT_Thunk
)
DEFINE_REGS_ENTRYPOINT
(
QT_Thunk
)
...
@@ -555,7 +554,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context )
...
@@ -555,7 +554,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context )
context16
.
SegCs
=
HIWORD
(
callTarget
);
context16
.
SegCs
=
HIWORD
(
callTarget
);
context16
.
Eip
=
LOWORD
(
callTarget
);
context16
.
Eip
=
LOWORD
(
callTarget
);
context16
.
Ebp
=
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
context16
.
Ebp
=
CURRENT_SP
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
argsize
=
context
->
Ebp
-
context
->
Esp
-
0x40
;
argsize
=
context
->
Ebp
-
context
->
Esp
-
0x40
;
if
(
argsize
>
sizeof
(
newstack
))
argsize
=
sizeof
(
newstack
);
if
(
argsize
>
sizeof
(
newstack
))
argsize
=
sizeof
(
newstack
);
...
@@ -567,9 +566,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context )
...
@@ -567,9 +566,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context )
if
(
mapESPrelative
&
(
1
<<
i
))
if
(
mapESPrelative
&
(
1
<<
i
))
{
{
SEGPTR
*
arg
=
(
SEGPTR
*
)
newstack
[
i
];
SEGPTR
*
arg
=
(
SEGPTR
*
)
newstack
[
i
];
*
arg
=
MAKESEGPTR
(
SELECTOROF
(
NtCurrentTeb
()
->
WOW32Reserved
),
*
arg
=
MAKESEGPTR
(
CURRENT_SS
,
CURRENT_SP
-
argsize
+
(
*
(
LPBYTE
*
)
arg
-
oldstack
));
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
-
argsize
+
(
*
(
LPBYTE
*
)
arg
-
oldstack
));
}
}
WOWCallback16Ex
(
0
,
WCB16_REGS
,
argsize
,
newstack
,
(
DWORD
*
)
&
context16
);
WOWCallback16Ex
(
0
,
WCB16_REGS
,
argsize
,
newstack
,
(
DWORD
*
)
&
context16
);
...
@@ -577,8 +574,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context )
...
@@ -577,8 +574,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context )
context
->
Edx
=
context16
.
Edx
;
context
->
Edx
=
context16
.
Edx
;
context
->
Ecx
=
context16
.
Ecx
;
context
->
Ecx
=
context16
.
Ecx
;
context
->
Esp
+=
LOWORD
(
context16
.
Esp
)
-
context
->
Esp
+=
LOWORD
(
context16
.
Esp
)
-
(
CURRENT_SP
-
argsize
);
(
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
-
argsize
);
/* Copy modified buffers back to 32-bit stack */
/* Copy modified buffers back to 32-bit stack */
memcpy
(
oldstack
,
newstack
,
argsize
);
memcpy
(
oldstack
,
newstack
,
argsize
);
...
@@ -713,7 +709,7 @@ void WINAPI __regs_Common32ThkLS( CONTEXT *context )
...
@@ -713,7 +709,7 @@ void WINAPI __regs_Common32ThkLS( CONTEXT *context )
context16
.
Edi
=
LOWORD
(
context
->
Ecx
);
context16
.
Edi
=
LOWORD
(
context
->
Ecx
);
context16
.
SegCs
=
HIWORD
(
context
->
Eax
);
context16
.
SegCs
=
HIWORD
(
context
->
Eax
);
context16
.
Eip
=
LOWORD
(
context
->
Eax
);
context16
.
Eip
=
LOWORD
(
context
->
Eax
);
context16
.
Ebp
=
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
context16
.
Ebp
=
CURRENT_SP
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
argsize
=
HIWORD
(
context
->
Edx
)
*
4
;
argsize
=
HIWORD
(
context
->
Edx
)
*
4
;
...
@@ -769,7 +765,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT *context )
...
@@ -769,7 +765,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT *context )
context16
.
SegCs
=
HIWORD
(
context
->
Edx
);
context16
.
SegCs
=
HIWORD
(
context
->
Edx
);
context16
.
Eip
=
LOWORD
(
context
->
Edx
);
context16
.
Eip
=
LOWORD
(
context
->
Edx
);
context16
.
Ebp
=
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
context16
.
Ebp
=
CURRENT_SP
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
argsize
=
2
*
*
(
WORD
*
)
context
->
Esp
+
2
;
argsize
=
2
*
*
(
WORD
*
)
context
->
Esp
+
2
;
...
@@ -781,8 +777,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT *context )
...
@@ -781,8 +777,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT *context )
memcpy
(
(
LPBYTE
)
context
->
Esp
,
memcpy
(
(
LPBYTE
)
context
->
Esp
,
(
LPBYTE
)
CURRENT_STACK16
-
argsize
,
argsize
);
(
LPBYTE
)
CURRENT_STACK16
-
argsize
,
argsize
);
context
->
Esp
+=
LOWORD
(
context16
.
Esp
)
-
context
->
Esp
+=
LOWORD
(
context16
.
Esp
)
-
(
CURRENT_SP
-
argsize
);
(
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
-
argsize
);
}
}
DEFINE_REGS_ENTRYPOINT
(
OT_32ThkLSF
)
DEFINE_REGS_ENTRYPOINT
(
OT_32ThkLSF
)
...
@@ -1239,21 +1234,22 @@ void WINAPI __regs_K32Thk1632Prolog( CONTEXT *context )
...
@@ -1239,21 +1234,22 @@ void WINAPI __regs_K32Thk1632Prolog( CONTEXT *context )
WORD
stackSel
=
SELECTOROF
(
frame32
->
frame16
);
WORD
stackSel
=
SELECTOROF
(
frame32
->
frame16
);
DWORD
stackBase
=
GetSelectorBase
(
stackSel
);
DWORD
stackBase
=
GetSelectorBase
(
stackSel
);
TRACE
(
"before SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %
p
\n
"
,
TRACE
(
"before SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %
04x:%04x
\n
"
,
context
->
Ebp
,
context
->
Esp
,
NtCurrentTeb
()
->
WOW32Reserved
);
context
->
Ebp
,
context
->
Esp
,
CURRENT_SS
,
CURRENT_SP
);
memset
(
frame16
,
'\0'
,
sizeof
(
STACK16FRAME
));
memset
(
frame16
,
'\0'
,
sizeof
(
STACK16FRAME
));
frame16
->
frame32
=
frame32
;
frame16
->
frame32
=
frame32
;
frame16
->
ebp
=
context
->
Ebp
;
frame16
->
ebp
=
context
->
Ebp
;
memcpy
(
stack32
,
stack16
,
argSize
);
memcpy
(
stack32
,
stack16
,
argSize
);
NtCurrentTeb
()
->
WOW32Reserved
=
(
void
*
)
MAKESEGPTR
(
stackSel
,
(
DWORD
)
frame16
-
stackBase
);
CURRENT_SS
=
stackSel
;
CURRENT_SP
=
(
DWORD
)
frame16
-
stackBase
;
context
->
Esp
=
(
DWORD
)
stack32
+
4
;
context
->
Esp
=
(
DWORD
)
stack32
+
4
;
context
->
Ebp
=
context
->
Esp
+
argSize
;
context
->
Ebp
=
context
->
Esp
+
argSize
;
TRACE
(
"after SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %
p
\n
"
,
TRACE
(
"after SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %
04x:%04x
\n
"
,
context
->
Ebp
,
context
->
Esp
,
NtCurrentTeb
()
->
WOW32Reserved
);
context
->
Ebp
,
context
->
Esp
,
CURRENT_SS
,
CURRENT_SP
);
}
}
/* entry_point is never used again once the entry point has
/* entry_point is never used again once the entry point has
...
@@ -1283,16 +1279,16 @@ void WINAPI __regs_K32Thk1632Epilog( CONTEXT *context )
...
@@ -1283,16 +1279,16 @@ void WINAPI __regs_K32Thk1632Epilog( CONTEXT *context )
DWORD
nArgsPopped
=
context
->
Esp
-
(
DWORD
)
stack32
;
DWORD
nArgsPopped
=
context
->
Esp
-
(
DWORD
)
stack32
;
TRACE
(
"before SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %
p
\n
"
,
TRACE
(
"before SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %
04x:%04x
\n
"
,
context
->
Ebp
,
context
->
Esp
,
NtCurrentTeb
()
->
WOW32Reserved
);
context
->
Ebp
,
context
->
Esp
,
CURRENT_SS
,
CURRENT_SP
);
NtCurrentTeb
()
->
WOW32Reserved
=
frame16
->
frame32
;
NtCurrentTeb
()
->
WOW32Reserved
=
frame16
->
frame32
;
context
->
Esp
=
(
DWORD
)
stack16
+
nArgsPopped
;
context
->
Esp
=
(
DWORD
)
stack16
+
nArgsPopped
;
context
->
Ebp
=
frame16
->
ebp
;
context
->
Ebp
=
frame16
->
ebp
;
TRACE
(
"after SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %
p
\n
"
,
TRACE
(
"after SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %
04x:%04x
\n
"
,
context
->
Ebp
,
context
->
Esp
,
NtCurrentTeb
()
->
WOW32Reserved
);
context
->
Ebp
,
context
->
Esp
,
CURRENT_SS
,
CURRENT_SP
);
}
}
}
}
DEFINE_REGS_ENTRYPOINT
(
K32Thk1632Epilog
)
DEFINE_REGS_ENTRYPOINT
(
K32Thk1632Epilog
)
...
@@ -2303,7 +2299,7 @@ void WINAPI Throw16( LPCATCHBUF lpbuf, INT16 retval, CONTEXT *context )
...
@@ -2303,7 +2299,7 @@ void WINAPI Throw16( LPCATCHBUF lpbuf, INT16 retval, CONTEXT *context )
frame32
=
pFrame
->
frame32
;
frame32
=
pFrame
->
frame32
;
while
(
frame32
&&
frame32
->
frame16
)
while
(
frame32
&&
frame32
->
frame16
)
{
{
if
(
OFFSETOF
(
frame32
->
frame16
)
<
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
)
if
(
OFFSETOF
(
frame32
->
frame16
)
<
CURRENT_SP
)
break
;
/* Something strange is going on */
break
;
/* Something strange is going on */
if
(
OFFSETOF
(
frame32
->
frame16
)
>
lpbuf
[
2
])
if
(
OFFSETOF
(
frame32
->
frame16
)
>
lpbuf
[
2
])
{
{
...
...
dlls/krnl386.exe16/wowthunk.c
View file @
f87262ea
...
@@ -412,8 +412,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
...
@@ -412,8 +412,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
TRACE_
(
relay
)(
"
\1
CallTo16(func=%04x:%04x"
,
context
->
SegCs
,
LOWORD
(
context
->
Eip
)
);
TRACE_
(
relay
)(
"
\1
CallTo16(func=%04x:%04x"
,
context
->
SegCs
,
LOWORD
(
context
->
Eip
)
);
while
(
count
)
TRACE_
(
relay
)(
",%04x"
,
wstack
[
--
count
]
);
while
(
count
)
TRACE_
(
relay
)(
",%04x"
,
wstack
[
--
count
]
);
TRACE_
(
relay
)(
") ss:sp=%04x:%04x ax=%04x bx=%04x cx=%04x dx=%04x si=%04x di=%04x bp=%04x ds=%04x es=%04x
\n
"
,
TRACE_
(
relay
)(
") ss:sp=%04x:%04x ax=%04x bx=%04x cx=%04x dx=%04x si=%04x di=%04x bp=%04x ds=%04x es=%04x
\n
"
,
SELECTOROF
(
NtCurrentTeb
()
->
WOW32Reserved
),
CURRENT_SS
,
CURRENT_SP
,
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
),
(
WORD
)
context
->
Eax
,
(
WORD
)
context
->
Ebx
,
(
WORD
)
context
->
Ecx
,
(
WORD
)
context
->
Eax
,
(
WORD
)
context
->
Ebx
,
(
WORD
)
context
->
Ecx
,
(
WORD
)
context
->
Edx
,
(
WORD
)
context
->
Esi
,
(
WORD
)
context
->
Edi
,
(
WORD
)
context
->
Edx
,
(
WORD
)
context
->
Esi
,
(
WORD
)
context
->
Edi
,
(
WORD
)
context
->
Ebp
,
(
WORD
)
context
->
SegDs
,
(
WORD
)
context
->
SegEs
);
(
WORD
)
context
->
Ebp
,
(
WORD
)
context
->
SegDs
,
(
WORD
)
context
->
SegEs
);
...
@@ -443,8 +442,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
...
@@ -443,8 +442,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
if
(
TRACE_ON
(
relay
))
if
(
TRACE_ON
(
relay
))
{
{
TRACE_
(
relay
)(
"
\1
RetFrom16() ss:sp=%04x:%04x ax=%04x bx=%04x cx=%04x dx=%04x bp=%04x sp=%04x
\n
"
,
TRACE_
(
relay
)(
"
\1
RetFrom16() ss:sp=%04x:%04x ax=%04x bx=%04x cx=%04x dx=%04x bp=%04x sp=%04x
\n
"
,
SELECTOROF
(
NtCurrentTeb
()
->
WOW32Reserved
),
CURRENT_SS
,
CURRENT_SP
,
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
),
(
WORD
)
context
->
Eax
,
(
WORD
)
context
->
Ebx
,
(
WORD
)
context
->
Ecx
,
(
WORD
)
context
->
Eax
,
(
WORD
)
context
->
Ebx
,
(
WORD
)
context
->
Ecx
,
(
WORD
)
context
->
Edx
,
(
WORD
)
context
->
Ebp
,
(
WORD
)
context
->
Esp
);
(
WORD
)
context
->
Edx
,
(
WORD
)
context
->
Ebp
,
(
WORD
)
context
->
Esp
);
SYSLEVEL_CheckNotLevel
(
2
);
SYSLEVEL_CheckNotLevel
(
2
);
...
@@ -460,10 +458,9 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
...
@@ -460,10 +458,9 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
WORD
*
wstack
=
(
WORD
*
)
stack
;
WORD
*
wstack
=
(
WORD
*
)
stack
;
TRACE_
(
relay
)(
"
\1
CallTo16(func=%04x:%04x,ds=%04x"
,
TRACE_
(
relay
)(
"
\1
CallTo16(func=%04x:%04x,ds=%04x"
,
HIWORD
(
vpfn16
),
LOWORD
(
vpfn16
),
SELECTOROF
(
NtCurrentTeb
()
->
WOW32Reserved
)
);
HIWORD
(
vpfn16
),
LOWORD
(
vpfn16
),
CURRENT_SS
);
while
(
count
)
TRACE_
(
relay
)(
",%04x"
,
wstack
[
--
count
]
);
while
(
count
)
TRACE_
(
relay
)(
",%04x"
,
wstack
[
--
count
]
);
TRACE_
(
relay
)(
") ss:sp=%04x:%04x
\n
"
,
SELECTOROF
(
NtCurrentTeb
()
->
WOW32Reserved
),
TRACE_
(
relay
)(
") ss:sp=%04x:%04x
\n
"
,
CURRENT_SS
,
CURRENT_SP
);
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
);
SYSLEVEL_CheckNotLevel
(
2
);
SYSLEVEL_CheckNotLevel
(
2
);
}
}
...
@@ -485,9 +482,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
...
@@ -485,9 +482,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
if
(
TRACE_ON
(
relay
))
if
(
TRACE_ON
(
relay
))
{
{
TRACE_
(
relay
)(
"
\1
RetFrom16() ss:sp=%04x:%04x retval=%08x
\n
"
,
TRACE_
(
relay
)(
"
\1
RetFrom16() ss:sp=%04x:%04x retval=%08x
\n
"
,
CURRENT_SS
,
CURRENT_SP
,
ret
);
SELECTOROF
(
NtCurrentTeb
()
->
WOW32Reserved
),
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
),
ret
);
SYSLEVEL_CheckNotLevel
(
2
);
SYSLEVEL_CheckNotLevel
(
2
);
}
}
}
}
...
...
dlls/system.drv16/system.c
View file @
f87262ea
...
@@ -70,7 +70,7 @@ static void CALLBACK SYSTEM_TimerTick( LPVOID arg, DWORD low, DWORD high )
...
@@ -70,7 +70,7 @@ static void CALLBACK SYSTEM_TimerTick( LPVOID arg, DWORD low, DWORD high )
memset
(
&
context
,
0
,
sizeof
(
context
)
);
memset
(
&
context
,
0
,
sizeof
(
context
)
);
context
.
SegCs
=
SELECTOROF
(
proc
);
context
.
SegCs
=
SELECTOROF
(
proc
);
context
.
Eip
=
OFFSETOF
(
proc
);
context
.
Eip
=
OFFSETOF
(
proc
);
context
.
Ebp
=
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
context
.
Ebp
=
CURRENT_SP
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
context
.
Eax
=
i
+
1
;
context
.
Eax
=
i
+
1
;
WOWCallback16Ex
(
0
,
WCB16_REGS
,
0
,
NULL
,
(
DWORD
*
)
&
context
);
WOWCallback16Ex
(
0
,
WCB16_REGS
,
0
,
NULL
,
(
DWORD
*
)
&
context
);
...
...
dlls/user.exe16/message.c
View file @
f87262ea
...
@@ -240,11 +240,11 @@ static LRESULT call_window_proc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPA
...
@@ -240,11 +240,11 @@ static LRESULT call_window_proc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPA
/* Window procedures want ax = hInstance, ds = es = ss */
/* Window procedures want ax = hInstance, ds = es = ss */
memset
(
&
context
,
0
,
sizeof
(
context
));
memset
(
&
context
,
0
,
sizeof
(
context
));
context
.
SegDs
=
context
.
SegEs
=
SELECTOROF
(
NtCurrentTeb
()
->
WOW32Reserved
)
;
context
.
SegDs
=
context
.
SegEs
=
CURRENT_SS
;
if
(
!
(
context
.
Eax
=
GetWindowWord
(
HWND_32
(
hwnd
),
GWLP_HINSTANCE
)))
context
.
Eax
=
context
.
SegDs
;
if
(
!
(
context
.
Eax
=
GetWindowWord
(
HWND_32
(
hwnd
),
GWLP_HINSTANCE
)))
context
.
Eax
=
context
.
SegDs
;
context
.
SegCs
=
SELECTOROF
(
func
);
context
.
SegCs
=
SELECTOROF
(
func
);
context
.
Eip
=
OFFSETOF
(
func
);
context
.
Eip
=
OFFSETOF
(
func
);
context
.
Ebp
=
OFFSETOF
(
NtCurrentTeb
()
->
WOW32Reserved
)
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
context
.
Ebp
=
CURRENT_SP
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
if
(
lParam
)
if
(
lParam
)
{
{
...
@@ -267,7 +267,7 @@ static LRESULT call_window_proc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPA
...
@@ -267,7 +267,7 @@ static LRESULT call_window_proc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPA
if
(
size
)
if
(
size
)
{
{
memcpy
(
&
args
.
u
,
MapSL
(
lParam
),
size
);
memcpy
(
&
args
.
u
,
MapSL
(
lParam
),
size
);
lParam
=
PtrToUlong
(
NtCurrentTeb
()
->
WOW32Reserved
)
-
size
;
lParam
=
MAKESEGPTR
(
CURRENT_SS
,
CURRENT_SP
-
size
)
;
}
}
}
}
...
...
include/wine/winbase16.h
View file @
f87262ea
...
@@ -564,5 +564,7 @@ BOOL16 WINAPI WriteProfileSection16(LPCSTR,LPCSTR);
...
@@ -564,5 +564,7 @@ BOOL16 WINAPI WriteProfileSection16(LPCSTR,LPCSTR);
#define CURRENT_STACK16 ((STACK16FRAME *)MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved))
#define CURRENT_STACK16 ((STACK16FRAME *)MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved))
#define CURRENT_DS (CURRENT_STACK16->ds)
#define CURRENT_DS (CURRENT_STACK16->ds)
#define CURRENT_SP (((WORD *)&NtCurrentTeb()->WOW32Reserved)[0])
#define CURRENT_SS (((WORD *)&NtCurrentTeb()->WOW32Reserved)[1])
#endif
/* __WINE_WINE_WINBASE16_H */
#endif
/* __WINE_WINE_WINBASE16_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment