Direct3D header update.
[wine.git] / win32 / device.c
blob4b659793f3523871fc98082ce53aba1af7501f0c
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 or win31 !\n", filename);
333 SetLastError( ERROR_FILE_NOT_FOUND );
334 return 0;
337 static const struct VxDInfo *DEVICE_GetInfo( HANDLE handle )
339 const struct VxDInfo *info = NULL;
340 SERVER_START_REQ( get_file_info )
342 req->handle = handle;
343 if (!SERVER_CALL() &&
344 (req->type == FILE_TYPE_UNKNOWN) &&
345 (req->attr & 0x10000))
347 for (info = VxDList; info->name; info++)
348 if (info->id == LOWORD(req->attr)) break;
351 SERVER_END_REQ;
352 return info;
355 /****************************************************************************
356 * DeviceIoControl (KERNEL32.188)
357 * This is one of those big ugly nasty procedure which can do
358 * a million and one things when it comes to devices. It can also be
359 * used for VxD communication.
361 * A return value of FALSE indicates that something has gone wrong which
362 * GetLastError can decypher.
364 BOOL WINAPI DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode,
365 LPVOID lpvInBuffer, DWORD cbInBuffer,
366 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
367 LPDWORD lpcbBytesReturned,
368 LPOVERLAPPED lpOverlapped)
370 const struct VxDInfo *info;
372 TRACE( "(%d,%ld,%p,%ld,%p,%ld,%p,%p)\n",
373 hDevice,dwIoControlCode,lpvInBuffer,cbInBuffer,
374 lpvOutBuffer,cbOutBuffer,lpcbBytesReturned,lpOverlapped );
376 if (!(info = DEVICE_GetInfo( hDevice )))
378 SetLastError( ERROR_INVALID_PARAMETER );
379 return FALSE;
382 /* Check if this is a user defined control code for a VxD */
383 if( HIWORD( dwIoControlCode ) == 0 )
385 if ( info->deviceio )
387 return info->deviceio( dwIoControlCode,
388 lpvInBuffer, cbInBuffer,
389 lpvOutBuffer, cbOutBuffer,
390 lpcbBytesReturned, lpOverlapped );
392 else
394 /* FIXME: Set appropriate error */
395 FIXME( "Unimplemented control %ld for VxD device %s\n",
396 dwIoControlCode, info->name ? info->name : "???" );
399 else
401 switch( dwIoControlCode )
403 case FSCTL_DELETE_REPARSE_POINT:
404 case FSCTL_DISMOUNT_VOLUME:
405 case FSCTL_GET_COMPRESSION:
406 case FSCTL_GET_REPARSE_POINT:
407 case FSCTL_LOCK_VOLUME:
408 case FSCTL_QUERY_ALLOCATED_RANGES:
409 case FSCTL_SET_COMPRESSION:
410 case FSCTL_SET_REPARSE_POINT:
411 case FSCTL_SET_SPARSE:
412 case FSCTL_SET_ZERO_DATA:
413 case FSCTL_UNLOCK_VOLUME:
414 case IOCTL_DISK_CHECK_VERIFY:
415 case IOCTL_DISK_EJECT_MEDIA:
416 case IOCTL_DISK_FORMAT_TRACKS:
417 case IOCTL_DISK_GET_DRIVE_GEOMETRY:
418 case IOCTL_DISK_GET_DRIVE_LAYOUT:
419 case IOCTL_DISK_GET_MEDIA_TYPES:
420 case IOCTL_DISK_GET_PARTITION_INFO:
421 case IOCTL_DISK_LOAD_MEDIA:
422 case IOCTL_DISK_MEDIA_REMOVAL:
423 case IOCTL_DISK_PERFORMANCE:
424 case IOCTL_DISK_REASSIGN_BLOCKS:
425 case IOCTL_DISK_SET_DRIVE_LAYOUT:
426 case IOCTL_DISK_SET_PARTITION_INFO:
427 case IOCTL_DISK_VERIFY:
428 case IOCTL_SERIAL_LSRMST_INSERT:
429 case IOCTL_STORAGE_CHECK_VERIFY:
430 case IOCTL_STORAGE_EJECT_MEDIA:
431 case IOCTL_STORAGE_GET_MEDIA_TYPES:
432 case IOCTL_STORAGE_LOAD_MEDIA:
433 case IOCTL_STORAGE_MEDIA_REMOVAL:
434 FIXME( "unimplemented dwIoControlCode=%08lx\n", dwIoControlCode);
435 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
436 return FALSE;
437 break;
438 default:
439 FIXME( "ignored dwIoControlCode=%08lx\n",dwIoControlCode);
440 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
441 return FALSE;
442 break;
445 return FALSE;
448 /***********************************************************************
449 * DeviceIo_VTDAPI
451 static BOOL DeviceIo_VTDAPI(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
452 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
453 LPDWORD lpcbBytesReturned,
454 LPOVERLAPPED lpOverlapped)
456 BOOL retv = TRUE;
458 switch (dwIoControlCode)
460 case 5:
461 if (lpvOutBuffer && (cbOutBuffer>=4))
462 *(DWORD*)lpvOutBuffer = GetTickCount();
464 if (lpcbBytesReturned)
465 *lpcbBytesReturned = 4;
467 break;
469 default:
470 FIXME( "Control %ld not implemented\n", dwIoControlCode);
471 retv = FALSE;
472 break;
475 return retv;
478 /***********************************************************************
479 * VxDCall0 (KERNEL32.1)
480 * VxDCall1 (KERNEL32.2)
481 * VxDCall2 (KERNEL32.3)
482 * VxDCall3 (KERNEL32.4)
483 * VxDCall4 (KERNEL32.5)
484 * VxDCall5 (KERNEL32.6)
485 * VxDCall6 (KERNEL32.7)
486 * VxDCall7 (KERNEL32.8)
487 * VxDCall8 (KERNEL32.9)
489 void VxDCall( DWORD service, CONTEXT86 *context )
491 DWORD ret = 0xffffffff; /* FIXME */
492 int i;
494 TRACE( "(%08lx, ...)\n", service);
496 for (i = 0; VxDList[i].name; i++)
497 if (VxDList[i].id == HIWORD(service))
498 break;
500 if (!VxDList[i].name)
501 FIXME( "Unknown VxD (%08lx)\n", service);
502 else if (!VxDList[i].vxdcall)
503 FIXME( "Unimplemented VxD (%08lx)\n", service);
504 else
505 ret = VxDList[i].vxdcall( service, context );
507 context->Eax = ret;
511 /***********************************************************************
512 * VxDCall_VMM
514 static DWORD VxDCall_VMM( DWORD service, CONTEXT86 *context )
516 switch ( LOWORD(service) )
518 case 0x0011: /* RegOpenKey */
520 HKEY hkey = (HKEY) stack32_pop( context );
521 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
522 LPHKEY retkey = (LPHKEY)stack32_pop( context );
523 return RegOpenKeyA( hkey, lpszSubKey, retkey );
526 case 0x0012: /* RegCreateKey */
528 HKEY hkey = (HKEY) stack32_pop( context );
529 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
530 LPHKEY retkey = (LPHKEY)stack32_pop( context );
531 return RegCreateKeyA( hkey, lpszSubKey, retkey );
534 case 0x0013: /* RegCloseKey */
536 HKEY hkey = (HKEY)stack32_pop( context );
537 return RegCloseKey( hkey );
540 case 0x0014: /* RegDeleteKey */
542 HKEY hkey = (HKEY) stack32_pop( context );
543 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
544 return RegDeleteKeyA( hkey, lpszSubKey );
547 case 0x0015: /* RegSetValue */
549 HKEY hkey = (HKEY) stack32_pop( context );
550 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
551 DWORD dwType = (DWORD) stack32_pop( context );
552 LPCSTR lpszData = (LPCSTR)stack32_pop( context );
553 DWORD cbData = (DWORD) stack32_pop( context );
554 return RegSetValueA( hkey, lpszSubKey, dwType, lpszData, cbData );
557 case 0x0016: /* RegDeleteValue */
559 HKEY hkey = (HKEY) stack32_pop( context );
560 LPSTR lpszValue = (LPSTR)stack32_pop( context );
561 return RegDeleteValueA( hkey, lpszValue );
564 case 0x0017: /* RegQueryValue */
566 HKEY hkey = (HKEY) stack32_pop( context );
567 LPSTR lpszSubKey = (LPSTR) stack32_pop( context );
568 LPSTR lpszData = (LPSTR) stack32_pop( context );
569 LPDWORD lpcbData = (LPDWORD)stack32_pop( context );
570 return RegQueryValueA( hkey, lpszSubKey, lpszData, lpcbData );
573 case 0x0018: /* RegEnumKey */
575 HKEY hkey = (HKEY) stack32_pop( context );
576 DWORD iSubkey = (DWORD)stack32_pop( context );
577 LPSTR lpszName = (LPSTR)stack32_pop( context );
578 DWORD lpcchName = (DWORD)stack32_pop( context );
579 return RegEnumKeyA( hkey, iSubkey, lpszName, lpcchName );
582 case 0x0019: /* RegEnumValue */
584 HKEY hkey = (HKEY) stack32_pop( context );
585 DWORD iValue = (DWORD) stack32_pop( context );
586 LPSTR lpszValue = (LPSTR) stack32_pop( context );
587 LPDWORD lpcchValue = (LPDWORD)stack32_pop( context );
588 LPDWORD lpReserved = (LPDWORD)stack32_pop( context );
589 LPDWORD lpdwType = (LPDWORD)stack32_pop( context );
590 LPBYTE lpbData = (LPBYTE) stack32_pop( context );
591 LPDWORD lpcbData = (LPDWORD)stack32_pop( context );
592 return RegEnumValueA( hkey, iValue, lpszValue, lpcchValue,
593 lpReserved, lpdwType, lpbData, lpcbData );
596 case 0x001A: /* RegQueryValueEx */
598 HKEY hkey = (HKEY) stack32_pop( context );
599 LPSTR lpszValue = (LPSTR) stack32_pop( context );
600 LPDWORD lpReserved = (LPDWORD)stack32_pop( context );
601 LPDWORD lpdwType = (LPDWORD)stack32_pop( context );
602 LPBYTE lpbData = (LPBYTE) stack32_pop( context );
603 LPDWORD lpcbData = (LPDWORD)stack32_pop( context );
604 return RegQueryValueExA( hkey, lpszValue, lpReserved,
605 lpdwType, lpbData, lpcbData );
608 case 0x001B: /* RegSetValueEx */
610 HKEY hkey = (HKEY) stack32_pop( context );
611 LPSTR lpszValue = (LPSTR) stack32_pop( context );
612 DWORD dwReserved = (DWORD) stack32_pop( context );
613 DWORD dwType = (DWORD) stack32_pop( context );
614 LPBYTE lpbData = (LPBYTE)stack32_pop( context );
615 DWORD cbData = (DWORD) stack32_pop( context );
616 return RegSetValueExA( hkey, lpszValue, dwReserved,
617 dwType, lpbData, cbData );
620 case 0x001C: /* RegFlushKey */
622 HKEY hkey = (HKEY)stack32_pop( context );
623 return RegFlushKey( hkey );
626 case 0x001D: /* RegQueryInfoKey */
628 /* NOTE: This VxDCall takes only a subset of the parameters that the
629 corresponding Win32 API call does. The implementation in Win95
630 ADVAPI32 sets all output parameters not mentioned here to zero. */
632 HKEY hkey = (HKEY) stack32_pop( context );
633 LPDWORD lpcSubKeys = (LPDWORD)stack32_pop( context );
634 LPDWORD lpcchMaxSubKey = (LPDWORD)stack32_pop( context );
635 LPDWORD lpcValues = (LPDWORD)stack32_pop( context );
636 LPDWORD lpcchMaxValueName = (LPDWORD)stack32_pop( context );
637 LPDWORD lpcchMaxValueData = (LPDWORD)stack32_pop( context );
638 return RegQueryInfoKeyA( hkey, NULL, NULL, NULL, lpcSubKeys, lpcchMaxSubKey,
639 NULL, lpcValues, lpcchMaxValueName, lpcchMaxValueData,
640 NULL, NULL );
643 case 0x0021: /* RegLoadKey */
645 HKEY hkey = (HKEY) stack32_pop( context );
646 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
647 LPCSTR lpszFile = (LPCSTR)stack32_pop( context );
648 return RegLoadKeyA( hkey, lpszSubKey, lpszFile );
651 case 0x0022: /* RegUnLoadKey */
653 HKEY hkey = (HKEY) stack32_pop( context );
654 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
655 return RegUnLoadKeyA( hkey, lpszSubKey );
658 case 0x0023: /* RegSaveKey */
660 HKEY hkey = (HKEY) stack32_pop( context );
661 LPCSTR lpszFile = (LPCSTR)stack32_pop( context );
662 LPSECURITY_ATTRIBUTES sa = (LPSECURITY_ATTRIBUTES)stack32_pop( context );
663 return RegSaveKeyA( hkey, lpszFile, sa );
666 #if 0 /* Functions are not yet implemented in misc/registry.c */
667 case 0x0024: /* RegRemapPreDefKey */
668 case 0x0026: /* RegQueryMultipleValues */
669 #endif
671 case 0x0027: /* RegReplaceKey */
673 HKEY hkey = (HKEY) stack32_pop( context );
674 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
675 LPCSTR lpszNewFile= (LPCSTR)stack32_pop( context );
676 LPCSTR lpszOldFile= (LPCSTR)stack32_pop( context );
677 return RegReplaceKeyA( hkey, lpszSubKey, lpszNewFile, lpszOldFile );
679 case 0x0000: /* PageReserve */
681 LPVOID address;
682 LPVOID ret;
683 DWORD psize = getpagesize();
684 ULONG page = (ULONG) stack32_pop( context );
685 ULONG npages = (ULONG) stack32_pop( context );
686 ULONG flags = (ULONG) stack32_pop( context );
688 TRACE("PageReserve: page: %08lx, npages: %08lx, flags: %08lx partial stub!\n",
689 page, npages, flags );
691 if ( page == PR_SYSTEM ) {
692 ERR("Can't reserve ring 1 memory\n");
693 return -1;
695 /* FIXME: This has to be handled separately, when we have separate
696 address-spaces */
697 if ( page == PR_PRIVATE || page == PR_SHARED ) page = 0;
698 /* FIXME: Handle flags in some way */
699 address = (LPVOID )(page * psize);
700 ret = VirtualAlloc ( address, ( npages * psize ), MEM_RESERVE, 0 );
701 TRACE("PageReserve: returning: %08lx\n", (DWORD )ret );
702 if ( ret == NULL )
703 return -1;
704 else
705 return (DWORD )ret;
708 case 0x0001: /* PageCommit */
710 LPVOID address;
711 LPVOID ret;
712 DWORD virt_perm;
713 DWORD psize = getpagesize();
714 ULONG page = (ULONG) stack32_pop( context );
715 ULONG npages = (ULONG) stack32_pop( context );
716 ULONG hpd = (ULONG) stack32_pop( context );
717 ULONG pagerdata = (ULONG) stack32_pop( context );
718 ULONG flags = (ULONG) stack32_pop( context );
720 TRACE("PageCommit: page: %08lx, npages: %08lx, hpd: %08lx pagerdata: "
721 "%08lx, flags: %08lx partial stub\n",
722 page, npages, hpd, pagerdata, flags );
724 if ( flags & PC_USER )
725 if ( flags & PC_WRITEABLE )
726 virt_perm = PAGE_EXECUTE_READWRITE;
727 else
728 virt_perm = PAGE_EXECUTE_READ;
729 else
730 virt_perm = PAGE_NOACCESS;
732 address = (LPVOID )(page * psize);
733 ret = VirtualAlloc ( address, ( npages * psize ), MEM_COMMIT, virt_perm );
734 TRACE("PageCommit: Returning: %08lx\n", (DWORD )ret );
735 return (DWORD )ret;
738 case 0x0002: /* PageDecommit */
740 LPVOID address;
741 BOOL ret;
742 DWORD psize = getpagesize();
743 ULONG page = (ULONG) stack32_pop( context );
744 ULONG npages = (ULONG) stack32_pop( context );
745 ULONG flags = (ULONG) stack32_pop( context );
747 TRACE("PageDecommit: page: %08lx, npages: %08lx, flags: %08lx partial stub\n",
748 page, npages, flags );
749 address = (LPVOID )( page * psize );
750 ret = VirtualFree ( address, ( npages * psize ), MEM_DECOMMIT );
751 TRACE("PageDecommit: Returning: %s\n", ret ? "TRUE" : "FALSE" );
752 return ret;
754 case 0x000d: /* PageModifyPermissions */
756 DWORD pg_old_perm;
757 DWORD pg_new_perm;
758 DWORD virt_old_perm;
759 DWORD virt_new_perm;
760 MEMORY_BASIC_INFORMATION mbi;
761 LPVOID address;
762 DWORD psize = getpagesize();
763 ULONG page = stack32_pop ( context );
764 ULONG npages = stack32_pop ( context );
765 ULONG permand = stack32_pop ( context );
766 ULONG permor = stack32_pop ( context );
768 TRACE("PageModifyPermissions %08lx %08lx %08lx %08lx partial stub\n",
769 page, npages, permand, permor );
770 address = (LPVOID )( page * psize );
772 VirtualQuery ( address, &mbi, sizeof ( MEMORY_BASIC_INFORMATION ));
773 virt_old_perm = mbi.Protect;
775 switch ( virt_old_perm & mbi.Protect ) {
776 case PAGE_READONLY:
777 case PAGE_EXECUTE:
778 case PAGE_EXECUTE_READ:
779 pg_old_perm = PC_USER;
780 break;
781 case PAGE_READWRITE:
782 case PAGE_WRITECOPY:
783 case PAGE_EXECUTE_READWRITE:
784 case PAGE_EXECUTE_WRITECOPY:
785 pg_old_perm = PC_USER | PC_WRITEABLE;
786 break;
787 case PAGE_NOACCESS:
788 default:
789 pg_old_perm = 0;
790 break;
792 pg_new_perm = pg_old_perm;
793 pg_new_perm &= permand & ~PC_STATIC;
794 pg_new_perm |= permor & ~PC_STATIC;
796 virt_new_perm = ( virt_old_perm ) & ~0xff;
797 if ( pg_new_perm & PC_USER )
799 if ( pg_new_perm & PC_WRITEABLE )
800 virt_new_perm |= PAGE_EXECUTE_READWRITE;
801 else
802 virt_new_perm |= PAGE_EXECUTE_READ;
805 if ( ! VirtualProtect ( address, ( npages * psize ), virt_new_perm, &virt_old_perm ) ) {
806 ERR("Can't change page permissions for %08lx\n", (DWORD )address );
807 return 0xffffffff;
809 TRACE("Returning: %08lx\n", pg_old_perm );
810 return pg_old_perm;
812 case 0x000a: /* PageFree */
814 BOOL ret;
815 LPVOID hmem = (LPVOID) stack32_pop( context );
816 DWORD flags = (DWORD ) stack32_pop( context );
818 TRACE("PageFree: hmem: %08lx, flags: %08lx partial stub\n",
819 (DWORD )hmem, flags );
821 ret = VirtualFree ( hmem, 0, MEM_RELEASE );
822 context->Eax = ret;
823 TRACE("Returning: %d\n", ret );
825 return 0;
827 case 0x001e: /* GetDemandPageInfo */
829 DWORD dinfo = (DWORD)stack32_pop( context );
830 DWORD flags = (DWORD)stack32_pop( context );
832 /* GetDemandPageInfo is supposed to fill out the struct at
833 * "dinfo" with various low-level memory management information.
834 * Apps are certainly not supposed to call this, although it's
835 * demoed and documented by Pietrek on pages 441-443 of "Windows
836 * 95 System Programming Secrets" if any program needs a real
837 * implementation of this.
840 FIXME("GetDemandPageInfo(%08lx %08lx): stub!\n", dinfo, flags);
842 return 0;
844 default:
845 if (LOWORD(service) < N_VMM_SERVICE)
846 FIXME( "Unimplemented service %s (%08lx)\n",
847 VMM_Service_Name[LOWORD(service)], service);
848 else
849 FIXME( "Unknown service %08lx\n", service);
850 break;
853 return 0xffffffff; /* FIXME */
856 /***********************************************************************
857 * DeviceIo_IFSMgr
858 * NOTES
859 * The ioctls is used by 'MSNET32.DLL'.
861 * I have been unable to uncover any documentation about the ioctls so
862 * the implementation of the cases IFS_IOCTL_21 and IFS_IOCTL_2F are
863 * based on a resonable guesses on information found in the Windows 95 DDK.
868 * IFSMgr DeviceIO service
871 #define IFS_IOCTL_21 100
872 #define IFS_IOCTL_2F 101
873 #define IFS_IOCTL_GET_RES 102
874 #define IFS_IOCTL_GET_NETPRO_NAME_A 103
876 struct win32apireq {
877 unsigned long ar_proid;
878 unsigned long ar_eax;
879 unsigned long ar_ebx;
880 unsigned long ar_ecx;
881 unsigned long ar_edx;
882 unsigned long ar_esi;
883 unsigned long ar_edi;
884 unsigned long ar_ebp;
885 unsigned short ar_error;
886 unsigned short ar_pad;
889 static void win32apieq_2_CONTEXT(struct win32apireq *pIn,CONTEXT86 *pCxt)
891 memset(pCxt,0,sizeof(*pCxt));
893 pCxt->ContextFlags=CONTEXT86_INTEGER|CONTEXT86_CONTROL;
894 pCxt->Eax = pIn->ar_eax;
895 pCxt->Ebx = pIn->ar_ebx;
896 pCxt->Ecx = pIn->ar_ecx;
897 pCxt->Edx = pIn->ar_edx;
898 pCxt->Esi = pIn->ar_esi;
899 pCxt->Edi = pIn->ar_edi;
901 /* FIXME: Only partial CONTEXT86_CONTROL */
902 pCxt->Ebp = pIn->ar_ebp;
904 /* FIXME: pIn->ar_proid ignored */
905 /* FIXME: pIn->ar_error ignored */
906 /* FIXME: pIn->ar_pad ignored */
909 static void CONTEXT_2_win32apieq(CONTEXT86 *pCxt,struct win32apireq *pOut)
911 memset(pOut,0,sizeof(struct win32apireq));
913 pOut->ar_eax = pCxt->Eax;
914 pOut->ar_ebx = pCxt->Ebx;
915 pOut->ar_ecx = pCxt->Ecx;
916 pOut->ar_edx = pCxt->Edx;
917 pOut->ar_esi = pCxt->Esi;
918 pOut->ar_edi = pCxt->Edi;
920 /* FIXME: Only partial CONTEXT86_CONTROL */
921 pOut->ar_ebp = pCxt->Ebp;
923 /* FIXME: pOut->ar_proid ignored */
924 /* FIXME: pOut->ar_error ignored */
925 /* FIXME: pOut->ar_pad ignored */
928 static BOOL DeviceIo_IFSMgr(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
929 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
930 LPDWORD lpcbBytesReturned,
931 LPOVERLAPPED lpOverlapped)
933 BOOL retv = TRUE;
934 TRACE("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
935 dwIoControlCode,
936 lpvInBuffer,cbInBuffer,
937 lpvOutBuffer,cbOutBuffer,
938 lpcbBytesReturned,
939 lpOverlapped);
941 switch (dwIoControlCode)
943 case IFS_IOCTL_21:
944 case IFS_IOCTL_2F:{
945 CONTEXT86 cxt;
946 struct win32apireq *pIn=(struct win32apireq *) lpvInBuffer;
947 struct win32apireq *pOut=(struct win32apireq *) lpvOutBuffer;
949 TRACE(
950 "Control '%s': "
951 "proid=0x%08lx, eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
952 "edx=0x%08lx, esi=0x%08lx, edi=0x%08lx, ebp=0x%08lx, "
953 "error=0x%04x, pad=0x%04x\n",
954 (dwIoControlCode==IFS_IOCTL_21)?"IFS_IOCTL_21":"IFS_IOCTL_2F",
955 pIn->ar_proid, pIn->ar_eax, pIn->ar_ebx, pIn->ar_ecx,
956 pIn->ar_edx, pIn->ar_esi, pIn->ar_edi, pIn->ar_ebp,
957 pIn->ar_error, pIn->ar_pad
960 win32apieq_2_CONTEXT(pIn,&cxt);
962 if(dwIoControlCode==IFS_IOCTL_21)
964 DOS3Call(&cxt); /* Call int 21h */
965 } else {
966 INT_Int2fHandler(&cxt); /* Call int 2Fh */
969 CONTEXT_2_win32apieq(&cxt,pOut);
971 retv = TRUE;
972 } break;
973 case IFS_IOCTL_GET_RES:{
974 FIXME( "Control 'IFS_IOCTL_GET_RES' not implemented\n");
975 retv = FALSE;
976 } break;
977 case IFS_IOCTL_GET_NETPRO_NAME_A:{
978 FIXME( "Control 'IFS_IOCTL_GET_NETPRO_NAME_A' not implemented\n");
979 retv = FALSE;
980 } break;
981 default:
982 FIXME( "Control %ld not implemented\n", dwIoControlCode);
983 retv = FALSE;
986 return retv;
989 /********************************************************************************
990 * VxDCall_VWin32
992 * Service numbers taken from page 448 of Pietrek's "Windows 95 System
993 * Progrmaming Secrets". Parameters from experimentation on real Win98.
997 static DWORD VxDCall_VWin32( DWORD service, CONTEXT86 *context )
999 switch ( LOWORD(service) )
1001 case 0x0000: /* GetVersion */
1003 DWORD vers = GetVersion();
1004 return (LOBYTE(vers) << 8) | HIBYTE(vers);
1006 break;
1008 case 0x0020: /* Get VMCPD Version */
1010 DWORD parm = (DWORD) stack32_pop(context);
1012 FIXME("Get VMCPD Version(%08lx): partial stub!\n", parm);
1014 /* FIXME: This is what Win98 returns, it may
1015 * not be correct in all situations.
1016 * It makes Bleem! happy though.
1019 return 0x0405;
1022 case 0x0029: /* Int31/DPMI dispatch */
1024 DWORD callnum = (DWORD) stack32_pop(context);
1025 DWORD parm = (DWORD) stack32_pop(context);
1027 TRACE("Int31/DPMI dispatch(%08lx)\n", callnum);
1029 AX_reg(context) = callnum;
1030 CX_reg(context) = parm;
1031 INT_Int31Handler(context);
1033 return LOWORD(context->Eax);
1035 break;
1037 case 0x002a: /* Int41 dispatch - parm = int41 service number */
1039 DWORD callnum = (DWORD) stack32_pop(context);
1041 return callnum; /* FIXME: should really call INT_Int41Handler() */
1043 break;
1045 default:
1046 FIXME("Unknown VWin32 service %08lx\n", service);
1047 break;
1050 return 0xffffffff;
1055 /***********************************************************************
1056 * DeviceIo_VWin32
1059 static void DIOCRegs_2_CONTEXT( DIOC_REGISTERS *pIn, CONTEXT86 *pCxt )
1061 memset( pCxt, 0, sizeof(*pCxt) );
1062 /* Note: segment registers == 0 means that CTX_SEG_OFF_TO_LIN
1063 will interpret 32-bit register contents as linear pointers */
1065 pCxt->ContextFlags=CONTEXT86_INTEGER|CONTEXT86_CONTROL;
1066 pCxt->Eax = pIn->reg_EAX;
1067 pCxt->Ebx = pIn->reg_EBX;
1068 pCxt->Ecx = pIn->reg_ECX;
1069 pCxt->Edx = pIn->reg_EDX;
1070 pCxt->Esi = pIn->reg_ESI;
1071 pCxt->Edi = pIn->reg_EDI;
1073 /* FIXME: Only partial CONTEXT86_CONTROL */
1074 pCxt->EFlags = pIn->reg_Flags;
1077 static void CONTEXT_2_DIOCRegs( CONTEXT86 *pCxt, DIOC_REGISTERS *pOut )
1079 memset( pOut, 0, sizeof(DIOC_REGISTERS) );
1081 pOut->reg_EAX = pCxt->Eax;
1082 pOut->reg_EBX = pCxt->Ebx;
1083 pOut->reg_ECX = pCxt->Ecx;
1084 pOut->reg_EDX = pCxt->Edx;
1085 pOut->reg_ESI = pCxt->Esi;
1086 pOut->reg_EDI = pCxt->Edi;
1088 /* FIXME: Only partial CONTEXT86_CONTROL */
1089 pOut->reg_Flags = pCxt->EFlags;
1093 static BOOL DeviceIo_VWin32(DWORD dwIoControlCode,
1094 LPVOID lpvInBuffer, DWORD cbInBuffer,
1095 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1096 LPDWORD lpcbBytesReturned,
1097 LPOVERLAPPED lpOverlapped)
1099 BOOL retv = TRUE;
1101 switch (dwIoControlCode)
1103 case VWIN32_DIOC_DOS_IOCTL:
1104 case VWIN32_DIOC_DOS_INT13:
1105 case VWIN32_DIOC_DOS_INT25:
1106 case VWIN32_DIOC_DOS_INT26:
1107 case VWIN32_DIOC_DOS_DRIVEINFO:
1109 CONTEXT86 cxt;
1110 DIOC_REGISTERS *pIn = (DIOC_REGISTERS *)lpvInBuffer;
1111 DIOC_REGISTERS *pOut = (DIOC_REGISTERS *)lpvOutBuffer;
1113 TRACE( "Control '%s': "
1114 "eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
1115 "edx=0x%08lx, esi=0x%08lx, edi=0x%08lx ",
1116 (dwIoControlCode == VWIN32_DIOC_DOS_IOCTL)? "VWIN32_DIOC_DOS_IOCTL" :
1117 (dwIoControlCode == VWIN32_DIOC_DOS_INT13)? "VWIN32_DIOC_DOS_INT13" :
1118 (dwIoControlCode == VWIN32_DIOC_DOS_INT25)? "VWIN32_DIOC_DOS_INT25" :
1119 (dwIoControlCode == VWIN32_DIOC_DOS_INT26)? "VWIN32_DIOC_DOS_INT26" :
1120 (dwIoControlCode == VWIN32_DIOC_DOS_DRIVEINFO)? "VWIN32_DIOC_DOS_DRIVEINFO" : "???",
1121 pIn->reg_EAX, pIn->reg_EBX, pIn->reg_ECX,
1122 pIn->reg_EDX, pIn->reg_ESI, pIn->reg_EDI );
1124 DIOCRegs_2_CONTEXT( pIn, &cxt );
1126 switch (dwIoControlCode)
1128 case VWIN32_DIOC_DOS_IOCTL: DOS3Call( &cxt ); break; /* Call int 21h */
1129 case VWIN32_DIOC_DOS_INT13: INT_Int13Handler( &cxt ); break;
1130 case VWIN32_DIOC_DOS_INT25: INT_Int25Handler( &cxt ); break;
1131 case VWIN32_DIOC_DOS_INT26: INT_Int26Handler( &cxt ); break;
1132 case VWIN32_DIOC_DOS_DRIVEINFO: DOS3Call( &cxt ); break; /* Call int 21h 730x */
1135 CONTEXT_2_DIOCRegs( &cxt, pOut );
1137 break;
1139 case VWIN32_DIOC_SIMCTRLC:
1140 FIXME( "Control VWIN32_DIOC_SIMCTRLC not implemented\n");
1141 retv = FALSE;
1142 break;
1144 default:
1145 FIXME( "Unknown Control %ld\n", dwIoControlCode);
1146 retv = FALSE;
1147 break;
1150 return retv;
1153 /* this is the main multimedia device loader */
1154 static BOOL DeviceIo_MMDEVLDR(DWORD dwIoControlCode,
1155 LPVOID lpvInBuffer, DWORD cbInBuffer,
1156 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1157 LPDWORD lpcbBytesReturned,
1158 LPOVERLAPPED lpOverlapped)
1160 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
1161 dwIoControlCode,
1162 lpvInBuffer,cbInBuffer,
1163 lpvOutBuffer,cbOutBuffer,
1164 lpcbBytesReturned,
1165 lpOverlapped
1167 switch (dwIoControlCode) {
1168 case 5:
1169 /* Hmm. */
1170 *(DWORD*)lpvOutBuffer=0;
1171 *lpcbBytesReturned=4;
1172 return TRUE;
1174 return FALSE;
1176 /* this is used by some Origin games */
1177 static BOOL DeviceIo_MONODEBG(DWORD dwIoControlCode,
1178 LPVOID lpvInBuffer, DWORD cbInBuffer,
1179 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1180 LPDWORD lpcbBytesReturned,
1181 LPOVERLAPPED lpOverlapped)
1183 switch (dwIoControlCode) {
1184 case 1: /* version */
1185 *(LPDWORD)lpvOutBuffer = 0x20004; /* WC SecretOps */
1186 break;
1187 case 9: /* debug output */
1188 ERR("MONODEBG: %s\n",debugstr_a(lpvInBuffer));
1189 break;
1190 default:
1191 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
1192 dwIoControlCode,
1193 lpvInBuffer,cbInBuffer,
1194 lpvOutBuffer,cbOutBuffer,
1195 lpcbBytesReturned,
1196 lpOverlapped
1198 break;
1200 return TRUE;
1202 /* pccard */
1203 static BOOL DeviceIo_PCCARD (DWORD dwIoControlCode,
1204 LPVOID lpvInBuffer, DWORD cbInBuffer,
1205 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1206 LPDWORD lpcbBytesReturned,
1207 LPOVERLAPPED lpOverlapped)
1209 switch (dwIoControlCode) {
1210 case 0x0000: /* PCCARD_Get_Version */
1211 case 0x0001: /* PCCARD_Card_Services */
1212 default:
1213 FIXME( "(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
1214 dwIoControlCode,
1215 lpvInBuffer,cbInBuffer,
1216 lpvOutBuffer,cbOutBuffer,
1217 lpcbBytesReturned,
1218 lpOverlapped
1220 break;
1222 return FALSE;
1225 /***********************************************************************
1226 * OpenVxDHandle (KERNEL32.@)
1228 DWORD WINAPI OpenVxDHandle(DWORD pmt)
1230 FIXME( "(0x%08lx) stub!\n", pmt);
1231 return 0;
1234 static BOOL DeviceIo_HASP(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
1235 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1236 LPDWORD lpcbBytesReturned,
1237 LPOVERLAPPED lpOverlapped)
1239 BOOL retv = TRUE;
1240 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
1241 dwIoControlCode,
1242 lpvInBuffer,cbInBuffer,
1243 lpvOutBuffer,cbOutBuffer,
1244 lpcbBytesReturned,
1245 lpOverlapped);
1247 return retv;