Release 951003
[wine/multimedia.git] / miscemu / int2f.c
blob779f6b787aaed890f35ba684aa8fee2c72d557ad
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 0x12: /* realtime compression interface */
44 break; /* not installed */
45 default:
46 INT_BARF( &context, 0x2f );
48 break;
49 default:
50 INT_BARF( &context, 0x2f );
51 break;
56 /**********************************************************************
57 * do_int2f_16
59 static void do_int2f_16(struct sigcontext_struct *context)
61 DWORD addr;
63 switch(AL_reg(context))
65 case 0x00: /* Windows enhanced mode installation check */
66 AX_reg(context) = Options.enhanced ? WINVERSION : 0;
67 break;
69 case 0x0a: /* Get Windows version and type */
70 AX_reg(context) = 0;
71 BX_reg(context) = (WINVERSION >> 8) | ((WINVERSION << 8) & 0xff00);
72 CX_reg(context) = Options.enhanced ? 3 : 2;
73 break;
75 case 0x80: /* Release time-slice */
76 AL_reg(context) = 0;
77 /* FIXME: We need to do something that lets some other process run
78 here. */
79 sleep(0);
80 break;
82 case 0x83: /* Return Current Virtual Machine ID */
83 /* Virtual Machines are usually created/destroyed when Windows runs
84 * DOS programs. Since we never do, we are always in the System VM.
85 * According to Ralf Brown's Interrupt List, never return 0. But it
86 * seems to work okay (returning 0), just to be sure we return 1.
88 BX_reg(context) = 1; /* VM 1 is probably the System VM */
89 break;
91 case 0x84: /* Get device API entry point */
92 addr = MODULE_GetEntryPoint( GetModuleHandle("WINPROCS"),
93 VXD_BASE + BX_reg(context) );
94 if (!addr) /* not supported */
96 fprintf( stderr,"Application attempted to access VxD %04x\n",
97 BX_reg(context) );
98 fprintf( stderr,"This device is not known to Wine.");
99 fprintf( stderr,"Expect a failure now\n");
101 ES_reg(context) = SELECTOROF(addr);
102 DI_reg(context) = OFFSETOF(addr);
103 break;
105 case 0x86: /* DPMI detect mode */
106 AX_reg(context) = 0; /* Running under DPMI */
107 break;
109 /* FIXME: is this right? Specs say that this should only be callable
110 in real (v86) mode which we never enter. */
111 case 0x87: /* DPMI installation check */
112 AX_reg(context) = 0x0000; /* DPMI Installed */
113 BX_reg(context) = 0x0001; /* 32bits available */
114 CL_reg(context) = runtime_cpu();
115 DX_reg(context) = 0x005a; /* DPMI major/minor 0.90 */
116 SI_reg(context) = 0; /* # of para. of DOS extended private data */
117 ES_reg(context) = 0; /* ES:DI is DPMI switch entry point */
118 DI_reg(context) = 0;
119 break;
121 case 0x8a: /* DPMI get vendor-specific API entry point. */
122 /* The 1.0 specs say this should work with all 0.9 hosts. */
123 break;
125 default:
126 INT_BARF( context, 0x2f );