mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 10:13:56 +00:00
Set %fs and %gs in the register context to their current value when
calling 16-bit code.
This commit is contained in:
parent
83d6e26b31
commit
47f62a402a
6 changed files with 25 additions and 10 deletions
|
@ -1463,6 +1463,8 @@ DWORD NE_StartTask(void)
|
|||
context.SegCs = GlobalHandleToSel16(pSegTable[pModule->cs - 1].hSeg);
|
||||
context.SegDs = GlobalHandleToSel16(pTask->hInstance);
|
||||
context.SegEs = pTask->hPDB;
|
||||
context.SegFs = wine_get_fs();
|
||||
context.SegGs = wine_get_gs();
|
||||
context.Eip = pModule->ip;
|
||||
context.Ebx = pModule->stack_size;
|
||||
context.Ecx = pModule->heap_size;
|
||||
|
|
|
@ -670,14 +670,14 @@ static BOOL NE_InitDLL( NE_MODULE *pModule )
|
|||
|
||||
context.Ecx = heap;
|
||||
context.Edi = hInst;
|
||||
context.SegDs = ds;
|
||||
context.SegEs = ds; /* who knows ... */
|
||||
|
||||
context.SegCs = SEL(pSegTable[pModule->cs-1].hSeg);
|
||||
context.SegDs = ds;
|
||||
context.SegEs = ds; /* who knows ... */
|
||||
context.SegFs = wine_get_fs();
|
||||
context.SegGs = wine_get_gs();
|
||||
context.SegCs = SEL(pSegTable[pModule->cs-1].hSeg);
|
||||
context.Eip = pModule->ip;
|
||||
context.Ebp = OFFSETOF(NtCurrentTeb()->cur_stack) + (WORD)&((STACK16FRAME*)0)->bp;
|
||||
|
||||
|
||||
pModule->cs = 0; /* Don't initialize it twice */
|
||||
TRACE_(dll)("Calling LibMain, cs:ip=%04lx:%04lx ds=%04lx di=%04x cx=%04x\n",
|
||||
context.SegCs, context.Eip, context.SegDs,
|
||||
|
@ -775,7 +775,8 @@ static void NE_CallDllEntryPoint( NE_MODULE *pModule, DWORD dwReason )
|
|||
memset( &context, 0, sizeof(context) );
|
||||
context.SegDs = ds;
|
||||
context.SegEs = ds; /* who knows ... */
|
||||
|
||||
context.SegFs = wine_get_fs();
|
||||
context.SegGs = wine_get_gs();
|
||||
context.SegCs = HIWORD(entryPoint);
|
||||
context.Eip = LOWORD(entryPoint);
|
||||
context.Ebp = OFFSETOF( NtCurrentTeb()->cur_stack )
|
||||
|
|
|
@ -169,8 +169,10 @@ static void call_timer_proc16( WORD timer )
|
|||
CONTEXT86 context;
|
||||
FARPROC16 proc = SYS_Timers[timer-1].callback16;
|
||||
|
||||
memset( &context, '\0', sizeof(context) );
|
||||
memset( &context, 0, sizeof(context) );
|
||||
|
||||
context.SegFs = wine_get_fs();
|
||||
context.SegGs = wine_get_gs();
|
||||
context.SegCs = SELECTOROF( proc );
|
||||
context.Eip = OFFSETOF( proc );
|
||||
context.Ebp = OFFSETOF( NtCurrentTeb()->cur_stack )
|
||||
|
|
|
@ -349,6 +349,8 @@ void WINAPI QT_Thunk( CONTEXT86 *context )
|
|||
|
||||
memcpy(&context16,context,sizeof(context16));
|
||||
|
||||
context16.SegFs = wine_get_fs();
|
||||
context16.SegGs = wine_get_gs();
|
||||
context16.SegCs = HIWORD(context->Edx);
|
||||
context16.Eip = LOWORD(context->Edx);
|
||||
/* point EBP to the STACK16FRAME on the stack
|
||||
|
@ -478,6 +480,8 @@ void WINAPI FT_Thunk( CONTEXT86 *context )
|
|||
|
||||
memcpy(&context16,context,sizeof(context16));
|
||||
|
||||
context16.SegFs = wine_get_fs();
|
||||
context16.SegGs = wine_get_gs();
|
||||
context16.SegCs = HIWORD(callTarget);
|
||||
context16.Eip = LOWORD(callTarget);
|
||||
context16.Ebp = OFFSETOF( NtCurrentTeb()->cur_stack )
|
||||
|
@ -690,6 +694,8 @@ void WINAPI Common32ThkLS( CONTEXT86 *context )
|
|||
|
||||
memcpy(&context16,context,sizeof(context16));
|
||||
|
||||
context16.SegFs = wine_get_fs();
|
||||
context16.SegGs = wine_get_gs();
|
||||
context16.Edi = LOWORD(context->Ecx);
|
||||
context16.SegCs = HIWORD(context->Eax);
|
||||
context16.Eip = LOWORD(context->Eax);
|
||||
|
@ -747,6 +753,8 @@ void WINAPI OT_32ThkLSF( CONTEXT86 *context )
|
|||
|
||||
memcpy(&context16,context,sizeof(context16));
|
||||
|
||||
context16.SegFs = wine_get_fs();
|
||||
context16.SegGs = wine_get_gs();
|
||||
context16.SegCs = HIWORD(context->Edx);
|
||||
context16.Eip = LOWORD(context->Edx);
|
||||
context16.Ebp = OFFSETOF( NtCurrentTeb()->cur_stack )
|
||||
|
|
|
@ -590,8 +590,8 @@ static void StartPM( CONTEXT86 *context )
|
|||
pm_ctx.Edx = cs;
|
||||
pm_ctx.SegDs = ds;
|
||||
pm_ctx.SegEs = es;
|
||||
pm_ctx.SegFs = 0;
|
||||
pm_ctx.SegGs = 0;
|
||||
pm_ctx.SegFs = wine_get_fs();
|
||||
pm_ctx.SegGs = wine_get_gs();
|
||||
pm_ctx.EFlags &= ~V86_FLAG;
|
||||
|
||||
TRACE("DOS program is now entering %d-bit protected mode\n",
|
||||
|
|
|
@ -252,8 +252,10 @@ static LRESULT WINAPI WINPROC_CallWndProc16( WNDPROC16 proc, HWND16 hwnd,
|
|||
|
||||
/* Window procedures want ax = hInstance, ds = es = ss */
|
||||
|
||||
memset(&context, '\0', sizeof(context));
|
||||
memset(&context, 0, sizeof(context));
|
||||
context.SegDs = context.SegEs = SELECTOROF(teb->cur_stack);
|
||||
context.SegFs = wine_get_fs();
|
||||
context.SegGs = wine_get_gs();
|
||||
if (!(context.Eax = GetWindowWord( HWND_32(hwnd), GWL_HINSTANCE ))) context.Eax = context.SegDs;
|
||||
context.SegCs = SELECTOROF(proc);
|
||||
context.Eip = OFFSETOF(proc);
|
||||
|
|
Loading…
Reference in a new issue