2 * Win32 device functions
4 * Copyright 1998 Marcus Meissner
5 * Copyright 1998 Ulrich Weigand
6 * Copyright 1998 Patrik Stridvall
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "wine/port.h"
30 #include <sys/types.h>
46 #include "kernel_private.h"
47 #include "wine/server.h"
48 #include "wine/debug.h"
50 WINE_DEFAULT_DEBUG_CHANNEL(file);
53 static BOOL DeviceIo_VTDAPI(DWORD dwIoControlCode,
54 LPVOID lpvInBuffer, DWORD cbInBuffer,
55 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
56 LPDWORD lpcbBytesReturned,
57 LPOVERLAPPED lpOverlapped);
58 static BOOL DeviceIo_MONODEBG(DWORD dwIoControlCode,
59 LPVOID lpvInBuffer, DWORD cbInBuffer,
60 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
61 LPDWORD lpcbBytesReturned,
62 LPOVERLAPPED lpOverlapped);
63 static BOOL DeviceIo_MMDEVLDR(DWORD dwIoControlCode,
64 LPVOID lpvInBuffer, DWORD cbInBuffer,
65 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
66 LPDWORD lpcbBytesReturned,
67 LPOVERLAPPED lpOverlapped);
69 static BOOL DeviceIo_IFSMgr(DWORD dwIoControlCode,
70 LPVOID lpvInBuffer, DWORD cbInBuffer,
71 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
72 LPDWORD lpcbBytesReturned,
73 LPOVERLAPPED lpOverlapped);
75 static BOOL DeviceIo_VCD(DWORD dwIoControlCode,
76 LPVOID lpvInBuffer, DWORD cbInBuffer,
77 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
78 LPDWORD lpcbBytesReturned,
79 LPOVERLAPPED lpOverlapped);
81 static BOOL DeviceIo_VWin32(DWORD dwIoControlCode,
82 LPVOID lpvInBuffer, DWORD cbInBuffer,
83 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
84 LPDWORD lpcbBytesReturned,
85 LPOVERLAPPED lpOverlapped);
87 static BOOL DeviceIo_PCCARD (DWORD dwIoControlCode,
88 LPVOID lpvInBuffer, DWORD cbInBuffer,
89 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
90 LPDWORD lpcbBytesReturned,
91 LPOVERLAPPED lpOverlapped);
93 static BOOL DeviceIo_HASP (DWORD dwIoControlCode,
94 LPVOID lpvInBuffer, DWORD cbInBuffer,
95 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
96 LPDWORD lpcbBytesReturned,
97 LPOVERLAPPED lpOverlapped);
99 * VxD names are taken from the Win95 DDK
106 BOOL (*deviceio)(DWORD, LPVOID, DWORD,
107 LPVOID, DWORD, LPDWORD, LPOVERLAPPED);
110 static const struct VxDInfo VxDList[] =
112 /* Standard VxD IDs */
113 { "VMM", 0x0001, NULL },
114 { "DEBUG", 0x0002, NULL },
115 { "VPICD", 0x0003, NULL },
116 { "VDMAD", 0x0004, NULL },
117 { "VTD", 0x0005, NULL },
118 { "V86MMGR", 0x0006, NULL },
119 { "PAGESWAP", 0x0007, NULL },
120 { "PARITY", 0x0008, NULL },
121 { "REBOOT", 0x0009, NULL },
122 { "VDD", 0x000A, NULL },
123 { "VSD", 0x000B, NULL },
124 { "VMD", 0x000C, NULL },
125 { "VKD", 0x000D, NULL },
126 { "VCD", 0x000E, DeviceIo_VCD },
127 { "VPD", 0x000F, NULL },
128 { "BLOCKDEV", 0x0010, NULL },
129 { "VMCPD", 0x0011, NULL },
130 { "EBIOS", 0x0012, NULL },
131 { "BIOSXLAT", 0x0013, NULL },
132 { "VNETBIOS", 0x0014, NULL },
133 { "DOSMGR", 0x0015, NULL },
134 { "WINLOAD", 0x0016, NULL },
135 { "SHELL", 0x0017, NULL },
136 { "VMPOLL", 0x0018, NULL },
137 { "VPROD", 0x0019, NULL },
138 { "DOSNET", 0x001A, NULL },
139 { "VFD", 0x001B, NULL },
140 { "VDD2", 0x001C, NULL },
141 { "WINDEBUG", 0x001D, NULL },
142 { "TSRLOAD", 0x001E, NULL },
143 { "BIOSHOOK", 0x001F, NULL },
144 { "INT13", 0x0020, NULL },
145 { "PAGEFILE", 0x0021, NULL },
146 { "SCSI", 0x0022, NULL },
147 { "MCA_POS", 0x0023, NULL },
148 { "SCSIFD", 0x0024, NULL },
149 { "VPEND", 0x0025, NULL },
150 { "VPOWERD", 0x0026, NULL },
151 { "VXDLDR", 0x0027, NULL },
152 { "NDIS", 0x0028, NULL },
153 { "BIOS_EXT", 0x0029, NULL },
154 { "VWIN32", 0x002A, DeviceIo_VWin32 },
155 { "VCOMM", 0x002B, NULL },
156 { "SPOOLER", 0x002C, NULL },
157 { "WIN32S", 0x002D, NULL },
158 { "DEBUGCMD", 0x002E, NULL },
160 { "VNB", 0x0031, NULL },
161 { "SERVER", 0x0032, NULL },
162 { "CONFIGMG", 0x0033, NULL },
163 { "DWCFGMG", 0x0034, NULL },
164 { "SCSIPORT", 0x0035, NULL },
165 { "VFBACKUP", 0x0036, NULL },
166 { "ENABLE", 0x0037, NULL },
167 { "VCOND", 0x0038, NULL },
169 { "EFAX", 0x003A, NULL },
170 { "DSVXD", 0x003B, NULL },
171 { "ISAPNP", 0x003C, NULL },
172 { "BIOS", 0x003D, NULL },
173 { "WINSOCK", 0x003E, NULL },
174 { "WSOCK", 0x003E, NULL },
175 { "WSIPX", 0x003F, NULL },
176 { "IFSMgr", 0x0040, DeviceIo_IFSMgr },
177 { "VCDFSD", 0x0041, NULL },
178 { "MRCI2", 0x0042, NULL },
179 { "PCI", 0x0043, NULL },
180 { "PELOADER", 0x0044, NULL },
181 { "EISA", 0x0045, NULL },
182 { "DRAGCLI", 0x0046, NULL },
183 { "DRAGSRV", 0x0047, NULL },
184 { "PERF", 0x0048, NULL },
185 { "AWREDIR", 0x0049, NULL },
187 /* Far East support */
188 { "ETEN", 0x0060, NULL },
189 { "CHBIOS", 0x0061, NULL },
190 { "VMSGD", 0x0062, NULL },
191 { "VPPID", 0x0063, NULL },
192 { "VIME", 0x0064, NULL },
193 { "VHBIOSD", 0x0065, NULL },
195 /* Multimedia OEM IDs */
196 { "VTDAPI", 0x0442, DeviceIo_VTDAPI },
197 { "MMDEVLDR", 0x044A, DeviceIo_MMDEVLDR },
199 /* Network Device IDs */
200 { "VNetSup", 0x0480, NULL },
201 { "VRedir", 0x0481, NULL },
202 { "VBrowse", 0x0482, NULL },
203 { "VSHARE", 0x0483, NULL },
204 { "IFSMgr", 0x0484, NULL },
205 { "MEMPROBE", 0x0485, NULL },
206 { "VFAT", 0x0486, NULL },
207 { "NWLINK", 0x0487, NULL },
208 { "VNWLINK", 0x0487, NULL },
209 { "NWSUP", 0x0487, NULL },
210 { "VTDI", 0x0488, NULL },
211 { "VIP", 0x0489, NULL },
212 { "VTCP", 0x048A, NULL },
213 { "VCache", 0x048B, NULL },
214 { "VUDP", 0x048C, NULL },
215 { "VAsync", 0x048D, NULL },
216 { "NWREDIR", 0x048E, NULL },
217 { "STAT80", 0x048F, NULL },
218 { "SCSIPORT", 0x0490, NULL },
219 { "FILESEC", 0x0491, NULL },
220 { "NWSERVER", 0x0492, NULL },
221 { "SECPROV", 0x0493, NULL },
222 { "NSCL", 0x0494, NULL },
223 { "WSTCP", 0x0495, NULL },
224 { "NDIS2SUP", 0x0496, NULL },
225 { "MSODISUP", 0x0497, NULL },
226 { "Splitter", 0x0498, NULL },
227 { "PPP", 0x0499, NULL },
228 { "VDHCP", 0x049A, NULL },
229 { "VNBT", 0x049B, NULL },
230 { "LOGGER", 0x049D, NULL },
231 { "EFILTER", 0x049E, NULL },
232 { "FFILTER", 0x049F, NULL },
233 { "TFILTER", 0x04A0, NULL },
234 { "AFILTER", 0x04A1, NULL },
235 { "IRLAMP", 0x04A2, NULL },
237 { "PCCARD", 0x097C, DeviceIo_PCCARD },
238 { "HASP95", 0x3721, DeviceIo_HASP },
240 /* WINE additions, ids unknown */
241 { "MONODEBG.VXD", 0x4242, DeviceIo_MONODEBG },
246 HANDLE DEVICE_Open( LPCWSTR filenameW, DWORD access, LPSECURITY_ATTRIBUTES sa )
248 const struct VxDInfo *info;
249 char filename[MAX_PATH];
251 if (!WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, MAX_PATH, NULL, NULL))
253 SetLastError( ERROR_FILE_NOT_FOUND );
257 for (info = VxDList; info->name; info++)
258 if (!strncasecmp( info->name, filename, strlen(info->name) ))
259 return FILE_CreateDevice( info->id | 0x10000, access, sa );
261 FIXME( "Unknown/unsupported VxD %s. Try setting Windows version to 'nt40' or 'win31'.\n",
263 SetLastError( ERROR_FILE_NOT_FOUND );
267 static DWORD DEVICE_GetClientID( HANDLE handle )
270 SERVER_START_REQ( get_device_id )
272 req->handle = handle;
273 if (!wine_server_call( req )) ret = reply->id;
279 static const struct VxDInfo *DEVICE_GetInfo( DWORD clientID )
281 const struct VxDInfo *info = NULL;
283 if (clientID & 0x10000)
285 for (info = VxDList; info->name; info++)
286 if (info->id == LOWORD(clientID)) break;
291 /****************************************************************************
292 * DeviceIoControl (KERNEL32.@)
293 * This is one of those big ugly nasty procedure which can do
294 * a million and one things when it comes to devices. It can also be
295 * used for VxD communication.
297 * A return value of FALSE indicates that something has gone wrong which
298 * GetLastError can decipher.
300 BOOL WINAPI DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode,
301 LPVOID lpvInBuffer, DWORD cbInBuffer,
302 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
303 LPDWORD lpcbBytesReturned,
304 LPOVERLAPPED lpOverlapped)
308 TRACE( "(%p,%ld,%p,%ld,%p,%ld,%p,%p)\n",
309 hDevice,dwIoControlCode,lpvInBuffer,cbInBuffer,
310 lpvOutBuffer,cbOutBuffer,lpcbBytesReturned,lpOverlapped );
312 if (!(clientID = DEVICE_GetClientID( hDevice )))
314 SetLastError( ERROR_INVALID_PARAMETER );
318 /* Check if this is a user defined control code for a VxD */
319 if( HIWORD( dwIoControlCode ) == 0 )
321 const struct VxDInfo *info;
322 if (!(info = DEVICE_GetInfo( clientID )))
324 FIXME( "No device found for id %lx\n", clientID);
326 else if ( info->deviceio )
328 return info->deviceio( dwIoControlCode,
329 lpvInBuffer, cbInBuffer,
330 lpvOutBuffer, cbOutBuffer,
331 lpcbBytesReturned, lpOverlapped );
335 FIXME( "Unimplemented control %ld for VxD device %s\n",
336 dwIoControlCode, info->name ? info->name : "???" );
337 /* FIXME: this is for invalid calls on W98SE,
338 * but maybe we should use ERROR_CALL_NOT_IMPLEMENTED
340 SetLastError( ERROR_INVALID_FUNCTION );
349 status = NtDeviceIoControlFile(hDevice, lpOverlapped->hEvent,
351 (PIO_STATUS_BLOCK)lpOverlapped,
353 lpvInBuffer, cbInBuffer,
354 lpvOutBuffer, cbOutBuffer);
355 if (status) SetLastError(RtlNtStatusToDosError(status));
356 if (lpcbBytesReturned) *lpcbBytesReturned = lpOverlapped->InternalHigh;
361 IO_STATUS_BLOCK iosb;
363 status = NtDeviceIoControlFile(hDevice, NULL, NULL, NULL, &iosb,
365 lpvInBuffer, cbInBuffer,
366 lpvOutBuffer, cbOutBuffer);
367 if (status) SetLastError(RtlNtStatusToDosError(status));
368 if (lpcbBytesReturned) *lpcbBytesReturned = iosb.Information;
375 /***********************************************************************
378 static BOOL DeviceIo_VTDAPI(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
379 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
380 LPDWORD lpcbBytesReturned,
381 LPOVERLAPPED lpOverlapped)
385 switch (dwIoControlCode)
388 if (lpvOutBuffer && (cbOutBuffer>=4))
389 *(DWORD*)lpvOutBuffer = GetTickCount();
391 if (lpcbBytesReturned)
392 *lpcbBytesReturned = 4;
397 FIXME( "Control %ld not implemented\n", dwIoControlCode);
405 /***********************************************************************
408 * These ioctls are used by 'MSNET32.DLL'.
410 * I have been unable to uncover any documentation about the ioctls so
411 * the implementation of the cases IFS_IOCTL_21 and IFS_IOCTL_2F are
412 * based on reasonable guesses on information found in the Windows 95 DDK.
417 * IFSMgr DeviceIO service
420 #define IFS_IOCTL_21 100
421 #define IFS_IOCTL_2F 101
422 #define IFS_IOCTL_GET_RES 102
423 #define IFS_IOCTL_GET_NETPRO_NAME_A 103
426 unsigned long ar_proid;
427 unsigned long ar_eax;
428 unsigned long ar_ebx;
429 unsigned long ar_ecx;
430 unsigned long ar_edx;
431 unsigned long ar_esi;
432 unsigned long ar_edi;
433 unsigned long ar_ebp;
434 unsigned short ar_error;
435 unsigned short ar_pad;
438 static void win32apieq_2_CONTEXT(struct win32apireq *pIn,CONTEXT86 *pCxt)
440 memset(pCxt,0,sizeof(*pCxt));
442 pCxt->ContextFlags=CONTEXT86_INTEGER|CONTEXT86_CONTROL;
443 pCxt->Eax = pIn->ar_eax;
444 pCxt->Ebx = pIn->ar_ebx;
445 pCxt->Ecx = pIn->ar_ecx;
446 pCxt->Edx = pIn->ar_edx;
447 pCxt->Esi = pIn->ar_esi;
448 pCxt->Edi = pIn->ar_edi;
450 /* FIXME: Only partial CONTEXT86_CONTROL */
451 pCxt->Ebp = pIn->ar_ebp;
453 /* FIXME: pIn->ar_proid ignored */
454 /* FIXME: pIn->ar_error ignored */
455 /* FIXME: pIn->ar_pad ignored */
458 static void CONTEXT_2_win32apieq(CONTEXT86 *pCxt,struct win32apireq *pOut)
460 memset(pOut,0,sizeof(struct win32apireq));
462 pOut->ar_eax = pCxt->Eax;
463 pOut->ar_ebx = pCxt->Ebx;
464 pOut->ar_ecx = pCxt->Ecx;
465 pOut->ar_edx = pCxt->Edx;
466 pOut->ar_esi = pCxt->Esi;
467 pOut->ar_edi = pCxt->Edi;
469 /* FIXME: Only partial CONTEXT86_CONTROL */
470 pOut->ar_ebp = pCxt->Ebp;
472 /* FIXME: pOut->ar_proid ignored */
473 /* FIXME: pOut->ar_error ignored */
474 /* FIXME: pOut->ar_pad ignored */
477 static BOOL DeviceIo_IFSMgr(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
478 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
479 LPDWORD lpcbBytesReturned,
480 LPOVERLAPPED lpOverlapped)
483 TRACE("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
485 lpvInBuffer,cbInBuffer,
486 lpvOutBuffer,cbOutBuffer,
490 switch (dwIoControlCode)
495 struct win32apireq *pIn=(struct win32apireq *) lpvInBuffer;
496 struct win32apireq *pOut=(struct win32apireq *) lpvOutBuffer;
500 "proid=0x%08lx, eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
501 "edx=0x%08lx, esi=0x%08lx, edi=0x%08lx, ebp=0x%08lx, "
502 "error=0x%04x, pad=0x%04x\n",
503 (dwIoControlCode==IFS_IOCTL_21)?"IFS_IOCTL_21":"IFS_IOCTL_2F",
504 pIn->ar_proid, pIn->ar_eax, pIn->ar_ebx, pIn->ar_ecx,
505 pIn->ar_edx, pIn->ar_esi, pIn->ar_edi, pIn->ar_ebp,
506 pIn->ar_error, pIn->ar_pad
509 win32apieq_2_CONTEXT(pIn,&cxt);
511 if(dwIoControlCode==IFS_IOCTL_21)
513 if(Dosvm.CallBuiltinHandler || DPMI_LoadDosSystem())
514 Dosvm.CallBuiltinHandler( &cxt, 0x21 );
518 if(Dosvm.CallBuiltinHandler || DPMI_LoadDosSystem())
519 Dosvm.CallBuiltinHandler( &cxt, 0x2f );
522 CONTEXT_2_win32apieq(&cxt,pOut);
526 case IFS_IOCTL_GET_RES:{
527 FIXME( "Control 'IFS_IOCTL_GET_RES' not implemented\n");
530 case IFS_IOCTL_GET_NETPRO_NAME_A:{
531 FIXME( "Control 'IFS_IOCTL_GET_NETPRO_NAME_A' not implemented\n");
535 FIXME( "Control %ld not implemented\n", dwIoControlCode);
542 /***********************************************************************
545 static BOOL DeviceIo_VCD(DWORD dwIoControlCode,
546 LPVOID lpvInBuffer, DWORD cbInBuffer,
547 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
548 LPDWORD lpcbBytesReturned,
549 LPOVERLAPPED lpOverlapped)
553 switch (dwIoControlCode)
555 case IOCTL_SERIAL_LSRMST_INSERT:
557 FIXME( "IOCTL_SERIAL_LSRMST_INSERT NIY !\n");
563 FIXME( "Unknown Control %ld\n", dwIoControlCode);
572 /***********************************************************************
576 static void DIOCRegs_2_CONTEXT( DIOC_REGISTERS *pIn, CONTEXT86 *pCxt )
578 memset( pCxt, 0, sizeof(*pCxt) );
579 /* Note: segment registers == 0 means that CTX_SEG_OFF_TO_LIN
580 will interpret 32-bit register contents as linear pointers */
582 pCxt->ContextFlags=CONTEXT86_INTEGER|CONTEXT86_CONTROL;
583 pCxt->Eax = pIn->reg_EAX;
584 pCxt->Ebx = pIn->reg_EBX;
585 pCxt->Ecx = pIn->reg_ECX;
586 pCxt->Edx = pIn->reg_EDX;
587 pCxt->Esi = pIn->reg_ESI;
588 pCxt->Edi = pIn->reg_EDI;
590 /* FIXME: Only partial CONTEXT86_CONTROL */
591 pCxt->EFlags = pIn->reg_Flags;
594 static void CONTEXT_2_DIOCRegs( CONTEXT86 *pCxt, DIOC_REGISTERS *pOut )
596 memset( pOut, 0, sizeof(DIOC_REGISTERS) );
598 pOut->reg_EAX = pCxt->Eax;
599 pOut->reg_EBX = pCxt->Ebx;
600 pOut->reg_ECX = pCxt->Ecx;
601 pOut->reg_EDX = pCxt->Edx;
602 pOut->reg_ESI = pCxt->Esi;
603 pOut->reg_EDI = pCxt->Edi;
605 /* FIXME: Only partial CONTEXT86_CONTROL */
606 pOut->reg_Flags = pCxt->EFlags;
609 #define DIOC_AH(regs) (((unsigned char*)&((regs)->reg_EAX))[1])
610 #define DIOC_AL(regs) (((unsigned char*)&((regs)->reg_EAX))[0])
611 #define DIOC_BH(regs) (((unsigned char*)&((regs)->reg_EBX))[1])
612 #define DIOC_BL(regs) (((unsigned char*)&((regs)->reg_EBX))[0])
613 #define DIOC_DH(regs) (((unsigned char*)&((regs)->reg_EDX))[1])
614 #define DIOC_DL(regs) (((unsigned char*)&((regs)->reg_EDX))[0])
616 #define DIOC_AX(regs) (((unsigned short*)&((regs)->reg_EAX))[0])
617 #define DIOC_BX(regs) (((unsigned short*)&((regs)->reg_EBX))[0])
618 #define DIOC_CX(regs) (((unsigned short*)&((regs)->reg_ECX))[0])
619 #define DIOC_DX(regs) (((unsigned short*)&((regs)->reg_EDX))[0])
621 #define DIOC_SET_CARRY(regs) (((regs)->reg_Flags)|=0x00000001)
623 static BOOL DeviceIo_VWin32(DWORD dwIoControlCode,
624 LPVOID lpvInBuffer, DWORD cbInBuffer,
625 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
626 LPDWORD lpcbBytesReturned,
627 LPOVERLAPPED lpOverlapped)
631 switch (dwIoControlCode)
633 case VWIN32_DIOC_DOS_IOCTL:
634 case 0x10: /* Int 0x21 call, call it VWIN_DIOC_INT21 ? */
635 case VWIN32_DIOC_DOS_INT13:
636 case VWIN32_DIOC_DOS_INT25:
637 case VWIN32_DIOC_DOS_INT26:
638 case 0x29: /* Int 0x31 call, call it VWIN_DIOC_INT31 ? */
639 case VWIN32_DIOC_DOS_DRIVEINFO:
642 DIOC_REGISTERS *pIn = (DIOC_REGISTERS *)lpvInBuffer;
643 DIOC_REGISTERS *pOut = (DIOC_REGISTERS *)lpvOutBuffer;
646 TRACE( "Control '%s': "
647 "eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
648 "edx=0x%08lx, esi=0x%08lx, edi=0x%08lx \n",
649 (dwIoControlCode == VWIN32_DIOC_DOS_IOCTL)? "VWIN32_DIOC_DOS_IOCTL" :
650 (dwIoControlCode == VWIN32_DIOC_DOS_INT25)? "VWIN32_DIOC_DOS_INT25" :
651 (dwIoControlCode == VWIN32_DIOC_DOS_INT26)? "VWIN32_DIOC_DOS_INT26" :
652 (dwIoControlCode == VWIN32_DIOC_DOS_DRIVEINFO)? "VWIN32_DIOC_DOS_DRIVEINFO" : "???",
653 pIn->reg_EAX, pIn->reg_EBX, pIn->reg_ECX,
654 pIn->reg_EDX, pIn->reg_ESI, pIn->reg_EDI );
656 DIOCRegs_2_CONTEXT( pIn, &cxt );
658 switch (dwIoControlCode)
660 case VWIN32_DIOC_DOS_IOCTL: /* Call int 21h */
661 case 0x10: /* Int 0x21 call, call it VWIN_DIOC_INT21 ? */
662 case VWIN32_DIOC_DOS_DRIVEINFO: /* Call int 21h 730x */
665 case VWIN32_DIOC_DOS_INT13:
668 case VWIN32_DIOC_DOS_INT25:
671 case VWIN32_DIOC_DOS_INT26:
674 case 0x29: /* Int 0x31 call, call it VWIN_DIOC_INT31 ? */
679 if(Dosvm.CallBuiltinHandler || DPMI_LoadDosSystem())
680 Dosvm.CallBuiltinHandler( &cxt, intnum );
682 CONTEXT_2_DIOCRegs( &cxt, pOut );
686 case VWIN32_DIOC_SIMCTRLC:
687 FIXME( "Control VWIN32_DIOC_SIMCTRLC not implemented\n");
692 FIXME( "Unknown Control %ld\n", dwIoControlCode);
700 /* this is the main multimedia device loader */
701 static BOOL DeviceIo_MMDEVLDR(DWORD dwIoControlCode,
702 LPVOID lpvInBuffer, DWORD cbInBuffer,
703 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
704 LPDWORD lpcbBytesReturned,
705 LPOVERLAPPED lpOverlapped)
707 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
709 lpvInBuffer,cbInBuffer,
710 lpvOutBuffer,cbOutBuffer,
714 switch (dwIoControlCode) {
717 *(DWORD*)lpvOutBuffer=0;
718 *lpcbBytesReturned=4;
723 /* this is used by some Origin games */
724 static BOOL DeviceIo_MONODEBG(DWORD dwIoControlCode,
725 LPVOID lpvInBuffer, DWORD cbInBuffer,
726 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
727 LPDWORD lpcbBytesReturned,
728 LPOVERLAPPED lpOverlapped)
730 switch (dwIoControlCode) {
731 case 1: /* version */
732 *(LPDWORD)lpvOutBuffer = 0x20004; /* WC SecretOps */
734 case 9: /* debug output */
735 ERR("MONODEBG: %s\n",debugstr_a(lpvInBuffer));
738 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
740 lpvInBuffer,cbInBuffer,
741 lpvOutBuffer,cbOutBuffer,
750 static BOOL DeviceIo_PCCARD (DWORD dwIoControlCode,
751 LPVOID lpvInBuffer, DWORD cbInBuffer,
752 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
753 LPDWORD lpcbBytesReturned,
754 LPOVERLAPPED lpOverlapped)
756 switch (dwIoControlCode) {
757 case 0x0000: /* PCCARD_Get_Version */
758 case 0x0001: /* PCCARD_Card_Services */
760 FIXME( "(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
762 lpvInBuffer,cbInBuffer,
763 lpvOutBuffer,cbOutBuffer,
772 static BOOL DeviceIo_HASP(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
773 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
774 LPDWORD lpcbBytesReturned,
775 LPOVERLAPPED lpOverlapped)
778 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
780 lpvInBuffer,cbInBuffer,
781 lpvOutBuffer,cbOutBuffer,