blob: 662f3ab41865e68af3131979cf15ef22f3d3a04c [file] [log] [blame]
Alexandre Julliardf90efa91998-06-14 15:24:15 +00001/*
2 * Win32 device functions
3 *
4 * Copyright 1998 Marcus Meissner
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00005 * Copyright 1998 Ulrich Weigand
Alexandre Julliarda0d77311998-09-13 16:32:00 +00006 * Copyright 1998 Patrik Stridvall
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00007 *
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00008 * 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.
12 *
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.
17 *
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
Alexandre Julliardf90efa91998-06-14 15:24:15 +000021 */
22
François Gouget14259412001-11-06 20:57:11 +000023#include "config.h"
Francois Gouget386cf6e2001-10-14 16:25:47 +000024#include "wine/port.h"
Patrik Stridvall96336321999-10-24 22:13:47 +000025
Alexandre Julliardf90efa91998-06-14 15:24:15 +000026#include <stdlib.h>
27#include <unistd.h>
28#include <sys/types.h>
Alexandre Julliardf90efa91998-06-14 15:24:15 +000029#include <string.h>
Alexandre Julliardfd456271999-05-13 14:42:14 +000030#include <stdarg.h>
Alexandre Julliardf90efa91998-06-14 15:24:15 +000031#include <time.h>
Francois Gouget386cf6e2001-10-14 16:25:47 +000032
Jeremy Whited3e22d92000-02-10 19:03:02 +000033#include "windef.h"
Alexandre Julliardf90efa91998-06-14 15:24:15 +000034#include "winbase.h"
Marcus Meissner04c3e1d1999-02-19 10:37:02 +000035#include "winreg.h"
Alexandre Julliardf90efa91998-06-14 15:24:15 +000036#include "winerror.h"
37#include "file.h"
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +000038#include "winioctl.h"
Alexandre Julliarda0d77311998-09-13 16:32:00 +000039#include "winnt.h"
40#include "msdos.h"
41#include "miscemu.h"
Ulrich Weigandf0052471999-11-12 01:39:18 +000042#include "stackframe.h"
Alexandre Julliard37e95032001-07-19 00:39:09 +000043#include "wine/server.h"
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000044#include "wine/debug.h"
Alexandre Julliardf90efa91998-06-14 15:24:15 +000045
Mike McCormack88dadae2002-04-21 22:09:47 +000046/* int 13 stuff */
Alexandre Julliard60443072002-05-17 03:31:08 +000047#ifdef HAVE_SYS_IOCTL_H
48# include <sys/ioctl.h>
49#endif
Mike McCormack88dadae2002-04-21 22:09:47 +000050#include <fcntl.h>
51#ifdef linux
52# include <linux/fd.h>
53#endif
54#include "drive.h"
55
56WINE_DEFAULT_DEBUG_CHANNEL(file);
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000057
Alexandre Julliardf90efa91998-06-14 15:24:15 +000058
Vincent Béron9a624912002-05-31 23:06:46 +000059static BOOL DeviceIo_VTDAPI(DWORD dwIoControlCode,
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000060 LPVOID lpvInBuffer, DWORD cbInBuffer,
61 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
62 LPDWORD lpcbBytesReturned,
63 LPOVERLAPPED lpOverlapped);
Vincent Béron9a624912002-05-31 23:06:46 +000064static BOOL DeviceIo_MONODEBG(DWORD dwIoControlCode,
Marcus Meissner6a41a4b1998-11-07 12:32:59 +000065 LPVOID lpvInBuffer, DWORD cbInBuffer,
66 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
67 LPDWORD lpcbBytesReturned,
68 LPOVERLAPPED lpOverlapped);
Vincent Béron9a624912002-05-31 23:06:46 +000069static BOOL DeviceIo_MMDEVLDR(DWORD dwIoControlCode,
Marcus Meissner91aaca81999-04-19 16:21:29 +000070 LPVOID lpvInBuffer, DWORD cbInBuffer,
71 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
72 LPDWORD lpcbBytesReturned,
73 LPOVERLAPPED lpOverlapped);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000074
Ulrich Weigandeb94c7d1999-11-13 23:54:04 +000075static DWORD VxDCall_VMM( DWORD service, CONTEXT86 *context );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000076
Vincent Béron9a624912002-05-31 23:06:46 +000077static BOOL DeviceIo_IFSMgr(DWORD dwIoControlCode,
Alexandre Julliarda0d77311998-09-13 16:32:00 +000078 LPVOID lpvInBuffer, DWORD cbInBuffer,
79 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
80 LPDWORD lpcbBytesReturned,
81 LPOVERLAPPED lpOverlapped);
82
Vincent Béron9a624912002-05-31 23:06:46 +000083static BOOL DeviceIo_VCD(DWORD dwIoControlCode,
Andreas Mohr3eb35692001-05-24 18:40:26 +000084 LPVOID lpvInBuffer, DWORD cbInBuffer,
85 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
86 LPDWORD lpcbBytesReturned,
87 LPOVERLAPPED lpOverlapped);
88
Ulrich Weigandeb94c7d1999-11-13 23:54:04 +000089static DWORD VxDCall_VWin32( DWORD service, CONTEXT86 *context );
Ian Schmidt796c0f11999-11-12 03:28:26 +000090
Vincent Béron9a624912002-05-31 23:06:46 +000091static BOOL DeviceIo_VWin32(DWORD dwIoControlCode,
Ulrich Weigand12980621998-11-25 10:20:03 +000092 LPVOID lpvInBuffer, DWORD cbInBuffer,
93 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
94 LPDWORD lpcbBytesReturned,
95 LPOVERLAPPED lpOverlapped);
96
Vincent Béron9a624912002-05-31 23:06:46 +000097static BOOL DeviceIo_PCCARD (DWORD dwIoControlCode,
Juergen Schmiedf08b8191999-05-22 10:33:50 +000098 LPVOID lpvInBuffer, DWORD cbInBuffer,
99 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
100 LPDWORD lpcbBytesReturned,
101 LPOVERLAPPED lpOverlapped);
Kees Schoenmakers0a5d9ef2000-11-29 17:43:09 +0000102
Vincent Béron9a624912002-05-31 23:06:46 +0000103static BOOL DeviceIo_HASP (DWORD dwIoControlCode,
Kees Schoenmakers0a5d9ef2000-11-29 17:43:09 +0000104 LPVOID lpvInBuffer, DWORD cbInBuffer,
105 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
106 LPDWORD lpcbBytesReturned,
107 LPOVERLAPPED lpOverlapped);
108/*
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000109 * VxD names are taken from the Win95 DDK
110 */
111
112struct VxDInfo
113{
114 LPCSTR name;
115 WORD id;
Ulrich Weigandeb94c7d1999-11-13 23:54:04 +0000116 DWORD (*vxdcall)(DWORD, CONTEXT86 *);
Vincent Béron9a624912002-05-31 23:06:46 +0000117 BOOL (*deviceio)(DWORD, LPVOID, DWORD,
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000118 LPVOID, DWORD, LPDWORD, LPOVERLAPPED);
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000119};
120
Vincent Béron9a624912002-05-31 23:06:46 +0000121static const struct VxDInfo VxDList[] =
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000122{
123 /* Standard VxD IDs */
124 { "VMM", 0x0001, VxDCall_VMM, NULL },
125 { "DEBUG", 0x0002, NULL, NULL },
126 { "VPICD", 0x0003, NULL, NULL },
127 { "VDMAD", 0x0004, NULL, NULL },
128 { "VTD", 0x0005, NULL, NULL },
129 { "V86MMGR", 0x0006, NULL, NULL },
130 { "PAGESWAP", 0x0007, NULL, NULL },
131 { "PARITY", 0x0008, NULL, NULL },
132 { "REBOOT", 0x0009, NULL, NULL },
133 { "VDD", 0x000A, NULL, NULL },
134 { "VSD", 0x000B, NULL, NULL },
135 { "VMD", 0x000C, NULL, NULL },
136 { "VKD", 0x000D, NULL, NULL },
Andreas Mohr3eb35692001-05-24 18:40:26 +0000137 { "VCD", 0x000E, NULL, DeviceIo_VCD },
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000138 { "VPD", 0x000F, NULL, NULL },
139 { "BLOCKDEV", 0x0010, NULL, NULL },
140 { "VMCPD", 0x0011, NULL, NULL },
141 { "EBIOS", 0x0012, NULL, NULL },
142 { "BIOSXLAT", 0x0013, NULL, NULL },
143 { "VNETBIOS", 0x0014, NULL, NULL },
144 { "DOSMGR", 0x0015, NULL, NULL },
145 { "WINLOAD", 0x0016, NULL, NULL },
146 { "SHELL", 0x0017, NULL, NULL },
147 { "VMPOLL", 0x0018, NULL, NULL },
148 { "VPROD", 0x0019, NULL, NULL },
149 { "DOSNET", 0x001A, NULL, NULL },
150 { "VFD", 0x001B, NULL, NULL },
151 { "VDD2", 0x001C, NULL, NULL },
152 { "WINDEBUG", 0x001D, NULL, NULL },
153 { "TSRLOAD", 0x001E, NULL, NULL },
154 { "BIOSHOOK", 0x001F, NULL, NULL },
155 { "INT13", 0x0020, NULL, NULL },
156 { "PAGEFILE", 0x0021, NULL, NULL },
157 { "SCSI", 0x0022, NULL, NULL },
158 { "MCA_POS", 0x0023, NULL, NULL },
159 { "SCSIFD", 0x0024, NULL, NULL },
160 { "VPEND", 0x0025, NULL, NULL },
161 { "VPOWERD", 0x0026, NULL, NULL },
162 { "VXDLDR", 0x0027, NULL, NULL },
163 { "NDIS", 0x0028, NULL, NULL },
164 { "BIOS_EXT", 0x0029, NULL, NULL },
Ian Schmidt796c0f11999-11-12 03:28:26 +0000165 { "VWIN32", 0x002A, VxDCall_VWin32, DeviceIo_VWin32 },
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000166 { "VCOMM", 0x002B, NULL, NULL },
167 { "SPOOLER", 0x002C, NULL, NULL },
168 { "WIN32S", 0x002D, NULL, NULL },
169 { "DEBUGCMD", 0x002E, NULL, NULL },
170
171 { "VNB", 0x0031, NULL, NULL },
172 { "SERVER", 0x0032, NULL, NULL },
173 { "CONFIGMG", 0x0033, NULL, NULL },
174 { "DWCFGMG", 0x0034, NULL, NULL },
175 { "SCSIPORT", 0x0035, NULL, NULL },
176 { "VFBACKUP", 0x0036, NULL, NULL },
177 { "ENABLE", 0x0037, NULL, NULL },
178 { "VCOND", 0x0038, NULL, NULL },
179
180 { "EFAX", 0x003A, NULL, NULL },
181 { "DSVXD", 0x003B, NULL, NULL },
182 { "ISAPNP", 0x003C, NULL, NULL },
183 { "BIOS", 0x003D, NULL, NULL },
184 { "WINSOCK", 0x003E, NULL, NULL },
185 { "WSOCK", 0x003E, NULL, NULL },
186 { "WSIPX", 0x003F, NULL, NULL },
Patrik Stridvall686db711998-10-11 15:55:55 +0000187 { "IFSMgr", 0x0040, NULL, DeviceIo_IFSMgr },
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000188 { "VCDFSD", 0x0041, NULL, NULL },
189 { "MRCI2", 0x0042, NULL, NULL },
190 { "PCI", 0x0043, NULL, NULL },
191 { "PELOADER", 0x0044, NULL, NULL },
192 { "EISA", 0x0045, NULL, NULL },
193 { "DRAGCLI", 0x0046, NULL, NULL },
194 { "DRAGSRV", 0x0047, NULL, NULL },
195 { "PERF", 0x0048, NULL, NULL },
196 { "AWREDIR", 0x0049, NULL, NULL },
197
198 /* Far East support */
199 { "ETEN", 0x0060, NULL, NULL },
200 { "CHBIOS", 0x0061, NULL, NULL },
201 { "VMSGD", 0x0062, NULL, NULL },
202 { "VPPID", 0x0063, NULL, NULL },
203 { "VIME", 0x0064, NULL, NULL },
204 { "VHBIOSD", 0x0065, NULL, NULL },
205
206 /* Multimedia OEM IDs */
207 { "VTDAPI", 0x0442, NULL, DeviceIo_VTDAPI },
Marcus Meissner91aaca81999-04-19 16:21:29 +0000208 { "MMDEVLDR", 0x044A, NULL, DeviceIo_MMDEVLDR },
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000209
210 /* Network Device IDs */
211 { "VNetSup", 0x0480, NULL, NULL },
212 { "VRedir", 0x0481, NULL, NULL },
213 { "VBrowse", 0x0482, NULL, NULL },
214 { "VSHARE", 0x0483, NULL, NULL },
215 { "IFSMgr", 0x0484, NULL, NULL },
216 { "MEMPROBE", 0x0485, NULL, NULL },
217 { "VFAT", 0x0486, NULL, NULL },
218 { "NWLINK", 0x0487, NULL, NULL },
219 { "VNWLINK", 0x0487, NULL, NULL },
220 { "NWSUP", 0x0487, NULL, NULL },
221 { "VTDI", 0x0488, NULL, NULL },
222 { "VIP", 0x0489, NULL, NULL },
223 { "VTCP", 0x048A, NULL, NULL },
224 { "VCache", 0x048B, NULL, NULL },
225 { "VUDP", 0x048C, NULL, NULL },
226 { "VAsync", 0x048D, NULL, NULL },
227 { "NWREDIR", 0x048E, NULL, NULL },
228 { "STAT80", 0x048F, NULL, NULL },
229 { "SCSIPORT", 0x0490, NULL, NULL },
230 { "FILESEC", 0x0491, NULL, NULL },
231 { "NWSERVER", 0x0492, NULL, NULL },
232 { "SECPROV", 0x0493, NULL, NULL },
233 { "NSCL", 0x0494, NULL, NULL },
234 { "WSTCP", 0x0495, NULL, NULL },
235 { "NDIS2SUP", 0x0496, NULL, NULL },
236 { "MSODISUP", 0x0497, NULL, NULL },
237 { "Splitter", 0x0498, NULL, NULL },
238 { "PPP", 0x0499, NULL, NULL },
239 { "VDHCP", 0x049A, NULL, NULL },
240 { "VNBT", 0x049B, NULL, NULL },
241 { "LOGGER", 0x049D, NULL, NULL },
242 { "EFILTER", 0x049E, NULL, NULL },
243 { "FFILTER", 0x049F, NULL, NULL },
244 { "TFILTER", 0x04A0, NULL, NULL },
245 { "AFILTER", 0x04A1, NULL, NULL },
246 { "IRLAMP", 0x04A2, NULL, NULL },
247
Juergen Schmiedf08b8191999-05-22 10:33:50 +0000248 { "PCCARD", 0x097C, NULL, DeviceIo_PCCARD },
Kees Schoenmakers0a5d9ef2000-11-29 17:43:09 +0000249 { "HASP95", 0x3721, NULL, DeviceIo_HASP },
Juergen Schmiedf08b8191999-05-22 10:33:50 +0000250
Marcus Meissner91aaca81999-04-19 16:21:29 +0000251 /* WINE additions, ids unknown */
Marcus Meissner6a41a4b1998-11-07 12:32:59 +0000252 { "MONODEBG.VXD", 0x4242, NULL, DeviceIo_MONODEBG },
253
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000254 { NULL, 0, NULL, NULL }
255};
256
257/*
258 * VMM VxDCall service names are (mostly) taken from Stan Mitchell's
259 * "Inside the Windows 95 File System"
260 */
261
262#define N_VMM_SERVICE 41
263
264LPCSTR VMM_Service_Name[N_VMM_SERVICE] =
Vincent Béron9a624912002-05-31 23:06:46 +0000265{
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000266 "PageReserve", /* 0x0000 */
267 "PageCommit", /* 0x0001 */
268 "PageDecommit", /* 0x0002 */
269 "PagerRegister", /* 0x0003 */
270 "PagerQuery", /* 0x0004 */
271 "HeapAllocate", /* 0x0005 */
272 "ContextCreate", /* 0x0006 */
273 "ContextDestroy", /* 0x0007 */
274 "PageAttach", /* 0x0008 */
275 "PageFlush", /* 0x0009 */
276 "PageFree", /* 0x000A */
277 "ContextSwitch", /* 0x000B */
278 "HeapReAllocate", /* 0x000C */
Peter Gantenbe728f11999-11-25 23:09:17 +0000279 "PageModifyPermissions", /* 0x000D */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000280 "PageQuery", /* 0x000E */
281 "GetCurrentContext", /* 0x000F */
282 "HeapFree", /* 0x0010 */
283 "RegOpenKey", /* 0x0011 */
284 "RegCreateKey", /* 0x0012 */
285 "RegCloseKey", /* 0x0013 */
286 "RegDeleteKey", /* 0x0014 */
287 "RegSetValue", /* 0x0015 */
288 "RegDeleteValue", /* 0x0016 */
289 "RegQueryValue", /* 0x0017 */
290 "RegEnumKey", /* 0x0018 */
291 "RegEnumValue", /* 0x0019 */
292 "RegQueryValueEx", /* 0x001A */
293 "RegSetValueEx", /* 0x001B */
294 "RegFlushKey", /* 0x001C */
295 "RegQueryInfoKey", /* 0x001D */
296 "GetDemandPageInfo", /* 0x001E */
297 "BlockOnID", /* 0x001F */
298 "SignalID", /* 0x0020 */
299 "RegLoadKey", /* 0x0021 */
300 "RegUnLoadKey", /* 0x0022 */
301 "RegSaveKey", /* 0x0023 */
302 "RegRemapPreDefKey", /* 0x0024 */
303 "PageChangePager", /* 0x0025 */
304 "RegQueryMultipleValues", /* 0x0026 */
305 "RegReplaceKey", /* 0x0027 */
306 "<KERNEL32.101>" /* 0x0028 -- What does this do??? */
307};
308
Peter Gantenbe728f11999-11-25 23:09:17 +0000309/* PageReserve arena values */
310#define PR_PRIVATE 0x80000400 /* anywhere in private arena */
311#define PR_SHARED 0x80060000 /* anywhere in shared arena */
312#define PR_SYSTEM 0x80080000 /* anywhere in system arena */
313
314/* PageReserve flags */
315#define PR_FIXED 0x00000008 /* don't move during PageReAllocate */
316#define PR_4MEG 0x00000001 /* allocate on 4mb boundary */
317#define PR_STATIC 0x00000010 /* see PageReserve documentation */
318
319/* PageCommit default pager handle values */
320#define PD_ZEROINIT 0x00000001 /* swappable zero-initialized pages */
321#define PD_NOINIT 0x00000002 /* swappable uninitialized pages */
322#define PD_FIXEDZERO 0x00000003 /* fixed zero-initialized pages */
323#define PD_FIXED 0x00000004 /* fixed uninitialized pages */
324
325/* PageCommit flags */
326#define PC_FIXED 0x00000008 /* pages are permanently locked */
Andreas Mohr3eb35692001-05-24 18:40:26 +0000327#define PC_LOCKED 0x00000080 /* pages are made present and locked */
Peter Gantenbe728f11999-11-25 23:09:17 +0000328#define PC_LOCKEDIFDP 0x00000100 /* pages are locked if swap via DOS */
329#define PC_WRITEABLE 0x00020000 /* make the pages writeable */
330#define PC_USER 0x00040000 /* make the pages ring 3 accessible */
331#define PC_INCR 0x40000000 /* increment "pagerdata" each page */
332#define PC_PRESENT 0x80000000 /* make pages initially present */
333#define PC_STATIC 0x20000000 /* allow commit in PR_STATIC object */
334#define PC_DIRTY 0x08000000 /* make pages initially dirty */
335#define PC_CACHEDIS 0x00100000 /* Allocate uncached pages - new for WDM */
336#define PC_CACHEWT 0x00080000 /* Allocate write through cache pages - new for WDM */
337#define PC_PAGEFLUSH 0x00008000 /* Touch device mapped pages on alloc - new for WDM */
338
339/* PageCommitContig additional flags */
340#define PCC_ZEROINIT 0x00000001 /* zero-initialize new pages */
341#define PCC_NOLIN 0x10000000 /* don't map to any linear address */
342
343
344
Eric Pouech5cc61052002-01-13 01:44:00 +0000345HANDLE DEVICE_Open( LPCSTR filename, DWORD access, LPSECURITY_ATTRIBUTES sa )
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000346{
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000347 const struct VxDInfo *info;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000348
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000349 for (info = VxDList; info->name; info++)
Alexandre Julliardcb10fda2000-08-06 02:41:16 +0000350 if (!strncasecmp( info->name, filename, strlen(info->name) ))
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000351 return FILE_CreateDevice( info->id | 0x10000, access, sa );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000352
Alexandre Julliard8c08ceb2002-05-23 19:35:18 +0000353 FIXME( "Unknown/unsupported VxD %s. Try setting Windows version to 'nt40' or 'win31'.\n",
354 filename);
Ulrich Weigand526d8e91999-09-13 15:12:45 +0000355 SetLastError( ERROR_FILE_NOT_FOUND );
Alexandre Julliard8081e5a2001-01-05 04:08:07 +0000356 return 0;
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000357}
358
Eric Pouech5cc61052002-01-13 01:44:00 +0000359static DWORD DEVICE_GetClientID( HANDLE handle )
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000360{
Eric Pouech5cc61052002-01-13 01:44:00 +0000361 DWORD ret = 0;
Alexandre Julliard67a74992001-02-27 02:09:16 +0000362 SERVER_START_REQ( get_file_info )
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000363 {
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000364 req->handle = handle;
Eric Pouech5cc61052002-01-13 01:44:00 +0000365 if (!wine_server_call( req ) && (reply->type == FILE_TYPE_UNKNOWN))
366 ret = reply->attr;
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000367 }
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000368 SERVER_END_REQ;
Eric Pouech5cc61052002-01-13 01:44:00 +0000369 return ret;
370}
371
372static const struct VxDInfo *DEVICE_GetInfo( DWORD clientID )
373{
374 const struct VxDInfo *info = NULL;
Vincent Béron9a624912002-05-31 23:06:46 +0000375
Eric Pouech5cc61052002-01-13 01:44:00 +0000376 if (clientID & 0x10000)
377 {
378 for (info = VxDList; info->name; info++)
379 if (info->id == LOWORD(clientID)) break;
380 }
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000381 return info;
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000382}
383
384/****************************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000385 * DeviceIoControl (KERNEL32.@)
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000386 * This is one of those big ugly nasty procedure which can do
387 * a million and one things when it comes to devices. It can also be
388 * used for VxD communication.
389 *
390 * A return value of FALSE indicates that something has gone wrong which
Andreas Mohr3eb35692001-05-24 18:40:26 +0000391 * GetLastError can decipher.
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000392 */
Vincent Béron9a624912002-05-31 23:06:46 +0000393BOOL WINAPI DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode,
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000394 LPVOID lpvInBuffer, DWORD cbInBuffer,
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000395 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
396 LPDWORD lpcbBytesReturned,
397 LPOVERLAPPED lpOverlapped)
398{
Eric Pouech5cc61052002-01-13 01:44:00 +0000399 DWORD clientID;
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000400
Alexandre Julliardfd456271999-05-13 14:42:14 +0000401 TRACE( "(%d,%ld,%p,%ld,%p,%ld,%p,%p)\n",
402 hDevice,dwIoControlCode,lpvInBuffer,cbInBuffer,
403 lpvOutBuffer,cbOutBuffer,lpcbBytesReturned,lpOverlapped );
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000404
Eric Pouech5cc61052002-01-13 01:44:00 +0000405 if (!(clientID = DEVICE_GetClientID( hDevice )))
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000406 {
407 SetLastError( ERROR_INVALID_PARAMETER );
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000408 return FALSE;
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000409 }
410
411 /* Check if this is a user defined control code for a VxD */
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000412 if( HIWORD( dwIoControlCode ) == 0 )
413 {
Eric Pouech5cc61052002-01-13 01:44:00 +0000414 const struct VxDInfo *info;
415 if (!(info = DEVICE_GetInfo( clientID )))
416 {
417 FIXME( "No device found for id %lx\n", clientID);
418 }
419 else if ( info->deviceio )
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000420 {
Vincent Béron9a624912002-05-31 23:06:46 +0000421 return info->deviceio( dwIoControlCode,
422 lpvInBuffer, cbInBuffer,
423 lpvOutBuffer, cbOutBuffer,
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000424 lpcbBytesReturned, lpOverlapped );
425 }
426 else
427 {
Vincent Béron9a624912002-05-31 23:06:46 +0000428 FIXME( "Unimplemented control %ld for VxD device %s\n",
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000429 dwIoControlCode, info->name ? info->name : "???" );
Andreas Mohr3eb35692001-05-24 18:40:26 +0000430 /* FIXME: this is for invalid calls on W98SE,
431 * but maybe we should use ERROR_CALL_NOT_IMPLEMENTED
432 * instead ? */
433 SetLastError( ERROR_INVALID_FUNCTION );
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000434 }
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000435 }
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000436 else
437 {
Eric Pouech5cc61052002-01-13 01:44:00 +0000438 char str[3];
439
440 strcpy(str, "A:");
441 str[0] += LOBYTE(clientID);
442 if (GetDriveTypeA(str) == DRIVE_CDROM)
443 return CDROM_DeviceIoControl(clientID, hDevice, dwIoControlCode, lpvInBuffer, cbInBuffer,
444 lpvOutBuffer, cbOutBuffer, lpcbBytesReturned,
445 lpOverlapped);
446 else switch( dwIoControlCode )
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000447 {
448 case FSCTL_DELETE_REPARSE_POINT:
449 case FSCTL_DISMOUNT_VOLUME:
450 case FSCTL_GET_COMPRESSION:
451 case FSCTL_GET_REPARSE_POINT:
452 case FSCTL_LOCK_VOLUME:
453 case FSCTL_QUERY_ALLOCATED_RANGES:
454 case FSCTL_SET_COMPRESSION:
455 case FSCTL_SET_REPARSE_POINT:
456 case FSCTL_SET_SPARSE:
457 case FSCTL_SET_ZERO_DATA:
458 case FSCTL_UNLOCK_VOLUME:
459 case IOCTL_DISK_CHECK_VERIFY:
460 case IOCTL_DISK_EJECT_MEDIA:
461 case IOCTL_DISK_FORMAT_TRACKS:
462 case IOCTL_DISK_GET_DRIVE_GEOMETRY:
463 case IOCTL_DISK_GET_DRIVE_LAYOUT:
464 case IOCTL_DISK_GET_MEDIA_TYPES:
465 case IOCTL_DISK_GET_PARTITION_INFO:
466 case IOCTL_DISK_LOAD_MEDIA:
467 case IOCTL_DISK_MEDIA_REMOVAL:
468 case IOCTL_DISK_PERFORMANCE:
469 case IOCTL_DISK_REASSIGN_BLOCKS:
470 case IOCTL_DISK_SET_DRIVE_LAYOUT:
471 case IOCTL_DISK_SET_PARTITION_INFO:
472 case IOCTL_DISK_VERIFY:
473 case IOCTL_SERIAL_LSRMST_INSERT:
474 case IOCTL_STORAGE_CHECK_VERIFY:
475 case IOCTL_STORAGE_EJECT_MEDIA:
476 case IOCTL_STORAGE_GET_MEDIA_TYPES:
477 case IOCTL_STORAGE_LOAD_MEDIA:
478 case IOCTL_STORAGE_MEDIA_REMOVAL:
Alexandre Julliardfd456271999-05-13 14:42:14 +0000479 FIXME( "unimplemented dwIoControlCode=%08lx\n", dwIoControlCode);
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000480 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
481 return FALSE;
482 break;
483 default:
Alexandre Julliardfd456271999-05-13 14:42:14 +0000484 FIXME( "ignored dwIoControlCode=%08lx\n",dwIoControlCode);
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000485 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
486 return FALSE;
487 break;
488 }
489 }
490 return FALSE;
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000491}
Vincent Béron9a624912002-05-31 23:06:46 +0000492
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000493/***********************************************************************
494 * DeviceIo_VTDAPI
495 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000496static BOOL DeviceIo_VTDAPI(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000497 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
498 LPDWORD lpcbBytesReturned,
499 LPOVERLAPPED lpOverlapped)
500{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000501 BOOL retv = TRUE;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000502
503 switch (dwIoControlCode)
504 {
505 case 5:
506 if (lpvOutBuffer && (cbOutBuffer>=4))
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000507 *(DWORD*)lpvOutBuffer = GetTickCount();
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000508
509 if (lpcbBytesReturned)
510 *lpcbBytesReturned = 4;
511
512 break;
513
514 default:
Alexandre Julliardfd456271999-05-13 14:42:14 +0000515 FIXME( "Control %ld not implemented\n", dwIoControlCode);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000516 retv = FALSE;
517 break;
518 }
519
520 return retv;
521}
522
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000523/***********************************************************************
Patrik Stridvalld0a41772001-02-14 23:11:17 +0000524 * VxDCall0 (KERNEL32.1)
525 * VxDCall1 (KERNEL32.2)
526 * VxDCall2 (KERNEL32.3)
527 * VxDCall3 (KERNEL32.4)
528 * VxDCall4 (KERNEL32.5)
529 * VxDCall5 (KERNEL32.6)
530 * VxDCall6 (KERNEL32.7)
531 * VxDCall7 (KERNEL32.8)
532 * VxDCall8 (KERNEL32.9)
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000533 */
Ulrich Weigandeb94c7d1999-11-13 23:54:04 +0000534void VxDCall( DWORD service, CONTEXT86 *context )
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000535{
Alexandre Julliardfd456271999-05-13 14:42:14 +0000536 DWORD ret = 0xffffffff; /* FIXME */
537 int i;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000538
Alexandre Julliardfd456271999-05-13 14:42:14 +0000539 TRACE( "(%08lx, ...)\n", service);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000540
541 for (i = 0; VxDList[i].name; i++)
542 if (VxDList[i].id == HIWORD(service))
543 break;
544
545 if (!VxDList[i].name)
Alexandre Julliardfd456271999-05-13 14:42:14 +0000546 FIXME( "Unknown VxD (%08lx)\n", service);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000547 else if (!VxDList[i].vxdcall)
Alexandre Julliardfd456271999-05-13 14:42:14 +0000548 FIXME( "Unimplemented VxD (%08lx)\n", service);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000549 else
Ulrich Weigandf0052471999-11-12 01:39:18 +0000550 ret = VxDList[i].vxdcall( service, context );
551
Alexandre Julliardd8fab2e2000-09-25 23:53:07 +0000552 context->Eax = ret;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000553}
554
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000555
556/***********************************************************************
557 * VxDCall_VMM
558 */
Ulrich Weigandeb94c7d1999-11-13 23:54:04 +0000559static DWORD VxDCall_VMM( DWORD service, CONTEXT86 *context )
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000560{
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000561 switch ( LOWORD(service) )
562 {
563 case 0x0011: /* RegOpenKey */
564 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000565 HKEY hkey = (HKEY) stack32_pop( context );
566 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
567 LPHKEY retkey = (LPHKEY)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000568 return RegOpenKeyA( hkey, lpszSubKey, retkey );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000569 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000570
571 case 0x0012: /* RegCreateKey */
572 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000573 HKEY hkey = (HKEY) stack32_pop( context );
574 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
575 LPHKEY retkey = (LPHKEY)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000576 return RegCreateKeyA( hkey, lpszSubKey, retkey );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000577 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000578
579 case 0x0013: /* RegCloseKey */
580 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000581 HKEY hkey = (HKEY)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000582 return RegCloseKey( hkey );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000583 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000584
585 case 0x0014: /* RegDeleteKey */
586 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000587 HKEY hkey = (HKEY) stack32_pop( context );
588 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000589 return RegDeleteKeyA( hkey, lpszSubKey );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000590 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000591
592 case 0x0015: /* RegSetValue */
593 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000594 HKEY hkey = (HKEY) stack32_pop( context );
595 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
596 DWORD dwType = (DWORD) stack32_pop( context );
597 LPCSTR lpszData = (LPCSTR)stack32_pop( context );
598 DWORD cbData = (DWORD) stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000599 return RegSetValueA( hkey, lpszSubKey, dwType, lpszData, cbData );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000600 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000601
602 case 0x0016: /* RegDeleteValue */
603 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000604 HKEY hkey = (HKEY) stack32_pop( context );
605 LPSTR lpszValue = (LPSTR)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000606 return RegDeleteValueA( hkey, lpszValue );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000607 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000608
609 case 0x0017: /* RegQueryValue */
610 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000611 HKEY hkey = (HKEY) stack32_pop( context );
612 LPSTR lpszSubKey = (LPSTR) stack32_pop( context );
613 LPSTR lpszData = (LPSTR) stack32_pop( context );
614 LPDWORD lpcbData = (LPDWORD)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000615 return RegQueryValueA( hkey, lpszSubKey, lpszData, lpcbData );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000616 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000617
618 case 0x0018: /* RegEnumKey */
619 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000620 HKEY hkey = (HKEY) stack32_pop( context );
621 DWORD iSubkey = (DWORD)stack32_pop( context );
622 LPSTR lpszName = (LPSTR)stack32_pop( context );
623 DWORD lpcchName = (DWORD)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000624 return RegEnumKeyA( hkey, iSubkey, lpszName, lpcchName );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000625 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000626
627 case 0x0019: /* RegEnumValue */
628 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000629 HKEY hkey = (HKEY) stack32_pop( context );
630 DWORD iValue = (DWORD) stack32_pop( context );
631 LPSTR lpszValue = (LPSTR) stack32_pop( context );
632 LPDWORD lpcchValue = (LPDWORD)stack32_pop( context );
633 LPDWORD lpReserved = (LPDWORD)stack32_pop( context );
634 LPDWORD lpdwType = (LPDWORD)stack32_pop( context );
635 LPBYTE lpbData = (LPBYTE) stack32_pop( context );
636 LPDWORD lpcbData = (LPDWORD)stack32_pop( context );
Vincent Béron9a624912002-05-31 23:06:46 +0000637 return RegEnumValueA( hkey, iValue, lpszValue, lpcchValue,
Alexandre Julliardfd456271999-05-13 14:42:14 +0000638 lpReserved, lpdwType, lpbData, lpcbData );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000639 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000640
641 case 0x001A: /* RegQueryValueEx */
642 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000643 HKEY hkey = (HKEY) stack32_pop( context );
644 LPSTR lpszValue = (LPSTR) stack32_pop( context );
645 LPDWORD lpReserved = (LPDWORD)stack32_pop( context );
646 LPDWORD lpdwType = (LPDWORD)stack32_pop( context );
647 LPBYTE lpbData = (LPBYTE) stack32_pop( context );
648 LPDWORD lpcbData = (LPDWORD)stack32_pop( context );
Vincent Béron9a624912002-05-31 23:06:46 +0000649 return RegQueryValueExA( hkey, lpszValue, lpReserved,
Alexandre Julliardfd456271999-05-13 14:42:14 +0000650 lpdwType, lpbData, lpcbData );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000651 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000652
653 case 0x001B: /* RegSetValueEx */
654 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000655 HKEY hkey = (HKEY) stack32_pop( context );
656 LPSTR lpszValue = (LPSTR) stack32_pop( context );
657 DWORD dwReserved = (DWORD) stack32_pop( context );
658 DWORD dwType = (DWORD) stack32_pop( context );
659 LPBYTE lpbData = (LPBYTE)stack32_pop( context );
660 DWORD cbData = (DWORD) stack32_pop( context );
Vincent Béron9a624912002-05-31 23:06:46 +0000661 return RegSetValueExA( hkey, lpszValue, dwReserved,
Alexandre Julliardfd456271999-05-13 14:42:14 +0000662 dwType, lpbData, cbData );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000663 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000664
665 case 0x001C: /* RegFlushKey */
666 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000667 HKEY hkey = (HKEY)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000668 return RegFlushKey( hkey );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000669 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000670
671 case 0x001D: /* RegQueryInfoKey */
672 {
673 /* NOTE: This VxDCall takes only a subset of the parameters that the
674 corresponding Win32 API call does. The implementation in Win95
675 ADVAPI32 sets all output parameters not mentioned here to zero. */
676
Ulrich Weigandf0052471999-11-12 01:39:18 +0000677 HKEY hkey = (HKEY) stack32_pop( context );
678 LPDWORD lpcSubKeys = (LPDWORD)stack32_pop( context );
679 LPDWORD lpcchMaxSubKey = (LPDWORD)stack32_pop( context );
680 LPDWORD lpcValues = (LPDWORD)stack32_pop( context );
681 LPDWORD lpcchMaxValueName = (LPDWORD)stack32_pop( context );
682 LPDWORD lpcchMaxValueData = (LPDWORD)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000683 return RegQueryInfoKeyA( hkey, NULL, NULL, NULL, lpcSubKeys, lpcchMaxSubKey,
684 NULL, lpcValues, lpcchMaxValueName, lpcchMaxValueData,
685 NULL, NULL );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000686 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000687
688 case 0x0021: /* RegLoadKey */
689 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000690 HKEY hkey = (HKEY) stack32_pop( context );
691 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
692 LPCSTR lpszFile = (LPCSTR)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000693 return RegLoadKeyA( hkey, lpszSubKey, lpszFile );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000694 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000695
696 case 0x0022: /* RegUnLoadKey */
697 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000698 HKEY hkey = (HKEY) stack32_pop( context );
699 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000700 return RegUnLoadKeyA( hkey, lpszSubKey );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000701 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000702
703 case 0x0023: /* RegSaveKey */
704 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000705 HKEY hkey = (HKEY) stack32_pop( context );
706 LPCSTR lpszFile = (LPCSTR)stack32_pop( context );
707 LPSECURITY_ATTRIBUTES sa = (LPSECURITY_ATTRIBUTES)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000708 return RegSaveKeyA( hkey, lpszFile, sa );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000709 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000710
711#if 0 /* Functions are not yet implemented in misc/registry.c */
712 case 0x0024: /* RegRemapPreDefKey */
713 case 0x0026: /* RegQueryMultipleValues */
714#endif
715
716 case 0x0027: /* RegReplaceKey */
717 {
Ulrich Weigandf0052471999-11-12 01:39:18 +0000718 HKEY hkey = (HKEY) stack32_pop( context );
719 LPCSTR lpszSubKey = (LPCSTR)stack32_pop( context );
720 LPCSTR lpszNewFile= (LPCSTR)stack32_pop( context );
721 LPCSTR lpszOldFile= (LPCSTR)stack32_pop( context );
Alexandre Julliardfd456271999-05-13 14:42:14 +0000722 return RegReplaceKeyA( hkey, lpszSubKey, lpszNewFile, lpszOldFile );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000723 }
Peter Gantenbe728f11999-11-25 23:09:17 +0000724 case 0x0000: /* PageReserve */
725 {
726 LPVOID address;
727 LPVOID ret;
Alexandre Julliard6c8edaa2000-12-13 20:22:47 +0000728 DWORD psize = getpagesize();
Peter Gantenbe728f11999-11-25 23:09:17 +0000729 ULONG page = (ULONG) stack32_pop( context );
730 ULONG npages = (ULONG) stack32_pop( context );
731 ULONG flags = (ULONG) stack32_pop( context );
732
Marcus Meissnerad2b1032000-10-29 18:03:18 +0000733 TRACE("PageReserve: page: %08lx, npages: %08lx, flags: %08lx partial stub!\n",
Peter Gantenbe728f11999-11-25 23:09:17 +0000734 page, npages, flags );
735
736 if ( page == PR_SYSTEM ) {
737 ERR("Can't reserve ring 1 memory\n");
738 return -1;
739 }
Andreas Mohr3eb35692001-05-24 18:40:26 +0000740 /* FIXME: This has to be handled separately for the separate
741 address-spaces we now have */
Peter Gantenbe728f11999-11-25 23:09:17 +0000742 if ( page == PR_PRIVATE || page == PR_SHARED ) page = 0;
743 /* FIXME: Handle flags in some way */
Vincent Béron9a624912002-05-31 23:06:46 +0000744 address = (LPVOID )(page * psize);
Peter Gantenbe728f11999-11-25 23:09:17 +0000745 ret = VirtualAlloc ( address, ( npages * psize ), MEM_RESERVE, 0 );
Marcus Meissnerad2b1032000-10-29 18:03:18 +0000746 TRACE("PageReserve: returning: %08lx\n", (DWORD )ret );
Peter Gantenbe728f11999-11-25 23:09:17 +0000747 if ( ret == NULL )
748 return -1;
749 else
750 return (DWORD )ret;
751 }
752
753 case 0x0001: /* PageCommit */
754 {
755 LPVOID address;
756 LPVOID ret;
757 DWORD virt_perm;
Alexandre Julliard6c8edaa2000-12-13 20:22:47 +0000758 DWORD psize = getpagesize();
Peter Gantenbe728f11999-11-25 23:09:17 +0000759 ULONG page = (ULONG) stack32_pop( context );
760 ULONG npages = (ULONG) stack32_pop( context );
761 ULONG hpd = (ULONG) stack32_pop( context );
762 ULONG pagerdata = (ULONG) stack32_pop( context );
763 ULONG flags = (ULONG) stack32_pop( context );
764
Marcus Meissnerad2b1032000-10-29 18:03:18 +0000765 TRACE("PageCommit: page: %08lx, npages: %08lx, hpd: %08lx pagerdata: "
Peter Gantenbe728f11999-11-25 23:09:17 +0000766 "%08lx, flags: %08lx partial stub\n",
767 page, npages, hpd, pagerdata, flags );
Vincent Béron9a624912002-05-31 23:06:46 +0000768
Peter Gantenbe728f11999-11-25 23:09:17 +0000769 if ( flags & PC_USER )
770 if ( flags & PC_WRITEABLE )
771 virt_perm = PAGE_EXECUTE_READWRITE;
772 else
773 virt_perm = PAGE_EXECUTE_READ;
774 else
775 virt_perm = PAGE_NOACCESS;
776
Vincent Béron9a624912002-05-31 23:06:46 +0000777 address = (LPVOID )(page * psize);
Peter Gantenbe728f11999-11-25 23:09:17 +0000778 ret = VirtualAlloc ( address, ( npages * psize ), MEM_COMMIT, virt_perm );
Marcus Meissnerad2b1032000-10-29 18:03:18 +0000779 TRACE("PageCommit: Returning: %08lx\n", (DWORD )ret );
Peter Gantenbe728f11999-11-25 23:09:17 +0000780 return (DWORD )ret;
781
782 }
783 case 0x0002: /* PageDecommit */
784 {
785 LPVOID address;
786 BOOL ret;
Alexandre Julliard6c8edaa2000-12-13 20:22:47 +0000787 DWORD psize = getpagesize();
Peter Gantenbe728f11999-11-25 23:09:17 +0000788 ULONG page = (ULONG) stack32_pop( context );
789 ULONG npages = (ULONG) stack32_pop( context );
790 ULONG flags = (ULONG) stack32_pop( context );
791
Marcus Meissnerad2b1032000-10-29 18:03:18 +0000792 TRACE("PageDecommit: page: %08lx, npages: %08lx, flags: %08lx partial stub\n",
Peter Gantenbe728f11999-11-25 23:09:17 +0000793 page, npages, flags );
794 address = (LPVOID )( page * psize );
Vincent Béron9a624912002-05-31 23:06:46 +0000795 ret = VirtualFree ( address, ( npages * psize ), MEM_DECOMMIT );
Marcus Meissnerad2b1032000-10-29 18:03:18 +0000796 TRACE("PageDecommit: Returning: %s\n", ret ? "TRUE" : "FALSE" );
Peter Gantenbe728f11999-11-25 23:09:17 +0000797 return ret;
798 }
799 case 0x000d: /* PageModifyPermissions */
Vincent Béron9a624912002-05-31 23:06:46 +0000800 {
Peter Gantenbe728f11999-11-25 23:09:17 +0000801 DWORD pg_old_perm;
802 DWORD pg_new_perm;
803 DWORD virt_old_perm;
804 DWORD virt_new_perm;
805 MEMORY_BASIC_INFORMATION mbi;
806 LPVOID address;
Alexandre Julliard6c8edaa2000-12-13 20:22:47 +0000807 DWORD psize = getpagesize();
Peter Gantenbe728f11999-11-25 23:09:17 +0000808 ULONG page = stack32_pop ( context );
809 ULONG npages = stack32_pop ( context );
810 ULONG permand = stack32_pop ( context );
811 ULONG permor = stack32_pop ( context );
812
Marcus Meissnerad2b1032000-10-29 18:03:18 +0000813 TRACE("PageModifyPermissions %08lx %08lx %08lx %08lx partial stub\n",
Peter Gantenbe728f11999-11-25 23:09:17 +0000814 page, npages, permand, permor );
815 address = (LPVOID )( page * psize );
816
817 VirtualQuery ( address, &mbi, sizeof ( MEMORY_BASIC_INFORMATION ));
818 virt_old_perm = mbi.Protect;
819
820 switch ( virt_old_perm & mbi.Protect ) {
821 case PAGE_READONLY:
822 case PAGE_EXECUTE:
823 case PAGE_EXECUTE_READ:
824 pg_old_perm = PC_USER;
825 break;
826 case PAGE_READWRITE:
827 case PAGE_WRITECOPY:
828 case PAGE_EXECUTE_READWRITE:
829 case PAGE_EXECUTE_WRITECOPY:
830 pg_old_perm = PC_USER | PC_WRITEABLE;
Vincent Béron9a624912002-05-31 23:06:46 +0000831 break;
Peter Gantenbe728f11999-11-25 23:09:17 +0000832 case PAGE_NOACCESS:
833 default:
834 pg_old_perm = 0;
835 break;
Vincent Béron9a624912002-05-31 23:06:46 +0000836 }
Peter Gantenbe728f11999-11-25 23:09:17 +0000837 pg_new_perm = pg_old_perm;
838 pg_new_perm &= permand & ~PC_STATIC;
839 pg_new_perm |= permor & ~PC_STATIC;
840
841 virt_new_perm = ( virt_old_perm ) & ~0xff;
842 if ( pg_new_perm & PC_USER )
Ian Schmidt1cc90ff1999-12-05 23:49:52 +0000843 {
Peter Gantenbe728f11999-11-25 23:09:17 +0000844 if ( pg_new_perm & PC_WRITEABLE )
845 virt_new_perm |= PAGE_EXECUTE_READWRITE;
846 else
847 virt_new_perm |= PAGE_EXECUTE_READ;
Ian Schmidt1cc90ff1999-12-05 23:49:52 +0000848 }
Vincent Béron9a624912002-05-31 23:06:46 +0000849
Peter Gantenbe728f11999-11-25 23:09:17 +0000850 if ( ! VirtualProtect ( address, ( npages * psize ), virt_new_perm, &virt_old_perm ) ) {
851 ERR("Can't change page permissions for %08lx\n", (DWORD )address );
852 return 0xffffffff;
853 }
Marcus Meissnerad2b1032000-10-29 18:03:18 +0000854 TRACE("Returning: %08lx\n", pg_old_perm );
Peter Gantenbe728f11999-11-25 23:09:17 +0000855 return pg_old_perm;
856 }
857 case 0x000a: /* PageFree */
858 {
859 BOOL ret;
860 LPVOID hmem = (LPVOID) stack32_pop( context );
861 DWORD flags = (DWORD ) stack32_pop( context );
Vincent Béron9a624912002-05-31 23:06:46 +0000862
Marcus Meissnerad2b1032000-10-29 18:03:18 +0000863 TRACE("PageFree: hmem: %08lx, flags: %08lx partial stub\n",
Peter Gantenbe728f11999-11-25 23:09:17 +0000864 (DWORD )hmem, flags );
865
866 ret = VirtualFree ( hmem, 0, MEM_RELEASE );
Alexandre Julliardd8fab2e2000-09-25 23:53:07 +0000867 context->Eax = ret;
Marcus Meissnerad2b1032000-10-29 18:03:18 +0000868 TRACE("Returning: %d\n", ret );
Peter Gantenbe728f11999-11-25 23:09:17 +0000869
870 return 0;
871 }
Ian Schmidt1cc90ff1999-12-05 23:49:52 +0000872 case 0x001e: /* GetDemandPageInfo */
873 {
874 DWORD dinfo = (DWORD)stack32_pop( context );
Vincent Béron9a624912002-05-31 23:06:46 +0000875 DWORD flags = (DWORD)stack32_pop( context );
Peter Gantenbe728f11999-11-25 23:09:17 +0000876
Ian Schmidt1cc90ff1999-12-05 23:49:52 +0000877 /* GetDemandPageInfo is supposed to fill out the struct at
878 * "dinfo" with various low-level memory management information.
879 * Apps are certainly not supposed to call this, although it's
880 * demoed and documented by Pietrek on pages 441-443 of "Windows
881 * 95 System Programming Secrets" if any program needs a real
882 * implementation of this.
883 */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000884
Ian Schmidt1cc90ff1999-12-05 23:49:52 +0000885 FIXME("GetDemandPageInfo(%08lx %08lx): stub!\n", dinfo, flags);
886
887 return 0;
888 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000889 default:
890 if (LOWORD(service) < N_VMM_SERVICE)
Alexandre Julliardfd456271999-05-13 14:42:14 +0000891 FIXME( "Unimplemented service %s (%08lx)\n",
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000892 VMM_Service_Name[LOWORD(service)], service);
893 else
Alexandre Julliardfd456271999-05-13 14:42:14 +0000894 FIXME( "Unknown service %08lx\n", service);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000895 break;
896 }
897
Alexandre Julliardfd456271999-05-13 14:42:14 +0000898 return 0xffffffff; /* FIXME */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000899}
900
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000901/***********************************************************************
902 * DeviceIo_IFSMgr
903 * NOTES
Andreas Mohr3eb35692001-05-24 18:40:26 +0000904 * These ioctls are used by 'MSNET32.DLL'.
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000905 *
Vincent Béron9a624912002-05-31 23:06:46 +0000906 * I have been unable to uncover any documentation about the ioctls so
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000907 * the implementation of the cases IFS_IOCTL_21 and IFS_IOCTL_2F are
Andreas Mohr3eb35692001-05-24 18:40:26 +0000908 * based on reasonable guesses on information found in the Windows 95 DDK.
Vincent Béron9a624912002-05-31 23:06:46 +0000909 *
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000910 */
911
Patrik Stridvall686db711998-10-11 15:55:55 +0000912/*
913 * IFSMgr DeviceIO service
914 */
915
916#define IFS_IOCTL_21 100
917#define IFS_IOCTL_2F 101
918#define IFS_IOCTL_GET_RES 102
919#define IFS_IOCTL_GET_NETPRO_NAME_A 103
920
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000921struct win32apireq {
922 unsigned long ar_proid;
Vincent Béron9a624912002-05-31 23:06:46 +0000923 unsigned long ar_eax;
924 unsigned long ar_ebx;
925 unsigned long ar_ecx;
926 unsigned long ar_edx;
927 unsigned long ar_esi;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000928 unsigned long ar_edi;
Vincent Béron9a624912002-05-31 23:06:46 +0000929 unsigned long ar_ebp;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000930 unsigned short ar_error;
931 unsigned short ar_pad;
932};
933
Alexandre Julliard617955d1999-06-26 18:40:24 +0000934static void win32apieq_2_CONTEXT(struct win32apireq *pIn,CONTEXT86 *pCxt)
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000935{
Alexandre Julliard617955d1999-06-26 18:40:24 +0000936 memset(pCxt,0,sizeof(*pCxt));
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000937
Ulrich Weigand0fa6dad1999-07-15 14:32:20 +0000938 pCxt->ContextFlags=CONTEXT86_INTEGER|CONTEXT86_CONTROL;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000939 pCxt->Eax = pIn->ar_eax;
940 pCxt->Ebx = pIn->ar_ebx;
941 pCxt->Ecx = pIn->ar_ecx;
942 pCxt->Edx = pIn->ar_edx;
943 pCxt->Esi = pIn->ar_esi;
944 pCxt->Edi = pIn->ar_edi;
945
Ulrich Weigand0fa6dad1999-07-15 14:32:20 +0000946 /* FIXME: Only partial CONTEXT86_CONTROL */
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000947 pCxt->Ebp = pIn->ar_ebp;
948
949 /* FIXME: pIn->ar_proid ignored */
950 /* FIXME: pIn->ar_error ignored */
951 /* FIXME: pIn->ar_pad ignored */
952}
953
Alexandre Julliard617955d1999-06-26 18:40:24 +0000954static void CONTEXT_2_win32apieq(CONTEXT86 *pCxt,struct win32apireq *pOut)
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000955{
956 memset(pOut,0,sizeof(struct win32apireq));
957
958 pOut->ar_eax = pCxt->Eax;
959 pOut->ar_ebx = pCxt->Ebx;
960 pOut->ar_ecx = pCxt->Ecx;
961 pOut->ar_edx = pCxt->Edx;
962 pOut->ar_esi = pCxt->Esi;
963 pOut->ar_edi = pCxt->Edi;
964
Ulrich Weigand0fa6dad1999-07-15 14:32:20 +0000965 /* FIXME: Only partial CONTEXT86_CONTROL */
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000966 pOut->ar_ebp = pCxt->Ebp;
967
968 /* FIXME: pOut->ar_proid ignored */
969 /* FIXME: pOut->ar_error ignored */
970 /* FIXME: pOut->ar_pad ignored */
971}
972
Alexandre Julliarda3960291999-02-26 11:11:13 +0000973static BOOL DeviceIo_IFSMgr(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000974 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
975 LPDWORD lpcbBytesReturned,
976 LPOVERLAPPED lpOverlapped)
977{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000978 BOOL retv = TRUE;
Alexandre Julliardfd456271999-05-13 14:42:14 +0000979 TRACE("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000980 dwIoControlCode,
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000981 lpvInBuffer,cbInBuffer,
982 lpvOutBuffer,cbOutBuffer,
983 lpcbBytesReturned,
984 lpOverlapped);
985
986 switch (dwIoControlCode)
987 {
988 case IFS_IOCTL_21:
989 case IFS_IOCTL_2F:{
Alexandre Julliard617955d1999-06-26 18:40:24 +0000990 CONTEXT86 cxt;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000991 struct win32apireq *pIn=(struct win32apireq *) lpvInBuffer;
992 struct win32apireq *pOut=(struct win32apireq *) lpvOutBuffer;
993
Alexandre Julliardfd456271999-05-13 14:42:14 +0000994 TRACE(
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000995 "Control '%s': "
996 "proid=0x%08lx, eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
997 "edx=0x%08lx, esi=0x%08lx, edi=0x%08lx, ebp=0x%08lx, "
998 "error=0x%04x, pad=0x%04x\n",
999 (dwIoControlCode==IFS_IOCTL_21)?"IFS_IOCTL_21":"IFS_IOCTL_2F",
1000 pIn->ar_proid, pIn->ar_eax, pIn->ar_ebx, pIn->ar_ecx,
1001 pIn->ar_edx, pIn->ar_esi, pIn->ar_edi, pIn->ar_ebp,
1002 pIn->ar_error, pIn->ar_pad
Vincent Béron9a624912002-05-31 23:06:46 +00001003 );
1004
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001005 win32apieq_2_CONTEXT(pIn,&cxt);
1006
1007 if(dwIoControlCode==IFS_IOCTL_21)
1008 {
1009 DOS3Call(&cxt); /* Call int 21h */
1010 } else {
1011 INT_Int2fHandler(&cxt); /* Call int 2Fh */
1012 }
Vincent Béron9a624912002-05-31 23:06:46 +00001013
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001014 CONTEXT_2_win32apieq(&cxt,pOut);
Vincent Béron9a624912002-05-31 23:06:46 +00001015
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001016 retv = TRUE;
1017 } break;
1018 case IFS_IOCTL_GET_RES:{
Alexandre Julliardfd456271999-05-13 14:42:14 +00001019 FIXME( "Control 'IFS_IOCTL_GET_RES' not implemented\n");
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001020 retv = FALSE;
1021 } break;
1022 case IFS_IOCTL_GET_NETPRO_NAME_A:{
Alexandre Julliardfd456271999-05-13 14:42:14 +00001023 FIXME( "Control 'IFS_IOCTL_GET_NETPRO_NAME_A' not implemented\n");
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001024 retv = FALSE;
Vincent Béron9a624912002-05-31 23:06:46 +00001025 } break;
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001026 default:
Alexandre Julliardfd456271999-05-13 14:42:14 +00001027 FIXME( "Control %ld not implemented\n", dwIoControlCode);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001028 retv = FALSE;
1029 }
1030
1031 return retv;
1032}
Marcus Meissner6a41a4b1998-11-07 12:32:59 +00001033
Ian Schmidt796c0f11999-11-12 03:28:26 +00001034/********************************************************************************
1035 * VxDCall_VWin32
1036 *
1037 * Service numbers taken from page 448 of Pietrek's "Windows 95 System
Andreas Mohr3eb35692001-05-24 18:40:26 +00001038 * Programming Secrets". Parameters from experimentation on real Win98.
Ian Schmidt796c0f11999-11-12 03:28:26 +00001039 *
1040 */
1041
Ulrich Weigandeb94c7d1999-11-13 23:54:04 +00001042static DWORD VxDCall_VWin32( DWORD service, CONTEXT86 *context )
Ian Schmidt796c0f11999-11-12 03:28:26 +00001043{
1044 switch ( LOWORD(service) )
1045 {
1046 case 0x0000: /* GetVersion */
1047 {
Alexandre Julliardd586dc92000-08-14 14:35:01 +00001048 DWORD vers = GetVersion();
1049 return (LOBYTE(vers) << 8) | HIBYTE(vers);
Ian Schmidt796c0f11999-11-12 03:28:26 +00001050 }
1051 break;
1052
Ian Schmidt1cc90ff1999-12-05 23:49:52 +00001053 case 0x0020: /* Get VMCPD Version */
1054 {
1055 DWORD parm = (DWORD) stack32_pop(context);
1056
1057 FIXME("Get VMCPD Version(%08lx): partial stub!\n", parm);
1058
1059 /* FIXME: This is what Win98 returns, it may
1060 * not be correct in all situations.
1061 * It makes Bleem! happy though.
1062 */
1063
1064 return 0x0405;
1065 }
1066
1067 case 0x0029: /* Int31/DPMI dispatch */
1068 {
1069 DWORD callnum = (DWORD) stack32_pop(context);
1070 DWORD parm = (DWORD) stack32_pop(context);
Vincent Béron9a624912002-05-31 23:06:46 +00001071
Ian Schmidt1cc90ff1999-12-05 23:49:52 +00001072 TRACE("Int31/DPMI dispatch(%08lx)\n", callnum);
1073
1074 AX_reg(context) = callnum;
Vincent Béron9a624912002-05-31 23:06:46 +00001075 CX_reg(context) = parm;
Ian Schmidt1cc90ff1999-12-05 23:49:52 +00001076 INT_Int31Handler(context);
1077
Alexandre Julliardd8fab2e2000-09-25 23:53:07 +00001078 return LOWORD(context->Eax);
Ian Schmidt1cc90ff1999-12-05 23:49:52 +00001079 }
1080 break;
1081
Ian Schmidt796c0f11999-11-12 03:28:26 +00001082 case 0x002a: /* Int41 dispatch - parm = int41 service number */
1083 {
1084 DWORD callnum = (DWORD) stack32_pop(context);
1085
1086 return callnum; /* FIXME: should really call INT_Int41Handler() */
1087 }
1088 break;
1089
1090 default:
1091 FIXME("Unknown VWin32 service %08lx\n", service);
1092 break;
1093 }
1094
1095 return 0xffffffff;
1096}
Vincent Béron9a624912002-05-31 23:06:46 +00001097
Ian Schmidt796c0f11999-11-12 03:28:26 +00001098
Andreas Mohr3eb35692001-05-24 18:40:26 +00001099/***********************************************************************
1100 * DeviceIo_VCD
1101 */
Vincent Béron9a624912002-05-31 23:06:46 +00001102static BOOL DeviceIo_VCD(DWORD dwIoControlCode,
Andreas Mohr3eb35692001-05-24 18:40:26 +00001103 LPVOID lpvInBuffer, DWORD cbInBuffer,
1104 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1105 LPDWORD lpcbBytesReturned,
1106 LPOVERLAPPED lpOverlapped)
1107{
1108 BOOL retv = TRUE;
1109
1110 switch (dwIoControlCode)
1111 {
1112 case IOCTL_SERIAL_LSRMST_INSERT:
1113 {
1114 FIXME( "IOCTL_SERIAL_LSRMST_INSERT NIY !\n");
1115 retv = FALSE;
1116 }
1117 break;
1118
1119 default:
1120 FIXME( "Unknown Control %ld\n", dwIoControlCode);
1121 retv = FALSE;
1122 break;
1123 }
1124
1125 return retv;
1126}
1127
Vincent Béron9a624912002-05-31 23:06:46 +00001128
Ulrich Weigand12980621998-11-25 10:20:03 +00001129/***********************************************************************
1130 * DeviceIo_VWin32
1131 */
1132
Alexandre Julliard617955d1999-06-26 18:40:24 +00001133static void DIOCRegs_2_CONTEXT( DIOC_REGISTERS *pIn, CONTEXT86 *pCxt )
Ulrich Weigand12980621998-11-25 10:20:03 +00001134{
Alexandre Julliard617955d1999-06-26 18:40:24 +00001135 memset( pCxt, 0, sizeof(*pCxt) );
Ulrich Weigand12980621998-11-25 10:20:03 +00001136 /* Note: segment registers == 0 means that CTX_SEG_OFF_TO_LIN
1137 will interpret 32-bit register contents as linear pointers */
1138
Ulrich Weigand0fa6dad1999-07-15 14:32:20 +00001139 pCxt->ContextFlags=CONTEXT86_INTEGER|CONTEXT86_CONTROL;
Ulrich Weigand12980621998-11-25 10:20:03 +00001140 pCxt->Eax = pIn->reg_EAX;
1141 pCxt->Ebx = pIn->reg_EBX;
1142 pCxt->Ecx = pIn->reg_ECX;
1143 pCxt->Edx = pIn->reg_EDX;
1144 pCxt->Esi = pIn->reg_ESI;
1145 pCxt->Edi = pIn->reg_EDI;
1146
Ulrich Weigand0fa6dad1999-07-15 14:32:20 +00001147 /* FIXME: Only partial CONTEXT86_CONTROL */
Ulrich Weigand12980621998-11-25 10:20:03 +00001148 pCxt->EFlags = pIn->reg_Flags;
1149}
1150
Alexandre Julliard617955d1999-06-26 18:40:24 +00001151static void CONTEXT_2_DIOCRegs( CONTEXT86 *pCxt, DIOC_REGISTERS *pOut )
Ulrich Weigand12980621998-11-25 10:20:03 +00001152{
1153 memset( pOut, 0, sizeof(DIOC_REGISTERS) );
1154
1155 pOut->reg_EAX = pCxt->Eax;
1156 pOut->reg_EBX = pCxt->Ebx;
1157 pOut->reg_ECX = pCxt->Ecx;
1158 pOut->reg_EDX = pCxt->Edx;
1159 pOut->reg_ESI = pCxt->Esi;
1160 pOut->reg_EDI = pCxt->Edi;
1161
Ulrich Weigand0fa6dad1999-07-15 14:32:20 +00001162 /* FIXME: Only partial CONTEXT86_CONTROL */
Ulrich Weigand12980621998-11-25 10:20:03 +00001163 pOut->reg_Flags = pCxt->EFlags;
1164}
1165
Mike McCormack88dadae2002-04-21 22:09:47 +00001166#define DIOC_AH(regs) (((unsigned char*)&((regs)->reg_EAX))[1])
1167#define DIOC_AL(regs) (((unsigned char*)&((regs)->reg_EAX))[0])
1168#define DIOC_BH(regs) (((unsigned char*)&((regs)->reg_EBX))[1])
1169#define DIOC_BL(regs) (((unsigned char*)&((regs)->reg_EBX))[0])
1170#define DIOC_DH(regs) (((unsigned char*)&((regs)->reg_EDX))[1])
1171#define DIOC_DL(regs) (((unsigned char*)&((regs)->reg_EDX))[0])
1172
1173#define DIOC_AX(regs) (((unsigned short*)&((regs)->reg_EAX))[0])
1174#define DIOC_BX(regs) (((unsigned short*)&((regs)->reg_EBX))[0])
1175#define DIOC_CX(regs) (((unsigned short*)&((regs)->reg_ECX))[0])
1176#define DIOC_DX(regs) (((unsigned short*)&((regs)->reg_EDX))[0])
1177
1178#define DIOC_SET_CARRY(regs) (((regs)->reg_Flags)|=0x00000001)
1179
1180static const DWORD VWIN32_DriveTypeInfo[7]={
1181 0x0000, /* none */
1182 0x2709, /* 360 K */
1183 0x4f0f, /* 1.2 M */
1184 0x4f09, /* 720 K */
1185 0x4f12, /* 1.44 M */
1186 0x4f24, /* 2.88 M */
1187 0x4f24 /* 2.88 M */
1188};
1189
Mike McCormack88dadae2002-04-21 22:09:47 +00001190/**********************************************************************
1191 * VWIN32_ReadFloppyParams
1192 *
1193 * Handler for int 13h (disk I/O).
1194 */
1195static VOID VWIN32_ReadFloppyParams(DIOC_REGISTERS *regs)
1196{
1197#ifdef linux
Gerald Pfeiferc97e24e2002-05-30 20:36:55 +00001198 static BYTE floppy_params[2][13] =
1199 {
1200 { 0xaf, 0x02, 0x25, 0x02, 0x12, 0x1b, 0xff, 0x6c, 0xf6, 0x0f, 0x08 },
1201 { 0xaf, 0x02, 0x25, 0x02, 0x12, 0x1b, 0xff, 0x6c, 0xf6, 0x0f, 0x08 }
1202 };
1203
Mike McCormack88dadae2002-04-21 22:09:47 +00001204 unsigned int i, nr_of_drives = 0;
1205 BYTE drive_nr = DIOC_DL(regs);
1206 int floppy_fd,r;
1207 struct floppy_drive_params floppy_parm;
1208 char root[] = "A:\\";
1209
1210 TRACE("in [ EDX=%08lx ]\n", regs->reg_EDX );
1211
1212 DIOC_AH(regs) = 0x00; /* success */
1213
1214 for (i = 0; i < MAX_DOS_DRIVES; i++, root[0]++)
1215 if (GetDriveTypeA(root) == DRIVE_REMOVABLE) nr_of_drives++;
1216 DIOC_DL(regs) = nr_of_drives;
1217
1218 if (drive_nr > 1) { /* invalid drive ? */
1219 DIOC_BX(regs) = 0;
1220 DIOC_CX(regs) = 0;
1221 DIOC_DH(regs) = 0;
1222 DIOC_SET_CARRY(regs);
1223 return;
1224 }
1225
1226 if ( (floppy_fd = DRIVE_OpenDevice( drive_nr, O_NONBLOCK)) == -1)
1227 {
1228 WARN("Can't determine floppy geometry !\n");
1229 DIOC_BX(regs) = 0;
1230 DIOC_CX(regs) = 0;
1231 DIOC_DH(regs) = 0;
1232 DIOC_SET_CARRY(regs);
1233 return;
1234 }
1235 r = ioctl(floppy_fd, FDGETDRVPRM, &floppy_parm);
1236
1237 close(floppy_fd);
1238
1239 if(r<0)
1240 {
1241 DIOC_SET_CARRY(regs);
1242 return;
1243 }
1244
1245 regs->reg_ECX = 0;
1246 DIOC_AL(regs) = 0;
1247 DIOC_BL(regs) = floppy_parm.cmos;
1248
1249 /* CH = low eight bits of max cyl
1250 CL = max sec nr (bits 5-0),
1251 hi two bits of max cyl (bits 7-6)
1252 DH = max head nr */
1253 if(DIOC_BL(regs) && (DIOC_BL(regs)<7))
1254 {
1255 DIOC_DH(regs) = 0x01;
1256 DIOC_CX(regs) = VWIN32_DriveTypeInfo[DIOC_BL(regs)];
1257 }
1258 else
1259 {
1260 DIOC_CX(regs) = 0x0;
1261 DIOC_DX(regs) = 0x0;
1262 }
1263
1264 regs->reg_EDI = (DWORD)floppy_params[drive_nr];
1265
1266 if(!regs->reg_EDI)
1267 {
1268 ERR("Get floppy params failed for drive %d\n",drive_nr);
1269 DIOC_SET_CARRY(regs);
1270 }
1271
1272 TRACE("out [ EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx EDI=%08lx ]\n",
1273 regs->reg_EAX, regs->reg_EBX, regs->reg_ECX, regs->reg_EDX, regs->reg_EDI);
1274
1275 /* FIXME: Word exits quietly if we return with no error. Why? */
1276 FIXME("Returned ERROR!\n");
1277 DIOC_SET_CARRY(regs);
1278
1279#else
1280 DIOC_AH(regs) = 0x01;
1281 DIOC_SET_CARRY(regs);
1282#endif
1283}
1284
1285/**********************************************************************
1286 * VWIN32_Int13Handler
1287 *
1288 * Handler for VWIN32_DIOC_DOS_INT13 (disk I/O).
1289 */
1290static VOID VWIN32_Int13Handler( DIOC_REGISTERS *regs)
1291{
1292 TRACE("AH=%02x\n",DIOC_AH(regs));
1293 switch(DIOC_AH(regs)) /* AH */
1294 {
1295 case 0x00: /* RESET DISK SYSTEM */
1296 break; /* no return ? */
1297
1298 case 0x01: /* STATUS OF DISK SYSTEM */
1299 DIOC_AL(regs) = 0; /* successful completion */
1300 break;
1301
1302 case 0x02: /* READ SECTORS INTO MEMORY */
1303 DIOC_AL(regs) = 0; /* number of sectors read */
1304 DIOC_AH(regs) = 0; /* status */
1305 break;
1306
1307 case 0x03: /* WRITE SECTORS FROM MEMORY */
1308 break; /* no return ? */
1309
1310 case 0x04: /* VERIFY DISK SECTOR(S) */
1311 DIOC_AL(regs) = 0; /* number of sectors verified */
1312 DIOC_AH(regs) = 0;
1313 break;
1314
1315 case 0x05: /* FORMAT TRACK */
1316 case 0x06: /* FORMAT TRACK AND SET BAD SECTOR FLAGS */
1317 case 0x07: /* FORMAT DRIVE STARTING AT GIVEN TRACK */
1318 /* despite what Ralf Brown says, 0x06 and 0x07 seem to
1319 * set CFLAG, too (at least my BIOS does that) */
1320 DIOC_AH(regs) = 0x0c;
1321 DIOC_SET_CARRY(regs);
1322 break;
1323
1324 case 0x08: /* GET DRIVE PARAMETERS */
1325 if (DIOC_DL(regs) & 0x80) { /* hard disk ? */
1326 DIOC_AH(regs) = 0x07;
1327 DIOC_SET_CARRY(regs);
1328 }
1329 else /* floppy disk */
1330 VWIN32_ReadFloppyParams(regs);
1331 break;
1332
1333 case 0x09: /* INITIALIZE CONTROLLER WITH DRIVE PARAMETERS */
1334 case 0x0a: /* FIXED DISK - READ LONG (XT,AT,XT286,PS) */
1335 case 0x0b: /* FIXED DISK - WRITE LONG (XT,AT,XT286,PS) */
1336 case 0x0c: /* SEEK TO CYLINDER */
1337 case 0x0d: /* ALTERNATE RESET HARD DISKS */
1338 case 0x10: /* CHECK IF DRIVE READY */
1339 case 0x11: /* RECALIBRATE DRIVE */
1340 case 0x14: /* CONTROLLER INTERNAL DIAGNOSTIC */
1341 DIOC_AH(regs) = 0;
1342 break;
1343
1344 case 0x15: /* GET DISK TYPE (AT,XT2,XT286,CONV,PS) */
1345 if (DIOC_DL(regs) & 0x80) { /* hard disk ? */
1346 DIOC_AH(regs) = 3; /* fixed disk */
1347 DIOC_SET_CARRY(regs);
1348 }
1349 else { /* floppy disk ? */
1350 DIOC_AH(regs) = 2; /* floppy with change detection */
1351 DIOC_SET_CARRY(regs);
1352 }
1353 break;
1354
1355 case 0x0e: /* READ SECTOR BUFFER (XT only) */
1356 case 0x0f: /* WRITE SECTOR BUFFER (XT only) */
1357 case 0x12: /* CONTROLLER RAM DIAGNOSTIC (XT,PS) */
1358 case 0x13: /* DRIVE DIAGNOSTIC (XT,PS) */
1359 DIOC_AH(regs) = 0x01;
1360 DIOC_SET_CARRY(regs);
1361 break;
1362
1363 case 0x16: /* FLOPPY - CHANGE OF DISK STATUS */
1364 DIOC_AH(regs) = 0; /* FIXME - no change */
1365 break;
1366
1367 case 0x17: /* SET DISK TYPE FOR FORMAT */
1368 if (DIOC_DL(regs) < 4)
1369 DIOC_AH(regs) = 0x00; /* successful completion */
1370 else
1371 DIOC_AH(regs) = 0x01; /* error */
1372 break;
1373
1374 case 0x18: /* SET MEDIA TYPE FOR FORMAT */
1375 if (DIOC_DL(regs) < 4)
1376 DIOC_AH(regs) = 0x00; /* successful completion */
1377 else
1378 DIOC_AH(regs) = 0x01; /* error */
1379 break;
1380
1381 case 0x19: /* FIXED DISK - PARK HEADS */
1382 break;
1383
1384 default:
1385 FIXME("Unknown VWIN32 INT13 call AX=%04X\n",DIOC_AX(regs));
1386 }
1387}
Ulrich Weigand12980621998-11-25 10:20:03 +00001388
Vincent Béron9a624912002-05-31 23:06:46 +00001389static BOOL DeviceIo_VWin32(DWORD dwIoControlCode,
Ulrich Weigand12980621998-11-25 10:20:03 +00001390 LPVOID lpvInBuffer, DWORD cbInBuffer,
1391 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1392 LPDWORD lpcbBytesReturned,
1393 LPOVERLAPPED lpOverlapped)
1394{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001395 BOOL retv = TRUE;
Ulrich Weigand12980621998-11-25 10:20:03 +00001396
1397 switch (dwIoControlCode)
1398 {
Ulrich Weigand12980621998-11-25 10:20:03 +00001399 case VWIN32_DIOC_DOS_INT13:
Mike McCormack88dadae2002-04-21 22:09:47 +00001400 {
1401 DIOC_REGISTERS *pIn = (DIOC_REGISTERS *)lpvInBuffer;
1402 DIOC_REGISTERS *pOut = (DIOC_REGISTERS *)lpvOutBuffer;
1403
1404 memcpy(pOut, pIn, sizeof (DIOC_REGISTERS));
1405 VWIN32_Int13Handler(pOut);
1406 break;
1407 }
1408
1409 case VWIN32_DIOC_DOS_IOCTL:
Andreas Mohr6a967492002-05-25 22:04:43 +00001410 case 0x10: /* Int 0x21 call, call it VWIN_DIOC_INT21 ? */
Ulrich Weigand12980621998-11-25 10:20:03 +00001411 case VWIN32_DIOC_DOS_INT25:
1412 case VWIN32_DIOC_DOS_INT26:
Andreas Mohr6a967492002-05-25 22:04:43 +00001413 case 0x29: /* Int 0x31 call, call it VWIN_DIOC_INT31 ? */
Eric Pouech5cc61052002-01-13 01:44:00 +00001414 case VWIN32_DIOC_DOS_DRIVEINFO:
Ulrich Weigand12980621998-11-25 10:20:03 +00001415 {
Alexandre Julliard617955d1999-06-26 18:40:24 +00001416 CONTEXT86 cxt;
Ulrich Weigand12980621998-11-25 10:20:03 +00001417 DIOC_REGISTERS *pIn = (DIOC_REGISTERS *)lpvInBuffer;
1418 DIOC_REGISTERS *pOut = (DIOC_REGISTERS *)lpvOutBuffer;
1419
Alexandre Julliardfd456271999-05-13 14:42:14 +00001420 TRACE( "Control '%s': "
1421 "eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
Mike McCormack88dadae2002-04-21 22:09:47 +00001422 "edx=0x%08lx, esi=0x%08lx, edi=0x%08lx \n",
Alexandre Julliardfd456271999-05-13 14:42:14 +00001423 (dwIoControlCode == VWIN32_DIOC_DOS_IOCTL)? "VWIN32_DIOC_DOS_IOCTL" :
Alexandre Julliardfd456271999-05-13 14:42:14 +00001424 (dwIoControlCode == VWIN32_DIOC_DOS_INT25)? "VWIN32_DIOC_DOS_INT25" :
Vincent Béron9a624912002-05-31 23:06:46 +00001425 (dwIoControlCode == VWIN32_DIOC_DOS_INT26)? "VWIN32_DIOC_DOS_INT26" :
Ian Schmidt5dff4fb2000-04-04 18:55:09 +00001426 (dwIoControlCode == VWIN32_DIOC_DOS_DRIVEINFO)? "VWIN32_DIOC_DOS_DRIVEINFO" : "???",
Alexandre Julliardfd456271999-05-13 14:42:14 +00001427 pIn->reg_EAX, pIn->reg_EBX, pIn->reg_ECX,
1428 pIn->reg_EDX, pIn->reg_ESI, pIn->reg_EDI );
Ulrich Weigand12980621998-11-25 10:20:03 +00001429
1430 DIOCRegs_2_CONTEXT( pIn, &cxt );
1431
1432 switch (dwIoControlCode)
1433 {
1434 case VWIN32_DIOC_DOS_IOCTL: DOS3Call( &cxt ); break; /* Call int 21h */
Andreas Mohr6a967492002-05-25 22:04:43 +00001435 case VWIN32_DIOC_DOS_INT13: INT_Int13Handler( &cxt ); break;
1436 case 0x10: /* Int 0x21 call, call it VWIN_DIOC_INT21 ? */
1437 DOS3Call( &cxt ); break;
Ulrich Weigand12980621998-11-25 10:20:03 +00001438 case VWIN32_DIOC_DOS_INT25: INT_Int25Handler( &cxt ); break;
1439 case VWIN32_DIOC_DOS_INT26: INT_Int26Handler( &cxt ); break;
Andreas Mohr6a967492002-05-25 22:04:43 +00001440 case 0x29: /* Int 0x31 call, call it VWIN_DIOC_INT31 ? */
1441 INT_Int31Handler( &cxt ); break;
Eric Pouech5cc61052002-01-13 01:44:00 +00001442 case VWIN32_DIOC_DOS_DRIVEINFO: DOS3Call( &cxt ); break; /* Call int 21h 730x */
Ulrich Weigand12980621998-11-25 10:20:03 +00001443 }
1444
1445 CONTEXT_2_DIOCRegs( &cxt, pOut );
1446 }
1447 break;
1448
1449 case VWIN32_DIOC_SIMCTRLC:
Alexandre Julliardfd456271999-05-13 14:42:14 +00001450 FIXME( "Control VWIN32_DIOC_SIMCTRLC not implemented\n");
Ulrich Weigand12980621998-11-25 10:20:03 +00001451 retv = FALSE;
1452 break;
1453
1454 default:
Alexandre Julliardfd456271999-05-13 14:42:14 +00001455 FIXME( "Unknown Control %ld\n", dwIoControlCode);
Ulrich Weigand12980621998-11-25 10:20:03 +00001456 retv = FALSE;
1457 break;
1458 }
1459
1460 return retv;
1461}
1462
Marcus Meissner91aaca81999-04-19 16:21:29 +00001463/* this is the main multimedia device loader */
Vincent Béron9a624912002-05-31 23:06:46 +00001464static BOOL DeviceIo_MMDEVLDR(DWORD dwIoControlCode,
Marcus Meissner91aaca81999-04-19 16:21:29 +00001465 LPVOID lpvInBuffer, DWORD cbInBuffer,
1466 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1467 LPDWORD lpcbBytesReturned,
1468 LPOVERLAPPED lpOverlapped)
1469{
Alexandre Julliardfd456271999-05-13 14:42:14 +00001470 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
Marcus Meissner91aaca81999-04-19 16:21:29 +00001471 dwIoControlCode,
1472 lpvInBuffer,cbInBuffer,
1473 lpvOutBuffer,cbOutBuffer,
1474 lpcbBytesReturned,
1475 lpOverlapped
1476 );
1477 switch (dwIoControlCode) {
1478 case 5:
1479 /* Hmm. */
1480 *(DWORD*)lpvOutBuffer=0;
1481 *lpcbBytesReturned=4;
1482 return TRUE;
1483 }
1484 return FALSE;
1485}
Marcus Meissner6a41a4b1998-11-07 12:32:59 +00001486/* this is used by some Origin games */
Vincent Béron9a624912002-05-31 23:06:46 +00001487static BOOL DeviceIo_MONODEBG(DWORD dwIoControlCode,
Marcus Meissner6a41a4b1998-11-07 12:32:59 +00001488 LPVOID lpvInBuffer, DWORD cbInBuffer,
1489 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1490 LPDWORD lpcbBytesReturned,
1491 LPOVERLAPPED lpOverlapped)
1492{
1493 switch (dwIoControlCode) {
1494 case 1: /* version */
1495 *(LPDWORD)lpvOutBuffer = 0x20004; /* WC SecretOps */
1496 break;
1497 case 9: /* debug output */
Jeremy Whited3e22d92000-02-10 19:03:02 +00001498 ERR("MONODEBG: %s\n",debugstr_a(lpvInBuffer));
Marcus Meissner6a41a4b1998-11-07 12:32:59 +00001499 break;
1500 default:
Alexandre Julliardfd456271999-05-13 14:42:14 +00001501 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
Alexandre Julliard62a8b431999-01-19 17:48:23 +00001502 dwIoControlCode,
Marcus Meissner6a41a4b1998-11-07 12:32:59 +00001503 lpvInBuffer,cbInBuffer,
1504 lpvOutBuffer,cbOutBuffer,
1505 lpcbBytesReturned,
1506 lpOverlapped
1507 );
1508 break;
1509 }
1510 return TRUE;
1511}
Juergen Schmiedf08b8191999-05-22 10:33:50 +00001512/* pccard */
Vincent Béron9a624912002-05-31 23:06:46 +00001513static BOOL DeviceIo_PCCARD (DWORD dwIoControlCode,
Juergen Schmiedf08b8191999-05-22 10:33:50 +00001514 LPVOID lpvInBuffer, DWORD cbInBuffer,
1515 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1516 LPDWORD lpcbBytesReturned,
1517 LPOVERLAPPED lpOverlapped)
1518{
1519 switch (dwIoControlCode) {
1520 case 0x0000: /* PCCARD_Get_Version */
1521 case 0x0001: /* PCCARD_Card_Services */
1522 default:
1523 FIXME( "(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
1524 dwIoControlCode,
1525 lpvInBuffer,cbInBuffer,
1526 lpvOutBuffer,cbOutBuffer,
1527 lpcbBytesReturned,
1528 lpOverlapped
1529 );
1530 break;
1531 }
1532 return FALSE;
1533}
Eric Pouechc53def71999-04-03 11:18:06 +00001534
Patrik Stridvall2d6457c2000-03-28 20:22:59 +00001535/***********************************************************************
Patrik Stridvalld0a41772001-02-14 23:11:17 +00001536 * OpenVxDHandle (KERNEL32.@)
Andreas Mohr6a967492002-05-25 22:04:43 +00001537 *
1538 * This function is supposed to return the corresponding Ring 0
1539 * ("kernel") handle for a Ring 3 handle in Win9x.
1540 * Evidently, Wine will have problems with this. But we try anyway,
1541 * maybe it helps...
Patrik Stridvall2d6457c2000-03-28 20:22:59 +00001542 */
Andreas Mohr6a967492002-05-25 22:04:43 +00001543HANDLE WINAPI OpenVxDHandle(HANDLE hHandleRing3)
Eric Pouechc53def71999-04-03 11:18:06 +00001544{
Gerald Pfeiferc97e24e2002-05-30 20:36:55 +00001545 FIXME( "(0x%08x), stub! (returning Ring 3 handle instead of Ring 0)\n", hHandleRing3);
Andreas Mohr6a967492002-05-25 22:04:43 +00001546 return hHandleRing3;
Eric Pouechc53def71999-04-03 11:18:06 +00001547}
Kees Schoenmakers0a5d9ef2000-11-29 17:43:09 +00001548
1549static BOOL DeviceIo_HASP(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
1550 LPVOID lpvOutBuffer, DWORD cbOutBuffer,
1551 LPDWORD lpcbBytesReturned,
1552 LPOVERLAPPED lpOverlapped)
1553{
1554 BOOL retv = TRUE;
1555 FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
1556 dwIoControlCode,
1557 lpvInBuffer,cbInBuffer,
1558 lpvOutBuffer,cbOutBuffer,
1559 lpcbBytesReturned,
1560 lpOverlapped);
1561
1562 return retv;
1563}
1564