diff --git a/dlls/kernel/kernel32.spec b/dlls/kernel/kernel32.spec index 4daa025ccdd..6ba75fa5545 100644 --- a/dlls/kernel/kernel32.spec +++ b/dlls/kernel/kernel32.spec @@ -1051,11 +1051,8 @@ @ cdecl DOSMEM_GetBlock(long ptr) DOSMEM_GetBlock @ cdecl DOSMEM_GetDPMISegments() DOSMEM_GetDPMISegments @ cdecl DOSMEM_Init(long) DOSMEM_Init -@ stdcall INT_Int11Handler(ptr) INT_Int11Handler -@ stdcall INT_Int15Handler(ptr) INT_Int15Handler @ stdcall INT_Int25Handler(ptr) INT_Int25Handler @ stdcall INT_Int26Handler(ptr) INT_Int26Handler -@ stdcall NetBIOSCall16(ptr) NetBIOSCall16 @ cdecl LOCAL_Alloc(long long long) LOCAL_Alloc @ cdecl LOCAL_Compact(long long long) LOCAL_Compact @ cdecl LOCAL_CountFree(long) LOCAL_CountFree diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index 3de2834f261..e09aca068ab 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -50,12 +50,9 @@ C_SRCS = \ $(TOPOBJDIR)/msdos/dosconf.c \ $(TOPOBJDIR)/msdos/dosmem.c \ $(TOPOBJDIR)/msdos/dpmi.c \ - $(TOPOBJDIR)/msdos/int11.c \ - $(TOPOBJDIR)/msdos/int15.c \ $(TOPOBJDIR)/msdos/int21.c \ $(TOPOBJDIR)/msdos/int25.c \ $(TOPOBJDIR)/msdos/int26.c \ - $(TOPOBJDIR)/msdos/int5c.c \ $(TOPOBJDIR)/msdos/ioports.c \ $(TOPOBJDIR)/msdos/ppdev.c \ $(TOPOBJDIR)/msdos/vxd.c \ diff --git a/dlls/winedos/Makefile.in b/dlls/winedos/Makefile.in index 4119ceb5c4e..350e50fd8b7 100644 --- a/dlls/winedos/Makefile.in +++ b/dlls/winedos/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = winedos.dll -IMPORTS = user32 kernel32 ntdll +IMPORTS = user32 advapi32 kernel32 ntdll ALTNAMES = winedos16.dll EXTRALIBS = $(LIBUNICODE) @@ -18,8 +18,10 @@ C_SRCS = \ fpu.c \ int09.c \ int10.c \ + int11.c \ int12.c \ int13.c \ + int15.c \ int16.c \ int17.c \ int19.c \ @@ -33,6 +35,7 @@ C_SRCS = \ int33.c \ int41.c \ int4b.c \ + int5c.c \ int67.c \ interrupts.c \ ioports.c \ diff --git a/dlls/winedos/dosexe.h b/dlls/winedos/dosexe.h index 42de724f3ca..306e725053d 100644 --- a/dlls/winedos/dosexe.h +++ b/dlls/winedos/dosexe.h @@ -116,12 +116,18 @@ extern BYTE WINAPI DOSVM_Int09ReadScan(BYTE*ascii); extern void WINAPI DOSVM_Int10Handler(CONTEXT86*); extern void WINAPI DOSVM_PutChar(BYTE ascii); +/* int11.c */ +extern void WINAPI DOSVM_Int11Handler(CONTEXT86*); + /* int12.c */ extern void WINAPI DOSVM_Int12Handler(CONTEXT86*); /* int13.c */ extern void WINAPI DOSVM_Int13Handler(CONTEXT86*); +/* int15.c */ +extern void WINAPI DOSVM_Int15Handler(CONTEXT86*); + /* int1a.c */ extern void WINAPI DOSVM_Int1aHandler(CONTEXT86*); @@ -169,6 +175,9 @@ extern void WINAPI DOSVM_Int41Handler(CONTEXT86*); /* int4b.c */ extern void WINAPI DOSVM_Int4bHandler(CONTEXT86*); +/* int5c.c */ +extern void WINAPI DOSVM_Int5cHandler(CONTEXT86*); + /* int67.c */ extern void WINAPI DOSVM_Int67Handler(CONTEXT86*); extern void WINAPI EMS_Ioctl_Handler(CONTEXT86*); diff --git a/dlls/winedos/int11.c b/dlls/winedos/int11.c new file mode 100644 index 00000000000..4c3b09c4fc9 --- /dev/null +++ b/dlls/winedos/int11.c @@ -0,0 +1,141 @@ +/* + * BIOS interrupt 11h handler + * + * Copyright 1996 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include "wine/port.h" + +#include +#include +#include + +#include "windef.h" +#include "winreg.h" +#include "miscemu.h" +#include "msdos.h" +#include "file.h" +#include "wine/unicode.h" +#include "wine/debug.h" + + +/********************************************************************** + * DOSVM_Int11Handler (WINEDOS16.117) + * + * Handler for int 11h (get equipment list). + * + * + * Borrowed from Ralph Brown's interrupt lists: + * + * bits 15-14: number of parallel devices + * bit 13: [Conv] Internal modem + * bit 12: reserved + * bits 11- 9: number of serial devices + * bit 8: reserved + * bits 7- 6: number of diskette drives minus one + * bits 5- 4: Initial video mode: + * 00b = EGA,VGA,PGA + * 01b = 40 x 25 color + * 10b = 80 x 25 color + * 11b = 80 x 25 mono + * bit 3: reserved + * bit 2: [PS] =1 if pointing device + * [non-PS] reserved + * bit 1: =1 if math co-processor + * bit 0: =1 if diskette available for boot + * + * + * Currently the only of these bits correctly set are: + * + * bits 15-14 } Added by William Owen Smith, + * bits 11-9 } wos@dcs.warwick.ac.uk + * bits 7-6 + * bit 2 (always set) ( bit 2 = 4 ) + * bit 1 } Robert 'Admiral' Coeyman + * All *nix systems either have a math processor or + * emulate one. + */ +void WINAPI DOSVM_Int11Handler( CONTEXT86 *context ) +{ + int diskdrives = 0; + int parallelports = 0; + int serialports = 0; + int x; + + if (GetDriveTypeA("A:\\") == DRIVE_REMOVABLE) diskdrives++; + if (GetDriveTypeA("B:\\") == DRIVE_REMOVABLE) diskdrives++; + if (diskdrives) diskdrives--; + + for (x=0; x < 9; x++) + { + HKEY hkey; + char option[10]; + char temp[256]; + + /* serial port name */ + strcpy( option, "COMx" ); + option[3] = '1' + x; + option[4] = '\0'; + + /* default value */ + strcpy( temp, "*" ); + + if (!RegOpenKeyA(HKEY_LOCAL_MACHINE, + "Software\\Wine\\Wine\\Config\\serialports", + &hkey)) + { + DWORD type; + DWORD count = sizeof(temp); + RegQueryValueExA( hkey, option, 0, &type, temp, &count ); + RegCloseKey( hkey ); + } + + if (strcmp(temp, "*") && *temp != '\0') + serialports++; + + /* parallel port name */ + strcpy( option, "LPTx" ); + option[3] = '1' + x; + option[4] = '\0'; + + /* default value */ + strcpy( temp, "*" ); + + if (!RegOpenKeyA(HKEY_LOCAL_MACHINE, + "Software\\Wine\\Wine\\Config\\parallelports", + &hkey)) + { + DWORD type; + DWORD count = sizeof(temp); + RegQueryValueExA( hkey, option, 0, &type, temp, &count ); + RegCloseKey( hkey ); + } + + if (strcmp(temp, "*") && *temp != '\0') + parallelports++; + } + + if (serialports > 7) /* 3 bits -- maximum value = 7 */ + serialports = 7; + + if (parallelports > 3) /* 2 bits -- maximum value = 3 */ + parallelports = 3; + + SET_AX( context, + (diskdrives << 6) | (serialports << 9) | (parallelports << 14) | 0x06 ); +} diff --git a/msdos/int15.c b/dlls/winedos/int15.c similarity index 83% rename from msdos/int15.c rename to dlls/winedos/int15.c index a7a69a62156..75ae20cde2d 100644 --- a/msdos/int15.c +++ b/dlls/winedos/int15.c @@ -21,16 +21,17 @@ #include #include "miscemu.h" #include "wine/debug.h" +#include "wine/winbase16.h" WINE_DEFAULT_DEBUG_CHANNEL(int); /********************************************************************** - * INT_Int15Handler (WPROCS.121) + * DOSVM_Int15Handler (WINEDOS16.121) * * Handler for int 15h */ -void WINAPI INT_Int15Handler( CONTEXT86 *context ) +void WINAPI DOSVM_Int15Handler( CONTEXT86 *context ) { switch(AH_reg(context)) { @@ -55,7 +56,6 @@ void WINAPI INT_Int15Handler( CONTEXT86 *context ) } RESET_CFLAG(context); - break; case 0x88: /* get size of memory above 1 M */ @@ -64,14 +64,23 @@ void WINAPI INT_Int15Handler( CONTEXT86 *context ) break; case 0xc0: /* GET CONFIGURATION */ - if (ISV86(context)) /* real */ + if (ISV86(context)) + { + /* real mode segment */ context->SegEs = 0xf000; + } else - context->SegEs = DOSMEM_BiosSysSeg; + { + /* KERNEL.194: __F000H - protected mode selector */ + FARPROC16 proc = GetProcAddress16( GetModuleHandle16("KERNEL"), + (LPCSTR)(ULONG_PTR)194 ); + context->SegEs = LOWORD(proc); + } SET_BX( context, 0xe6f5 ); SET_AH( context, 0x0 ); RESET_CFLAG(context); break; + case 0xc2: switch(AL_reg(context)) { @@ -98,7 +107,8 @@ void WINAPI INT_Int15Handler( CONTEXT86 *context ) break; case 0x04: /* Get Pointing Device Type */ FIXME("Get Pointing Device Type - not implemented\n"); - SET_BH( context, 0x01 );/*Device id FIXME what is it supposed to be?*/ + /* FIXME: BH = Device id, What is it supposed to be? */ + SET_BH( context, 0x01 ); break; default: INT_BARF( context, 0x15 ); diff --git a/msdos/int5c.c b/dlls/winedos/int5c.c similarity index 87% rename from msdos/int5c.c rename to dlls/winedos/int5c.c index 655fc1d8a8a..37cd3d65652 100644 --- a/msdos/int5c.c +++ b/dlls/winedos/int5c.c @@ -25,12 +25,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(int); /*********************************************************************** - * NetBIOSCall (KERNEL.103) - * INT_Int5cHandler (WPROCS.192) + * DOSVM_Int5cHandler (WINEDOS16.192) * - * Also handler for interrupt 5c. + * Called from NetBIOSCall16. */ -void WINAPI NetBIOSCall16( CONTEXT86 *context ) +void WINAPI DOSVM_Int5cHandler( CONTEXT86 *context ) { BYTE* ptr; ptr = MapSL( MAKESEGPTR(context->SegEs,BX_reg(context)) ); diff --git a/dlls/winedos/interrupts.c b/dlls/winedos/interrupts.c index b468e015d65..1706ee4e9c3 100644 --- a/dlls/winedos/interrupts.c +++ b/dlls/winedos/interrupts.c @@ -25,21 +25,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(int); /*********************************************************************** - * DOSVM_Int11Handler (WINEDOS16.117) - * DOSVM_Int15Handler (WINEDOS16.121) * DOSVM_Int25Handler (WINEDOS16.137) * DOSVM_Int26Handler (WINEDOS16.138) - * DOSVM_Int5cHandler (WINEDOS16.192) * * FIXME: Interrupt handlers for interrupts implemented in other DLLs. * These functions should be removed when the interrupt handlers have * been moved to winedos. */ -void WINAPI DOSVM_Int11Handler( CONTEXT86 *context ) { INT_Int11Handler(context); } -void WINAPI DOSVM_Int15Handler( CONTEXT86 *context ) { INT_Int15Handler(context); } void WINAPI DOSVM_Int25Handler( CONTEXT86 *context ) { INT_Int25Handler(context); } void WINAPI DOSVM_Int26Handler( CONTEXT86 *context ) { INT_Int26Handler(context); } -void WINAPI DOSVM_Int5cHandler( CONTEXT86 *context ) { NetBIOSCall16(context); } static FARPROC16 DOSVM_Vectors16[256]; static FARPROC48 DOSVM_Vectors48[256]; diff --git a/include/miscemu.h b/include/miscemu.h index 4329fdb680f..107894710fd 100644 --- a/include/miscemu.h +++ b/include/miscemu.h @@ -196,21 +196,12 @@ extern BOOL INSTR_EmulateInstruction( CONTEXT86 *context ); extern DWORD IO_inport( int port, int count ); extern void IO_outport( int port, int count, DWORD value ); -/* msdos/int11.c */ -extern void WINAPI INT_Int11Handler(CONTEXT86*); - -/* msdos/int15.c */ -extern void WINAPI INT_Int15Handler(CONTEXT86*); - /* msdos/int25.c */ extern void WINAPI INT_Int25Handler(CONTEXT86*); /* msdos/int26.c */ extern void WINAPI INT_Int26Handler(CONTEXT86*); -/* msdos/int5c.c */ -extern void WINAPI NetBIOSCall16(CONTEXT86*); - /* msdos/dpmi.c */ extern BOOL DPMI_LoadDosSystem(void); diff --git a/msdos/dpmi.c b/msdos/dpmi.c index 58c9bd40789..8b56b6f3f07 100644 --- a/msdos/dpmi.c +++ b/msdos/dpmi.c @@ -55,3 +55,14 @@ BOOL DPMI_LoadDosSystem(void) #undef GET_ADDR return TRUE; } + + +/*********************************************************************** + * NetBIOSCall (KERNEL.103) + * + */ +void WINAPI NetBIOSCall16( CONTEXT86 *context ) +{ + if (Dosvm.CallBuiltinHandler || DPMI_LoadDosSystem()) + Dosvm.CallBuiltinHandler( context, 0x5c ); +} diff --git a/msdos/int11.c b/msdos/int11.c deleted file mode 100644 index 8b4d4ff8355..00000000000 --- a/msdos/int11.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * BIOS interrupt 11h handler - * - * Copyright 1996 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" -#include "wine/port.h" - -#include -#include -#include - -#include "windef.h" -#include "miscemu.h" -#include "msdos.h" -#include "file.h" -#include "wine/unicode.h" -#include "wine/debug.h" - -/********************************************************************** - * INT_Int11Handler (WPROCS.117) - * - * Handler for int 11h (get equipment list). - */ -void WINAPI INT_Int11Handler( CONTEXT86 *context ) -{ - int diskdrives = 0; - int parallelports = 0; - int serialports = 0; - int x; - -/* borrowed from Ralph Brown's interrupt lists - - bits 15-14: number of parallel devices - bit 13: [Conv] Internal modem - bit 12: reserved - bits 11- 9: number of serial devices - bit 8: reserved - bits 7- 6: number of diskette drives minus one - bits 5- 4: Initial video mode: - 00b = EGA,VGA,PGA - 01b = 40 x 25 color - 10b = 80 x 25 color - 11b = 80 x 25 mono - bit 3: reserved - bit 2: [PS] =1 if pointing device - [non-PS] reserved - bit 1: =1 if math co-processor - bit 0: =1 if diskette available for boot -*/ -/* Currently the only of these bits correctly set are: - bits 15-14 } Added by William Owen Smith, - bits 11-9 } wos@dcs.warwick.ac.uk - bits 7-6 - bit 2 (always set) ( bit 2 = 4 ) - bit 1 } Robert 'Admiral' Coeyman - All *nix systems either have a math processor or - emmulate one. -*/ - - if (GetDriveTypeA("A:\\") == DRIVE_REMOVABLE) diskdrives++; - if (GetDriveTypeA("B:\\") == DRIVE_REMOVABLE) diskdrives++; - if (diskdrives) diskdrives--; - - for (x=0; x < 9; x++) - { - WCHAR temp[16]; - WCHAR comW[] = {'C','O','M','?',0}; - WCHAR lptW[] = {'L','P','T','?',0}; - static const WCHAR serialportsW[] = {'s','e','r','i','a','l','p','o','r','t','s',0}; - static const WCHAR parallelportsW[] = {'p','a','r','a','l','l','e','l','p','o','r','t','s',0}; - static const WCHAR asteriskW[] = {'*',0}; - - comW[3] = '0' + x; - PROFILE_GetWineIniString(serialportsW, comW, asteriskW, temp, 16); - if(strcmpW(temp, asteriskW)) - serialports++; - - lptW[3] = '0' + x; - PROFILE_GetWineIniString(parallelportsW, lptW, asteriskW, temp, 16); - if(strcmpW(temp, asteriskW)) - parallelports++; - } - if (serialports > 7) /* 3 bits -- maximum value = 7 */ - serialports=7; - if (parallelports > 3) /* 2 bits -- maximum value = 3 */ - parallelports=3; - - SET_AX( context, (diskdrives << 6) | (serialports << 9) | (parallelports << 14) | 0x06 ); -}