From 97f2b6b12886f338d8ea2a589fe7724686d0c563 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sat, 19 Sep 2015 22:42:13 +0000 Subject: [PATCH] [NTVDM] Also save and restore the registers around other mouse callbacks and the DOS driver routine calls. svn path=/trunk/; revision=69299 --- .../mvdm/ntvdm/dos/dos32krnl/device.c | 20 ++++++++++++++++--- reactos/subsystems/mvdm/ntvdm/dos/mouse32.c | 6 ++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/device.c b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/device.c index 4f4fa7cb137..4a4bc76b085 100644 --- a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/device.c +++ b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/device.c @@ -47,8 +47,15 @@ static PDOS_REQUEST_HEADER DeviceRequest; static VOID DosCallDriver(DWORD Driver, PDOS_REQUEST_HEADER Request) { PDOS_DRIVER DriverBlock = (PDOS_DRIVER)FAR_POINTER(Driver); - WORD ES = getES(); + WORD AX = getAX(); + WORD CX = getCX(); + WORD DX = getDX(); WORD BX = getBX(); + WORD BP = getBP(); + WORD SI = getSI(); + WORD DI = getDI(); + WORD DS = getDS(); + WORD ES = getES(); /* Set ES:BX to the location of the request */ setES(DOS_DATA_SEGMENT); @@ -64,9 +71,16 @@ static VOID DosCallDriver(DWORD Driver, PDOS_REQUEST_HEADER Request) /* Get the request structure from ES:BX */ RtlMoveMemory(Request, &Sda->Request, Request->RequestLength); - /* Restore ES:BX */ - setES(ES); + /* Restore the registers */ + setAX(AX); + setCX(CX); + setDX(DX); setBX(BX); + setBP(BP); + setSI(SI); + setDI(DI); + setDS(DS); + setES(ES); } static inline WORD NTAPI DosDriverReadInternal(PDOS_DEVICE_NODE DeviceNode, diff --git a/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c b/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c index 257dac4b78f..171bdfd00cb 100644 --- a/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c +++ b/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c @@ -310,8 +310,11 @@ static VOID CallMouseUserHandlers(USHORT CallMask) BX = getBX(); CX = getCX(); DX = getDX(); + BP = getBP(); SI = getSI(); DI = getDI(); + DS = getDS(); + ES = getES(); setAX(CallMask); setBX(DriverState.ButtonState); @@ -333,8 +336,11 @@ static VOID CallMouseUserHandlers(USHORT CallMask) setBX(BX); setCX(CX); setDX(DX); + setBP(BP); setSI(SI); setDI(DI); + setDS(DS); + setES(ES); } } }