CVS: winex/dlls/kernel thunk.c,1.7,1.8
[email protected] 12 Sep 2007 12:33:32 -0000
| Newsgroups | gmane.comp.emulators.winex.cvs |
|---|---|
| Message-ID | <[email protected]> |
Subject: winex/dlls/kernel thunk.c,1.7,1.8Update of /var/lib/cvsd/cvsroot/winex/dlls/kernel
In directory agravaine:/tmp/cvs-serv11341/dlls/kernel
Modified Files:
thunk.c
Log Message:
- changed TEB::cur_stack to TEB::WOW32Reserved. WOW32Reserved is now at offset 0xC0 (cur_stack was at 0x70). The old cur_stack has been renamed to 'unknown70'.
Index: thunk.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/dlls/kernel/thunk.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- thunk.c 9 Jan 2006 18:01:40 -0000 1.7
+++ thunk.c 12 Sep 2007 12:33:30 -0000 1.8
@@ -320,7 +320,7 @@
context16.Eip = LOWORD(context->Edx);
/* point EBP to the STACK16FRAME on the stack
* for the call_to_16 to set up the register content on calling */
- context16.Ebp = OFFSETOF( NtCurrentTeb()->cur_stack )
+ context16.Ebp = OFFSETOF( NtCurrentTeb()->WOW32Reserved )
+ (WORD)&((STACK16FRAME*)0)->bp;
/*
@@ -348,7 +348,7 @@
* the number of parameters that the Win16 function
* accepted (that it popped from the corresponding Win16 stack) */
context->Esp += LOWORD(context16.Esp) -
- ( OFFSETOF( NtCurrentTeb()->cur_stack ) - argsize );
+ ( OFFSETOF( NtCurrentTeb()->WOW32Reserved ) - argsize );
}
@@ -451,7 +451,7 @@
context16.SegCs = HIWORD(callTarget);
context16.Eip = LOWORD(callTarget);
- context16.Ebp = OFFSETOF( NtCurrentTeb()->cur_stack )
+ context16.Ebp = OFFSETOF( NtCurrentTeb()->WOW32Reserved )
+ (WORD)&((STACK16FRAME*)0)->bp;
argsize = context->Ebp-context->Esp-0x40;
@@ -464,8 +464,8 @@
if (mapESPrelative & (1 << i))
{
SEGPTR *arg = (SEGPTR *)(newstack + 2*i);
- *arg = MAKESEGPTR(SELECTOROF(NtCurrentTeb()->cur_stack),
- OFFSETOF(NtCurrentTeb()->cur_stack) - argsize
+ *arg = MAKESEGPTR(SELECTOROF(NtCurrentTeb()->WOW32Reserved ),
+ OFFSETOF(NtCurrentTeb()->WOW32Reserved ) - argsize
+ (*(LPBYTE *)arg - oldstack));
}
@@ -475,7 +475,7 @@
context->Ecx = context16.Ecx;
context->Esp += LOWORD(context16.Esp) -
- ( OFFSETOF( NtCurrentTeb()->cur_stack ) - argsize );
+ ( OFFSETOF( NtCurrentTeb()->WOW32Reserved ) - argsize );
/* Copy modified buffers back to 32-bit stack */
memcpy( oldstack, newstack, argsize );
@@ -664,7 +664,7 @@
context16.Edi = LOWORD(context->Ecx);
context16.SegCs = HIWORD(context->Eax);
context16.Eip = LOWORD(context->Eax);
- context16.Ebp = OFFSETOF( NtCurrentTeb()->cur_stack )
+ context16.Ebp = OFFSETOF( NtCurrentTeb()->WOW32Reserved )
+ (WORD)&((STACK16FRAME*)0)->bp;
argsize = HIWORD(context->Edx) * 4;
@@ -719,7 +719,7 @@
context16.SegCs = HIWORD(context->Edx);
context16.Eip = LOWORD(context->Edx);
- context16.Ebp = OFFSETOF( NtCurrentTeb()->cur_stack )
+ context16.Ebp = OFFSETOF( NtCurrentTeb()->WOW32Reserved )
+ (WORD)&((STACK16FRAME*)0)->bp;
argsize = 2 * *(WORD *)context->Esp + 2;
@@ -736,7 +736,7 @@
(LPBYTE)CURRENT_STACK16 - argsize, argsize );
context->Esp += LOWORD(context16.Esp) -
- ( OFFSETOF( NtCurrentTeb()->cur_stack ) - argsize );
+ ( OFFSETOF( NtCurrentTeb()->WOW32Reserved ) - argsize );
}
/***********************************************************************
@@ -1131,7 +1131,7 @@
If we recognize this situation, we try to simulate the actions
of our CallTo/CallFrom mechanism by copying the 16-bit stack
to our 32-bit stack, creating a proper STACK16FRAME and
- updating cur_stack. */
+ updating WOW32Reserved. */
if ( code[5] == 0xFF && code[6] == 0x55 && code[7] == 0xFC
&& code[13] == 0x66 && code[14] == 0xCB)
@@ -1141,24 +1141,24 @@
DWORD argSize = context->Ebp - context->Esp;
char *stack16 = (char *)context->Esp - 4;
- char *stack32 = (char *)NtCurrentTeb()->cur_stack - argSize;
+ char *stack32 = (char *)NtCurrentTeb()->WOW32Reserved - argSize;
STACK16FRAME *frame16 = (STACK16FRAME *)stack16 - 1;
- TRACE("before SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n",
- context->Ebp, context->Esp, NtCurrentTeb()->cur_stack);
+ TRACE("before SYSTHUNK hack: EBP: %08lx ESP: %08lx WOW32Reserved: %p\n",
+ context->Ebp, context->Esp, NtCurrentTeb()->WOW32Reserved);
memset(frame16, '\0', sizeof(STACK16FRAME));
- frame16->frame32 = (STACK32FRAME *)NtCurrentTeb()->cur_stack;
+ frame16->frame32 = (STACK32FRAME *)NtCurrentTeb()->WOW32Reserved;
frame16->ebp = context->Ebp;
memcpy(stack32, stack16, argSize);
- NtCurrentTeb()->cur_stack = MAKESEGPTR(stackSel, (DWORD)frame16 - stackBase);
+ NtCurrentTeb()->WOW32Reserved = (void *)(MAKESEGPTR(stackSel, (DWORD)frame16 - stackBase));
context->Esp = (DWORD)stack32 + 4;
context->Ebp = context->Esp + argSize;
- TRACE("after SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n",
- context->Ebp, context->Esp, NtCurrentTeb()->cur_stack);
+ TRACE("after SYSTHUNK hack: EBP: %08lx ESP: %08lx WOW32Reserved: %p\n",
+ context->Ebp, context->Esp, NtCurrentTeb()->WOW32Reserved);
}
/* entry_point is never used again once the entry point has
@@ -1180,23 +1180,23 @@
if ( code[5] == 0xFF && code[6] == 0x55 && code[7] == 0xFC
&& code[13] == 0x66 && code[14] == 0xCB)
{
- STACK16FRAME *frame16 = MapSL(NtCurrentTeb()->cur_stack);
+ STACK16FRAME *frame16 = MapSL((DWORD)NtCurrentTeb()->WOW32Reserved);
char *stack16 = (char *)(frame16 + 1);
DWORD argSize = frame16->ebp - (DWORD)stack16;
char *stack32 = (char *)frame16->frame32 - argSize;
DWORD nArgsPopped = context->Esp - (DWORD)stack32;
- TRACE("before SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n",
- context->Ebp, context->Esp, NtCurrentTeb()->cur_stack);
+ TRACE("before SYSTHUNK hack: EBP: %08lx ESP: %08lx WOW32Reserved: %p\n",
+ context->Ebp, context->Esp, NtCurrentTeb()->WOW32Reserved);
- NtCurrentTeb()->cur_stack = (DWORD)frame16->frame32;
+ NtCurrentTeb()->WOW32Reserved = (void *)frame16->frame32;
context->Esp = (DWORD)stack16 + nArgsPopped;
context->Ebp = frame16->ebp;
- TRACE("after SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n",
- context->Ebp, context->Esp, NtCurrentTeb()->cur_stack);
+ TRACE("after SYSTHUNK hack: EBP: %08lx ESP: %08lx WOW32Reserved: %p\n",
+ context->Ebp, context->Esp, NtCurrentTeb()->WOW32Reserved);
}
}
@@ -2079,7 +2079,7 @@
frame32 = pFrame->frame32;
while (frame32 && frame32->frame16)
{
- if (OFFSETOF(frame32->frame16) < OFFSETOF(teb->cur_stack))
+ if (OFFSETOF(frame32->frame16) < OFFSETOF(teb->WOW32Reserved))
break; /* Something strange is going on */
if (OFFSETOF(frame32->frame16) > lpbuf[2])
{