From ca2902f3d11b321a237bb39c9658166bcdf8a048 Mon Sep 17 00:00:00 2001 From: Jukka Heinonen Date: Tue, 7 Oct 2003 03:32:03 +0000 Subject: [PATCH] Use correct pointer when accessing real mode interrupt vectors under Win16. --- dlls/winedos/interrupts.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/dlls/winedos/interrupts.c b/dlls/winedos/interrupts.c index 64ee72c26d4..5bfc6f0e8a4 100644 --- a/dlls/winedos/interrupts.c +++ b/dlls/winedos/interrupts.c @@ -71,6 +71,27 @@ static const INTPROC DOSVM_VectorsBuiltin[] = #define DOSVM_STUB_PM48 6 +/********************************************************************** + * DOSVM_GetRMVector + * + * Return pointer to real mode interrupt vector. These are not at fixed + * location because those Win16 programs that do not use any real mode + * code have protected NULL pointer catching block at low linear memory + * and interrupt vectors have been moved to another location. + */ +static FARPROC16* DOSVM_GetRMVector( BYTE intnum ) +{ + LDT_ENTRY entry; + FARPROC16 proc; + + proc = GetProcAddress16( GetModuleHandle16( "KERNEL" ), + (LPCSTR)(ULONG_PTR)183 ); + wine_ldt_get_entry( LOWORD(proc), &entry ); + + return (FARPROC16*)wine_ldt_get_base( &entry ) + intnum; +} + + /********************************************************************** * DOSVM_IsIRQ * @@ -517,7 +538,7 @@ void DOSVM_HardwareInterruptRM( CONTEXT86 *context, BYTE intnum ) */ FARPROC16 DOSVM_GetRMHandler( BYTE intnum ) { - return ((FARPROC16*)0)[intnum]; + return *DOSVM_GetRMVector( intnum ); } @@ -530,7 +551,7 @@ void DOSVM_SetRMHandler( BYTE intnum, FARPROC16 handler ) { TRACE("Set real mode interrupt vector %02x <- %04x:%04x\n", intnum, HIWORD(handler), LOWORD(handler) ); - ((FARPROC16*)0)[intnum] = handler; + *DOSVM_GetRMVector( intnum ) = handler; }