Added an ICOM_FN that generates either fn##xfn or sfn as appropriate.
[wine/hacks.git] / win32 / device.c
blobe3fbab9092d14a0d69f2a690a3d2854d50d0ccb8
1 /*
2 * Win32 device functions
4 * Copyright 1998 Marcus Meissner
5 * Copyright 1998 Ulrich Weigand
6 * Copyright 1998 Patrik Stridvall
8 */
10 #include "config.h"
12 #include <errno.h>
13 #include <assert.h>
14 #include <stdlib.h>
15 #include <unistd.h>
16 #include <sys/types.h>
17 #include <sys/stat.h>
18 #ifdef HAVE_SYS_MMAN_H
19 #include <sys/mman.h>
20 #endif
21 #include <fcntl.h>
22 #include <string.h>
23 #include <stdarg.h>
24 #include <time.h>
25 #include "wine/port.h"
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winreg.h"
29 #include "winerror.h"
30 #include "file.h"
31 #include "heap.h"
32 #include "winioctl.h"
33 #include "winnt.h"
34 #include "msdos.h"
35 #include "miscemu.h"
36 #include "stackframe.h"
37 #include "server.h"
38 #include "debugtools.h"
40 DEFAULT_DEBUG_CHANNEL(win32);
43 static BOOL DeviceIo_VTDAPI(DWORD dwIoControlCode,
44 LPVOID lpvInBuffer, DWORD cbInBuffer,
45 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
46 LPDWORD lpcbBytesReturned,
47 LPOVERLAPPED lpOverlapped);
48 static BOOL DeviceIo_MONODEBG(DWORD dwIoControlCode,
49 LPVOID lpvInBuffer, DWORD cbInBuffer,
50 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
51 LPDWORD lpcbBytesReturned,
52 LPOVERLAPPED lpOverlapped);
53 static BOOL DeviceIo_MMDEVLDR(DWORD dwIoControlCode,
54 LPVOID lpvInBuffer, DWORD cbInBuffer,
55 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
56 LPDWORD lpcbBytesReturned,
57 LPOVERLAPPED lpOverlapped);
59 static DWORD VxDCall_VMM( DWORD service, CONTEXT86 *context );
61 static BOOL DeviceIo_IFSMgr(DWORD dwIoControlCode,
62 LPVOID lpvInBuffer, DWORD cbInBuffer,
63 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
64 LPDWORD lpcbBytesReturned,
65 LPOVERLAPPED lpOverlapped);
67 static DWORD VxDCall_VWin32( DWORD service, CONTEXT86 *context );
69 static BOOL DeviceIo_VWin32(DWORD dwIoControlCode,
70 LPVOID lpvInBuffer, DWORD cbInBuffer,
71 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
72 LPDWORD lpcbBytesReturned,
73 LPOVERLAPPED lpOverlapped);
75 static BOOL DeviceIo_PCCARD (DWORD dwIoControlCode,
76 LPVOID lpvInBuffer, DWORD cbInBuffer,
77 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
78 LPDWORD lpcbBytesReturned,
79 LPOVERLAPPED lpOverlapped);
81 static BOOL DeviceIo_HASP (DWORD dwIoControlCode,
82 LPVOID lpvInBuffer, DWORD cbInBuffer,
83 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
84 LPDWORD lpcbBytesReturned,
85 LPOVERLAPPED lpOverlapped);
87 * VxD names are taken from the Win95 DDK
90 struct VxDInfo
92 LPCSTR name;
93 WORD id;
94 DWORD (*vxdcall)(DWORD, CONTEXT86 *);
95 BOOL (*deviceio)(DWORD, LPVOID, DWORD,
96 LPVOID, DWORD, LPDWORD, LPOVERLAPPED);
99 static const struct VxDInfo VxDList[] =
101 /* Standard VxD IDs */
102 { "VMM", 0x0001, VxDCall_VMM, NULL },
103 { "DEBUG", 0x0002, NULL, NULL },
104 { "VPICD", 0x0003, NULL, NULL },
105 { "VDMAD", 0x0004, NULL, NULL },
106 { "VTD", 0x0005, NULL, NULL },
107 { "V86MMGR", 0x0006, NULL, NULL },
108 { "PAGESWAP", 0x0007, NULL, NULL },
109 { "PARITY", 0x0008, NULL, NULL },
110 { "REBOOT", 0x0009, NULL, NULL },
111 { "VDD", 0x000A, NULL, NULL },
112 { "VSD", 0x000B, NULL, NULL },
113 { "VMD", 0x000C, NULL, NULL },
114 { "VKD", 0x000D, NULL, NULL },
115 { "VCD", 0x000E, NULL, NULL },
116 { "VPD", 0x000F, NULL, NULL },
117 { "BLOCKDEV", 0x0010, NULL, NULL },
118 { "VMCPD", 0x0011, NULL, NULL },
119 { "EBIOS", 0x0012, NULL, NULL },
120 { "BIOSXLAT", 0x0013, NULL, NULL },
121 { "VNETBIOS", 0x0014, NULL, NULL },
122 { "DOSMGR", 0x0015, NULL, NULL },
123 { "WINLOAD", 0x0016, NULL, NULL },
124 { "SHELL", 0x0017, NULL, NULL },
125 { "VMPOLL", 0x0018, NULL, NULL },
126 { "VPROD", 0x0019, NULL, NULL },
127 { "DOSNET", 0x001A, NULL, NULL },
128 { "VFD", 0x001B, NULL, NULL },
129 { "VDD2", 0x001C, NULL, NULL },
130 { "WINDEBUG", 0x001D, NULL, NULL },
131 { "TSRLOAD", 0x001E, NULL, NULL },
132 { "BIOSHOOK", 0x001F, NULL, NULL },
133 { "INT13", 0x0020, NULL, NULL },
134 { "PAGEFILE", 0x0021, NULL, NULL },
135 { "SCSI", 0x0022, NULL, NULL },
136 { "MCA_POS", 0x0023, NULL, NULL },
137 { "SCSIFD", 0x0024, NULL, NULL },
138 { "VPEND", 0x0025, NULL, NULL },
139 { "VPOWERD", 0x0026, NULL, NULL },
140 { "VXDLDR", 0x0027, NULL, NULL },
141 { "NDIS", 0x0028, NULL, NULL },
142 { "BIOS_EXT", 0x0029, NULL, NULL },
143 { "VWIN32", 0x002A, VxDCall_VWin32, DeviceIo_VWin32 },
144 { "VCOMM", 0x002B, NULL, NULL },
145 { "SPOOLER", 0x002C, NULL, NULL },
146 { "WIN32S", 0x002D, NULL, NULL },
147 { "DEBUGCMD", 0x002E, NULL, NULL },
149 { "VNB", 0x0031, NULL, NULL },
150 { "SERVER", 0x0032, NULL, NULL },
151 { "CONFIGMG", 0x0033, NULL, NULL },
152 { "DWCFGMG", 0x0034, NULL, NULL },
153 { "SCSIPORT", 0x0035, NULL, NULL },
154 { "VFBACKUP", 0x0036, NULL, NULL },
155 { "ENABLE", 0x0037, NULL, NULL },
156 { "VCOND", 0x0038, NULL, NULL },
158 { "EFAX", 0x003A, NULL, NULL },
159 { "DSVXD", 0x003B, NULL, NULL },
160 { "ISAPNP", 0x003C, NULL, NULL },
161 { "BIOS", 0x003D, NULL, NULL },
162 { "WINSOCK", 0x003E, NULL, NULL },
163 { "WSOCK", 0x003E, NULL, NULL },
164 { "WSIPX", 0x003F, NULL, NULL },
165 { "IFSMgr", 0x0040, NULL, DeviceIo_IFSMgr },
166 { "VCDFSD", 0x0041, NULL, NULL },
167 { "MRCI2", 0x0042, NULL, NULL },
168 { "PCI", 0x0043, NULL, NULL },
169 { "PELOADER", 0x0044, NULL, NULL },
170 { "EISA", 0x0045, NULL, NULL },
171 { "DRAGCLI", 0x0046, NULL, NULL },
172 { "DRAGSRV", 0x0047, NULL, NULL },
173 { "PERF", 0x0048, NULL, NULL },
174 { "AWREDIR", 0x0049, NULL, NULL },
176 /* Far East support */
177 { "ETEN", 0x0060, NULL, NULL },
178 { "CHBIOS", 0x0061, NULL, NULL },
179 { "VMSGD", 0x0062, NULL, NULL },
180 { "VPPID", 0x0063, NULL, NULL },
181 { "VIME", 0x0064, NULL, NULL },
182 { "VHBIOSD", 0x0065, NULL, NULL },
184 /* Multimedia OEM IDs */
185 { "VTDAPI", 0x0442, NULL, DeviceIo_VTDAPI },
186 { "MMDEVLDR", 0x044A, NULL, DeviceIo_MMDEVLDR },
188 /* Network Device IDs */
189 { "VNetSup", 0x0480, NULL, NULL },
190 { "VRedir", 0x0481, NULL, NULL },
191 { "VBrowse", 0x0482, NULL, NULL },
192 { "VSHARE", 0x0483, NULL, NULL },
193 { "IFSMgr", 0x0484, NULL, NULL },
194 { "MEMPROBE", 0x0485, NULL, NULL },
195 { "VFAT", 0x0486, NULL, NULL },
196 { "NWLINK", 0x0487, NULL, NULL },
197 { "VNWLINK", 0x0487, NULL, NULL },
198 { "NWSUP", 0x0487, NULL, NULL },
199 { "VTDI", 0x0488, NULL, NULL },
200 { "VIP", 0x0489, NULL, NULL },
201 { "VTCP", 0x048A, NULL, NULL },
202 { "VCache", 0x048B, NULL, NULL },
203 { "VUDP", 0x048C, NULL, NULL },
204 { "VAsync", 0x048D, NULL, NULL },
205 { "NWREDIR", 0x048E, NULL, NULL },
206 { "STAT80", 0x048F, NULL, NULL },
207 { "SCSIPORT", 0x0490, NULL, NULL },
208 { "FILESEC", 0x0491, NULL, NULL },
209 { "NWSERVER", 0x0492, NULL, NULL },
210 { "SECPROV", 0x0493, NULL, NULL },
211 { "NSCL", 0x0494, NULL, NULL },
212 { "WSTCP", 0x0495, NULL, NULL },
213 { "NDIS2SUP", 0x0496, NULL, NULL },
214 { "MSODISUP", 0x0497, NULL, NULL },
215 { "Splitter", 0x0498, NULL, NULL },
216 { "PPP", 0x0499, NULL, NULL },
217 { "VDHCP", 0x049A, NULL, NULL },
218 { "VNBT", 0x049B, NULL, NULL },
219 { "LOGGER", 0x049D, NULL, NULL },
220 { "EFILTER", 0x049E, NULL, NULL },
221 { "FFILTER", 0x049F, NULL, NULL },
222 { "TFILTER", 0x04A0, NULL, NULL },
223 { "AFILTER", 0x04A1, NULL, NULL },
224 { "IRLAMP", 0x04A2, NULL, NULL },
226 { "PCCARD", 0x097C, NULL, DeviceIo_PCCARD },
227 { "HASP95", 0x3721, NULL, DeviceIo_HASP },
229 /* WINE additions, ids unknown */
230 { "MONODEBG.VXD", 0x4242, NULL, DeviceIo_MONODEBG },
232 { NULL, 0, NULL, NULL }
236 * VMM VxDCall service names are (mostly) taken from Stan Mitchell's
237 * "Inside the Windows 95 File System"
240 #define N_VMM_SERVICE 41
242 LPCSTR VMM_Service_Name[N_VMM_SERVICE] =
244 "PageReserve", /* 0x0000 */
245 "PageCommit", /* 0x0001 */
246 "PageDecommit", /* 0x0002 */
247 "PagerRegister", /* 0x0003 */
248 "PagerQuery", /* 0x0004 */
249 "HeapAllocate", /* 0x0005 */
250 "ContextCreate", /* 0x0006 */
251 "ContextDestroy", /* 0x0007 */
252 "PageAttach", /* 0x0008 */
253 "PageFlush", /* 0x0009 */
254 "PageFree", /* 0x000A */
255 "ContextSwitch", /* 0x000B */
256 "HeapReAllocate", /* 0x000C */
257 "PageModifyPermissions", /* 0x000D */
258 "PageQuery", /* 0x000E */
259 "GetCurrentContext", /* 0x000F */
260 "HeapFree", /* 0x0010 */
261 "RegOpenKey", /* 0x0011 */
262 "RegCreateKey", /* 0x0012 */
263 "RegCloseKey", /* 0x0013 */
264 "RegDeleteKey", /* 0x0014 */
265 "RegSetValue", /* 0x0015 */
266 "RegDeleteValue", /* 0x0016 */
267 "RegQueryValue", /* 0x0017 */
268 "RegEnumKey", /* 0x0018 */
269 "RegEnumValue", /* 0x0019 */
270 "RegQueryValueEx", /* 0x001A */
271 "RegSetValueEx", /* 0x001B */
272 "RegFlushKey", /* 0x001C */
273 "RegQueryInfoKey", /* 0x001D */
274 "GetDemandPageInfo", /* 0x001E */
275 "BlockOnID", /* 0x001F */
276 "SignalID", /* 0x0020 */
277 "RegLoadKey", /* 0x0021 */
278 "RegUnLoadKey", /* 0x0022 */
279 "RegSaveKey", /* 0x0023 */
280 "RegRemapPreDefKey", /* 0x0024 */
281 "PageChangePager", /* 0x0025 */
282 "RegQueryMultipleValues", /* 0x0026 */
283 "RegReplaceKey", /* 0x0027 */
284 "<KERNEL32.101>" /* 0x0028 -- What does this do??? */
287 /* PageReserve arena values */
288 #define PR_PRIVATE 0x80000400 /* anywhere in private arena */
289 #define PR_SHARED 0x80060000 /* anywhere in shared arena */
290 #define PR_SYSTEM 0x80080000 /* anywhere in system arena */
292 /* PageReserve flags */
293 #define PR_FIXED 0x00000008 /* don't move during PageReAllocate */
294 #define PR_4MEG 0x00000001 /* allocate on 4mb boundary */
295 #define PR_STATIC 0x00000010 /* see PageReserve documentation */
297 /* PageCommit default pager handle values */
298 #define PD_ZEROINIT 0x00000001 /* swappable zero-initialized pages */
299 #define PD_NOINIT 0x00000002 /* swappable uninitialized pages */
300 #define PD_FIXEDZERO 0x00000003 /* fixed zero-initialized pages */
301 #define PD_FIXED 0x00000004 /* fixed uninitialized pages */
303 /* PageCommit flags */
304 #define PC_FIXED 0x00000008 /* pages are permanently locked */
305 #define PC_LOCKED 0x00000080 /* pages are made present and locked*/
306 #define PC_LOCKEDIFDP 0x00000100 /* pages are locked if swap via DOS */
307 #define PC_WRITEABLE 0x00020000 /* make the pages writeable */
308 #define PC_USER 0x00040000 /* make the pages ring 3 accessible */
309 #define PC_INCR 0x40000000 /* increment "pagerdata" each page */
310 #define PC_PRESENT 0x80000000 /* make pages initially present */
311 #define PC_STATIC 0x20000000 /* allow commit in PR_STATIC object */
312 #define PC_DIRTY 0x08000000 /* make pages initially dirty */
313 #define PC_CACHEDIS 0x00100000 /* Allocate uncached pages - new for WDM */
314 #define PC_CACHEWT 0x00080000 /* Allocate write through cache pages - new for WDM */
315 #define PC_PAGEFLUSH 0x00008000 /* Touch device mapped pages on alloc - new for WDM */
317 /* PageCommitContig additional flags */
318 #define PCC_ZEROINIT 0x00000001 /* zero-initialize new pages */
319 #define PCC_NOLIN 0x10000000 /* don't map to any linear address */
323 HANDLE DEVICE_Open( LPCSTR filename, DWORD access,
324 LPSECURITY_ATTRIBUTES sa )
326 const struct VxDInfo *info;
328 for (info = VxDList; info->name; info++)
329 if (!strncasecmp( info->name, filename, strlen(info->name) ))
330 return FILE_CreateDevice( info->id | 0x10000, access, sa );
332 FIXME( "Unknown VxD %s. Try --winver nt40 !\n", filename);
333 SetLastError( ERROR_FILE_NOT_FOUND );
334 return HFILE_ERROR;
337 static const struct VxDInfo *DEVICE_GetInfo( HANDLE handle )
339 const struct VxDInfo *info = NULL;
340 SERVER_START_REQ
342 struct get_file_info_request *req = server_alloc_req( sizeof(*req), 0 );
344 req->handle = handle;
345 if (!server_call( REQ_GET_FILE_INFO ) &&
346 (req->type == FILE_TYPE_UNKNOWN) &&
347 (req->attr & 0x10000))
349 for (info = VxDList; info->name; info++)
350 if (info->id == LOWORD(req->attr)) break;
353 SERVER_END_REQ;
354 return info;
357 /****************************************************************************
358 * DeviceIoControl (KERNEL32.188)
359 * This is one of those big ugly nasty procedure which can do
360 * a million and one things when it comes to devices. It can also be
361 * used for VxD communication.
363 * A return value of FALSE indicates that something has gone wrong which
364 * GetLastError can decypher.
366 BOOL WINAPI DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode,
367 LPVOID lpvInBuffer, DWORD cbInBuffer,
368 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
369 LPDWORD lpcbBytesReturned,
370 LPOVERLAPPED lpOverlapped)
372 const struct VxDInfo *info;
374 TRACE( "(%d,%ld,%p,%ld,%p,%ld,%p,%p)\n",
375 hDevice,dwIoControlCode,lpvInBuffer,cbInBuffer,
376 lpvOutBuffer,cbOutBuffer,lpcbBytesReturned,lpOverlapped );
378 if (!(info = DEVICE_GetInfo( hDevice )))
380 SetLastError( ERROR_INVALID_PARAMETER );
381 return FALSE;
384 /* Check if this is a user defined control code for a VxD */
385 if( HIWORD( dwIoControlCode ) == 0 )
387 if ( info->deviceio )
389 return info->deviceio( dwIoControlCode,
390 lpvInBuffer, cbInBuffer,
391 lpvOutBuffer, cbOutBuffer,
392 lpcbBytesReturned, lpOverlapped );
394 else
396 /* FIXME: Set appropriate error */
397 FIXME( "Unimplemented control %ld for VxD device %s\n",
398 dwIoControlCode, info->name ? info->name : "???" );
401 else
403 switch( dwIoControlCode )
405 case FSCTL_DELETE_REPARSE_POINT:
406 case FSCTL_DISMOUNT_VOLUME:
407 case FSCTL_GET_COMPRESSION:
408 case FSCTL_GET_REPARSE_POINT:
409 case FSCTL_LOCK_VOLUME:
410 case FSCTL_QUERY_ALLOCATED_RANGES:
411 case FSCTL_SET_COMPRESSION:
412 case FSCTL_SET_REPARSE_POINT:
413 case FSCTL_SET_SPARSE:
414 case FSCTL_SET_ZERO_DATA:
415 case FSCTL_UNLOCK_VOLUME:
416 case IOCTL_DISK_CHECK_VERIFY:
417 case IOCTL_DISK_EJECT_MEDIA:
418 case IOCTL_DISK_FORMAT_TRACKS:
419 case IOCTL_DISK_GET_DRIVE_GEOMETRY:
420 case IOCTL_DISK_GET_DRIVE_LAYOUT:
421 case IOCTL_DISK_GET_MEDIA_TYPES:
422 case IOCTL_DISK_GET_PARTITION_INFO:
423 case IOCTL_DISK_LOAD_MEDIA:
424 case IOCTL_DISK_MEDIA_REMOVAL:
425 case IOCTL_DISK_PERFORMANCE:
426 case IOCTL_DISK_REASSIGN_BLOCKS:
427 case IOCTL_DISK_SET_DRIVE_LAYOUT:
428 case IOCTL_DISK_SET_PARTITION_INFO:
429 case IOCTL_DISK_VERIFY:
430 case IOCTL_SERIAL_LSRMST_INSERT:
431 case IOCTL_STORAGE_CHECK_VERIFY:
432 case IOCTL_STORAGE_EJECT_MEDIA:
433 case IOCTL_STORAGE_GET_MEDIA_TYPES:
434 case IOCTL_STORAGE_LOAD_MEDIA:
435 case IOCTL_STORAGE_MEDIA_REMOVAL:
436 FIXME( "unimplemented dwIoControlCode=%08lx\n", dwIoControlCode);
437 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
438 return FALSE;
439 break;
440 default:
441 FIXME( "ignored dwIoControlCode=%08lx\n",dwIoControlCode);
442 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
443 return FALSE;
444 break;
447 return FALSE;
450 /***********************************************************************
451 * DeviceIo_VTDAPI
453 static BOOL DeviceIo_VTDAPI(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
454 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
455 LPDWORD lpcbBytesReturned,
456 LPOVERLAPPED lpOverlapped)
458 BOOL retv = TRUE;
460 switch (dwIoControlCode)
462 case 5:
463 if (lpvOutBuffer && (cbOutBuffer>=4))
464 *(DWORD*)lpvOutBuffer = GetTickCount();
466 if (lpcbBytesReturned)
467 *lpcbBytesReturned = 4;
469 break;
471 default:
472 FIXME( "Control %ld not implemented\n", dwIoControlCode);
473 retv = FALSE;
474 break;
477 return retv;
484 /***********************************************************************
485 * VxDCall (KERNEL32.[1-9])
487 void VxDCall( DWORD service, CONTEXT86 *context )
489 DWORD ret = 0xffffffff; /* FIXME */
490 int i;
492 TRACE( "(%08lx, ...)\n", service);
494 for (i = 0; VxDList[i].name; i++)
495 if (VxDList[i].id == HIWORD(service))
496 break;
498 if (!VxDList[i].name)
499 FIXME( "Unknown VxD (%08lx)\n", service);
500 else if (!VxDList[i].vxdcall)
501 FIXME( "Unimplemented VxD (%08lx)\n", service);
502 else
503 ret = VxDList[i].vxdcall( service, context );
505 context->Eax = ret;
509 /***********************************************************************
510 * VxDCall_VMM
512 static DWORD VxDCall_VMM( DWORD service, CONTEXT86 *context )
514 switch ( LOWORD(service) )
516 case 0x0011: /* RegOpenKey */
518 HKEY hkey = (HKEY) stack32_pop( context );
519 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
520 LPHKEY retkey = (LPHKEY)stack32_pop( context );
521 return RegOpenKeyA( hkey, lpszSubKey, retkey );
524 case 0x0012: /* RegCreateKey */
526 HKEY hkey = (HKEY) stack32_pop( context );
527 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
528 LPHKEY retkey = (LPHKEY)stack32_pop( context );
529 return RegCreateKeyA( hkey, lpszSubKey, retkey );
532 case 0x0013: /* RegCloseKey */
534 HKEY hkey = (HKEY)stack32_pop( context );
535 return RegCloseKey( hkey );
538 case 0x0014: /* RegDeleteKey */
540 HKEY hkey = (HKEY) stack32_pop( context );
541 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
542 return RegDeleteKeyA( hkey, lpszSubKey );
545 case 0x0015: /* RegSetValue */
547 HKEY hkey = (HKEY) stack32_pop( context );
548 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
549 DWORD dwType = (DWORD) stack32_pop( context );
550 LPCSTR lpszData = (LPCSTR)stack32_pop( context );
551 DWORD cbData = (DWORD) stack32_pop( context );
552 return RegSetValueA( hkey, lpszSubKey, dwType, lpszData, cbData );
555 case 0x0016: /* RegDeleteValue */
557 HKEY hkey = (HKEY) stack32_pop( context );
558 LPSTR lpszValue = (LPSTR)stack32_pop( context );
559 return RegDeleteValueA( hkey, lpszValue );
562 case 0x0017: /* RegQueryValue */
564 HKEY hkey = (HKEY) stack32_pop( context );
565 LPSTR lpszSubKey = (LPSTR) stack32_pop( context );
566 LPSTR lpszData = (LPSTR) stack32_pop( context );
567 LPDWORD lpcbData = (LPDWORD)stack32_pop( context );
568 return RegQueryValueA( hkey, lpszSubKey, lpszData, lpcbData );
571 case 0x0018: /* RegEnumKey */
573 HKEY hkey = (HKEY) stack32_pop( context );
574 DWORD iSubkey = (DWORD)stack32_pop( context );
575 LPSTR lpszName = (LPSTR)stack32_pop( context );
576 DWORD lpcchName = (DWORD)stack32_pop( context );
577 return RegEnumKeyA( hkey, iSubkey, lpszName, lpcchName );
580 case 0x0019: /* RegEnumValue */
582 HKEY hkey = (HKEY) stack32_pop( context );
583 DWORD iValue = (DWORD) stack32_pop( context );
584 LPSTR lpszValue = (LPSTR) stack32_pop( context );
585 LPDWORD lpcchValue = (LPDWORD)stack32_pop( context );
586 LPDWORD lpReserved = (LPDWORD)stack32_pop( context );
587 LPDWORD lpdwType = (LPDWORD)stack32_pop( context );
588 LPBYTE lpbData = (LPBYTE) stack32_pop( context );
589 LPDWORD lpcbData = (LPDWORD)stack32_pop( context );
590 return RegEnumValueA( hkey, iValue, lpszValue, lpcchValue,
591 lpReserved, lpdwType, lpbData, lpcbData );
594 case 0x001A: /* RegQueryValueEx */
596 HKEY hkey = (HKEY) stack32_pop( context );
597 LPSTR lpszValue = (LPSTR) stack32_pop( context );
598 LPDWORD lpReserved = (LPDWORD)stack32_pop( context );
599 LPDWORD lpdwType = (LPDWORD)stack32_pop( context );
600 LPBYTE lpbData = (LPBYTE) stack32_pop( context );
601 LPDWORD lpcbData = (LPDWORD)stack32_pop( context );
602 return RegQueryValueExA( hkey, lpszValue, lpReserved,
603 lpdwType, lpbData, lpcbData );
606 case 0x001B: /* RegSetValueEx */
608 HKEY hkey = (HKEY) stack32_pop( context );
609 LPSTR lpszValue = (LPSTR) stack32_pop( context );
610 DWORD dwReserved = (DWORD) stack32_pop( context );
611 DWORD dwType = (DWORD) stack32_pop( context );
612 LPBYTE lpbData = (LPBYTE)stack32_pop( context );
613 DWORD cbData = (DWORD) stack32_pop( context );
614 return RegSetValueExA( hkey, lpszValue, dwReserved,
615 dwType, lpbData, cbData );
618 case 0x001C: /* RegFlushKey */
620 HKEY hkey = (HKEY)stack32_pop( context );
621 return RegFlushKey( hkey );
624 case 0x001D: /* RegQueryInfoKey */
626 /* NOTE: This VxDCall takes only a subset of the parameters that the
627 corresponding Win32 API call does. The implementation in Win95
628 ADVAPI32 sets all output parameters not mentioned here to zero. */
630 HKEY hkey = (HKEY) stack32_pop( context );
631 LPDWORD lpcSubKeys = (LPDWORD)stack32_pop( context );
632 LPDWORD lpcchMaxSubKey = (LPDWORD)stack32_pop( context );
633 LPDWORD lpcValues = (LPDWORD)stack32_pop( context );
634 LPDWORD lpcchMaxValueName = (LPDWORD)stack32_pop( context );
635 LPDWORD lpcchMaxValueData = (LPDWORD)stack32_pop( context );
636 return RegQueryInfoKeyA( hkey, NULL, NULL, NULL, lpcSubKeys, lpcchMaxSubKey,
637 NULL, lpcValues, lpcchMaxValueName, lpcchMaxValueData,
638 NULL, NULL );
641 case 0x0021: /* RegLoadKey */
643 HKEY hkey = (HKEY) stack32_pop( context );
644 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
645 LPCSTR lpszFile = (LPCSTR)stack32_pop( context );
646 return RegLoadKeyA( hkey, lpszSubKey, lpszFile );
649 case 0x0022: /* RegUnLoadKey */
651 HKEY hkey = (HKEY) stack32_pop( context );
652 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
653 return RegUnLoadKeyA( hkey, lpszSubKey );
656 case 0x0023: /* RegSaveKey */
658 HKEY hkey = (HKEY) stack32_pop( context );
659 LPCSTR lpszFile = (LPCSTR)stack32_pop( context );
660 LPSECURITY_ATTRIBUTES sa = (LPSECURITY_ATTRIBUTES)stack32_pop( context );
661 return RegSaveKeyA( hkey, lpszFile, sa );
664 #if 0 /* Functions are not yet implemented in misc/registry.c */
665 case 0x0024: /* RegRemapPreDefKey */
666 case 0x0026: /* RegQueryMultipleValues */
667 #endif
669 case 0x0027: /* RegReplaceKey */
671 HKEY hkey = (HKEY) stack32_pop( context );
672 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
673 LPCSTR lpszNewFile= (LPCSTR)stack32_pop( context );
674 LPCSTR lpszOldFile= (LPCSTR)stack32_pop( context );
675 return RegReplaceKeyA( hkey, lpszSubKey, lpszNewFile, lpszOldFile );
677 case 0x0000: /* PageReserve */
679 LPVOID address;
680 LPVOID ret;
681 DWORD psize = getpagesize();
682 ULONG page = (ULONG) stack32_pop( context );
683 ULONG npages = (ULONG) stack32_pop( context );
684 ULONG flags = (ULONG) stack32_pop( context );
686 TRACE("PageReserve: page: %08lx, npages: %08lx, flags: %08lx partial stub!\n",
687 page, npages, flags );
689 if ( page == PR_SYSTEM ) {
690 ERR("Can't reserve ring 1 memory\n");
691 return -1;
693 /* FIXME: This has to be handled seperatly, when we have seperate
694 address-spaces */
695 if ( page == PR_PRIVATE || page == PR_SHARED ) page = 0;
696 /* FIXME: Handle flags in some way */
697 address = (LPVOID )(page * psize);
698 ret = VirtualAlloc ( address, ( npages * psize ), MEM_RESERVE, 0 );
699 TRACE("PageReserve: returning: %08lx\n", (DWORD )ret );
700 if ( ret == NULL )
701 return -1;
702 else
703 return (DWORD )ret;
706 case 0x0001: /* PageCommit */
708 LPVOID address;
709 LPVOID ret;
710 DWORD virt_perm;
711 DWORD psize = getpagesize();
712 ULONG page = (ULONG) stack32_pop( context );
713 ULONG npages = (ULONG) stack32_pop( context );
714 ULONG hpd = (ULONG) stack32_pop( context );
715 ULONG pagerdata = (ULONG) stack32_pop( context );
716 ULONG flags = (ULONG) stack32_pop( context );
718 TRACE("PageCommit: page: %08lx, npages: %08lx, hpd: %08lx pagerdata: "
719 "%08lx, flags: %08lx partial stub\n",
720 page, npages, hpd, pagerdata, flags );
722 if ( flags & PC_USER )
723 if ( flags & PC_WRITEABLE )
724 virt_perm = PAGE_EXECUTE_READWRITE;
725 else
726 virt_perm = PAGE_EXECUTE_READ;
727 else
728 virt_perm = PAGE_NOACCESS;
730 address = (LPVOID )(page * psize);
731 ret = VirtualAlloc ( address, ( npages * psize ), MEM_COMMIT, virt_perm );
732 TRACE("PageCommit: Returning: %08lx\n", (DWORD )ret );
733 return (DWORD )ret;
736 case 0x0002: /* PageDecommit */
738 LPVOID address;
739 BOOL ret;
740 DWORD psize = getpagesize();
741 ULONG page = (ULONG) stack32_pop( context );
742 ULONG npages = (ULONG) stack32_pop( context );
743 ULONG flags = (ULONG) stack32_pop( context );
745 TRACE("PageDecommit: page: %08lx, npages: %08lx, flags: %08lx partial stub\n",
746 page, npages, flags );
747 address = (LPVOID )( page * psize );
748 ret = VirtualFree ( address, ( npages * psize ), MEM_DECOMMIT );
749 TRACE("PageDecommit: Returning: %s\n", ret ? "TRUE" : "FALSE" );
750 return ret;
752 case 0x000d: /* PageModifyPermissions */
754 DWORD pg_old_perm;
755 DWORD pg_new_perm;
756 DWORD virt_old_perm;
757 DWORD virt_new_perm;
758 MEMORY_BASIC_INFORMATION mbi;
759 LPVOID address;
760 DWORD psize = getpagesize();
761 ULONG page = stack32_pop ( context );
762 ULONG npages = stack32_pop ( context );
763 ULONG permand = stack32_pop ( context );
764 ULONG permor = stack32_pop ( context );
766 TRACE("PageModifyPermissions %08lx %08lx %08lx %08lx partial stub\n",
767 page, npages, permand, permor );
768 address = (LPVOID )( page * psize );
770 VirtualQuery ( address, &mbi, sizeof ( MEMORY_BASIC_INFORMATION ));
771 virt_old_perm = mbi.Protect;
773 switch ( virt_old_perm & mbi.Protect ) {
774 case PAGE_READONLY:
775 case PAGE_EXECUTE:
776 case PAGE_EXECUTE_READ:
777 pg_old_perm = PC_USER;
778 break;
779 case PAGE_READWRITE:
780 case PAGE_WRITECOPY:
781 case PAGE_EXECUTE_READWRITE:
782 case PAGE_EXECUTE_WRITECOPY:
783 pg_old_perm = PC_USER | PC_WRITEABLE;
784 break;
785 case PAGE_NOACCESS:
786 default:
787 pg_old_perm = 0;
788 break;
790 pg_new_perm = pg_old_perm;
791 pg_new_perm &= permand & ~PC_STATIC;
792 pg_new_perm |= permor & ~PC_STATIC;
794 virt_new_perm = ( virt_old_perm ) & ~0xff;
795 if ( pg_new_perm & PC_USER )
797 if ( pg_new_perm & PC_WRITEABLE )
798 virt_new_perm |= PAGE_EXECUTE_READWRITE;
799 else
800 virt_new_perm |= PAGE_EXECUTE_READ;
803 if ( ! VirtualProtect ( address, ( npages * psize ), virt_new_perm, &virt_old_perm ) ) {
804 ERR("Can't change page permissions for %08lx\n", (DWORD )address );
805 return 0xffffffff;
807 TRACE("Returning: %08lx\n", pg_old_perm );
808 return pg_old_perm;
810 case 0x000a: /* PageFree */
812 BOOL ret;
813 LPVOID hmem = (LPVOID) stack32_pop( context );
814 DWORD flags = (DWORD ) stack32_pop( context );
816 TRACE("PageFree: hmem: %08lx, flags: %08lx partial stub\n",
817 (DWORD )hmem, flags );
819 ret = VirtualFree ( hmem, 0, MEM_RELEASE );
820 context->Eax = ret;
821 TRACE("Returning: %d\n", ret );
823 return 0;
825 case 0x001e: /* GetDemandPageInfo */
827 DWORD dinfo = (DWORD)stack32_pop( context );
828 DWORD flags = (DWORD)stack32_pop( context );
830 /* GetDemandPageInfo is supposed to fill out the struct at
831 * "dinfo" with various low-level memory management information.
832 * Apps are certainly not supposed to call this, although it's
833 * demoed and documented by Pietrek on pages 441-443 of "Windows
834 * 95 System Programming Secrets" if any program needs a real
835 * implementation of this.
838 FIXME("GetDemandPageInfo(%08lx %08lx): stub!\n", dinfo, flags);
840 return 0;
842 default:
843 if (LOWORD(service) < N_VMM_SERVICE)
844 FIXME( "Unimplemented service %s (%08lx)\n",
845 VMM_Service_Name[LOWORD(service)], service);
846 else
847 FIXME( "Unknown service %08lx\n", service);
848 break;
851 return 0xffffffff; /* FIXME */
854 /***********************************************************************
855 * DeviceIo_IFSMgr
856 * NOTES
857 * The ioctls is used by 'MSNET32.DLL'.
859 * I have been unable to uncover any documentation about the ioctls so
860 * the implementation of the cases IFS_IOCTL_21 and IFS_IOCTL_2F are
861 * based on a resonable guesses on information found in the Windows 95 DDK.
866 * IFSMgr DeviceIO service
869 #define IFS_IOCTL_21 100
870 #define IFS_IOCTL_2F 101
871 #define IFS_IOCTL_GET_RES 102
872 #define IFS_IOCTL_GET_NETPRO_NAME_A 103
874 struct win32apireq {
875 unsigned long ar_proid;
876 unsigned long ar_eax;
877 unsigned long ar_ebx;
878 unsigned long ar_ecx;
879 unsigned long ar_edx;
880 unsigned long ar_esi;
881 unsigned long ar_edi;
882 unsigned long ar_ebp;
883 unsigned short ar_error;
884 unsigned short ar_pad;
887 static void win32apieq_2_CONTEXT(struct win32apireq *pIn,CONTEXT86 *pCxt)
889 memset(pCxt,0,sizeof(*pCxt));
891 pCxt->ContextFlags=CONTEXT86_INTEGER|CONTEXT86_CONTROL;
892 pCxt->Eax = pIn->ar_eax;
893 pCxt->Ebx = pIn->ar_ebx;
894 pCxt->Ecx = pIn->ar_ecx;
895 pCxt->Edx = pIn->ar_edx;
896 pCxt->Esi = pIn->ar_esi;
897 pCxt->Edi = pIn->ar_edi;
899 /* FIXME: Only partial CONTEXT86_CONTROL */
900 pCxt->Ebp = pIn->ar_ebp;
902 /* FIXME: pIn->ar_proid ignored */
903 /* FIXME: pIn->ar_error ignored */
904 /* FIXME: pIn->ar_pad ignored */
907 static void CONTEXT_2_win32apieq(CONTEXT86 *pCxt,struct win32apireq *pOut)
909 memset(pOut,0,sizeof(struct win32apireq));
911 pOut->ar_eax = pCxt->Eax;
912 pOut->ar_ebx = pCxt->Ebx;
913 pOut->ar_ecx = pCxt->Ecx;
914 pOut->ar_edx = pCxt->Edx;
915 pOut->ar_esi = pCxt->Esi;
916 pOut->ar_edi = pCxt->Edi;
918 /* FIXME: Only partial CONTEXT86_CONTROL */
919 pOut->ar_ebp = pCxt->Ebp;
921 /* FIXME: pOut->ar_proid ignored */
922 /* FIXME: pOut->ar_error ignored */
923 /* FIXME: pOut->ar_pad ignored */
926 static BOOL DeviceIo_IFSMgr(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
927 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
928 LPDWORD lpcbBytesReturned,
929 LPOVERLAPPED lpOverlapped)
931 BOOL retv = TRUE;
932 TRACE("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
933 dwIoControlCode,
934 lpvInBuffer,cbInBuffer,
935 lpvOutBuffer,cbOutBuffer,
936 lpcbBytesReturned,
937 lpOverlapped);
939 switch (dwIoControlCode)
941 case IFS_IOCTL_21:
942 case IFS_IOCTL_2F:{
943 CONTEXT86 cxt;
944 struct win32apireq *pIn=(struct win32apireq *) lpvInBuffer;
945 struct win32apireq *pOut=(struct win32apireq *) lpvOutBuffer;
947 TRACE(
948 "Control '%s': "
949 "proid=0x%08lx, eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
950 "edx=0x%08lx, esi=0x%08lx, edi=0x%08lx, ebp=0x%08lx, "
951 "error=0x%04x, pad=0x%04x\n",
952 (dwIoControlCode==IFS_IOCTL_21)?"IFS_IOCTL_21":"IFS_IOCTL_2F",
953 pIn->ar_proid, pIn->ar_eax, pIn->ar_ebx, pIn->ar_ecx,
954 pIn->ar_edx, pIn->ar_esi, pIn->ar_edi, pIn->ar_ebp,
955 pIn->ar_error, pIn->ar_pad
958 win32apieq_2_CONTEXT(pIn,&cxt);
960 if(dwIoControlCode==IFS_IOCTL_21)
962 DOS3Call(&cxt); /* Call int 21h */
963 } else {
964 INT_Int2fHandler(&cxt); /* Call int 2Fh */
967 CONTEXT_2_win32apieq(&cxt,pOut);
969 retv = TRUE;
970 } break;
971 case IFS_IOCTL_GET_RES:{
972 FIXME( "Control 'IFS_IOCTL_GET_RES' not implemented\n");
973 retv = FALSE;
974 } break;
975 case IFS_IOCTL_GET_NETPRO_NAME_A:{
976 FIXME( "Control 'IFS_IOCTL_GET_NETPRO_NAME_A' not implemented\n");
977 retv = FALSE;
978 } break;
979 default:
980 FIXME( "Control %ld not implemented\n", dwIoControlCode);
981 retv = FALSE;
984 return retv;
987 /********************************************************************************
988 * VxDCall_VWin32
990 * Service numbers taken from page 448 of Pietrek's "Windows 95 System
991 * Progrmaming Secrets". Parameters from experimentation on real Win98.
995 static DWORD VxDCall_VWin32( DWORD service, CONTEXT86 *context )
997 switch ( LOWORD(service) )
999 case 0x0000: /* GetVersion */
1001 DWORD vers = GetVersion();
1002 return (LOBYTE(vers) << 8) | HIBYTE(vers);
1004 break;
1006 case 0x0020: /* Get VMCPD Version */
1008 DWORD parm = (DWORD) stack32_pop(context);
1010 FIXME("Get VMCPD Version(%08lx): partial stub!\n", parm);
1012 /* FIXME: This is what Win98 returns, it may
1013 * not be correct in all situations.
1014 * It makes Bleem! happy though.
1017 return 0x0405;
1020 case 0x0029: /* Int31/DPMI dispatch */
1022 DWORD callnum = (DWORD) stack32_pop(context);
1023 DWORD parm = (DWORD) stack32_pop(context);
1025 TRACE("Int31/DPMI dispatch(%08lx)\n", callnum);
1027 AX_reg(context) = callnum;
1028 CX_reg(context) = parm;
1029 INT_Int31Handler(context);
1031 return LOWORD(context->Eax);
1033 break;
1035 case 0x002a: /* Int41 dispatch - parm = int41 service number */
1037 DWORD callnum = (DWORD) stack32_pop(context);
1039 return callnum; /* FIXME: should really call INT_Int41Handler() */
1041 break;
1043 default:
1044 FIXME("Unknown VWin32 service %08lx\n", service);
1045 break;
1048 return 0xffffffff;
1053 /***********************************************************************
1054 * DeviceIo_VWin32
1057 static void DIOCRegs_2_CONTEXT( DIOC_REGISTERS *pIn, CONTEXT86 *pCxt )
1059 memset( pCxt, 0, sizeof(*pCxt) );
1060 /* Note: segment registers == 0 means that CTX_SEG_OFF_TO_LIN
1061 will interpret 32-bit register contents as linear pointers */
1063 pCxt->ContextFlags=CONTEXT86_INTEGER|CONTEXT86_CONTROL;
1064 pCxt->Eax = pIn->reg_EAX;
1065 pCxt->Ebx = pIn->reg_EBX;
1066 pCxt->Ecx = pIn->reg_ECX;
1067 pCxt->Edx = pIn->reg_EDX;
1068 pCxt->Esi = pIn->reg_ESI;
1069 pCxt->Edi = pIn->reg_EDI;
1071 /* FIXME: Only partial CONTEXT86_CONTROL */
1072 pCxt->EFlags = pIn->reg_Flags;
1075 static void CONTEXT_2_DIOCRegs( CONTEXT86 *pCxt, DIOC_REGISTERS *pOut )
1077 memset( pOut, 0, sizeof(DIOC_REGISTERS) );
1079 pOut->reg_EAX = pCxt->Eax;
1080 pOut->reg_EBX = pCxt->Ebx;
1081 pOut->reg_ECX = pCxt->Ecx;
1082 pOut->reg_EDX = pCxt->Edx;
1083 pOut->reg_ESI = pCxt->Esi;
1084 pOut->reg_EDI = pCxt->Edi;
1086 /* FIXME: Only partial CONTEXT86_CONTROL */
1087 pOut->reg_Flags = pCxt->EFlags;
1091 static BOOL DeviceIo_VWin32(DWORD dwIoControlCode,
1092 LPVOID lpvInBuffer, DWORD cbInBuffer,
1093 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1094 LPDWORD lpcbBytesReturned,
1095 LPOVERLAPPED lpOverlapped)
1097 BOOL retv = TRUE;
1099 switch (dwIoControlCode)
1101 case VWIN32_DIOC_DOS_IOCTL:
1102 case VWIN32_DIOC_DOS_INT13:
1103 case VWIN32_DIOC_DOS_INT25:
1104 case VWIN32_DIOC_DOS_INT26:
1105 case VWIN32_DIOC_DOS_DRIVEINFO:
1107 CONTEXT86 cxt;
1108 DIOC_REGISTERS *pIn = (DIOC_REGISTERS *)lpvInBuffer;
1109 DIOC_REGISTERS *pOut = (DIOC_REGISTERS *)lpvOutBuffer;
1111 TRACE( "Control '%s': "
1112 "eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
1113 "edx=0x%08lx, esi=0x%08lx, edi=0x%08lx ",
1114 (dwIoControlCode == VWIN32_DIOC_DOS_IOCTL)? "VWIN32_DIOC_DOS_IOCTL" :
1115 (dwIoControlCode == VWIN32_DIOC_DOS_INT13)? "VWIN32_DIOC_DOS_INT13" :
1116 (dwIoControlCode == VWIN32_DIOC_DOS_INT25)? "VWIN32_DIOC_DOS_INT25" :
1117 (dwIoControlCode == VWIN32_DIOC_DOS_INT26)? "VWIN32_DIOC_DOS_INT26" :
1118 (dwIoControlCode == VWIN32_DIOC_DOS_DRIVEINFO)? "VWIN32_DIOC_DOS_DRIVEINFO" : "???",
1119 pIn->reg_EAX, pIn->reg_EBX, pIn->reg_ECX,
1120 pIn->reg_EDX, pIn->reg_ESI, pIn->reg_EDI );
1122 DIOCRegs_2_CONTEXT( pIn, &cxt );
1124 switch (dwIoControlCode)
1126 case VWIN32_DIOC_DOS_IOCTL: DOS3Call( &cxt ); break; /* Call int 21h */
1127 case VWIN32_DIOC_DOS_INT13: INT_Int13Handler( &cxt ); break;
1128 case VWIN32_DIOC_DOS_INT25: INT_Int25Handler( &cxt ); break;
1129 case VWIN32_DIOC_DOS_INT26: INT_Int26Handler( &cxt ); break;
1130 case VWIN32_DIOC_DOS_DRIVEINFO: DOS3Call( &cxt ); break; /* Call int 21h 730x */
1133 CONTEXT_2_DIOCRegs( &cxt, pOut );
1135 break;
1137 case VWIN32_DIOC_SIMCTRLC:
1138 FIXME( "Control VWIN32_DIOC_SIMCTRLC not implemented\n");
1139 retv = FALSE;
1140 break;
1142 default:
1143 FIXME( "Unknown Control %ld\n", dwIoControlCode);
1144 retv = FALSE;
1145 break;
1148 return retv;
1151 /* this is the main multimedia device loader */
1152 static BOOL DeviceIo_MMDEVLDR(DWORD dwIoControlCode,
1153 LPVOID lpvInBuffer, DWORD cbInBuffer,
1154 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1155 LPDWORD lpcbBytesReturned,
1156 LPOVERLAPPED lpOverlapped)
1158 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
1159 dwIoControlCode,
1160 lpvInBuffer,cbInBuffer,
1161 lpvOutBuffer,cbOutBuffer,
1162 lpcbBytesReturned,
1163 lpOverlapped
1165 switch (dwIoControlCode) {
1166 case 5:
1167 /* Hmm. */
1168 *(DWORD*)lpvOutBuffer=0;
1169 *lpcbBytesReturned=4;
1170 return TRUE;
1172 return FALSE;
1174 /* this is used by some Origin games */
1175 static BOOL DeviceIo_MONODEBG(DWORD dwIoControlCode,
1176 LPVOID lpvInBuffer, DWORD cbInBuffer,
1177 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1178 LPDWORD lpcbBytesReturned,
1179 LPOVERLAPPED lpOverlapped)
1181 switch (dwIoControlCode) {
1182 case 1: /* version */
1183 *(LPDWORD)lpvOutBuffer = 0x20004; /* WC SecretOps */
1184 break;
1185 case 9: /* debug output */
1186 ERR("MONODEBG: %s\n",debugstr_a(lpvInBuffer));
1187 break;
1188 default:
1189 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
1190 dwIoControlCode,
1191 lpvInBuffer,cbInBuffer,
1192 lpvOutBuffer,cbOutBuffer,
1193 lpcbBytesReturned,
1194 lpOverlapped
1196 break;
1198 return TRUE;
1200 /* pccard */
1201 static BOOL DeviceIo_PCCARD (DWORD dwIoControlCode,
1202 LPVOID lpvInBuffer, DWORD cbInBuffer,
1203 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1204 LPDWORD lpcbBytesReturned,
1205 LPOVERLAPPED lpOverlapped)
1207 switch (dwIoControlCode) {
1208 case 0x0000: /* PCCARD_Get_Version */
1209 case 0x0001: /* PCCARD_Card_Services */
1210 default:
1211 FIXME( "(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
1212 dwIoControlCode,
1213 lpvInBuffer,cbInBuffer,
1214 lpvOutBuffer,cbOutBuffer,
1215 lpcbBytesReturned,
1216 lpOverlapped
1218 break;
1220 return FALSE;
1223 /***********************************************************************
1224 * OpenVxDHandle
1226 DWORD WINAPI OpenVxDHandle(DWORD pmt)
1228 FIXME( "(0x%08lx) stub!\n", pmt);
1229 return 0;
1232 static BOOL DeviceIo_HASP(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
1233 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1234 LPDWORD lpcbBytesReturned,
1235 LPOVERLAPPED lpOverlapped)
1237 BOOL retv = TRUE;
1238 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
1239 dwIoControlCode,
1240 lpvInBuffer,cbInBuffer,
1241 lpvOutBuffer,cbOutBuffer,
1242 lpcbBytesReturned,
1243 lpOverlapped);
1245 return retv;