Fixed header dependencies to be fully compatible with the Windows
[wine/multimedia.git] / dlls / winedos / int11.c
blobb6dd6b75fd58d0b5c9d4bfd788f62b3bac439daf
1 /*
2 * BIOS interrupt 11h handler
4 * Copyright 1996 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 "config.h"
22 #include "wine/port.h"
24 #include <stdarg.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winreg.h"
32 #include "miscemu.h"
33 #include "msdos.h"
34 #include "file.h"
35 #include "wine/unicode.h"
36 #include "wine/debug.h"
39 /**********************************************************************
40 * DOSVM_Int11Handler (WINEDOS16.117)
42 * Handler for int 11h (get equipment list).
45 * Borrowed from Ralph Brown's interrupt lists:
47 * bits 15-14: number of parallel devices
48 * bit 13: [Conv] Internal modem
49 * bit 12: reserved
50 * bits 11- 9: number of serial devices
51 * bit 8: reserved
52 * bits 7- 6: number of diskette drives minus one
53 * bits 5- 4: Initial video mode:
54 * 00b = EGA,VGA,PGA
55 * 01b = 40 x 25 color
56 * 10b = 80 x 25 color
57 * 11b = 80 x 25 mono
58 * bit 3: reserved
59 * bit 2: [PS] =1 if pointing device
60 * [non-PS] reserved
61 * bit 1: =1 if math co-processor
62 * bit 0: =1 if diskette available for boot
65 * Currently the only of these bits correctly set are:
67 * bits 15-14 } Added by William Owen Smith,
68 * bits 11-9 } wos@dcs.warwick.ac.uk
69 * bits 7-6
70 * bit 2 (always set) ( bit 2 = 4 )
71 * bit 1 } Robert 'Admiral' Coeyman
72 * All *nix systems either have a math processor or
73 * emulate one.
75 void WINAPI DOSVM_Int11Handler( CONTEXT86 *context )
77 int diskdrives = 0;
78 int parallelports = 0;
79 int serialports = 0;
80 int x;
82 if (GetDriveTypeA("A:\\") == DRIVE_REMOVABLE) diskdrives++;
83 if (GetDriveTypeA("B:\\") == DRIVE_REMOVABLE) diskdrives++;
84 if (diskdrives) diskdrives--;
86 for (x=0; x < 9; x++)
88 HKEY hkey;
89 char option[10];
90 char temp[256];
92 /* serial port name */
93 strcpy( option, "COMx" );
94 option[3] = '1' + x;
95 option[4] = '\0';
97 /* default value */
98 strcpy( temp, "*" );
100 if (!RegOpenKeyA(HKEY_LOCAL_MACHINE,
101 "Software\\Wine\\Wine\\Config\\serialports",
102 &hkey))
104 DWORD type;
105 DWORD count = sizeof(temp);
106 RegQueryValueExA( hkey, option, 0, &type, temp, &count );
107 RegCloseKey( hkey );
110 if (strcmp(temp, "*") && *temp != '\0')
111 serialports++;
113 /* parallel port name */
114 strcpy( option, "LPTx" );
115 option[3] = '1' + x;
116 option[4] = '\0';
118 /* default value */
119 strcpy( temp, "*" );
121 if (!RegOpenKeyA(HKEY_LOCAL_MACHINE,
122 "Software\\Wine\\Wine\\Config\\parallelports",
123 &hkey))
125 DWORD type;
126 DWORD count = sizeof(temp);
127 RegQueryValueExA( hkey, option, 0, &type, temp, &count );
128 RegCloseKey( hkey );
131 if (strcmp(temp, "*") && *temp != '\0')
132 parallelports++;
135 if (serialports > 7) /* 3 bits -- maximum value = 7 */
136 serialports = 7;
138 if (parallelports > 3) /* 2 bits -- maximum value = 3 */
139 parallelports = 3;
141 SET_AX( context,
142 (diskdrives << 6) | (serialports << 9) | (parallelports << 14) | 0x06 );