Release 951212
[wine/multimedia.git] / miscemu / int2f.c
blob7501c76720b1081931dfc06078203119f1cbe034
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 #include "registers.h"
5 #include "wine.h"
6 #include "msdos.h"
7 #include "miscemu.h"
8 #include "module.h"
9 #include "options.h"
10 #include "stddebug.h"
11 /* #define DEBUG_INT */
12 #include "debug.h"
14 /* base WINPROC module number for VxDs */
15 #define VXD_BASE 400
17 static void do_int2f_16(struct sigcontext_struct *context);
19 /**********************************************************************
20 * INT_Int2fHandler
22 * Handler for int 2fh (multiplex).
24 void INT_Int2fHandler( struct sigcontext_struct context )
26 switch(AH_reg(&context))
28 case 0x10:
29 AL_reg(&context) = 0xff; /* share is installed */
30 break;
32 case 0x15: /* mscdex */
33 /* ignore requests */
34 break;
36 case 0x16:
37 do_int2f_16( &context );
38 break;
40 case 0x4a:
41 switch(AL_reg(&context))
43 case 0x10: /* smartdrv */
44 break; /* not installed */
45 case 0x12: /* realtime compression interface */
46 break; /* not installed */
47 default:
48 INT_BARF( &context, 0x2f );
50 break;
51 default:
52 INT_BARF( &context, 0x2f );
53 break;
58 /**********************************************************************
59 * do_int2f_16
61 static void do_int2f_16(struct sigcontext_struct *context)
63 DWORD addr;
65 switch(AL_reg(context))
67 case 0x00: /* Windows enhanced mode installation check */
68 AX_reg(context) = Options.enhanced ? WINVERSION : 0;
69 break;
71 case 0x0a: /* Get Windows version and type */
72 AX_reg(context) = 0;
73 BX_reg(context) = (WINVERSION >> 8) | ((WINVERSION << 8) & 0xff00);
74 CX_reg(context) = Options.enhanced ? 3 : 2;
75 break;
77 case 0x80: /* Release time-slice */
78 AL_reg(context) = 0;
79 /* FIXME: We need to do something that lets some other process run
80 here. */
81 sleep(0);
82 break;
84 case 0x83: /* Return Current Virtual Machine ID */
85 /* Virtual Machines are usually created/destroyed when Windows runs
86 * DOS programs. Since we never do, we are always in the System VM.
87 * According to Ralf Brown's Interrupt List, never return 0. But it
88 * seems to work okay (returning 0), just to be sure we return 1.
90 BX_reg(context) = 1; /* VM 1 is probably the System VM */
91 break;
93 case 0x84: /* Get device API entry point */
94 addr = MODULE_GetEntryPoint( GetModuleHandle("WINPROCS"),
95 VXD_BASE + BX_reg(context) );
96 if (!addr) /* not supported */
98 fprintf( stderr,"Application attempted to access VxD %04x\n",
99 BX_reg(context) );
100 fprintf( stderr,"This device is not known to Wine.");
101 fprintf( stderr,"Expect a failure now\n");
103 ES_reg(context) = SELECTOROF(addr);
104 DI_reg(context) = OFFSETOF(addr);
105 break;
107 case 0x86: /* DPMI detect mode */
108 AX_reg(context) = 0; /* Running under DPMI */
109 break;
111 /* FIXME: is this right? Specs say that this should only be callable
112 in real (v86) mode which we never enter. */
113 case 0x87: /* DPMI installation check */
114 AX_reg(context) = 0x0000; /* DPMI Installed */
115 BX_reg(context) = 0x0001; /* 32bits available */
116 CL_reg(context) = runtime_cpu();
117 DX_reg(context) = 0x005a; /* DPMI major/minor 0.90 */
118 SI_reg(context) = 0; /* # of para. of DOS extended private data */
119 ES_reg(context) = 0; /* ES:DI is DPMI switch entry point */
120 DI_reg(context) = 0;
121 break;
123 case 0x8a: /* DPMI get vendor-specific API entry point. */
124 /* The 1.0 specs say this should work with all 0.9 hosts. */
125 break;
127 default:
128 INT_BARF( context, 0x2f );