Bugfix: FT_PrologPrime was broken due to relay changes.

This commit is contained in:
Ulrich Weigand 1999-05-17 14:57:06 +00:00 committed by Alexandre Julliard
parent 73cf91e00a
commit cd819fefc8
1 changed files with 25 additions and 20 deletions

View File

@ -711,23 +711,25 @@ LPVOID WINAPI ThunkInitLSF(
* (ESP+4) pointer to start of relay code * (ESP+4) pointer to start of relay code
* (this is where the FT_Prolog call stub gets written to) * (this is where the FT_Prolog call stub gets written to)
* *
* Note: The two DWORD arguments get popped from the stack. * Note: The two DWORD arguments get popped off the stack.
* The first arg is popped by the relay code and stored in EIP_reg.
* *
*/ */
void WINAPI REGS_FUNC(FT_PrologPrime)( CONTEXT *context ) void WINAPI REGS_FUNC(FT_PrologPrime)( CONTEXT *context )
{ {
DWORD targetTableOffset = EIP_reg(context); DWORD targetTableOffset;
LPBYTE relayCode = (LPBYTE)STACK32_POP(context); LPBYTE relayCode;
DWORD *targetTable = *(DWORD **)(relayCode+targetTableOffset);
DWORD targetNr = LOBYTE(ECX_reg(context));
_write_ftprolog(relayCode, targetTable); /* Compensate for the fact that the Wine register relay code thought
we were being called, although we were in fact jumped to */
ESP_reg(context) -= 4;
/* We should actually call the relay code now, */ /* Write FT_Prolog call stub */
/* but we skip it and go directly to FT_Prolog */ targetTableOffset = STACK32_POP(context);
EDX_reg(context) = targetTable[targetNr]; relayCode = (LPBYTE)STACK32_POP(context);
REGS_FUNC(FT_Prolog)(context); _write_ftprolog( relayCode, *(DWORD **)(relayCode+targetTableOffset) );
/* Jump to the call stub just created */
EIP_reg(context) = (DWORD)relayCode;
} }
/*********************************************************************** /***********************************************************************
@ -743,17 +745,20 @@ void WINAPI REGS_FUNC(FT_PrologPrime)( CONTEXT *context )
*/ */
void WINAPI REGS_FUNC(QT_ThunkPrime)( CONTEXT *context ) void WINAPI REGS_FUNC(QT_ThunkPrime)( CONTEXT *context )
{ {
DWORD targetTableOffset = EDX_reg(context); DWORD targetTableOffset;
LPBYTE relayCode = (LPBYTE)EAX_reg(context); LPBYTE relayCode;
DWORD *targetTable = *(DWORD **)(relayCode+targetTableOffset);
DWORD targetNr = LOBYTE(*(DWORD *)(EBP_reg(context) - 4));
_write_qtthunk(relayCode, targetTable); /* Compensate for the fact that the Wine register relay code thought
we were being called, although we were in fact jumped to */
ESP_reg(context) -= 4;
/* We should actually call the relay code now, */ /* Write QT_Thunk call stub */
/* but we skip it and go directly to QT_Thunk */ targetTableOffset = EDX_reg(context);
EDX_reg(context) = targetTable[targetNr]; relayCode = (LPBYTE)EAX_reg(context);
REGS_FUNC(QT_Thunk)(context); _write_qtthunk( relayCode, *(DWORD **)(relayCode+targetTableOffset) );
/* Jump to the call stub just created */
EIP_reg(context) = (DWORD)relayCode;
} }
/*********************************************************************** /***********************************************************************