Added ctrl-c support.
[wine.git] / msdos / interrupts.c
blob27e75c6edd142d2ca89ebed1b31137e7ef71a2f2
1 /*
2 * Interrupt vectors emulation
4 * Copyright 1995 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <sys/types.h>
22 #include "windef.h"
23 #include "wine/winbase16.h"
24 #include "miscemu.h"
25 #include "msdos.h"
26 #include "module.h"
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(int);
31 static FARPROC16 INT_Vectors[256];
33 /* Ordinal number for interrupt 0 handler in WPROCS.DLL */
34 #define FIRST_INTERRUPT 100
37 /**********************************************************************
38 * INT_GetPMHandler
40 * Return the protected mode interrupt vector for a given interrupt.
42 FARPROC16 INT_GetPMHandler( BYTE intnum )
44 if (!INT_Vectors[intnum])
46 static HMODULE16 wprocs;
47 if (!wprocs)
49 if (((wprocs = GetModuleHandle16( "wprocs" )) < 32) &&
50 ((wprocs = LoadLibrary16( "wprocs" )) < 32))
52 ERR("could not load wprocs.dll\n");
53 return 0;
56 if (!(INT_Vectors[intnum] = GetProcAddress16( wprocs, (LPCSTR)(FIRST_INTERRUPT + intnum))))
58 WARN("int%x not implemented, returning dummy handler\n", intnum );
59 INT_Vectors[intnum] = GetProcAddress16( wprocs, (LPCSTR)(FIRST_INTERRUPT + 256) );
62 return INT_Vectors[intnum];
66 /**********************************************************************
67 * INT_SetPMHandler
69 * Set the protected mode interrupt handler for a given interrupt.
71 void INT_SetPMHandler( BYTE intnum, FARPROC16 handler )
73 TRACE("Set protected mode interrupt vector %02x <- %04x:%04x\n",
74 intnum, HIWORD(handler), LOWORD(handler) );
75 INT_Vectors[intnum] = handler;
79 /**********************************************************************
80 * INT_DefaultHandler (WPROCS.356)
82 * Default interrupt handler.
84 void WINAPI INT_DefaultHandler( CONTEXT86 *context )