Commit d8fab2e6 authored by Alexandre Julliard's avatar Alexandre Julliard

Removed some of the XXX_reg macros now that we are using the standard

CONTEXT86 structure everywhere.
parent 072dfb57
...@@ -138,12 +138,12 @@ BOOL DEBUG_ValidateRegisters(void) ...@@ -138,12 +138,12 @@ BOOL DEBUG_ValidateRegisters(void)
cs = __get_cs(); cs = __get_cs();
ds = __get_ds(); ds = __get_ds();
if (CS_reg(DEBUG_context) != cs) CHECK_SEG(CS_reg(DEBUG_context), "CS"); if (DEBUG_context.SegCs != cs) CHECK_SEG(DEBUG_context.SegCs, "CS");
if (SS_reg(DEBUG_context) != ds) CHECK_SEG(SS_reg(DEBUG_context), "SS"); if (DEBUG_context.SegSs != ds) CHECK_SEG(DEBUG_context.SegSs, "SS");
if (DS_reg(DEBUG_context) != ds) CHECK_SEG(DS_reg(DEBUG_context), "DS"); if (DEBUG_context.SegDs != ds) CHECK_SEG(DEBUG_context.SegDs, "DS");
if (ES_reg(DEBUG_context) != ds) CHECK_SEG(ES_reg(DEBUG_context), "ES"); if (DEBUG_context.SegEs != ds) CHECK_SEG(DEBUG_context.SegEs, "ES");
if (FS_reg(DEBUG_context) != ds) CHECK_SEG(FS_reg(DEBUG_context), "FS"); if (DEBUG_context.SegFs != ds) CHECK_SEG(DEBUG_context.SegFs, "FS");
if (GS_reg(DEBUG_context) != ds) CHECK_SEG(GS_reg(DEBUG_context), "GS"); if (DEBUG_context.SegGs != ds) CHECK_SEG(DEBUG_context.SegGs, "GS");
#endif #endif
/* Check that CS and SS are not NULL */ /* Check that CS and SS are not NULL */
......
...@@ -84,8 +84,8 @@ void WIN87_Init( CONTEXT86 *context ) ...@@ -84,8 +84,8 @@ void WIN87_Init( CONTEXT86 *context )
void WINAPI WIN87_fpmath( CONTEXT86 *context ) void WINAPI WIN87_fpmath( CONTEXT86 *context )
{ {
TRACE("(cs:eip=%x:%lx es=%x bx=%04x ax=%04x dx==%04x)\n", TRACE("(cs:eip=%x:%lx es=%x bx=%04x ax=%04x dx==%04x)\n",
(WORD)CS_reg(context), EIP_reg(context), (WORD)context->SegCs, context->Eip,
(WORD)ES_reg(context), BX_reg(context), (WORD)context->SegEs, BX_reg(context),
AX_reg(context), DX_reg(context) ); AX_reg(context), DX_reg(context) );
switch(BX_reg(context)) switch(BX_reg(context))
......
...@@ -363,11 +363,11 @@ BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type) ...@@ -363,11 +363,11 @@ BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type)
*/ */
void WINAPI NTDLL_chkstk( CONTEXT86 *context ) void WINAPI NTDLL_chkstk( CONTEXT86 *context )
{ {
ESP_reg(context) -= EAX_reg(context); context->Esp -= context->Eax;
} }
void WINAPI NTDLL_alloca_probe( CONTEXT86 *context ) void WINAPI NTDLL_alloca_probe( CONTEXT86 *context )
{ {
ESP_reg(context) -= EAX_reg(context); context->Esp -= context->Eax;
} }
/****************************************************************************** /******************************************************************************
......
...@@ -73,14 +73,14 @@ static VOID WINAPI MOUSE_CallMouseEventProc( FARPROC16 proc, ...@@ -73,14 +73,14 @@ static VOID WINAPI MOUSE_CallMouseEventProc( FARPROC16 proc,
CONTEXT86 context; CONTEXT86 context;
memset( &context, 0, sizeof(context) ); memset( &context, 0, sizeof(context) );
CS_reg(&context) = SELECTOROF( proc ); context.SegCs = SELECTOROF( proc );
EIP_reg(&context) = OFFSETOF( proc ); context.Eip = OFFSETOF( proc );
AX_reg(&context) = (WORD)dwFlags; context.Eax = (WORD)dwFlags;
BX_reg(&context) = (WORD)dx; context.Ebx = (WORD)dx;
CX_reg(&context) = (WORD)dy; context.Ecx = (WORD)dy;
DX_reg(&context) = (WORD)cButtons; context.Edx = (WORD)cButtons;
SI_reg(&context) = LOWORD( dwExtraInfo ); context.Esi = LOWORD( dwExtraInfo );
DI_reg(&context) = HIWORD( dwExtraInfo ); context.Edi = HIWORD( dwExtraInfo );
CallTo16RegisterShort( &context, 0 ); CallTo16RegisterShort( &context, 0 );
} }
......
...@@ -212,7 +212,7 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context ) ...@@ -212,7 +212,7 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context )
DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n", DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context), AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context), DX_reg(context), SI_reg(context), DI_reg(context),
(WORD)ES_reg(context), EFL_reg(context) ); (WORD)context->SegEs, context->EFlags );
SYSLEVEL_CheckNotLevel( 2 ); SYSLEVEL_CheckNotLevel( 2 );
} }
...@@ -249,11 +249,11 @@ void RELAY_DebugCallFrom16Ret( CONTEXT86 *context, int ret_val ) ...@@ -249,11 +249,11 @@ void RELAY_DebugCallFrom16Ret( CONTEXT86 *context, int ret_val )
|| memcmp( args+2, "intr_", 5 ) == 0 ) || memcmp( args+2, "intr_", 5 ) == 0 )
{ {
DPRINTF("retval=none ret=%04x:%04x ds=%04x\n", DPRINTF("retval=none ret=%04x:%04x ds=%04x\n",
(WORD)CS_reg(context), LOWORD(EIP_reg(context)), (WORD)DS_reg(context)); (WORD)context->SegCs, LOWORD(context->Eip), (WORD)context->SegDs);
DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n", DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context), AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context), DX_reg(context), SI_reg(context), DI_reg(context),
(WORD)ES_reg(context), EFL_reg(context) ); (WORD)context->SegEs, context->EFlags );
} }
SYSLEVEL_CheckNotLevel( 2 ); SYSLEVEL_CheckNotLevel( 2 );
...@@ -302,14 +302,14 @@ void RELAY_DebugCallTo16( LPVOID target, int nb_args, BOOL reg_func ) ...@@ -302,14 +302,14 @@ void RELAY_DebugCallTo16( LPVOID target, int nb_args, BOOL reg_func )
CONTEXT86 *context = (CONTEXT86 *)target; CONTEXT86 *context = (CONTEXT86 *)target;
DPRINTF("CallTo16(func=%04lx:%04x,ds=%04lx", DPRINTF("CallTo16(func=%04lx:%04x,ds=%04lx",
CS_reg(context), LOWORD(EIP_reg(context)), DS_reg(context) ); context->SegCs, LOWORD(context->Eip), context->SegDs );
while (nb_args--) DPRINTF( ",0x%04x", *--stack16 ); while (nb_args--) DPRINTF( ",0x%04x", *--stack16 );
DPRINTF(") ss:sp=%04x:%04x\n", SELECTOROF(teb->cur_stack), DPRINTF(") ss:sp=%04x:%04x\n", SELECTOROF(teb->cur_stack),
OFFSETOF(teb->cur_stack) ); OFFSETOF(teb->cur_stack) );
DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x BP=%04x ES=%04x FS=%04x\n", DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x BP=%04x ES=%04x FS=%04x\n",
AX_reg(context), BX_reg(context), CX_reg(context), AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context), DX_reg(context), SI_reg(context), DI_reg(context),
BP_reg(context), (WORD)ES_reg(context), (WORD)FS_reg(context) ); BP_reg(context), (WORD)context->SegEs, (WORD)context->SegFs );
} }
else else
{ {
...@@ -346,7 +346,7 @@ void RELAY_DebugCallTo16Ret( BOOL reg_func, int ret_val ) ...@@ -346,7 +346,7 @@ void RELAY_DebugCallTo16Ret( BOOL reg_func, int ret_val )
OFFSETOF(NtCurrentTeb()->cur_stack)); OFFSETOF(NtCurrentTeb()->cur_stack));
DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x BP=%04x SP=%04x\n", DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x BP=%04x SP=%04x\n",
AX_reg(context), BX_reg(context), CX_reg(context), AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), BP_reg(context), LOWORD(ESP_reg(context))); DX_reg(context), BP_reg(context), LOWORD(context->Esp));
} }
SYSLEVEL_CheckNotLevel( 2 ); SYSLEVEL_CheckNotLevel( 2 );
......
...@@ -207,11 +207,11 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) { ...@@ -207,11 +207,11 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) {
return (FARPROC16)(SEGPTR)MAKELONG(((char*)fun-(char*)dll->funs),dll->funhandle); return (FARPROC16)(SEGPTR)MAKELONG(((char*)fun-(char*)dll->funs),dll->funhandle);
} }
#define CALLER1REF (*(DWORD*)(PTR_SEG_OFF_TO_LIN(SS_reg(context),LOWORD(ESP_reg(context))+4))) #define CALLER1REF (*(DWORD*)(PTR_SEG_OFF_TO_LIN(context->SegSs,LOWORD(context->Esp)+4)))
void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) { void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) {
DWORD ordinal=0; DWORD ordinal=0;
DWORD entry=(DWORD)PTR_SEG_OFF_TO_LIN(CS_reg(context),LOWORD(EIP_reg(context)))-5; DWORD entry=(DWORD)PTR_SEG_OFF_TO_LIN(context->SegCs,LOWORD(context->Eip))-5;
WORD xcs = CS_reg(context); WORD xcs = context->SegCs;
SNOOP16_DLL *dll = firstdll; SNOOP16_DLL *dll = firstdll;
SNOOP16_FUN *fun = NULL; SNOOP16_FUN *fun = NULL;
SNOOP16_RETURNENTRIES **rets = &firstrets; SNOOP16_RETURNENTRIES **rets = &firstrets;
...@@ -253,10 +253,10 @@ void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) { ...@@ -253,10 +253,10 @@ void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) {
ret->dll = dll; ret->dll = dll;
ret->args = NULL; ret->args = NULL;
ret->ordinal = ordinal; ret->ordinal = ordinal;
ret->origSP = LOWORD(ESP_reg(context)); ret->origSP = LOWORD(context->Esp);
EIP_reg(context)= LOWORD(fun->origfun); context->Eip= LOWORD(fun->origfun);
CS_reg(context) = HIWORD(fun->origfun); context->SegCs = HIWORD(fun->origfun);
DPRINTF("CALL %s.%ld: %s(",dll->name,ordinal,fun->name); DPRINTF("CALL %s.%ld: %s(",dll->name,ordinal,fun->name);
...@@ -264,19 +264,19 @@ void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) { ...@@ -264,19 +264,19 @@ void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) {
max = fun->nrofargs; max = fun->nrofargs;
if (max>16) max=16; if (max>16) max=16;
for (i=max;i--;) for (i=max;i--;)
DPRINTF("%04x%s",*(WORD*)((char *) PTR_SEG_OFF_TO_LIN(SS_reg(context),LOWORD(ESP_reg(context)))+8+sizeof(WORD)*i),i?",":""); DPRINTF("%04x%s",*(WORD*)((char *) PTR_SEG_OFF_TO_LIN(context->SegSs,LOWORD(context->Esp))+8+sizeof(WORD)*i),i?",":"");
if (max!=fun->nrofargs) if (max!=fun->nrofargs)
DPRINTF(" ..."); DPRINTF(" ...");
} else if (fun->nrofargs<0) { } else if (fun->nrofargs<0) {
DPRINTF("<unknown, check return>"); DPRINTF("<unknown, check return>");
ret->args = HeapAlloc(GetProcessHeap(),0,16*sizeof(WORD)); ret->args = HeapAlloc(GetProcessHeap(),0,16*sizeof(WORD));
memcpy(ret->args,(LPBYTE)((char *) PTR_SEG_OFF_TO_LIN(SS_reg(context),LOWORD(ESP_reg(context)))+8),sizeof(WORD)*16); memcpy(ret->args,(LPBYTE)((char *) PTR_SEG_OFF_TO_LIN(context->SegSs,LOWORD(context->Esp))+8),sizeof(WORD)*16);
} }
DPRINTF(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn)); DPRINTF(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn));
} }
void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT86 *context) { void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT86 *context) {
SNOOP16_RETURNENTRY *ret = (SNOOP16_RETURNENTRY*)((char *) PTR_SEG_OFF_TO_LIN(CS_reg(context),LOWORD(EIP_reg(context)))-5); SNOOP16_RETURNENTRY *ret = (SNOOP16_RETURNENTRY*)((char *) PTR_SEG_OFF_TO_LIN(context->SegCs,LOWORD(context->Eip))-5);
/* We haven't found out the nrofargs yet. If we called a cdecl /* We haven't found out the nrofargs yet. If we called a cdecl
* function it is too late anyway and we can just set '0' (which * function it is too late anyway and we can just set '0' (which
...@@ -284,10 +284,10 @@ void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT86 *context) { ...@@ -284,10 +284,10 @@ void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT86 *context) {
* If pascal -> everything ok. * If pascal -> everything ok.
*/ */
if (ret->dll->funs[ret->ordinal].nrofargs<0) { if (ret->dll->funs[ret->ordinal].nrofargs<0) {
ret->dll->funs[ret->ordinal].nrofargs=(LOWORD(ESP_reg(context))-ret->origSP-4)/2; ret->dll->funs[ret->ordinal].nrofargs=(LOWORD(context->Esp)-ret->origSP-4)/2;
} }
EIP_reg(context) = LOWORD(ret->origreturn); context->Eip = LOWORD(ret->origreturn);
CS_reg(context) = HIWORD(ret->origreturn); context->SegCs = HIWORD(ret->origreturn);
if (ret->args) { if (ret->args) {
int i,max; int i,max;
......
...@@ -268,8 +268,8 @@ extern void ASPI_DOS_HandleInt(CONTEXT86 *context); ...@@ -268,8 +268,8 @@ extern void ASPI_DOS_HandleInt(CONTEXT86 *context);
ERR( "int%x: unknown/not implemented parameters:\n" \ ERR( "int%x: unknown/not implemented parameters:\n" \
"int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \ "int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \
"SI %04x, DI %04x, DS %04x, ES %04x\n", \ "SI %04x, DI %04x, DS %04x, ES %04x\n", \
(num), (num), AX_reg(context), BX_reg(context), CX_reg(context), \ (num), (num), LOWORD((context)->Eax), LOWORD((context)->Ebx), \
DX_reg(context), SI_reg(context), DI_reg(context), \ LOWORD((context)->Ecx), LOWORD((context)->Edx), LOWORD((context)->Esi), \
(WORD)DS_reg(context), (WORD)ES_reg(context) ) LOWORD((context)->Edi), (WORD)(context)->SegDs, (WORD)(context)->SegEs )
#endif /* __WINE_MISCEMU_H */ #endif /* __WINE_MISCEMU_H */
...@@ -688,48 +688,28 @@ typedef HANDLE *PHANDLE; ...@@ -688,48 +688,28 @@ typedef HANDLE *PHANDLE;
/* Macros for easier access to i386 context registers */ /* Macros for easier access to i386 context registers */
#define EAX_reg(context) ((context)->Eax) #define AX_reg(context) (*(WORD*)&(context)->Eax)
#define EBX_reg(context) ((context)->Ebx) #define BX_reg(context) (*(WORD*)&(context)->Ebx)
#define ECX_reg(context) ((context)->Ecx) #define CX_reg(context) (*(WORD*)&(context)->Ecx)
#define EDX_reg(context) ((context)->Edx) #define DX_reg(context) (*(WORD*)&(context)->Edx)
#define ESI_reg(context) ((context)->Esi) #define SI_reg(context) (*(WORD*)&(context)->Esi)
#define EDI_reg(context) ((context)->Edi) #define DI_reg(context) (*(WORD*)&(context)->Edi)
#define EBP_reg(context) ((context)->Ebp) #define BP_reg(context) (*(WORD*)&(context)->Ebp)
#define CS_reg(context) ((context)->SegCs) #define AL_reg(context) (*(BYTE*)&(context)->Eax)
#define DS_reg(context) ((context)->SegDs) #define AH_reg(context) (*((BYTE*)&(context)->Eax + 1))
#define ES_reg(context) ((context)->SegEs) #define BL_reg(context) (*(BYTE*)&(context)->Ebx)
#define FS_reg(context) ((context)->SegFs) #define BH_reg(context) (*((BYTE*)&(context)->Ebx + 1))
#define GS_reg(context) ((context)->SegGs) #define CL_reg(context) (*(BYTE*)&(context)->Ecx)
#define SS_reg(context) ((context)->SegSs) #define CH_reg(context) (*((BYTE*)&(context)->Ecx + 1))
#define DL_reg(context) (*(BYTE*)&(context)->Edx)
#define EFL_reg(context) ((context)->EFlags) #define DH_reg(context) (*((BYTE*)&(context)->Edx + 1))
#define EIP_reg(context) ((context)->Eip)
#define ESP_reg(context) ((context)->Esp) #define SET_CFLAG(context) ((context)->EFlags |= 0x0001)
#define RESET_CFLAG(context) ((context)->EFlags &= ~0x0001)
#define AX_reg(context) (*(WORD*)&EAX_reg(context)) #define SET_ZFLAG(context) ((context)->EFlags |= 0x0040)
#define BX_reg(context) (*(WORD*)&EBX_reg(context)) #define RESET_ZFLAG(context) ((context)->EFlags &= ~0x0040)
#define CX_reg(context) (*(WORD*)&ECX_reg(context)) #define ISV86(context) ((context)->EFlags & 0x00020000)
#define DX_reg(context) (*(WORD*)&EDX_reg(context))
#define SI_reg(context) (*(WORD*)&ESI_reg(context))
#define DI_reg(context) (*(WORD*)&EDI_reg(context))
#define BP_reg(context) (*(WORD*)&EBP_reg(context))
#define AL_reg(context) (*(BYTE*)&EAX_reg(context))
#define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
#define BL_reg(context) (*(BYTE*)&EBX_reg(context))
#define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
#define CL_reg(context) (*(BYTE*)&ECX_reg(context))
#define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
#define DL_reg(context) (*(BYTE*)&EDX_reg(context))
#define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
#define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
#define RESET_CFLAG(context) (EFL_reg(context) &= ~0x0001)
#define SET_ZFLAG(context) (EFL_reg(context) |= 0x0040)
#define RESET_ZFLAG(context) (EFL_reg(context) &= ~0x0040)
#define ISV86(context) (EFL_reg(context) & 0x00020000)
/* Macros to retrieve the current context */ /* Macros to retrieve the current context */
......
...@@ -50,11 +50,11 @@ DECLARE_DEBUG_CHANNEL(relay) ...@@ -50,11 +50,11 @@ DECLARE_DEBUG_CHANNEL(relay)
# include <sys/mman.h> # include <sys/mman.h>
#endif #endif
#define IF_CLR(ctx) EFL_reg(ctx) &= ~VIF_MASK #define IF_CLR(ctx) ((ctx)->EFlags &= ~VIF_MASK)
#define IF_ENABLED(ctx) (EFL_reg(ctx) & VIF_MASK) #define IF_ENABLED(ctx) ((ctx)->EFlags & VIF_MASK)
#define SET_PEND(ctx) EFL_reg(ctx) |= VIP_MASK #define SET_PEND(ctx) ((ctx)->EFlags |= VIP_MASK)
#define CLR_PEND(ctx) EFL_reg(ctx) &= ~VIP_MASK #define CLR_PEND(ctx) ((ctx)->EFlags &= ~VIP_MASK)
#define IS_PEND(ctx) (EFL_reg(ctx) & VIP_MASK) #define IS_PEND(ctx) ((ctx)->EFlags & VIP_MASK)
#undef TRY_PICRETURN #undef TRY_PICRETURN
...@@ -87,7 +87,7 @@ static void do_exception( int signal, CONTEXT86 *context ) ...@@ -87,7 +87,7 @@ static void do_exception( int signal, CONTEXT86 *context )
rec.ExceptionFlags = EH_NONCONTINUABLE; rec.ExceptionFlags = EH_NONCONTINUABLE;
} }
rec.ExceptionRecord = NULL; rec.ExceptionRecord = NULL;
rec.ExceptionAddress = (LPVOID)EIP_reg(context); rec.ExceptionAddress = (LPVOID)context->Eip;
rec.NumberParameters = 0; rec.NumberParameters = 0;
EXC_RtlRaiseException( &rec, context ); EXC_RtlRaiseException( &rec, context );
} }
...@@ -129,7 +129,7 @@ static void DOSVM_Dump( int fn, int sig, struct vm86plus_struct*VM86 ) ...@@ -129,7 +129,7 @@ static void DOSVM_Dump( int fn, int sig, struct vm86plus_struct*VM86 )
static int DOSVM_Int( int vect, CONTEXT86 *context ) static int DOSVM_Int( int vect, CONTEXT86 *context )
{ {
if (vect==0x31) { if (vect==0x31) {
if (CS_reg(context)==DOSMEM_wrap_seg) { if (context->SegCs==DOSMEM_wrap_seg) {
/* exit from real-mode wrapper */ /* exit from real-mode wrapper */
return -1; return -1;
} }
...@@ -148,17 +148,17 @@ static void DOSVM_SimulateInt( int vect, CONTEXT86 *context ) ...@@ -148,17 +148,17 @@ static void DOSVM_SimulateInt( int vect, CONTEXT86 *context )
INT_RealModeInterrupt(vect,context); INT_RealModeInterrupt(vect,context);
} else { } else {
WORD*stack= PTR_REAL_TO_LIN( context->SegSs, context->Esp ); WORD*stack= PTR_REAL_TO_LIN( context->SegSs, context->Esp );
WORD flag=LOWORD(EFL_reg(context)); WORD flag=LOWORD(context->EFlags);
if (IF_ENABLED(context)) flag|=IF_MASK; if (IF_ENABLED(context)) flag|=IF_MASK;
else flag&=~IF_MASK; else flag&=~IF_MASK;
*(--stack)=flag; *(--stack)=flag;
*(--stack)=CS_reg(context); *(--stack)=context->SegCs;
*(--stack)=LOWORD(EIP_reg(context)); *(--stack)=LOWORD(context->Eip);
ESP_reg(context)-=6; context->Esp-=6;
CS_reg(context)=SELECTOROF(handler); context->SegCs=SELECTOROF(handler);
EIP_reg(context)=OFFSETOF(handler); context->Eip=OFFSETOF(handler);
IF_CLR(context); IF_CLR(context);
} }
} }
...@@ -250,23 +250,23 @@ void DOSVM_QueueEvent( int irq, int priority, void (*relay)(CONTEXT86*,void*), v ...@@ -250,23 +250,23 @@ void DOSVM_QueueEvent( int irq, int priority, void (*relay)(CONTEXT86*,void*), v
} }
} }
#define CV CP(eax,EAX); CP(ecx,ECX); CP(edx,EDX); CP(ebx,EBX); \ #define CV do { CP(eax,Eax); CP(ecx,Ecx); CP(edx,Edx); CP(ebx,Ebx); \
CP(esi,ESI); CP(edi,EDI); CP(esp,ESP); CP(ebp,EBP); \ CP(esi,Esi); CP(edi,Edi); CP(esp,Esp); CP(ebp,Ebp); \
CP(cs,CS); CP(ds,DS); CP(es,ES); \ CP(cs,SegCs); CP(ds,SegDs); CP(es,SegEs); \
CP(ss,SS); CP(fs,FS); CP(gs,GS); \ CP(ss,SegSs); CP(fs,SegFs); CP(gs,SegGs); \
CP(eip,EIP); CP(eflags,EFL) CP(eip,Eip); CP(eflags,EFlags); } while(0)
static int DOSVM_Process( int fn, int sig, struct vm86plus_struct*VM86 ) static int DOSVM_Process( int fn, int sig, struct vm86plus_struct*VM86 )
{ {
CONTEXT86 context; CONTEXT86 context;
int ret=0; int ret=0;
#define CP(x,y) y##_reg(&context) = VM86->regs.x #define CP(x,y) context.y = VM86->regs.x
CV; CV;
#undef CP #undef CP
if (VM86_TYPE(fn)==VM86_UNKNOWN) { if (VM86_TYPE(fn)==VM86_UNKNOWN) {
ret=INSTR_EmulateInstruction(&context); ret=INSTR_EmulateInstruction(&context);
#define CP(x,y) VM86->regs.x = y##_reg(&context) #define CP(x,y) VM86->regs.x = context.y
CV; CV;
#undef CP #undef CP
if (ret) return 0; if (ret) return 0;
...@@ -333,7 +333,7 @@ static int DOSVM_Process( int fn, int sig, struct vm86plus_struct*VM86 ) ...@@ -333,7 +333,7 @@ static int DOSVM_Process( int fn, int sig, struct vm86plus_struct*VM86 )
ret=-1; ret=-1;
} }
#define CP(x,y) VM86->regs.x = y##_reg(&context) #define CP(x,y) VM86->regs.x = context.y
CV; CV;
#undef CP #undef CP
#ifdef TRY_PICRETURN #ifdef TRY_PICRETURN
...@@ -456,7 +456,7 @@ int DOSVM_Enter( CONTEXT86 *context ) ...@@ -456,7 +456,7 @@ int DOSVM_Enter( CONTEXT86 *context )
struct vm86plus_struct VM86; struct vm86plus_struct VM86;
int stat,len,sig; int stat,len,sig;
#define CP(x,y) VM86.regs.x = y##_reg(context) #define CP(x,y) VM86.regs.x = context->y
CV; CV;
#undef CP #undef CP
if (VM86.regs.eflags & IF_MASK) if (VM86.regs.eflags & IF_MASK)
...@@ -517,11 +517,9 @@ int DOSVM_Enter( CONTEXT86 *context ) ...@@ -517,11 +517,9 @@ int DOSVM_Enter( CONTEXT86 *context )
} while (DOSVM_Process(stat,sig,&VM86)>=0); } while (DOSVM_Process(stat,sig,&VM86)>=0);
entered--; entered--;
if (context) { #define CP(x,y) context->y = VM86.regs.x
#define CP(x,y) y##_reg(context) = VM86.regs.x
CV; CV;
#undef CP #undef CP
}
return 0; return 0;
} }
......
...@@ -1177,24 +1177,24 @@ static void NE_InitProcess(void) ...@@ -1177,24 +1177,24 @@ static void NE_InitProcess(void)
* sp top of the stack * sp top of the stack
*/ */
memset( &context, 0, sizeof(context) ); memset( &context, 0, sizeof(context) );
CS_reg(&context) = GlobalHandleToSel16(pSegTable[pModule->cs - 1].hSeg); context.SegCs = GlobalHandleToSel16(pSegTable[pModule->cs - 1].hSeg);
DS_reg(&context) = GlobalHandleToSel16(pTask->hInstance); context.SegDs = GlobalHandleToSel16(pTask->hInstance);
ES_reg(&context) = pTask->hPDB; context.SegEs = pTask->hPDB;
EIP_reg(&context) = pModule->ip; context.Eip = pModule->ip;
EBX_reg(&context) = pModule->stack_size; context.Ebx = pModule->stack_size;
ECX_reg(&context) = pModule->heap_size; context.Ecx = pModule->heap_size;
EDI_reg(&context) = pTask->hInstance; context.Edi = pTask->hInstance;
ESI_reg(&context) = pTask->hPrevInstance; context.Esi = pTask->hPrevInstance;
/* Now call 16-bit entry point */ /* Now call 16-bit entry point */
TRACE("Starting main program: cs:ip=%04lx:%04lx ds=%04lx ss:sp=%04x:%04x\n", TRACE("Starting main program: cs:ip=%04lx:%04lx ds=%04lx ss:sp=%04x:%04x\n",
CS_reg(&context), EIP_reg(&context), DS_reg(&context), context.SegCs, context.Eip, context.SegDs,
SELECTOROF(pTask->teb->cur_stack), SELECTOROF(pTask->teb->cur_stack),
OFFSETOF(pTask->teb->cur_stack) ); OFFSETOF(pTask->teb->cur_stack) );
CallTo16RegisterShort( &context, 0 ); CallTo16RegisterShort( &context, 0 );
ExitThread( AX_reg( &context ) ); ExitThread( LOWORD(context.Eax) );
} }
SYSLEVEL_LeaveWin16Lock(); SYSLEVEL_LeaveWin16Lock();
...@@ -1473,13 +1473,13 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name ) ...@@ -1473,13 +1473,13 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
if (pModule->flags & NE_FFLAGS_WIN32) continue; if (pModule->flags & NE_FFLAGS_WIN32) continue;
name_table = (BYTE *)pModule + pModule->name_table; name_table = (BYTE *)pModule + pModule->name_table;
/* FIXME: the lstrncmpiA is WRONG. It should not be case insensitive, /* FIXME: the strncasecmp is WRONG. It should not be case insensitive,
* but case sensitive! (Unfortunately Winword 6 and subdlls have * but case sensitive! (Unfortunately Winword 6 and subdlls have
* lowercased module names, but try to load uppercase DLLs, so this * lowercased module names, but try to load uppercase DLLs, so this
* 'i' compare is just a quickfix until the loader handles that * 'i' compare is just a quickfix until the loader handles that
* correctly. -MM 990705 * correctly. -MM 990705
*/ */
if ((*name_table == len) && !lstrncmpiA(tmpstr, name_table+1, len)) if ((*name_table == len) && !strncasecmp(tmpstr, name_table+1, len))
return hModule; return hModule;
} }
...@@ -1611,7 +1611,7 @@ static HMODULE16 NE_GetModuleByFilename( LPCSTR name ) ...@@ -1611,7 +1611,7 @@ static HMODULE16 NE_GetModuleByFilename( LPCSTR name )
if (pModule->flags & NE_FFLAGS_WIN32) continue; if (pModule->flags & NE_FFLAGS_WIN32) continue;
name_table = (BYTE *)pModule + pModule->name_table; name_table = (BYTE *)pModule + pModule->name_table;
if ((*name_table == len) && !lstrncmpiA(s, name_table+1, len)) if ((*name_table == len) && !strncasecmp(s, name_table+1, len))
return hModule; return hModule;
} }
...@@ -1729,7 +1729,7 @@ HMODULE WINAPI MapHModuleSL(HMODULE16 hmod) { ...@@ -1729,7 +1729,7 @@ HMODULE WINAPI MapHModuleSL(HMODULE16 hmod) {
*/ */
void WINAPI MapHInstLS( CONTEXT86 *context ) void WINAPI MapHInstLS( CONTEXT86 *context )
{ {
EAX_reg(context) = MapHModuleLS(EAX_reg(context)); context->Eax = MapHModuleLS(context->Eax);
} }
/*************************************************************************** /***************************************************************************
...@@ -1737,7 +1737,7 @@ void WINAPI MapHInstLS( CONTEXT86 *context ) ...@@ -1737,7 +1737,7 @@ void WINAPI MapHInstLS( CONTEXT86 *context )
*/ */
void WINAPI MapHInstSL( CONTEXT86 *context ) void WINAPI MapHInstSL( CONTEXT86 *context )
{ {
EAX_reg(context) = MapHModuleSL(EAX_reg(context)); context->Eax = MapHModuleSL(context->Eax);
} }
/*************************************************************************** /***************************************************************************
...@@ -1745,8 +1745,7 @@ void WINAPI MapHInstSL( CONTEXT86 *context ) ...@@ -1745,8 +1745,7 @@ void WINAPI MapHInstSL( CONTEXT86 *context )
*/ */
void WINAPI MapHInstLS_PN( CONTEXT86 *context ) void WINAPI MapHInstLS_PN( CONTEXT86 *context )
{ {
if (EAX_reg(context)) if (context->Eax) context->Eax = MapHModuleLS(context->Eax);
EAX_reg(context) = MapHModuleLS(EAX_reg(context));
} }
/*************************************************************************** /***************************************************************************
...@@ -1754,7 +1753,6 @@ void WINAPI MapHInstLS_PN( CONTEXT86 *context ) ...@@ -1754,7 +1753,6 @@ void WINAPI MapHInstLS_PN( CONTEXT86 *context )
*/ */
void WINAPI MapHInstSL_PN( CONTEXT86 *context ) void WINAPI MapHInstSL_PN( CONTEXT86 *context )
{ {
if (EAX_reg(context)) if (context->Eax) context->Eax = MapHModuleSL(context->Eax);
EAX_reg(context) = MapHModuleSL(EAX_reg(context));
} }
...@@ -613,20 +613,20 @@ static BOOL NE_InitDLL( TDB* pTask, NE_MODULE *pModule ) ...@@ -613,20 +613,20 @@ static BOOL NE_InitDLL( TDB* pTask, NE_MODULE *pModule )
NE_GetDLLInitParams( pModule, &hInst, &ds, &heap ); NE_GetDLLInitParams( pModule, &hInst, &ds, &heap );
ECX_reg(&context) = heap; context.Ecx = heap;
EDI_reg(&context) = hInst; context.Edi = hInst;
DS_reg(&context) = ds; context.SegDs = ds;
ES_reg(&context) = ds; /* who knows ... */ context.SegEs = ds; /* who knows ... */
CS_reg(&context) = SEL(pSegTable[pModule->cs-1].hSeg); context.SegCs = SEL(pSegTable[pModule->cs-1].hSeg);
EIP_reg(&context) = pModule->ip; context.Eip = pModule->ip;
EBP_reg(&context) = OFFSETOF(NtCurrentTeb()->cur_stack) + (WORD)&((STACK16FRAME*)0)->bp; context.Ebp = OFFSETOF(NtCurrentTeb()->cur_stack) + (WORD)&((STACK16FRAME*)0)->bp;
pModule->cs = 0; /* Don't initialize it twice */ pModule->cs = 0; /* Don't initialize it twice */
TRACE_(dll)("Calling LibMain, cs:ip=%04lx:%04lx ds=%04lx di=%04x cx=%04x\n", TRACE_(dll)("Calling LibMain, cs:ip=%04lx:%04lx ds=%04lx di=%04x cx=%04x\n",
CS_reg(&context), EIP_reg(&context), DS_reg(&context), context.SegCs, context.Eip, context.SegDs,
DI_reg(&context), CX_reg(&context) ); LOWORD(context.Edi), LOWORD(context.Ecx) );
CallTo16RegisterShort( &context, 0 ); CallTo16RegisterShort( &context, 0 );
return TRUE; return TRUE;
} }
...@@ -697,12 +697,12 @@ static void NE_CallDllEntryPoint( NE_MODULE *pModule, DWORD dwReason ) ...@@ -697,12 +697,12 @@ static void NE_CallDllEntryPoint( NE_MODULE *pModule, DWORD dwReason )
CONTEXT86 context; CONTEXT86 context;
memset( &context, 0, sizeof(context) ); memset( &context, 0, sizeof(context) );
DS_reg(&context) = ds; context.SegDs = ds;
ES_reg(&context) = ds; /* who knows ... */ context.SegEs = ds; /* who knows ... */
CS_reg(&context) = HIWORD(entryPoint); context.SegCs = HIWORD(entryPoint);
EIP_reg(&context) = LOWORD(entryPoint); context.Eip = LOWORD(entryPoint);
EBP_reg(&context) = OFFSETOF( NtCurrentTeb()->cur_stack ) context.Ebp = OFFSETOF( NtCurrentTeb()->cur_stack )
+ (WORD)&((STACK16FRAME*)0)->bp; + (WORD)&((STACK16FRAME*)0)->bp;
*(DWORD *)(stack - 4) = dwReason; /* dwReason */ *(DWORD *)(stack - 4) = dwReason; /* dwReason */
......
...@@ -631,7 +631,7 @@ void WINAPI InitTask16( CONTEXT86 *context ) ...@@ -631,7 +631,7 @@ void WINAPI InitTask16( CONTEXT86 *context )
INSTANCEDATA *pinstance; INSTANCEDATA *pinstance;
SEGPTR ptr; SEGPTR ptr;
EAX_reg(context) = 0; context->Eax = 0;
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return; if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return;
/* Note: we need to trust that BX/CX contain the stack/heap sizes, /* Note: we need to trust that BX/CX contain the stack/heap sizes,
...@@ -642,12 +642,12 @@ void WINAPI InitTask16( CONTEXT86 *context ) ...@@ -642,12 +642,12 @@ void WINAPI InitTask16( CONTEXT86 *context )
pinstance = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN(CURRENT_DS, 0); pinstance = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN(CURRENT_DS, 0);
pinstance->stackmin = OFFSETOF( pTask->teb->cur_stack ) + sizeof( STACK16FRAME ); pinstance->stackmin = OFFSETOF( pTask->teb->cur_stack ) + 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 > BX_reg(context)? pinstance->stacktop = ( pinstance->stackmin > LOWORD(context->Ebx) ?
pinstance->stackmin - BX_reg(context) : 0 ) + 150; pinstance->stackmin - LOWORD(context->Ebx) : 0 ) + 150;
/* Initialize the local heap */ /* Initialize the local heap */
if ( CX_reg(context) ) if (LOWORD(context->Ecx))
LocalInit16( GlobalHandleToSel16(pTask->hInstance), 0, CX_reg(context) ); LocalInit16( GlobalHandleToSel16(pTask->hInstance), 0, LOWORD(context->Ecx) );
/* Initialize implicitly loaded DLLs */ /* Initialize implicitly loaded DLLs */
NE_InitializeDLLs( pTask->hModule ); NE_InitializeDLLs( pTask->hModule );
...@@ -665,22 +665,22 @@ void WINAPI InitTask16( CONTEXT86 *context ) ...@@ -665,22 +665,22 @@ void WINAPI InitTask16( CONTEXT86 *context )
*/ */
ptr = stack16_push( sizeof(WORD) ); ptr = stack16_push( sizeof(WORD) );
*(WORD *)PTR_SEG_TO_LIN(ptr) = 0; *(WORD *)PTR_SEG_TO_LIN(ptr) = 0;
ESP_reg(context) -= 2; context->Esp -= 2;
EAX_reg(context) = 1; context->Eax = 1;
if (!pTask->pdb.cmdLine[0]) EBX_reg(context) = 0x80; if (!pTask->pdb.cmdLine[0]) context->Ebx = 0x80;
else else
{ {
LPBYTE p = &pTask->pdb.cmdLine[1]; LPBYTE p = &pTask->pdb.cmdLine[1];
while ((*p == ' ') || (*p == '\t')) p++; while ((*p == ' ') || (*p == '\t')) p++;
EBX_reg(context) = 0x80 + (p - pTask->pdb.cmdLine); context->Ebx = 0x80 + (p - pTask->pdb.cmdLine);
} }
ECX_reg(context) = pinstance->stacktop; context->Ecx = pinstance->stacktop;
EDX_reg(context) = pTask->nCmdShow; context->Edx = pTask->nCmdShow;
ESI_reg(context) = (DWORD)pTask->hPrevInstance; context->Esi = (DWORD)pTask->hPrevInstance;
EDI_reg(context) = (DWORD)pTask->hInstance; context->Edi = (DWORD)pTask->hInstance;
ES_reg (context) = (WORD)pTask->hPDB; context->SegEs = (WORD)pTask->hPDB;
} }
...@@ -1229,8 +1229,8 @@ void WINAPI SwitchStackBack16( CONTEXT86 *context ) ...@@ -1229,8 +1229,8 @@ void WINAPI SwitchStackBack16( CONTEXT86 *context )
/* Switch back to the old stack */ /* Switch back to the old stack */
NtCurrentTeb()->cur_stack = pData->old_ss_sp - sizeof(STACK16FRAME); NtCurrentTeb()->cur_stack = pData->old_ss_sp - sizeof(STACK16FRAME);
SS_reg(context) = SELECTOROF(pData->old_ss_sp); context->SegSs = SELECTOROF(pData->old_ss_sp);
ESP_reg(context) = OFFSETOF(pData->old_ss_sp) - sizeof(DWORD); /*ret addr*/ context->Esp = OFFSETOF(pData->old_ss_sp) - sizeof(DWORD); /*ret addr*/
pData->old_ss_sp = 0; pData->old_ss_sp = 0;
/* Build a stack frame for the return */ /* Build a stack frame for the return */
......
...@@ -690,15 +690,15 @@ static void ...@@ -690,15 +690,15 @@ static void
x_SMapLS_IP_EBP_x(CONTEXT86 *context,int argoff) { x_SMapLS_IP_EBP_x(CONTEXT86 *context,int argoff) {
DWORD val,ptr; DWORD val,ptr;
val =*(DWORD*)(EBP_reg(context)+argoff); val =*(DWORD*)(context->Ebp + argoff);
if (val<0x10000) { if (val<0x10000) {
ptr=val; ptr=val;
*(DWORD*)(EBP_reg(context)+argoff) = 0; *(DWORD*)(context->Ebp + argoff) = 0;
} else { } else {
ptr = MapLS((LPVOID)val); ptr = MapLS((LPVOID)val);
*(DWORD*)(EBP_reg(context)+argoff) = ptr; *(DWORD*)(context->Ebp + argoff) = ptr;
} }
EAX_reg(context) = ptr; context->Eax = ptr;
} }
/*********************************************************************** /***********************************************************************
...@@ -751,11 +751,12 @@ void WINAPI SMapLS_IP_EBP_40(CONTEXT86 *context) {x_SMapLS_IP_EBP_x(context,40); ...@@ -751,11 +751,12 @@ void WINAPI SMapLS_IP_EBP_40(CONTEXT86 *context) {x_SMapLS_IP_EBP_x(context,40);
*/ */
void WINAPI SMapLS( CONTEXT86 *context ) void WINAPI SMapLS( CONTEXT86 *context )
{ {
if (EAX_reg(context)>=0x10000) { if (HIWORD(context->Eax))
EAX_reg(context) = MapLS((LPVOID)EAX_reg(context)); {
EDX_reg(context) = EAX_reg(context); context->Eax = MapLS( (LPVOID)context->Eax );
context->Edx = context->Eax;
} else { } else {
EDX_reg(context) = 0; context->Edx = 0;
} }
} }
...@@ -765,15 +766,17 @@ void WINAPI SMapLS( CONTEXT86 *context ) ...@@ -765,15 +766,17 @@ void WINAPI SMapLS( CONTEXT86 *context )
void WINAPI SUnMapLS( CONTEXT86 *context ) void WINAPI SUnMapLS( CONTEXT86 *context )
{ {
if (EAX_reg(context)>=0x10000) if (HIWORD(context->Eax)) UnMapLS( (SEGPTR)context->Eax );
UnMapLS((SEGPTR)EAX_reg(context));
} }
static void inline static void x_SUnMapLS_IP_EBP_x(CONTEXT86 *context,int argoff)
x_SUnMapLS_IP_EBP_x(CONTEXT86 *context,int argoff) { {
if (*(DWORD*)(EBP_reg(context)+argoff)) SEGPTR *ptr = (SEGPTR *)(context->Ebp + argoff);
UnMapLS(*(DWORD*)(EBP_reg(context)+argoff)); if (*ptr)
*(DWORD*)(EBP_reg(context)+argoff)=0; {
UnMapLS( *ptr );
*ptr = 0;
}
} }
/*********************************************************************** /***********************************************************************
...@@ -842,7 +845,7 @@ void WINAPI SUnMapLS_IP_EBP_40(CONTEXT86 *context) { x_SUnMapLS_IP_EBP_x(context ...@@ -842,7 +845,7 @@ void WINAPI SUnMapLS_IP_EBP_40(CONTEXT86 *context) { x_SUnMapLS_IP_EBP_x(context
void WINAPI AllocMappedBuffer( CONTEXT86 *context ) void WINAPI AllocMappedBuffer( CONTEXT86 *context )
{ {
HGLOBAL handle = GlobalAlloc(0, EDI_reg(context) + 8); HGLOBAL handle = GlobalAlloc(0, context->Edi + 8);
DWORD *buffer = (DWORD *)GlobalLock(handle); DWORD *buffer = (DWORD *)GlobalLock(handle);
SEGPTR ptr = 0; SEGPTR ptr = 0;
...@@ -854,14 +857,14 @@ void WINAPI AllocMappedBuffer( CONTEXT86 *context ) ...@@ -854,14 +857,14 @@ void WINAPI AllocMappedBuffer( CONTEXT86 *context )
} }
if (!ptr) if (!ptr)
EAX_reg(context) = EDI_reg(context) = 0; context->Eax = context->Edi = 0;
else else
{ {
buffer[0] = handle; buffer[0] = handle;
buffer[1] = ptr; buffer[1] = ptr;
EAX_reg(context) = (DWORD) ptr; context->Eax = (DWORD) ptr;
EDI_reg(context) = (DWORD)(buffer + 2); context->Edi = (DWORD)(buffer + 2);
} }
} }
...@@ -875,9 +878,9 @@ void WINAPI AllocMappedBuffer( CONTEXT86 *context ) ...@@ -875,9 +878,9 @@ void WINAPI AllocMappedBuffer( CONTEXT86 *context )
void WINAPI FreeMappedBuffer( CONTEXT86 *context ) void WINAPI FreeMappedBuffer( CONTEXT86 *context )
{ {
if (EDI_reg(context)) if (context->Edi)
{ {
DWORD *buffer = (DWORD *)EDI_reg(context) - 2; DWORD *buffer = (DWORD *)context->Edi - 2;
UnMapLS(buffer[1]); UnMapLS(buffer[1]);
......
...@@ -162,11 +162,9 @@ void WINAPI LogParamError16(UINT16 uErr, FARPROC16 lpfn, LPVOID lpvParam) ...@@ -162,11 +162,9 @@ void WINAPI LogParamError16(UINT16 uErr, FARPROC16 lpfn, LPVOID lpvParam)
*/ */
void WINAPI HandleParamError( CONTEXT86 *context ) void WINAPI HandleParamError( CONTEXT86 *context )
{ {
UINT16 uErr = BX_reg( context ); UINT16 uErr = LOWORD(context->Ebx);
FARPROC16 lpfn = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( CS_reg(context), FARPROC16 lpfn = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( context->SegCs, context->Eip );
EIP_reg(context) ); LPVOID lpvParam = (LPVOID)MAKELONG( LOWORD(context->Eax), LOWORD(context->Ecx) );
LPVOID lpvParam = (LPVOID)MAKELONG( AX_reg( context ),
CX_reg( context ) );
LogParamError16( uErr, lpfn, lpvParam ); LogParamError16( uErr, lpfn, lpvParam );
...@@ -175,15 +173,14 @@ void WINAPI HandleParamError( CONTEXT86 *context ) ...@@ -175,15 +173,14 @@ void WINAPI HandleParamError( CONTEXT86 *context )
/* Abort current procedure: Unwind stack frame and jump /* Abort current procedure: Unwind stack frame and jump
to error handler (location at [bp-2]) */ to error handler (location at [bp-2]) */
WORD *stack = PTR_SEG_OFF_TO_LIN( SS_reg( context ), WORD *stack = PTR_SEG_OFF_TO_LIN( context->SegSs, LOWORD(context->Ebp) );
LOWORD(EBP_reg( context )) ); context->Esp = LOWORD(context->Ebp) - 2;
ESP_reg( context ) = LOWORD(EBP_reg( context )) - 2; context->Ebp = stack[0] & 0xfffe;
EBP_reg( context ) = stack[0] & 0xfffe;
EIP_reg( context ) = stack[-1]; context->Eip = stack[-1];
EAX_reg( context ) = ECX_reg( context ) = EDX_reg( context ) = 0; context->Eax = context->Ecx = context->Edx = 0;
ES_reg( context) = 0; context->SegEs = 0;
} }
} }
...@@ -129,9 +129,9 @@ static void SYSTEM_CallSystemTimerProc( FARPROC16 proc, WORD timer ) ...@@ -129,9 +129,9 @@ static void SYSTEM_CallSystemTimerProc( FARPROC16 proc, WORD timer )
CONTEXT86 context; CONTEXT86 context;
memset( &context, '\0', sizeof(context) ); memset( &context, '\0', sizeof(context) );
CS_reg( &context ) = SELECTOROF( proc ); context.SegCs = SELECTOROF( proc );
EIP_reg( &context ) = OFFSETOF( proc ); context.Eip = OFFSETOF( proc );
EBP_reg( &context ) = OFFSETOF( NtCurrentTeb()->cur_stack ) context.Ebp = OFFSETOF( NtCurrentTeb()->cur_stack )
+ (WORD)&((STACK16FRAME*)0)->bp; + (WORD)&((STACK16FRAME*)0)->bp;
AX_reg( &context ) = timer; AX_reg( &context ) = timer;
......
...@@ -141,16 +141,16 @@ DWORD DOS_LOLSeg; ...@@ -141,16 +141,16 @@ DWORD DOS_LOLSeg;
/* the device implementations */ /* the device implementations */
static void do_lret(CONTEXT86*ctx) static void do_lret(CONTEXT86*ctx)
{ {
WORD *stack = CTX_SEG_OFF_TO_LIN(ctx, SS_reg(ctx), ESP_reg(ctx)); WORD *stack = CTX_SEG_OFF_TO_LIN(ctx, ctx->SegSs, ctx->Esp);
EIP_reg(ctx) = *(stack++); ctx->Eip = *(stack++);
CS_reg(ctx) = *(stack++); ctx->SegCs = *(stack++);
ESP_reg(ctx) += 2*sizeof(WORD); ctx->Esp += 2*sizeof(WORD);
} }
static void do_strategy(CONTEXT86*ctx, int id, int extra) static void do_strategy(CONTEXT86*ctx, int id, int extra)
{ {
REQUEST_HEADER *hdr = CTX_SEG_OFF_TO_LIN(ctx, ES_reg(ctx), EBX_reg(ctx)); REQUEST_HEADER *hdr = CTX_SEG_OFF_TO_LIN(ctx, ctx->SegEs, ctx->Ebx);
void **hdr_ptr = strategy_data[id]; void **hdr_ptr = strategy_data[id];
if (!hdr_ptr) { if (!hdr_ptr) {
...@@ -527,17 +527,17 @@ static void DOSDEV_DoReq(void*req, DWORD dev) ...@@ -527,17 +527,17 @@ static void DOSDEV_DoReq(void*req, DWORD dev)
memset(&ctx, 0, sizeof(ctx)); memset(&ctx, 0, sizeof(ctx));
/* ES:BX points to request for strategy routine */ /* ES:BX points to request for strategy routine */
ES_reg(&ctx) = HIWORD(DOS_LOLSeg); ctx.SegEs = HIWORD(DOS_LOLSeg);
EBX_reg(&ctx) = DOS_DATASEG_OFF(req); ctx.Ebx = DOS_DATASEG_OFF(req);
/* call strategy routine */ /* call strategy routine */
CS_reg(&ctx) = SELECTOROF(dev); ctx.SegCs = SELECTOROF(dev);
EIP_reg(&ctx) = dhdr->strategy; ctx.Eip = dhdr->strategy;
DPMI_CallRMProc(&ctx, 0, 0, 0); DPMI_CallRMProc(&ctx, 0, 0, 0);
/* call interrupt routine */ /* call interrupt routine */
CS_reg(&ctx) = SELECTOROF(dev); ctx.SegCs = SELECTOROF(dev);
EIP_reg(&ctx) = dhdr->interrupt; ctx.Eip = dhdr->interrupt;
DPMI_CallRMProc(&ctx, 0, 0, 0); DPMI_CallRMProc(&ctx, 0, 0, 0);
/* completed, copy request back */ /* completed, copy request back */
......
...@@ -66,8 +66,8 @@ DOSASPI_PostProc( SRB_ExecSCSICmd *lpPRB ) ...@@ -66,8 +66,8 @@ DOSASPI_PostProc( SRB_ExecSCSICmd *lpPRB )
/* Zero everything */ /* Zero everything */
memset(&ctx, 0, sizeof(ctx)); memset(&ctx, 0, sizeof(ctx));
/* CS:IP is routine to call */ /* CS:IP is routine to call */
CS_reg(&ctx) = SELECTOROF(lpSRB16->cmd.SRB_PostProc); ctx.SegCs = SELECTOROF(lpSRB16->cmd.SRB_PostProc);
EIP_reg(&ctx) = OFFSETOF(lpSRB16->cmd.SRB_PostProc); ctx.Eip = OFFSETOF(lpSRB16->cmd.SRB_PostProc);
/* DPMI_CallRMProc will push the pointer to the stack /* DPMI_CallRMProc will push the pointer to the stack
* it is given (in this case &ptrSRB) with length * it is given (in this case &ptrSRB) with length
* 2*sizeof(WORD), that is, it copies the the contents * 2*sizeof(WORD), that is, it copies the the contents
...@@ -156,22 +156,22 @@ DWORD ASPI_SendASPIDOSCommand(DWORD ptrSRB) ...@@ -156,22 +156,22 @@ DWORD ASPI_SendASPIDOSCommand(DWORD ptrSRB)
void WINAPI ASPI_DOS_func(CONTEXT86 *context) void WINAPI ASPI_DOS_func(CONTEXT86 *context)
{ {
WORD *stack = CTX_SEG_OFF_TO_LIN(context, SS_reg(context), ESP_reg(context)); WORD *stack = CTX_SEG_OFF_TO_LIN(context, context->SegSs, context->Esp);
DWORD ptrSRB = *(DWORD *)&stack[2]; DWORD ptrSRB = *(DWORD *)&stack[2];
ASPI_SendASPIDOSCommand(ptrSRB); ASPI_SendASPIDOSCommand(ptrSRB);
/* simulate a normal RETF sequence as required by DPMI CallRMProcFar */ /* simulate a normal RETF sequence as required by DPMI CallRMProcFar */
EIP_reg(context) = *(stack++); context->Eip = *(stack++);
CS_reg(context) = *(stack++); context->SegCs = *(stack++);
ESP_reg(context) += 2*sizeof(WORD); context->Esp += 2*sizeof(WORD);
} }
/* returns the address of a real mode callback to ASPI_DOS_func() */ /* returns the address of a real mode callback to ASPI_DOS_func() */
void ASPI_DOS_HandleInt(CONTEXT86 *context) void ASPI_DOS_HandleInt(CONTEXT86 *context)
{ {
FARPROC16 *p = (FARPROC16 *)CTX_SEG_OFF_TO_LIN(context, DS_reg(context), EDX_reg(context)); FARPROC16 *p = (FARPROC16 *)CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx);
TRACE("DOS ASPI opening\n"); TRACE("DOS ASPI opening\n");
if ((CX_reg(context) == 4) || (CX_reg(context) == 5)) if ((CX_reg(context) == 4) || (CX_reg(context) == 5))
{ {
......
...@@ -722,9 +722,9 @@ else { ...@@ -722,9 +722,9 @@ else {
{ {
AL_reg(context) = 0x1b; AL_reg(context) = 0x1b;
if (ISV86(context)) /* real */ if (ISV86(context)) /* real */
ES_reg(context) = 0xf000; context->SegEs = 0xf000;
else else
ES_reg(context) = DOSMEM_BiosSysSeg; context->SegEs = DOSMEM_BiosSysSeg;
BX_reg(context) = 0xe000; BX_reg(context) = 0xe000;
} }
break; break;
...@@ -736,7 +736,7 @@ else { ...@@ -736,7 +736,7 @@ else {
case 0x4f: /* Get SuperVGA INFORMATION */ case 0x4f: /* Get SuperVGA INFORMATION */
{ {
BYTE *p = BYTE *p =
CTX_SEG_OFF_TO_LIN(context, ES_reg(context), EDI_reg(context)); CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Edi);
/* BOOL16 vesa20 = (*(DWORD *)p == *(DWORD *)"VBE2"); */ /* BOOL16 vesa20 = (*(DWORD *)p == *(DWORD *)"VBE2"); */
TRACE("Get SuperVGA information\n"); TRACE("Get SuperVGA information\n");
......
...@@ -118,7 +118,7 @@ void WINAPI INT_Int13Handler( CONTEXT86 *context ) ...@@ -118,7 +118,7 @@ void WINAPI INT_Int13Handler( CONTEXT86 *context )
CX_reg(context) = 0x4f24; CX_reg(context) = 0x4f24;
break; break;
} }
ES_reg(context) = 0x0000; /* FIXME: drive parameter table */ context->SegEs = 0x0000; /* FIXME: drive parameter table */
DI_reg(context) = 0x0000; DI_reg(context) = 0x0000;
#else #else
AH_reg(context) = 0x01; AH_reg(context) = 0x01;
......
...@@ -49,9 +49,9 @@ void WINAPI INT_Int15Handler( CONTEXT86 *context ) ...@@ -49,9 +49,9 @@ void WINAPI INT_Int15Handler( CONTEXT86 *context )
case 0xc0: /* GET CONFIGURATION */ case 0xc0: /* GET CONFIGURATION */
if (ISV86(context)) /* real */ if (ISV86(context)) /* real */
ES_reg(context) = 0xf000; context->SegEs = 0xf000;
else else
ES_reg(context) = DOSMEM_BiosSysSeg; context->SegEs = DOSMEM_BiosSysSeg;
BX_reg(context) = 0xe6f5; BX_reg(context) = 0xe6f5;
AH_reg(context) = 0x0; AH_reg(context) = 0x0;
RESET_CFLAG(context); RESET_CFLAG(context);
......
...@@ -22,17 +22,17 @@ DEFAULT_DEBUG_CHANNEL(int) ...@@ -22,17 +22,17 @@ DEFAULT_DEBUG_CHANNEL(int)
*/ */
void WINAPI INT_Int25Handler( CONTEXT86 *context ) void WINAPI INT_Int25Handler( CONTEXT86 *context )
{ {
BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EBX_reg(context) ); BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, context->SegDs, context->Ebx );
DWORD begin, length; DWORD begin, length;
if (!DRIVE_IsValid(AL_reg(context))) if (!DRIVE_IsValid(LOBYTE(context->Eax)))
{ {
SET_CFLAG(context); SET_CFLAG(context);
AX_reg(context) = 0x0201; /* unknown unit */ AX_reg(context) = 0x0201; /* unknown unit */
return; return;
} }
if (CX_reg(context) == 0xffff) if (LOWORD(context->Ecx) == 0xffff)
{ {
begin = *(DWORD *)dataptr; begin = *(DWORD *)dataptr;
length = *(WORD *)(dataptr + 4); length = *(WORD *)(dataptr + 4);
...@@ -41,14 +41,14 @@ void WINAPI INT_Int25Handler( CONTEXT86 *context ) ...@@ -41,14 +41,14 @@ void WINAPI INT_Int25Handler( CONTEXT86 *context )
} }
else else
{ {
begin = DX_reg(context); begin = LOWORD(context->Edx);
length = CX_reg(context); length = LOWORD(context->Ecx);
} }
TRACE("int25: abs diskread, drive %d, sector %ld, " TRACE("int25: abs diskread, drive %d, sector %ld, "
"count %ld, buffer %p\n", "count %ld, buffer %p\n",
AL_reg(context), begin, length, dataptr); LOBYTE(context->Eax), begin, length, dataptr);
DRIVE_RawRead(AL_reg(context), begin, length, dataptr, TRUE); DRIVE_RawRead(LOBYTE(context->Eax), begin, length, dataptr, TRUE);
RESET_CFLAG(context); RESET_CFLAG(context);
} }
...@@ -20,17 +20,17 @@ DEFAULT_DEBUG_CHANNEL(int) ...@@ -20,17 +20,17 @@ DEFAULT_DEBUG_CHANNEL(int)
*/ */
void WINAPI INT_Int26Handler( CONTEXT86 *context ) void WINAPI INT_Int26Handler( CONTEXT86 *context )
{ {
BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EBX_reg(context) ); BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, context->SegDs, context->Ebx );
DWORD begin, length; DWORD begin, length;
if (!DRIVE_IsValid(AL_reg(context))) if (!DRIVE_IsValid(LOBYTE(context->Eax)))
{ {
SET_CFLAG(context); SET_CFLAG(context);
AX_reg(context) = 0x0201; /* unknown unit */ AX_reg(context) = 0x0201; /* unknown unit */
return; return;
} }
if (CX_reg(context) == 0xffff) if (LOWORD(context->Ecx) == 0xffff)
{ {
begin = *(DWORD *)dataptr; begin = *(DWORD *)dataptr;
length = *(WORD *)(dataptr + 4); length = *(WORD *)(dataptr + 4);
...@@ -39,14 +39,14 @@ void WINAPI INT_Int26Handler( CONTEXT86 *context ) ...@@ -39,14 +39,14 @@ void WINAPI INT_Int26Handler( CONTEXT86 *context )
} }
else else
{ {
begin = DX_reg(context); begin = LOWORD(context->Edx);
length = CX_reg(context); length = LOWORD(context->Ecx);
} }
TRACE("int26: abs diskwrite, drive %d, sector %ld, " TRACE("int26: abs diskwrite, drive %d, sector %ld, "
"count %ld, buffer %p\n", "count %ld, buffer %p\n",
AL_reg(context), begin, length, dataptr ); AL_reg(context), begin, length, dataptr );
DRIVE_RawWrite(AL_reg(context), begin, length, dataptr, TRUE); DRIVE_RawWrite(LOBYTE(context->Eax), begin, length, dataptr, TRUE);
RESET_CFLAG(context); RESET_CFLAG(context);
} }
...@@ -43,7 +43,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -43,7 +43,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
break; break;
case 0x11: /* Network Redirector / IFSFUNC */ case 0x11: /* Network Redirector / IFSFUNC */
switch (AL_reg(context)) switch (LOBYTE(context->Eax))
{ {
case 0x00: /* Install check */ case 0x00: /* Install check */
/* not installed */ /* not installed */
...@@ -58,7 +58,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -58,7 +58,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
break; break;
case 0x12: case 0x12:
switch (AL_reg(context)) switch (LOBYTE(context->Eax))
{ {
case 0x2e: /* get or set DOS error table address */ case 0x2e: /* get or set DOS error table address */
switch (DL_reg(context)) switch (DL_reg(context))
...@@ -78,7 +78,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -78,7 +78,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
case 0x02: case 0x02:
case 0x04: case 0x04:
case 0x06: case 0x06:
ES_reg(context) = 0x0001; context->SegEs = 0x0001;
DI_reg(context) = 0x0000; DI_reg(context) = 0x0000;
break; break;
case 0x08: case 0x08:
...@@ -107,7 +107,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -107,7 +107,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
case 0x43: case 0x43:
#if 1 #if 1
switch (AL_reg(context)) switch (LOBYTE(context->Eax))
{ {
case 0x00: /* XMS v2+ installation check */ case 0x00: /* XMS v2+ installation check */
WARN("XMS is not fully implemented\n"); WARN("XMS is not fully implemented\n");
...@@ -115,7 +115,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -115,7 +115,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
break; break;
case 0x10: /* XMS v2+ get driver address */ case 0x10: /* XMS v2+ get driver address */
{ {
ES_reg(context) = DOSMEM_xms_seg; context->SegEs = DOSMEM_xms_seg;
BX_reg(context) = 0; BX_reg(context) = 0;
break; break;
} }
...@@ -129,7 +129,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -129,7 +129,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
break; break;
case 0x45: case 0x45:
switch (AL_reg(context)) switch (LOBYTE(context->Eax))
{ {
case 0x00: case 0x00:
case 0x01: case 0x01:
...@@ -148,7 +148,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -148,7 +148,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
break; break;
case 0x4a: case 0x4a:
switch(AL_reg(context)) switch(LOBYTE(context->Eax))
{ {
case 0x10: /* smartdrv */ case 0x10: /* smartdrv */
break; /* not installed */ break; /* not installed */
...@@ -163,7 +163,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -163,7 +163,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
} }
break; break;
case 0x4b: case 0x4b:
switch(AL_reg(context)) switch(LOBYTE(context->Eax))
{ {
case 0x01: case 0x01:
case 0x02: case 0x02:
...@@ -177,7 +177,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -177,7 +177,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
} }
break; break;
case 0x56: /* INTERLNK */ case 0x56: /* INTERLNK */
switch(AL_reg(context)) switch(LOBYTE(context->Eax))
{ {
case 0x01: /* check if redirected drive */ case 0x01: /* check if redirected drive */
AL_reg(context) = 0; /* not redirected */ AL_reg(context) = 0; /* not redirected */
...@@ -187,7 +187,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -187,7 +187,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
} }
break; break;
case 0x7a: /* NOVELL NetWare */ case 0x7a: /* NOVELL NetWare */
switch (AL_reg(context)) switch (LOBYTE(context->Eax))
{ {
case 0x0: /* Low-level Netware installation check AL=0 not installed.*/ case 0x0: /* Low-level Netware installation check AL=0 not installed.*/
AL_reg(context) = 0; AL_reg(context) = 0;
...@@ -201,10 +201,10 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -201,10 +201,10 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
} }
break; break;
case 0xb7: /* append */ case 0xb7: /* append */
AL_reg(context) = 0; /* not installed */ LOBYTE(context->Eax) = 0; /* not installed */
break; break;
case 0xb8: /* network */ case 0xb8: /* network */
switch (AL_reg(context)) switch (LOBYTE(context->Eax))
{ {
case 0x00: /* Install check */ case 0x00: /* Install check */
/* not installed */ /* not installed */
...@@ -218,7 +218,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -218,7 +218,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
AX_reg(context) = 0xa5a5; /* pretend to have Novell IPX installed */ AX_reg(context) = 0xa5a5; /* pretend to have Novell IPX installed */
break; break;
case 0xbf: /* REDIRIFS.EXE */ case 0xbf: /* REDIRIFS.EXE */
switch (AL_reg(context)) switch (LOBYTE(context->Eax))
{ {
case 0x00: /* Install check */ case 0x00: /* Install check */
/* not installed */ /* not installed */
...@@ -229,7 +229,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -229,7 +229,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
} }
break; break;
case 0xd2: case 0xd2:
switch(AL_reg(context)) switch(LOBYTE(context->Eax))
{ {
case 0x01: /* Quarterdeck RPCI - QEMM/QRAM - PCL-838.EXE functions */ case 0x01: /* Quarterdeck RPCI - QEMM/QRAM - PCL-838.EXE functions */
if(BX_reg(context) == 0x5145 && CX_reg(context) == 0x4D4D if(BX_reg(context) == 0x5145 && CX_reg(context) == 0x4D4D
...@@ -242,7 +242,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -242,7 +242,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
} }
break; break;
case 0xd7: /* Banyan Vines */ case 0xd7: /* Banyan Vines */
switch (AL_reg(context)) switch (LOBYTE(context->Eax))
{ {
case 0x01: /* Install check - Get Int Number */ case 0x01: /* Install check - Get Int Number */
/* not installed */ /* not installed */
...@@ -253,7 +253,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) ...@@ -253,7 +253,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
} }
break; break;
case 0xde: case 0xde:
switch(AL_reg(context)) switch(LOBYTE(context->Eax))
{ {
case 0x01: /* Quarterdeck QDPMI.SYS - DESQview */ case 0x01: /* Quarterdeck QDPMI.SYS - DESQview */
if(BX_reg(context) == 0x4450 && CX_reg(context) == 0x4d49 if(BX_reg(context) == 0x4450 && CX_reg(context) == 0x4d49
...@@ -281,7 +281,7 @@ static void do_int2f_16( CONTEXT86 *context ) ...@@ -281,7 +281,7 @@ static void do_int2f_16( CONTEXT86 *context )
{ {
DWORD addr; DWORD addr;
switch(AL_reg(context)) switch(LOBYTE(context->Eax))
{ {
case 0x00: /* Windows enhanced mode installation check */ case 0x00: /* Windows enhanced mode installation check */
AX_reg(context) = (GetWinFlags16() & WF_ENHANCED) ? AX_reg(context) = (GetWinFlags16() & WF_ENHANCED) ?
...@@ -333,7 +333,7 @@ static void do_int2f_16( CONTEXT86 *context ) ...@@ -333,7 +333,7 @@ static void do_int2f_16( CONTEXT86 *context )
ERR("Accessing unknown VxD %04x - Expect a failure now.\n", ERR("Accessing unknown VxD %04x - Expect a failure now.\n",
BX_reg(context) ); BX_reg(context) );
} }
ES_reg(context) = SELECTOROF(addr); context->SegEs = SELECTOROF(addr);
DI_reg(context) = OFFSETOF(addr); DI_reg(context) = OFFSETOF(addr);
break; break;
...@@ -353,7 +353,7 @@ static void do_int2f_16( CONTEXT86 *context ) ...@@ -353,7 +353,7 @@ static void do_int2f_16( CONTEXT86 *context )
CL_reg(context) = si.wProcessorLevel; CL_reg(context) = si.wProcessorLevel;
DX_reg(context) = 0x005a; /* DPMI major/minor 0.90 */ DX_reg(context) = 0x005a; /* DPMI major/minor 0.90 */
SI_reg(context) = 0; /* # of para. of DOS extended private data */ SI_reg(context) = 0; /* # of para. of DOS extended private data */
ES_reg(context) = DOSMEM_dpmi_seg; context->SegEs = DOSMEM_dpmi_seg;
DI_reg(context) = 0; /* ES:DI is DPMI switch entry point */ DI_reg(context) = 0; /* ES:DI is DPMI switch entry point */
break; break;
} }
...@@ -429,7 +429,7 @@ static void MSCDEX_Handler(CONTEXT86* context) ...@@ -429,7 +429,7 @@ static void MSCDEX_Handler(CONTEXT86* context)
int drive, count; int drive, count;
char* p; char* p;
switch(AL_reg(context)) { switch(LOBYTE(context->Eax)) {
case 0x00: /* Installation check */ case 0x00: /* Installation check */
/* Count the number of contiguous CDROM drives /* Count the number of contiguous CDROM drives
*/ */
...@@ -455,7 +455,7 @@ static void MSCDEX_Handler(CONTEXT86* context) ...@@ -455,7 +455,7 @@ static void MSCDEX_Handler(CONTEXT86* context)
break; break;
case 0x0D: /* get drive letters */ case 0x0D: /* get drive letters */
p = CTX_SEG_OFF_TO_LIN(context, ES_reg(context), EBX_reg(context)); p = CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Ebx);
memset(p, 0, MAX_DOS_DRIVES); memset(p, 0, MAX_DOS_DRIVES);
for (drive = 0; drive < MAX_DOS_DRIVES; drive++) { for (drive = 0; drive < MAX_DOS_DRIVES; drive++) {
if (DRIVE_GetType(drive) == TYPE_CDROM) *p++ = drive; if (DRIVE_GetType(drive) == TYPE_CDROM) *p++ = drive;
...@@ -477,7 +477,7 @@ static void MSCDEX_Handler(CONTEXT86* context) ...@@ -477,7 +477,7 @@ static void MSCDEX_Handler(CONTEXT86* context)
/* FIXME - to be deleted ?? */ /* FIXME - to be deleted ?? */
ERR("ES:BX==0 ! SEGFAULT ?\n"); ERR("ES:BX==0 ! SEGFAULT ?\n");
ERR("-->BX=0x%04x, ES=0x%04lx, DS=0x%04lx, CX=0x%04x\n", ERR("-->BX=0x%04x, ES=0x%04lx, DS=0x%04lx, CX=0x%04x\n",
BX_reg(context), ES_reg(context), DS_reg(context), CX_reg(context)); BX_reg(context), context->SegEs, context->SegDs, CX_reg(context));
driver_request[4] |= 0x80; driver_request[4] |= 0x80;
driver_request[3] = 5; /* bad request length */ driver_request[3] = 5; /* bad request length */
return; return;
...@@ -800,7 +800,7 @@ static void MSCDEX_Handler(CONTEXT86* context) ...@@ -800,7 +800,7 @@ static void MSCDEX_Handler(CONTEXT86* context)
} }
break; break;
default: default:
FIXME("Unimplemented MSCDEX function 0x%02X.\n", AL_reg(context)); FIXME("Unimplemented MSCDEX function 0x%02X.\n", LOBYTE(context->Eax));
break; break;
} }
} }
...@@ -27,7 +27,7 @@ static struct ...@@ -27,7 +27,7 @@ static struct
*/ */
void WINAPI INT_Int33Handler( CONTEXT86 *context ) void WINAPI INT_Int33Handler( CONTEXT86 *context )
{ {
switch (AX_reg(context)) { switch (LOWORD(context->Eax)) {
case 0x00: case 0x00:
TRACE("Reset mouse driver and request status\n"); TRACE("Reset mouse driver and request status\n");
AX_reg(context) = 0xFFFF; /* installed */ AX_reg(context) = 0xFFFF; /* installed */
...@@ -64,7 +64,7 @@ void WINAPI INT_Int33Handler( CONTEXT86 *context ) ...@@ -64,7 +64,7 @@ void WINAPI INT_Int33Handler( CONTEXT86 *context )
case 0x0C: case 0x0C:
TRACE("Define mouse interrupt subroutine\n"); TRACE("Define mouse interrupt subroutine\n");
mouse_info.callmask = CX_reg(context); mouse_info.callmask = CX_reg(context);
mouse_info.callback = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR(ES_reg(context), DX_reg(context)); mouse_info.callback = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR(context->SegEs, LOWORD(context->Edx));
break; break;
case 0x10: case 0x10:
FIXME("Define screen region for update\n"); FIXME("Define screen region for update\n");
...@@ -84,14 +84,14 @@ static void MouseRelay(CONTEXT86 *context,void *mdata) ...@@ -84,14 +84,14 @@ static void MouseRelay(CONTEXT86 *context,void *mdata)
MCALLDATA *data = (MCALLDATA *)mdata; MCALLDATA *data = (MCALLDATA *)mdata;
CONTEXT86 ctx = *context; CONTEXT86 ctx = *context;
EAX_reg(&ctx) = data->mask; ctx.Eax = data->mask;
EBX_reg(&ctx) = data->but; ctx.Ebx = data->but;
ECX_reg(&ctx) = data->x; ctx.Ecx = data->x;
EDX_reg(&ctx) = data->y; ctx.Edx = data->y;
ESI_reg(&ctx) = data->mx; ctx.Esi = data->mx;
EDI_reg(&ctx) = data->my; ctx.Edi = data->my;
CS_reg(&ctx) = SELECTOROF(data->proc); ctx.SegCs = SELECTOROF(data->proc);
EIP_reg(&ctx) = OFFSETOF(data->proc); ctx.Eip = OFFSETOF(data->proc);
free(data); free(data);
DPMI_CallRMProc(&ctx, NULL, 0, 0); DPMI_CallRMProc(&ctx, NULL, 0, 0);
} }
......
...@@ -19,7 +19,7 @@ DEFAULT_DEBUG_CHANNEL(int) ...@@ -19,7 +19,7 @@ DEFAULT_DEBUG_CHANNEL(int)
void WINAPI NetBIOSCall16( CONTEXT86 *context ) void WINAPI NetBIOSCall16( CONTEXT86 *context )
{ {
BYTE* ptr; BYTE* ptr;
ptr = (BYTE*) PTR_SEG_OFF_TO_LIN(ES_reg(context),BX_reg(context)); ptr = (BYTE*) PTR_SEG_OFF_TO_LIN(context->SegEs,BX_reg(context));
FIXME("(%p): command code %02x (ignored)\n",context, *ptr); FIXME("(%p): command code %02x (ignored)\n",context, *ptr);
AL_reg(context) = *(ptr+0x01) = 0xFB; /* NetBIOS emulator not found */ AL_reg(context) = *(ptr+0x01) = 0xFB; /* NetBIOS emulator not found */
} }
......
...@@ -76,7 +76,7 @@ void WINAPI XMS_Handler( CONTEXT86 *context ) ...@@ -76,7 +76,7 @@ void WINAPI XMS_Handler( CONTEXT86 *context )
case 0x0b: /* Move Extended Memory Block */ case 0x0b: /* Move Extended Memory Block */
{ {
MOVESTRUCT*move=CTX_SEG_OFF_TO_LIN(context, MOVESTRUCT*move=CTX_SEG_OFF_TO_LIN(context,
DS_reg(context),ESI_reg(context)); context->SegDs,context->Esi);
BYTE*src,*dst; BYTE*src,*dst;
TRACE("move extended memory block\n"); TRACE("move extended memory block\n");
src=XMS_Offset(&move->Source); src=XMS_Offset(&move->Source);
......
...@@ -50,8 +50,8 @@ int RELAY_ShowDebugmsgRelay(const char *func) { ...@@ -50,8 +50,8 @@ int RELAY_ShowDebugmsgRelay(const char *func) {
term += 2; term += 2;
for(; *listitem; listitem++) { for(; *listitem; listitem++) {
itemlen = strlen(*listitem); itemlen = strlen(*listitem);
if((itemlen == len && !lstrncmpiA(*listitem, func, len)) || if((itemlen == len && !strncasecmp(*listitem, func, len)) ||
(itemlen == len2 && !lstrncmpiA(*listitem, func, len2)) || (itemlen == len2 && !strncasecmp(*listitem, func, len2)) ||
!strcasecmp(*listitem, term)) { !strcasecmp(*listitem, term)) {
show = !show; show = !show;
break; break;
...@@ -287,7 +287,7 @@ static int RELAY_CallFrom32( int ret_addr, ... ) ...@@ -287,7 +287,7 @@ static int RELAY_CallFrom32( int ret_addr, ... )
/*********************************************************************** /***********************************************************************
* RELAY_CallFrom32Regs * RELAY_CallFrom32Regs
* *
* Stack layout (esp is ESP_reg(context), not the current %esp): * Stack layout (esp is context->Esp, not the current %esp):
* *
* ... * ...
* (esp+4) first arg * (esp+4) first arg
...@@ -306,14 +306,14 @@ void WINAPI RELAY_DoCallFrom32Regs( CONTEXT86 *context ) ...@@ -306,14 +306,14 @@ void WINAPI RELAY_DoCallFrom32Regs( CONTEXT86 *context )
FARPROC func; FARPROC func;
BYTE *entry_point; BYTE *entry_point;
BYTE *relay_addr = *((BYTE **)ESP_reg(context) - 1); BYTE *relay_addr = *((BYTE **)context->Esp - 1);
DEBUG_ENTRY_POINT *relay = (DEBUG_ENTRY_POINT *)(relay_addr - 5); DEBUG_ENTRY_POINT *relay = (DEBUG_ENTRY_POINT *)(relay_addr - 5);
WORD nb_args = (relay->args & ~0x8000) / sizeof(int); WORD nb_args = (relay->args & ~0x8000) / sizeof(int);
/* remove extra stuff from the stack */ /* remove extra stuff from the stack */
EIP_reg(context) = stack32_pop(context); context->Eip = stack32_pop(context);
args = (int *)ESP_reg(context); args = (int *)context->Esp;
ESP_reg(context) += 4 * nb_args; context->Esp += 4 * nb_args;
assert(TRACE_ON(relay)); assert(TRACE_ON(relay));
...@@ -325,14 +325,14 @@ void WINAPI RELAY_DoCallFrom32Regs( CONTEXT86 *context ) ...@@ -325,14 +325,14 @@ void WINAPI RELAY_DoCallFrom32Regs( CONTEXT86 *context )
DPRINTF( "Call %s(", buffer ); DPRINTF( "Call %s(", buffer );
RELAY_PrintArgs( args, nb_args, relay->argtypes ); RELAY_PrintArgs( args, nb_args, relay->argtypes );
DPRINTF( ") ret=%08lx fs=%04lx\n", EIP_reg(context), FS_reg(context) ); DPRINTF( ") ret=%08lx fs=%04lx\n", context->Eip, context->SegFs );
DPRINTF(" eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n", DPRINTF(" eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n",
EAX_reg(context), EBX_reg(context), ECX_reg(context), context->Eax, context->Ebx, context->Ecx,
EDX_reg(context), ESI_reg(context), EDI_reg(context) ); context->Edx, context->Esi, context->Edi );
DPRINTF(" ebp=%08lx esp=%08lx ds=%04lx es=%04lx gs=%04lx flags=%08lx\n", DPRINTF(" ebp=%08lx esp=%08lx ds=%04lx es=%04lx gs=%04lx flags=%08lx\n",
EBP_reg(context), ESP_reg(context), DS_reg(context), context->Ebp, context->Esp, context->SegDs,
ES_reg(context), GS_reg(context), EFL_reg(context) ); context->SegEs, context->SegGs, context->EFlags );
SYSLEVEL_CheckNotLevel( 2 ); SYSLEVEL_CheckNotLevel( 2 );
...@@ -370,13 +370,14 @@ void WINAPI RELAY_DoCallFrom32Regs( CONTEXT86 *context ) ...@@ -370,13 +370,14 @@ void WINAPI RELAY_DoCallFrom32Regs( CONTEXT86 *context )
} }
DPRINTF( "Ret %s() retval=%08lx ret=%08lx fs=%04lx\n", DPRINTF( "Ret %s() retval=%08lx ret=%08lx fs=%04lx\n",
buffer, EAX_reg(context), EIP_reg(context), FS_reg(context) ); buffer, context->Eax, context->Eip, context->SegFs );
DPRINTF(" eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n", DPRINTF(" eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n",
EAX_reg(context), EBX_reg(context), ECX_reg(context), context->Eax, context->Ebx, context->Ecx,
EDX_reg(context), ESI_reg(context), EDI_reg(context) ); context->Edx, context->Esi, context->Edi );
DPRINTF(" ebp=%08lx esp=%08lx ds=%04lx es=%04lx gs=%04lx flags=%08lx\n", DPRINTF(" ebp=%08lx esp=%08lx ds=%04lx es=%04lx gs=%04lx flags=%08lx\n",
EBP_reg(context), ESP_reg(context), DS_reg(context), context->Ebp, context->Esp, context->SegDs,
ES_reg(context), GS_reg(context), EFL_reg(context) ); context->SegEs, context->SegGs, context->EFlags );
SYSLEVEL_CheckNotLevel( 2 ); SYSLEVEL_CheckNotLevel( 2 );
} }
......
...@@ -254,13 +254,13 @@ SNOOP_PrintArg(DWORD x) { ...@@ -254,13 +254,13 @@ SNOOP_PrintArg(DWORD x) {
return buf; return buf;
} }
#define CALLER1REF (*(DWORD*)ESP_reg(context)) #define CALLER1REF (*(DWORD*)context->Esp)
void WINAPI SNOOP_DoEntry( CONTEXT86 *context ); void WINAPI SNOOP_DoEntry( CONTEXT86 *context );
DEFINE_REGS_ENTRYPOINT_0( SNOOP_Entry, SNOOP_DoEntry ); DEFINE_REGS_ENTRYPOINT_0( SNOOP_Entry, SNOOP_DoEntry );
void WINAPI SNOOP_DoEntry( CONTEXT86 *context ) void WINAPI SNOOP_DoEntry( CONTEXT86 *context )
{ {
DWORD ordinal=0,entry = EIP_reg(context)-5; DWORD ordinal=0,entry = context->Eip - 5;
SNOOP_DLL *dll = firstdll; SNOOP_DLL *dll = firstdll;
SNOOP_FUN *fun = NULL; SNOOP_FUN *fun = NULL;
SNOOP_RETURNENTRIES **rets = &firstrets; SNOOP_RETURNENTRIES **rets = &firstrets;
...@@ -319,30 +319,30 @@ void WINAPI SNOOP_DoEntry( CONTEXT86 *context ) ...@@ -319,30 +319,30 @@ void WINAPI SNOOP_DoEntry( CONTEXT86 *context )
ret->dll = dll; ret->dll = dll;
ret->args = NULL; ret->args = NULL;
ret->ordinal = ordinal; ret->ordinal = ordinal;
ret->origESP = ESP_reg(context); ret->origESP = context->Esp;
EIP_reg(context)= (DWORD)fun->origfun; context->Eip = (DWORD)fun->origfun;
DPRINTF("CALL %s.%ld: %s(",dll->name,ordinal,fun->name); DPRINTF("CALL %s.%ld: %s(",dll->name,ordinal,fun->name);
if (fun->nrofargs>0) { if (fun->nrofargs>0) {
max = fun->nrofargs; if (max>16) max=16; max = fun->nrofargs; if (max>16) max=16;
for (i=0;i<max;i++) for (i=0;i<max;i++)
DPRINTF("%s%s",SNOOP_PrintArg(*(DWORD*)(ESP_reg(context)+4+sizeof(DWORD)*i)),(i<fun->nrofargs-1)?",":""); DPRINTF("%s%s",SNOOP_PrintArg(*(DWORD*)(context->Esp + 4 + sizeof(DWORD)*i)),(i<fun->nrofargs-1)?",":"");
if (max!=fun->nrofargs) if (max!=fun->nrofargs)
DPRINTF(" ..."); DPRINTF(" ...");
} else if (fun->nrofargs<0) { } else if (fun->nrofargs<0) {
DPRINTF("<unknown, check return>"); DPRINTF("<unknown, check return>");
ret->args = HeapAlloc(GetProcessHeap(),0,16*sizeof(DWORD)); ret->args = HeapAlloc(GetProcessHeap(),0,16*sizeof(DWORD));
memcpy(ret->args,(LPBYTE)(ESP_reg(context)+4),sizeof(DWORD)*16); memcpy(ret->args,(LPBYTE)(context->Esp + 4),sizeof(DWORD)*16);
} }
DPRINTF(") ret=%08lx fs=%04lx\n",(DWORD)ret->origreturn,FS_reg(context)); DPRINTF(") ret=%08lx fs=%04lx\n",(DWORD)ret->origreturn,context->SegFs);
} }
void WINAPI SNOOP_DoReturn( CONTEXT86 *context ); void WINAPI SNOOP_DoReturn( CONTEXT86 *context );
DEFINE_REGS_ENTRYPOINT_0( SNOOP_Return, SNOOP_DoReturn ); DEFINE_REGS_ENTRYPOINT_0( SNOOP_Return, SNOOP_DoReturn );
void WINAPI SNOOP_DoReturn( CONTEXT86 *context ) void WINAPI SNOOP_DoReturn( CONTEXT86 *context )
{ {
SNOOP_RETURNENTRY *ret = (SNOOP_RETURNENTRY*)(EIP_reg(context)-5); SNOOP_RETURNENTRY *ret = (SNOOP_RETURNENTRY*)(context->Eip - 5);
/* We haven't found out the nrofargs yet. If we called a cdecl /* We haven't found out the nrofargs yet. If we called a cdecl
* function it is too late anyway and we can just set '0' (which * function it is too late anyway and we can just set '0' (which
...@@ -350,8 +350,8 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context ) ...@@ -350,8 +350,8 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context )
* If stdcall -> everything ok. * If stdcall -> everything ok.
*/ */
if (ret->dll->funs[ret->ordinal].nrofargs<0) if (ret->dll->funs[ret->ordinal].nrofargs<0)
ret->dll->funs[ret->ordinal].nrofargs=(ESP_reg(context)-ret->origESP-4)/4; ret->dll->funs[ret->ordinal].nrofargs=(context->Esp - ret->origESP-4)/4;
EIP_reg(context) = (DWORD)ret->origreturn; context->Eip = (DWORD)ret->origreturn;
if (ret->args) { if (ret->args) {
int i,max; int i,max;
...@@ -362,15 +362,13 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context ) ...@@ -362,15 +362,13 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context )
for (i=0;i<max;i++) for (i=0;i<max;i++)
DPRINTF("%s%s",SNOOP_PrintArg(ret->args[i]),(i<max-1)?",":""); DPRINTF("%s%s",SNOOP_PrintArg(ret->args[i]),(i<max-1)?",":"");
DPRINTF(") retval = %08lx ret=%08lx fs=%04lx\n", DPRINTF(") retval = %08lx ret=%08lx fs=%04lx\n",
EAX_reg(context),(DWORD)ret->origreturn,FS_reg(context) context->Eax,(DWORD)ret->origreturn,context->SegFs );
);
HeapFree(GetProcessHeap(),0,ret->args); HeapFree(GetProcessHeap(),0,ret->args);
ret->args = NULL; ret->args = NULL;
} else } else
DPRINTF("RET %s.%ld: %s() retval = %08lx ret=%08lx fs=%04lx\n", DPRINTF("RET %s.%ld: %s() retval = %08lx ret=%08lx fs=%04lx\n",
ret->dll->name,ret->ordinal,ret->dll->funs[ret->ordinal].name, ret->dll->name,ret->ordinal,ret->dll->funs[ret->ordinal].name,
EAX_reg(context),(DWORD)ret->origreturn,FS_reg(context) context->Eax,(DWORD)ret->origreturn,context->SegFs );
);
ret->origreturn = NULL; /* mark as empty */ ret->origreturn = NULL; /* mark as empty */
} }
#else /* !__i386__ */ #else /* !__i386__ */
......
...@@ -496,7 +496,7 @@ void VxDCall( DWORD service, CONTEXT86 *context ) ...@@ -496,7 +496,7 @@ void VxDCall( DWORD service, CONTEXT86 *context )
else else
ret = VxDList[i].vxdcall( service, context ); ret = VxDList[i].vxdcall( service, context );
EAX_reg( context ) = ret; context->Eax = ret;
} }
...@@ -811,7 +811,7 @@ static DWORD VxDCall_VMM( DWORD service, CONTEXT86 *context ) ...@@ -811,7 +811,7 @@ static DWORD VxDCall_VMM( DWORD service, CONTEXT86 *context )
(DWORD )hmem, flags ); (DWORD )hmem, flags );
ret = VirtualFree ( hmem, 0, MEM_RELEASE ); ret = VirtualFree ( hmem, 0, MEM_RELEASE );
EAX_reg( context ) = ret; context->Eax = ret;
FIXME("Returning: %d\n", ret ); FIXME("Returning: %d\n", ret );
return 0; return 0;
...@@ -1022,7 +1022,7 @@ static DWORD VxDCall_VWin32( DWORD service, CONTEXT86 *context ) ...@@ -1022,7 +1022,7 @@ static DWORD VxDCall_VWin32( DWORD service, CONTEXT86 *context )
CX_reg(context) = parm; CX_reg(context) = parm;
INT_Int31Handler(context); INT_Int31Handler(context);
return(AX_reg(context)); return LOWORD(context->Eax);
} }
break; break;
......
...@@ -77,14 +77,12 @@ static VOID WINAPI KEYBOARD_CallKeybdEventProc( FARPROC16 proc, ...@@ -77,14 +77,12 @@ static VOID WINAPI KEYBOARD_CallKeybdEventProc( FARPROC16 proc,
CONTEXT86 context; CONTEXT86 context;
memset( &context, 0, sizeof(context) ); memset( &context, 0, sizeof(context) );
CS_reg(&context) = SELECTOROF( proc ); context.SegCs = SELECTOROF( proc );
EIP_reg(&context) = OFFSETOF( proc ); context.Eip = OFFSETOF( proc );
AH_reg(&context) = (dwFlags & KEYEVENTF_KEYUP)? 0x80 : 0; context.Eax = bVk | ((dwFlags & KEYEVENTF_KEYUP)? 0x8000 : 0);
AL_reg(&context) = bVk; context.Ebx = bScan | ((dwFlags & KEYEVENTF_EXTENDEDKEY) ? 0x100 : 0);
BH_reg(&context) = (dwFlags & KEYEVENTF_EXTENDEDKEY)? 1 : 0; context.Esi = LOWORD( dwExtraInfo );
BL_reg(&context) = bScan; context.Edi = HIWORD( dwExtraInfo );
SI_reg(&context) = LOWORD( dwExtraInfo );
DI_reg(&context) = HIWORD( dwExtraInfo );
CallTo16RegisterShort( &context, 0 ); CallTo16RegisterShort( &context, 0 );
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "wingdi.h" #include "wingdi.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "wine/winestring.h"
#include "stackframe.h" #include "stackframe.h"
#include "builtin16.h" #include "builtin16.h"
#include "heap.h" #include "heap.h"
...@@ -193,12 +194,11 @@ static LRESULT WINAPI WINPROC_CallWndProc16( WNDPROC16 proc, HWND16 hwnd, ...@@ -193,12 +194,11 @@ static LRESULT WINAPI WINPROC_CallWndProc16( WNDPROC16 proc, HWND16 hwnd,
/* 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));
DS_reg(&context) = SELECTOROF(teb->cur_stack); context.SegDs = context.SegEs = SELECTOROF(teb->cur_stack);
ES_reg(&context) = DS_reg(&context); context.Eax = wndPtr ? wndPtr->hInstance : context.SegDs;
EAX_reg(&context) = wndPtr ? wndPtr->hInstance : DS_reg(&context); context.SegCs = SELECTOROF(proc);
CS_reg(&context) = SELECTOROF(proc); context.Eip = OFFSETOF(proc);
EIP_reg(&context) = OFFSETOF(proc); context.Ebp = OFFSETOF(teb->cur_stack)
EBP_reg(&context) = OFFSETOF(teb->cur_stack)
+ (WORD)&((STACK16FRAME*)0)->bp; + (WORD)&((STACK16FRAME*)0)->bp;
WIN_ReleaseWndPtr(wndPtr); WIN_ReleaseWndPtr(wndPtr);
...@@ -239,7 +239,7 @@ static LRESULT WINAPI WINPROC_CallWndProc16( WNDPROC16 proc, HWND16 hwnd, ...@@ -239,7 +239,7 @@ static LRESULT WINAPI WINPROC_CallWndProc16( WNDPROC16 proc, HWND16 hwnd,
args[4] = hwnd; args[4] = hwnd;
CallTo16RegisterShort( &context, 5 * sizeof(WORD) ); CallTo16RegisterShort( &context, 5 * sizeof(WORD) );
ret = MAKELONG( AX_reg(&context), DX_reg(&context) ); ret = MAKELONG( LOWORD(context.Eax), LOWORD(context.Edx) );
if (offset) stack16_pop( offset ); if (offset) stack16_pop( offset );
WIN_RestoreWndsLock(iWndsLocks); WIN_RestoreWndsLock(iWndsLocks);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment