blob: 54365c74af26bcb91168dcdcaba44c267a99377a [file] [log] [blame]
Alexandre Julliard60ce85c1998-02-01 18:33:27 +00001/* DirectInput
2 *
3 * Copyright 1998 Marcus Meissner
Lionel Ulmer629b9fa1999-02-09 14:18:21 +00004 * Copyright 1998,1999 Lionel Ulmer
Ove Kaavend2d08f02002-06-14 00:39:44 +00005 * Copyright 2000-2002 TransGaming Technologies Inc.
Lionel Ulmer89f8ba21998-11-06 17:28:22 +00006 *
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00007 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Alexandre Julliard60ce85c1998-02-01 18:33:27 +000021 */
22/* Status:
23 *
24 * - Tomb Raider 2 Demo:
Alexandre Julliarda11d7b11998-03-01 20:05:02 +000025 * Playable using keyboard only.
Alexandre Julliard60ce85c1998-02-01 18:33:27 +000026 * - WingCommander Prophecy Demo:
Alexandre Julliarda11d7b11998-03-01 20:05:02 +000027 * Doesn't get Input Focus.
Vincent Béron9a624912002-05-31 23:06:46 +000028 *
Lionel Ulmer89f8ba21998-11-06 17:28:22 +000029 * - Fallout : works great in X and DGA mode
Alexandre Julliard60ce85c1998-02-01 18:33:27 +000030 */
31
32#include "config.h"
Alexandre Julliard60ce85c1998-02-01 18:33:27 +000033#include <assert.h>
Alexandre Julliarde37c6e12003-09-05 23:08:26 +000034#include <stdarg.h>
James Juranf4d5fef2001-01-26 20:43:40 +000035#include <string.h>
Alexandre Julliardbea617b2000-08-03 04:22:35 +000036
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000037#include "wine/debug.h"
Raphael Junqueirac4050192003-06-16 20:22:13 +000038#include "wine/unicode.h"
Alexandre Julliarde37c6e12003-09-05 23:08:26 +000039#include "windef.h"
Lionel Ulmer3b3dc5c1999-07-25 11:21:07 +000040#include "winbase.h"
Arjen Nienhuisc9654a72002-05-19 22:26:16 +000041#include "winuser.h"
Patrik Stridvalld96e1f11999-07-04 13:31:03 +000042#include "winerror.h"
Lionel Ulmer6301e942000-11-05 20:25:02 +000043#include "dinput_private.h"
Alexandre Julliardbea617b2000-08-03 04:22:35 +000044
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000045WINE_DEFAULT_DEBUG_CHANNEL(dinput);
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000046
Alexandre Julliard48c4bb32004-08-12 23:00:51 +000047static IDirectInput7AVtbl ddi7avt;
48static IDirectInput7WVtbl ddi7wvt;
49static IDirectInput8AVtbl ddi8avt;
50static IDirectInput8WVtbl ddi8wvt;
Francois Gougetb233fc31999-02-22 09:52:54 +000051
Lionel Ulmer6301e942000-11-05 20:25:02 +000052/* This array will be filled a dinput.so loading */
Marcus Meissnerc9b3b2e2000-12-12 00:38:58 +000053#define MAX_WINE_DINPUT_DEVICES 4
Lionel Ulmer6301e942000-11-05 20:25:02 +000054static dinput_device * dinput_devices[MAX_WINE_DINPUT_DEVICES];
55static int nrof_dinput_devices = 0;
Francois Gougetb233fc31999-02-22 09:52:54 +000056
Alexandre Julliard6ed40bb2002-12-24 01:18:21 +000057HINSTANCE DINPUT_instance = NULL;
58
Alexandre Julliard1e1313d2002-11-04 23:53:41 +000059BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserv)
Arjen Nienhuisc9654a72002-05-19 22:26:16 +000060{
61 switch(reason)
62 {
63 case DLL_PROCESS_ATTACH:
Dmitry Timoshkov4e1ef0c2003-06-30 20:53:48 +000064 DisableThreadLibraryCalls(inst);
Alexandre Julliard6ed40bb2002-12-24 01:18:21 +000065 DINPUT_instance = inst;
Arjen Nienhuisc9654a72002-05-19 22:26:16 +000066 break;
67 case DLL_PROCESS_DETACH:
Arjen Nienhuisc9654a72002-05-19 22:26:16 +000068 break;
69 }
70 return TRUE;
71}
72
73
Vincent Béron9a624912002-05-31 23:06:46 +000074/* register a direct draw driver. We better not use malloc for we are in
Lionel Ulmer6301e942000-11-05 20:25:02 +000075 * the ELF startup initialisation at this point.
Lionel Ulmer629b9fa1999-02-09 14:18:21 +000076 */
Lionel Ulmer6301e942000-11-05 20:25:02 +000077void dinput_register_device(dinput_device *device) {
Marcus Meissnerc9b3b2e2000-12-12 00:38:58 +000078 int i;
79
80 /* insert according to priority */
81 for (i=0;i<nrof_dinput_devices;i++) {
82 if (dinput_devices[i]->pref <= device->pref) {
83 memcpy(dinput_devices+i+1,dinput_devices+i,sizeof(dinput_devices[0])*(nrof_dinput_devices-i));
84 dinput_devices[i] = device;
85 break;
86 }
87 }
88 if (i==nrof_dinput_devices) /* not found, or too low priority */
89 dinput_devices[nrof_dinput_devices] = device;
90
91 nrof_dinput_devices++;
Lionel Ulmer629b9fa1999-02-09 14:18:21 +000092
Lionel Ulmer6301e942000-11-05 20:25:02 +000093 /* increase MAX_DDRAW_DRIVERS if the line below triggers */
94 assert(nrof_dinput_devices <= MAX_WINE_DINPUT_DEVICES);
Lionel Ulmer5e6d0622000-02-26 13:15:17 +000095}
96
Alexandre Julliarda845b881998-06-01 10:44:35 +000097/******************************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +000098 * DirectInputCreateEx (DINPUT.@)
Marcus Meissner4b3afdc2000-10-13 23:07:29 +000099 */
100HRESULT WINAPI DirectInputCreateEx(
101 HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI,
Raphael Junqueirac4050192003-06-16 20:22:13 +0000102 LPUNKNOWN punkOuter)
103{
104 IDirectInputImpl* This;
Lionel Ulmer6301e942000-11-05 20:25:02 +0000105
Raphael Junqueirac4050192003-06-16 20:22:13 +0000106 TRACE("(0x%08lx,%04lx,%s,%p,%p)\n", (DWORD)hinst,dwVersion,debugstr_guid(riid),ppDI,punkOuter);
107
Ove Kaavend2d08f02002-06-14 00:39:44 +0000108 if (IsEqualGUID(&IID_IDirectInputA,riid) ||
109 IsEqualGUID(&IID_IDirectInput2A,riid) ||
110 IsEqualGUID(&IID_IDirectInput7A,riid)) {
Raphael Junqueirac4050192003-06-16 20:22:13 +0000111 This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
Ove Kaavend2d08f02002-06-14 00:39:44 +0000112 This->lpVtbl = &ddi7avt;
Lionel Ulmer6301e942000-11-05 20:25:02 +0000113 This->ref = 1;
Christian Costa77c00c92003-06-13 18:55:41 +0000114 This->version = 1;
Lionel Ulmer6301e942000-11-05 20:25:02 +0000115 *ppDI = This;
Vincent Béron9a624912002-05-31 23:06:46 +0000116
Lionel Ulmer6301e942000-11-05 20:25:02 +0000117 return DI_OK;
118 }
Vincent Béron9a624912002-05-31 23:06:46 +0000119
Raphael Junqueirac4050192003-06-16 20:22:13 +0000120 if (IsEqualGUID(&IID_IDirectInputW,riid) ||
121 IsEqualGUID(&IID_IDirectInput2W,riid) ||
122 IsEqualGUID(&IID_IDirectInput7W,riid)) {
123 This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
124 This->lpVtbl = &ddi7wvt;
125 This->ref = 1;
126 This->version = 1;
127 *ppDI = This;
128
129 return DI_OK;
130 }
Ove Kaavend2d08f02002-06-14 00:39:44 +0000131
132 if (IsEqualGUID(&IID_IDirectInput8A,riid)) {
Raphael Junqueirac4050192003-06-16 20:22:13 +0000133 This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
Ove Kaavend2d08f02002-06-14 00:39:44 +0000134 This->lpVtbl = &ddi8avt;
Lionel Ulmer6301e942000-11-05 20:25:02 +0000135 This->ref = 1;
Christian Costa77c00c92003-06-13 18:55:41 +0000136 This->version = 8;
Lionel Ulmer6301e942000-11-05 20:25:02 +0000137 *ppDI = This;
Vincent Béron9a624912002-05-31 23:06:46 +0000138
Lionel Ulmer6301e942000-11-05 20:25:02 +0000139 return DI_OK;
140 }
141
Raphael Junqueirac4050192003-06-16 20:22:13 +0000142 if (IsEqualGUID(&IID_IDirectInput8W,riid)) {
143 This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
144 This->lpVtbl = &ddi8wvt;
145 This->ref = 1;
146 This->version = 8;
147 *ppDI = This;
148
149 return DI_OK;
150 }
151
Lionel Ulmer6301e942000-11-05 20:25:02 +0000152 return DIERR_OLDDIRECTINPUTVERSION;
Marcus Meissner4b3afdc2000-10-13 23:07:29 +0000153}
154
155/******************************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +0000156 * DirectInputCreateA (DINPUT.@)
Alexandre Julliarda845b881998-06-01 10:44:35 +0000157 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000158HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter)
Francois Gougetb233fc31999-02-22 09:52:54 +0000159{
Raphael Junqueirac4050192003-06-16 20:22:13 +0000160 IDirectInputImpl* This;
161 TRACE("(0x%08lx,%04lx,%p,%p)\n", (DWORD)hinst,dwVersion,ppDI,punkOuter);
162 This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
Ove Kaavend2d08f02002-06-14 00:39:44 +0000163 This->lpVtbl = &ddi7avt;
Francois Gougetb233fc31999-02-22 09:52:54 +0000164 This->ref = 1;
Lionel Ulmer4f640692004-06-04 18:06:37 +0000165 if (dwVersion >= 0x0800) {
166 This->version = 8;
167 } else {
168 /* We do not differientiate between version 1, 2 and 7 */
169 This->version = 1;
170 }
Raphael Junqueirac4050192003-06-16 20:22:13 +0000171 *ppDI = (IDirectInputA*)This;
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000172 return 0;
Ove Kaavend2d08f02002-06-14 00:39:44 +0000173
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000174}
Raphael Junqueirac4050192003-06-16 20:22:13 +0000175
176/******************************************************************************
177 * DirectInputCreateW (DINPUT.@)
178 */
179HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter)
180{
181 IDirectInputImpl* This;
182 TRACE("(0x%08lx,%04lx,%p,%p)\n", (DWORD)hinst,dwVersion,ppDI,punkOuter);
183 This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
184 This->lpVtbl = &ddi7wvt;
185 This->ref = 1;
Lionel Ulmer4f640692004-06-04 18:06:37 +0000186 if (dwVersion >= 0x0800) {
187 This->version = 8;
188 } else {
189 /* We do not differientiate between version 1, 2 and 7 */
190 This->version = 1;
191 }
Raphael Junqueirac4050192003-06-16 20:22:13 +0000192 *ppDI = (IDirectInputW*)This;
193 return 0;
Lionel Ulmer4f640692004-06-04 18:06:37 +0000194}
Raphael Junqueirac4050192003-06-16 20:22:13 +0000195
Lionel Ulmer4f640692004-06-04 18:06:37 +0000196static char *_dump_DIDEVTYPE_value(DWORD dwDevType) {
197 switch (dwDevType) {
198 case 0: return "All devices";
199 case DIDEVTYPE_MOUSE: return "DIDEVTYPE_MOUSE";
200 case DIDEVTYPE_KEYBOARD: return "DIDEVTYPE_KEYBOARD";
201 case DIDEVTYPE_JOYSTICK: return "DIDEVTYPE_JOYSTICK";
202 case DIDEVTYPE_DEVICE: return "DIDEVTYPE_DEVICE";
203 default: return "Unkown";
204 }
205}
206
207static void _dump_EnumDevices_dwFlags(DWORD dwFlags) {
208 if (TRACE_ON(dinput)) {
Hans Leidekkerfe442b22004-09-08 01:23:57 +0000209 unsigned int i;
Lionel Ulmer4f640692004-06-04 18:06:37 +0000210 static const struct {
211 DWORD mask;
212 const char *name;
213 } flags[] = {
214#define FE(x) { x, #x}
215 FE(DIEDFL_ALLDEVICES),
216 FE(DIEDFL_ATTACHEDONLY),
217 FE(DIEDFL_FORCEFEEDBACK),
218 FE(DIEDFL_INCLUDEALIASES),
219 FE(DIEDFL_INCLUDEPHANTOMS)
220#undef FE
221 };
222 if (dwFlags == 0) {
223 DPRINTF("DIEDFL_ALLDEVICES");
224 return;
225 }
226 for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++)
227 if (flags[i].mask & dwFlags)
228 DPRINTF("%s ",flags[i].name);
229 }
Raphael Junqueirac4050192003-06-16 20:22:13 +0000230}
231
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000232/******************************************************************************
Alexandre Julliarda845b881998-06-01 10:44:35 +0000233 * IDirectInputA_EnumDevices
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000234 */
Francois Gougetb233fc31999-02-22 09:52:54 +0000235static HRESULT WINAPI IDirectInputAImpl_EnumDevices(
Alexandre Julliarde81843b2001-01-28 23:14:25 +0000236 LPDIRECTINPUT7A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback,
Raphael Junqueirac4050192003-06-16 20:22:13 +0000237 LPVOID pvRef, DWORD dwFlags)
Francois Gougetb233fc31999-02-22 09:52:54 +0000238{
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000239 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Lionel Ulmer4f640692004-06-04 18:06:37 +0000240 DIDEVICEINSTANCEA devInstance;
Robert Reif76447ec2004-09-13 19:16:47 +0000241 int i, j, r;
Lionel Ulmer4f640692004-06-04 18:06:37 +0000242
243 TRACE("(this=%p,0x%04lx '%s',%p,%p,%04lx)\n",
244 This, dwDevType, _dump_DIDEVTYPE_value(dwDevType),
245 lpCallback, pvRef, dwFlags);
246 TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n");
247
248 for (i = 0; i < nrof_dinput_devices; i++) {
Robert Reif76447ec2004-09-13 19:16:47 +0000249 for (j = 0, r = -1; r != 0; j++) {
250 devInstance.dwSize = sizeof(devInstance);
251 TRACE(" - checking device %d ('%s')\n", i, dinput_devices[i]->name);
252 if ((r = dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->version, j))) {
253 if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
254 return 0;
255 }
Raphael Junqueirac4050192003-06-16 20:22:13 +0000256 }
Lionel Ulmer4f640692004-06-04 18:06:37 +0000257 }
258
259 return 0;
Raphael Junqueirac4050192003-06-16 20:22:13 +0000260}
261/******************************************************************************
262 * IDirectInputW_EnumDevices
263 */
264static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
265 LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback,
266 LPVOID pvRef, DWORD dwFlags)
267{
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000268 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Lionel Ulmer4f640692004-06-04 18:06:37 +0000269 DIDEVICEINSTANCEW devInstance;
Robert Reif76447ec2004-09-13 19:16:47 +0000270 int i, j, r;
Lionel Ulmer4f640692004-06-04 18:06:37 +0000271
272 TRACE("(this=%p,0x%04lx '%s',%p,%p,%04lx)\n",
273 This, dwDevType, _dump_DIDEVTYPE_value(dwDevType),
274 lpCallback, pvRef, dwFlags);
275 TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n");
276
277 for (i = 0; i < nrof_dinput_devices; i++) {
Robert Reif76447ec2004-09-13 19:16:47 +0000278 for (j = 0, r = -1; r != 0; j++) {
279 devInstance.dwSize = sizeof(devInstance);
280 TRACE(" - checking device %d ('%s')\n", i, dinput_devices[i]->name);
281 if ((r = dinput_devices[i]->enum_deviceW(dwDevType, dwFlags, &devInstance, This->version, j))) {
282 if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
283 return 0;
284 }
Marcus Meissnerbc2ad4a1999-07-27 16:08:59 +0000285 }
Lionel Ulmer4f640692004-06-04 18:06:37 +0000286 }
287
288 return 0;
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000289}
290
Alexandre Julliarde81843b2001-01-28 23:14:25 +0000291static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface)
Francois Gougetb233fc31999-02-22 09:52:54 +0000292{
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000293 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Francois Gougetb233fc31999-02-22 09:52:54 +0000294 return ++(This->ref);
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000295}
296
Alexandre Julliarde81843b2001-01-28 23:14:25 +0000297static ULONG WINAPI IDirectInputAImpl_Release(LPDIRECTINPUT7A iface)
Francois Gougetb233fc31999-02-22 09:52:54 +0000298{
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000299 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Francois Gougetb233fc31999-02-22 09:52:54 +0000300 if (!(--This->ref)) {
301 HeapFree(GetProcessHeap(),0,This);
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000302 return 0;
303 }
Francois Gougetb233fc31999-02-22 09:52:54 +0000304 return This->ref;
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000305}
306
Raphael Junqueirac4050192003-06-16 20:22:13 +0000307static HRESULT WINAPI IDirectInputAImpl_QueryInterface(LPDIRECTINPUT7A iface, REFIID riid, LPVOID *ppobj) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000308 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Raphael Junqueirac4050192003-06-16 20:22:13 +0000309
310 TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
311 if (IsEqualGUID(&IID_IUnknown,riid) ||
312 IsEqualGUID(&IID_IDirectInputA,riid) ||
313 IsEqualGUID(&IID_IDirectInput2A,riid) ||
314 IsEqualGUID(&IID_IDirectInput7A,riid)) {
315 IDirectInputAImpl_AddRef(iface);
316 *ppobj = This;
317 return 0;
318 }
319 TRACE("Unsupported interface !\n");
320 return E_FAIL;
321}
322
323static HRESULT WINAPI IDirectInputWImpl_QueryInterface(LPDIRECTINPUT7W iface, REFIID riid, LPVOID *ppobj) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000324 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Raphael Junqueirac4050192003-06-16 20:22:13 +0000325
326 TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
327 if (IsEqualGUID(&IID_IUnknown,riid) ||
328 IsEqualGUID(&IID_IDirectInputW,riid) ||
329 IsEqualGUID(&IID_IDirectInput2W,riid) ||
330 IsEqualGUID(&IID_IDirectInput7W,riid)) {
331 IDirectInputAImpl_AddRef((LPDIRECTINPUT7A) iface);
332 *ppobj = This;
333 return 0;
334 }
335 TRACE("Unsupported interface !\n");
336 return E_FAIL;
337}
338
Francois Gougetb233fc31999-02-22 09:52:54 +0000339static HRESULT WINAPI IDirectInputAImpl_CreateDevice(
Alexandre Julliarde81843b2001-01-28 23:14:25 +0000340 LPDIRECTINPUT7A iface,REFGUID rguid,LPDIRECTINPUTDEVICEA* pdev,
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000341 LPUNKNOWN punk
342) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000343 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Lionel Ulmer6301e942000-11-05 20:25:02 +0000344 HRESULT ret_value = DIERR_DEVICENOTREG;
345 int i;
Vincent Béron9a624912002-05-31 23:06:46 +0000346
Alexandre Julliard681c75b2000-01-18 05:09:49 +0000347 TRACE("(this=%p,%s,%p,%p)\n",This,debugstr_guid(rguid),pdev,punk);
Lionel Ulmer78e84102000-02-14 19:55:26 +0000348
Lionel Ulmer6301e942000-11-05 20:25:02 +0000349 /* Loop on all the devices to see if anyone matches the given GUID */
350 for (i = 0; i < nrof_dinput_devices; i++) {
351 HRESULT ret;
Raphael Junqueirac4050192003-06-16 20:22:13 +0000352 if ((ret = dinput_devices[i]->create_deviceA(This, rguid, NULL, pdev)) == DI_OK)
Lionel Ulmer6301e942000-11-05 20:25:02 +0000353 return DI_OK;
Lionel Ulmer78e84102000-02-14 19:55:26 +0000354
Lionel Ulmer6301e942000-11-05 20:25:02 +0000355 if (ret == DIERR_NOINTERFACE)
356 ret_value = DIERR_NOINTERFACE;
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000357 }
Lionel Ulmer78e84102000-02-14 19:55:26 +0000358
Lionel Ulmer6301e942000-11-05 20:25:02 +0000359 return ret_value;
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000360}
361
Raphael Junqueirac4050192003-06-16 20:22:13 +0000362static HRESULT WINAPI IDirectInputWImpl_CreateDevice(LPDIRECTINPUT7A iface,
363 REFGUID rguid, LPDIRECTINPUTDEVICEW* pdev, LPUNKNOWN punk) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000364 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Raphael Junqueirac4050192003-06-16 20:22:13 +0000365 HRESULT ret_value = DIERR_DEVICENOTREG;
366 int i;
367
368 TRACE("(this=%p,%s,%p,%p)\n",This,debugstr_guid(rguid),pdev,punk);
369
370 /* Loop on all the devices to see if anyone matches the given GUID */
371 for (i = 0; i < nrof_dinput_devices; i++) {
372 HRESULT ret;
373 if ((ret = dinput_devices[i]->create_deviceW(This, rguid, NULL, pdev)) == DI_OK)
374 return DI_OK;
375
376 if (ret == DIERR_NOINTERFACE)
377 ret_value = DIERR_NOINTERFACE;
378 }
379
380 return ret_value;
381}
382
383static HRESULT WINAPI IDirectInputAImpl_Initialize(LPDIRECTINPUT7A iface, HINSTANCE hinst, DWORD x) {
Alexandre Julliarda11d7b11998-03-01 20:05:02 +0000384 return DIERR_ALREADYINITIALIZED;
385}
386
Alexandre Julliarde81843b2001-01-28 23:14:25 +0000387static HRESULT WINAPI IDirectInputAImpl_GetDeviceStatus(LPDIRECTINPUT7A iface,
Lionel Ulmer75e8a781999-02-24 10:53:30 +0000388 REFGUID rguid) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000389 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Vincent Béron9a624912002-05-31 23:06:46 +0000390
Alexandre Julliard681c75b2000-01-18 05:09:49 +0000391 FIXME("(%p)->(%s): stub\n",This,debugstr_guid(rguid));
Vincent Béron9a624912002-05-31 23:06:46 +0000392
Lionel Ulmer75e8a781999-02-24 10:53:30 +0000393 return DI_OK;
394}
395
Alexandre Julliarde81843b2001-01-28 23:14:25 +0000396static HRESULT WINAPI IDirectInputAImpl_RunControlPanel(LPDIRECTINPUT7A iface,
Alexandre Julliarda3960291999-02-26 11:11:13 +0000397 HWND hwndOwner,
Lionel Ulmer75e8a781999-02-24 10:53:30 +0000398 DWORD dwFlags) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000399 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Alexandre Julliard359f497e1999-07-04 16:02:24 +0000400 FIXME("(%p)->(%08lx,%08lx): stub\n",This, (DWORD) hwndOwner, dwFlags);
Vincent Béron9a624912002-05-31 23:06:46 +0000401
Lionel Ulmer75e8a781999-02-24 10:53:30 +0000402 return DI_OK;
403}
404
Ove Kaavend2d08f02002-06-14 00:39:44 +0000405static HRESULT WINAPI IDirectInput2AImpl_FindDevice(LPDIRECTINPUT7A iface, REFGUID rguid,
Lionel Ulmer6301e942000-11-05 20:25:02 +0000406 LPCSTR pszName, LPGUID pguidInstance) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000407 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Lionel Ulmer6301e942000-11-05 20:25:02 +0000408 FIXME("(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), pszName, pguidInstance);
Vincent Béron9a624912002-05-31 23:06:46 +0000409
Lionel Ulmer6301e942000-11-05 20:25:02 +0000410 return DI_OK;
411}
412
Raphael Junqueirac4050192003-06-16 20:22:13 +0000413static HRESULT WINAPI IDirectInput2WImpl_FindDevice(LPDIRECTINPUT7W iface, REFGUID rguid,
414 LPCWSTR pszName, LPGUID pguidInstance) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000415 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Raphael Junqueirac4050192003-06-16 20:22:13 +0000416 FIXME("(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), debugstr_w(pszName), pguidInstance);
417
418 return DI_OK;
419}
420
Lionel Ulmer6301e942000-11-05 20:25:02 +0000421static HRESULT WINAPI IDirectInput7AImpl_CreateDeviceEx(LPDIRECTINPUT7A iface, REFGUID rguid,
422 REFIID riid, LPVOID* pvOut, LPUNKNOWN lpUnknownOuter)
423{
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000424 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Lionel Ulmer6301e942000-11-05 20:25:02 +0000425 HRESULT ret_value = DIERR_DEVICENOTREG;
426 int i;
Vincent Béron9a624912002-05-31 23:06:46 +0000427
Lionel Ulmer6301e942000-11-05 20:25:02 +0000428 TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter);
429
430 /* Loop on all the devices to see if anyone matches the given GUID */
431 for (i = 0; i < nrof_dinput_devices; i++) {
432 HRESULT ret;
Raphael Junqueirac4050192003-06-16 20:22:13 +0000433 if ((ret = dinput_devices[i]->create_deviceA(This, rguid, riid, (LPDIRECTINPUTDEVICEA*) pvOut)) == DI_OK)
Lionel Ulmer6301e942000-11-05 20:25:02 +0000434 return DI_OK;
Vincent Béron9a624912002-05-31 23:06:46 +0000435
Lionel Ulmer6301e942000-11-05 20:25:02 +0000436 if (ret == DIERR_NOINTERFACE)
437 ret_value = DIERR_NOINTERFACE;
438 }
Vincent Béron9a624912002-05-31 23:06:46 +0000439
Lionel Ulmer6301e942000-11-05 20:25:02 +0000440 return ret_value;
441}
442
Raphael Junqueirac4050192003-06-16 20:22:13 +0000443static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx(LPDIRECTINPUT7W iface, REFGUID rguid,
444 REFIID riid, LPVOID* pvOut, LPUNKNOWN lpUnknownOuter)
445{
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000446 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Raphael Junqueirac4050192003-06-16 20:22:13 +0000447 HRESULT ret_value = DIERR_DEVICENOTREG;
448 int i;
449
450 TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter);
451
452 /* Loop on all the devices to see if anyone matches the given GUID */
453 for (i = 0; i < nrof_dinput_devices; i++) {
454 HRESULT ret;
455 if ((ret = dinput_devices[i]->create_deviceW(This, rguid, riid, (LPDIRECTINPUTDEVICEW*) pvOut)) == DI_OK)
456 return DI_OK;
457
458 if (ret == DIERR_NOINTERFACE)
459 ret_value = DIERR_NOINTERFACE;
460 }
461
462 return ret_value;
463}
464
465static HRESULT WINAPI IDirectInput8AImpl_QueryInterface(LPDIRECTINPUT8A iface, REFIID riid, LPVOID *ppobj) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000466 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Patrik Stridvall23447982001-07-26 21:44:44 +0000467
Ove Kaavend2d08f02002-06-14 00:39:44 +0000468 TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
469 if (IsEqualGUID(&IID_IUnknown,riid) ||
470 IsEqualGUID(&IID_IDirectInput8A,riid)) {
Raphael Junqueirac4050192003-06-16 20:22:13 +0000471 IDirectInputAImpl_AddRef((LPDIRECTINPUT7A) iface);
Ove Kaavend2d08f02002-06-14 00:39:44 +0000472 *ppobj = This;
473 return 0;
474 }
475 TRACE("Unsupported interface !\n");
Raphael Junqueirac4050192003-06-16 20:22:13 +0000476 return E_NOINTERFACE;
477}
478
479static HRESULT WINAPI IDirectInput8WImpl_QueryInterface(LPDIRECTINPUT8W iface, REFIID riid, LPVOID *ppobj) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000480 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Raphael Junqueirac4050192003-06-16 20:22:13 +0000481
482 TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
483 if (IsEqualGUID(&IID_IUnknown,riid) ||
484 IsEqualGUID(&IID_IDirectInput8W,riid)) {
485 IDirectInputAImpl_AddRef((LPDIRECTINPUT7A) iface);
486 *ppobj = This;
487 return 0;
488 }
489 TRACE("Unsupported interface !\n");
490 return E_NOINTERFACE;
Ove Kaavend2d08f02002-06-14 00:39:44 +0000491}
492
493static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
494 LPDIRECTINPUT8A iface, LPCSTR ptszUserName, LPDIACTIONFORMATA lpdiActionFormat,
495 LPDIENUMDEVICESBYSEMANTICSCBA lpCallback,
496 LPVOID pvRef, DWORD dwFlags
497)
Paul Quinn2305f3c1999-05-22 11:41:38 +0000498{
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000499 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Ove Kaavend2d08f02002-06-14 00:39:44 +0000500
501 FIXME("(this=%p,%s,%p,%p,%p,%04lx): stub\n", This, ptszUserName, lpdiActionFormat,
502 lpCallback, pvRef, dwFlags);
503 return 0;
504}
505
Raphael Junqueirac4050192003-06-16 20:22:13 +0000506static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
507 LPDIRECTINPUT8W iface, LPCWSTR ptszUserName, LPDIACTIONFORMATW lpdiActionFormat,
508 LPDIENUMDEVICESBYSEMANTICSCBW lpCallback,
509 LPVOID pvRef, DWORD dwFlags
510)
511{
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000512 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Raphael Junqueirac4050192003-06-16 20:22:13 +0000513
514 FIXME("(this=%p,%s,%p,%p,%p,%04lx): stub\n", This, debugstr_w(ptszUserName), lpdiActionFormat,
515 lpCallback, pvRef, dwFlags);
516 return 0;
517}
518
Ove Kaavend2d08f02002-06-14 00:39:44 +0000519static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(
520 LPDIRECTINPUT8A iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback,
521 LPDICONFIGUREDEVICESPARAMSA lpdiCDParams, DWORD dwFlags, LPVOID pvRefData
522)
523{
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000524 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Raphael Junqueirac4050192003-06-16 20:22:13 +0000525
526 FIXME("(this=%p,%p,%p,%04lx,%p): stub\n", This, lpdiCallback, lpdiCDParams,
527 dwFlags, pvRefData);
528 return 0;
529}
530
531static HRESULT WINAPI IDirectInput8WImpl_ConfigureDevices(
532 LPDIRECTINPUT8W iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback,
533 LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData
534)
535{
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000536 IDirectInputImpl *This = (IDirectInputImpl *)iface;
Ove Kaavend2d08f02002-06-14 00:39:44 +0000537
538 FIXME("(this=%p,%p,%p,%04lx,%p): stub\n", This, lpdiCallback, lpdiCDParams,
539 dwFlags, pvRefData);
540 return 0;
541}
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000542
Lionel Ulmer6301e942000-11-05 20:25:02 +0000543#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
Ove Kaavend2d08f02002-06-14 00:39:44 +0000544# define XCAST(fun) (typeof(ddi7avt.fun))
Lionel Ulmer6301e942000-11-05 20:25:02 +0000545#else
546# define XCAST(fun) (void*)
Lionel Ulmer5e6d0622000-02-26 13:15:17 +0000547#endif
548
Alexandre Julliard48c4bb32004-08-12 23:00:51 +0000549static IDirectInput7AVtbl ddi7avt = {
Lionel Ulmer6301e942000-11-05 20:25:02 +0000550 XCAST(QueryInterface)IDirectInputAImpl_QueryInterface,
551 XCAST(AddRef)IDirectInputAImpl_AddRef,
552 XCAST(Release)IDirectInputAImpl_Release,
553 XCAST(CreateDevice)IDirectInputAImpl_CreateDevice,
554 XCAST(EnumDevices)IDirectInputAImpl_EnumDevices,
555 XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus,
556 XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel,
557 XCAST(Initialize)IDirectInputAImpl_Initialize,
558 XCAST(FindDevice)IDirectInput2AImpl_FindDevice,
Raphael Junqueirac4050192003-06-16 20:22:13 +0000559 XCAST(CreateDeviceEx)IDirectInput7AImpl_CreateDeviceEx
560};
561
562#undef XCAST
563#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
564# define XCAST(fun) (typeof(ddi7wvt.fun))
565#else
566# define XCAST(fun) (void*)
567#endif
568
Alexandre Julliard48c4bb32004-08-12 23:00:51 +0000569static IDirectInput7WVtbl ddi7wvt = {
Raphael Junqueirac4050192003-06-16 20:22:13 +0000570 XCAST(QueryInterface)IDirectInputWImpl_QueryInterface,
571 XCAST(AddRef)IDirectInputAImpl_AddRef,
572 XCAST(Release)IDirectInputAImpl_Release,
573 XCAST(CreateDevice)IDirectInputWImpl_CreateDevice,
574 XCAST(EnumDevices)IDirectInputWImpl_EnumDevices,
575 XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus,
576 XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel,
577 XCAST(Initialize)IDirectInputAImpl_Initialize,
578 XCAST(FindDevice)IDirectInput2WImpl_FindDevice,
579 XCAST(CreateDeviceEx)IDirectInput7WImpl_CreateDeviceEx
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000580};
Lionel Ulmer6301e942000-11-05 20:25:02 +0000581#undef XCAST
Patrik Stridvall55ef9a52000-04-24 18:03:54 +0000582
Ove Kaavend2d08f02002-06-14 00:39:44 +0000583#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
584# define XCAST(fun) (typeof(ddi8avt.fun))
585#else
586# define XCAST(fun) (void*)
587#endif
588
Alexandre Julliard48c4bb32004-08-12 23:00:51 +0000589static IDirectInput8AVtbl ddi8avt = {
Ove Kaavend2d08f02002-06-14 00:39:44 +0000590 XCAST(QueryInterface)IDirectInput8AImpl_QueryInterface,
591 XCAST(AddRef)IDirectInputAImpl_AddRef,
592 XCAST(Release)IDirectInputAImpl_Release,
593 XCAST(CreateDevice)IDirectInputAImpl_CreateDevice,
594 XCAST(EnumDevices)IDirectInputAImpl_EnumDevices,
595 XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus,
596 XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel,
597 XCAST(Initialize)IDirectInputAImpl_Initialize,
598 XCAST(FindDevice)IDirectInput2AImpl_FindDevice,
Raphael Junqueirac4050192003-06-16 20:22:13 +0000599 XCAST(EnumDevicesBySemantics)IDirectInput8AImpl_EnumDevicesBySemantics,
600 XCAST(ConfigureDevices)IDirectInput8AImpl_ConfigureDevices
601};
602#undef XCAST
603
604#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
605# define XCAST(fun) (typeof(ddi8wvt.fun))
606#else
607# define XCAST(fun) (void*)
608#endif
Alexandre Julliard48c4bb32004-08-12 23:00:51 +0000609static IDirectInput8WVtbl ddi8wvt = {
Raphael Junqueirac4050192003-06-16 20:22:13 +0000610 XCAST(QueryInterface)IDirectInput8WImpl_QueryInterface,
611 XCAST(AddRef)IDirectInputAImpl_AddRef,
612 XCAST(Release)IDirectInputAImpl_Release,
613 XCAST(CreateDevice)IDirectInputWImpl_CreateDevice,
614 XCAST(EnumDevices)IDirectInputWImpl_EnumDevices,
615 XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus,
616 XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel,
617 XCAST(Initialize)IDirectInputAImpl_Initialize,
618 XCAST(FindDevice)IDirectInput2WImpl_FindDevice,
619 XCAST(EnumDevicesBySemantics)IDirectInput8WImpl_EnumDevicesBySemantics,
620 XCAST(ConfigureDevices)IDirectInput8WImpl_ConfigureDevices
Ove Kaavend2d08f02002-06-14 00:39:44 +0000621};
622#undef XCAST
623
Christian Costab92a58e2003-04-29 22:43:48 +0000624/*******************************************************************************
625 * DirectInput ClassFactory
626 */
627typedef struct
628{
629 /* IUnknown fields */
Alexandre Julliard0467ce92004-08-12 19:52:49 +0000630 IClassFactoryVtbl *lpVtbl;
Christian Costab92a58e2003-04-29 22:43:48 +0000631 DWORD ref;
632} IClassFactoryImpl;
633
634static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000635 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
Christian Costab92a58e2003-04-29 22:43:48 +0000636
637 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
638 return E_NOINTERFACE;
639}
640
641static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000642 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
Christian Costab92a58e2003-04-29 22:43:48 +0000643 return ++(This->ref);
644}
645
646static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000647 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
Christian Costab92a58e2003-04-29 22:43:48 +0000648 /* static class, won't be freed */
649 return --(This->ref);
650}
651
652static HRESULT WINAPI DICF_CreateInstance(
653 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
654) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000655 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
Christian Costab92a58e2003-04-29 22:43:48 +0000656
657 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
658 if ( IsEqualGUID( &IID_IDirectInputA, riid ) ||
Raphael Junqueirac4050192003-06-16 20:22:13 +0000659 IsEqualGUID( &IID_IDirectInputW, riid ) ||
Christian Costab92a58e2003-04-29 22:43:48 +0000660 IsEqualGUID( &IID_IDirectInput2A, riid ) ||
Raphael Junqueirac4050192003-06-16 20:22:13 +0000661 IsEqualGUID( &IID_IDirectInput2W, riid ) ||
Christian Costab92a58e2003-04-29 22:43:48 +0000662 IsEqualGUID( &IID_IDirectInput7A, riid ) ||
Raphael Junqueirac4050192003-06-16 20:22:13 +0000663 IsEqualGUID( &IID_IDirectInput7W, riid ) ||
664 IsEqualGUID( &IID_IDirectInput8A, riid ) ||
665 IsEqualGUID( &IID_IDirectInput8W, riid ) ) {
Christian Costab92a58e2003-04-29 22:43:48 +0000666 /* FIXME: reuse already created dinput if present? */
667 return DirectInputCreateEx(0,0,riid,ppobj,pOuter);
668 }
669
670 FIXME("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
671 return E_NOINTERFACE;
672}
673
674static HRESULT WINAPI DICF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
Alexandre Julliard314b99c2004-09-09 20:17:07 +0000675 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
Christian Costab92a58e2003-04-29 22:43:48 +0000676 FIXME("(%p)->(%d),stub!\n",This,dolock);
677 return S_OK;
678}
679
Alexandre Julliard48c4bb32004-08-12 23:00:51 +0000680static IClassFactoryVtbl DICF_Vtbl = {
Christian Costab92a58e2003-04-29 22:43:48 +0000681 DICF_QueryInterface,
682 DICF_AddRef,
683 DICF_Release,
684 DICF_CreateInstance,
685 DICF_LockServer
686};
687static IClassFactoryImpl DINPUT_CF = {&DICF_Vtbl, 1 };
688
Patrik Stridvall55ef9a52000-04-24 18:03:54 +0000689/***********************************************************************
690 * DllCanUnloadNow (DINPUT.@)
691 */
692HRESULT WINAPI DINPUT_DllCanUnloadNow(void)
693{
694 FIXME("(void): stub\n");
695
696 return S_FALSE;
697}
698
699/***********************************************************************
700 * DllGetClassObject (DINPUT.@)
701 */
702HRESULT WINAPI DINPUT_DllGetClassObject(REFCLSID rclsid, REFIID riid,
703 LPVOID *ppv)
704{
Christian Costab92a58e2003-04-29 22:43:48 +0000705 TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
706 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
707 *ppv = (LPVOID)&DINPUT_CF;
708 IClassFactory_AddRef((IClassFactory*)*ppv);
709 return S_OK;
710 }
Patrik Stridvall55ef9a52000-04-24 18:03:54 +0000711
Christian Costab92a58e2003-04-29 22:43:48 +0000712 FIXME("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
Patrik Stridvall55ef9a52000-04-24 18:03:54 +0000713 return CLASS_E_CLASSNOTAVAILABLE;
714}