mmdevapi/tests: Fix test on some 2k8 and mark those errors broken.
[wine] / dlls / ifsmgr.vxd / ifsmgr.c
1 /*
2  * IFSMGR VxD implementation
3  *
4  * Copyright 1998 Marcus Meissner
5  * Copyright 1998 Ulrich Weigand
6  * Copyright 1998 Patrik Stridvall
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22
23 /* NOTES
24  *   These ioctls are used by 'MSNET32.DLL'.
25  *
26  *   I have been unable to uncover any documentation about the ioctls so
27  *   the implementation of the cases IFS_IOCTL_21 and IFS_IOCTL_2F are
28  *   based on reasonable guesses on information found in the Windows 95 DDK.
29  */
30
31 #include <stdarg.h>
32
33 #include "windef.h"
34 #include "winbase.h"
35 #include "wine/debug.h"
36
37 WINE_DEFAULT_DEBUG_CHANNEL(vxd);
38
39 /*
40  * IFSMgr DeviceIO service
41  */
42
43 #define IFS_IOCTL_21                100
44 #define IFS_IOCTL_2F                101
45 #define IFS_IOCTL_GET_RES           102
46 #define IFS_IOCTL_GET_NETPRO_NAME_A 103
47
48 struct win32apireq {
49         unsigned long   ar_proid;
50         unsigned long   ar_eax;
51         unsigned long   ar_ebx;
52         unsigned long   ar_ecx;
53         unsigned long   ar_edx;
54         unsigned long   ar_esi;
55         unsigned long   ar_edi;
56         unsigned long   ar_ebp;
57         unsigned short  ar_error;
58         unsigned short  ar_pad;
59 };
60
61 static void win32apieq_2_CONTEXT(const struct win32apireq *pIn, CONTEXT *pCxt)
62 {
63         memset(pCxt,0,sizeof(*pCxt));
64
65         pCxt->ContextFlags=CONTEXT_INTEGER|CONTEXT_CONTROL;
66         pCxt->Eax = pIn->ar_eax;
67         pCxt->Ebx = pIn->ar_ebx;
68         pCxt->Ecx = pIn->ar_ecx;
69         pCxt->Edx = pIn->ar_edx;
70         pCxt->Esi = pIn->ar_esi;
71         pCxt->Edi = pIn->ar_edi;
72
73         /* FIXME: Only partial CONTEXT_CONTROL */
74         pCxt->Ebp = pIn->ar_ebp;
75
76         /* FIXME: pIn->ar_proid ignored */
77         /* FIXME: pIn->ar_error ignored */
78         /* FIXME: pIn->ar_pad ignored */
79 }
80
81 static void CONTEXT_2_win32apieq(const CONTEXT *pCxt, struct win32apireq *pOut)
82 {
83         memset(pOut,0,sizeof(struct win32apireq));
84
85         pOut->ar_eax = pCxt->Eax;
86         pOut->ar_ebx = pCxt->Ebx;
87         pOut->ar_ecx = pCxt->Ecx;
88         pOut->ar_edx = pCxt->Edx;
89         pOut->ar_esi = pCxt->Esi;
90         pOut->ar_edi = pCxt->Edi;
91
92         /* FIXME: Only partial CONTEXT_CONTROL */
93         pOut->ar_ebp = pCxt->Ebp;
94
95         /* FIXME: pOut->ar_proid ignored */
96         /* FIXME: pOut->ar_error ignored */
97         /* FIXME: pOut->ar_pad ignored */
98 }
99
100 extern void __wine_call_int_handler( CONTEXT *context, BYTE intnum );
101
102 /***********************************************************************
103  *           DeviceIoControl   (IFSMGR.VXD.@)
104  */
105 BOOL WINAPI IFSMGR_DeviceIoControl(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
106                                   LPVOID lpvOutBuffer, DWORD cbOutBuffer,
107                                   LPDWORD lpcbBytesReturned,
108                                   LPOVERLAPPED lpOverlapped)
109 {
110     TRACE("(%d,%p,%d,%p,%d,%p,%p): stub\n",
111           dwIoControlCode, lpvInBuffer,cbInBuffer, lpvOutBuffer,cbOutBuffer,
112           lpcbBytesReturned, lpOverlapped);
113
114     switch (dwIoControlCode)
115     {
116     case IFS_IOCTL_21:
117     case IFS_IOCTL_2F:
118         {
119             CONTEXT cxt;
120             struct win32apireq *pIn=lpvInBuffer;
121             struct win32apireq *pOut=lpvOutBuffer;
122
123             TRACE( "Control '%s': "
124                    "proid=0x%08lx, eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
125                    "edx=0x%08lx, esi=0x%08lx, edi=0x%08lx, ebp=0x%08lx, "
126                    "error=0x%04x, pad=0x%04x\n",
127                    (dwIoControlCode==IFS_IOCTL_21)?"IFS_IOCTL_21":"IFS_IOCTL_2F",
128                    pIn->ar_proid, pIn->ar_eax, pIn->ar_ebx, pIn->ar_ecx,
129                    pIn->ar_edx, pIn->ar_esi, pIn->ar_edi, pIn->ar_ebp,
130                    pIn->ar_error, pIn->ar_pad );
131
132             win32apieq_2_CONTEXT(pIn,&cxt);
133
134             if(dwIoControlCode==IFS_IOCTL_21)
135                 __wine_call_int_handler( &cxt, 0x21 );
136             else
137                 __wine_call_int_handler( &cxt, 0x2f );
138
139             CONTEXT_2_win32apieq(&cxt,pOut);
140             return TRUE;
141         }
142     case IFS_IOCTL_GET_RES:
143         FIXME( "Control 'IFS_IOCTL_GET_RES' not implemented\n");
144         return FALSE;
145     case IFS_IOCTL_GET_NETPRO_NAME_A:
146         FIXME( "Control 'IFS_IOCTL_GET_NETPRO_NAME_A' not implemented\n");
147         return FALSE;
148     default:
149         FIXME( "Control %d not implemented\n", dwIoControlCode);
150         return FALSE;
151     }
152 }