Fixed DLLMODE handling (--mode is now --subsystem and uses -Wb).
[wine] / dlls / dinput / device.c
1 /*              DirectInput Device
2  *
3  * Copyright 1998 Marcus Meissner
4  * Copyright 1998,1999 Lionel Ulmer
5  *
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 /* This file contains all the Device specific functions that can be used as stubs
23    by real device implementations.
24
25    It also contains all the helper functions.
26 */
27 #include "config.h"
28
29 #include <stdarg.h>
30 #include <string.h>
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
33 #include "windef.h"
34 #include "winbase.h"
35 #include "winerror.h"
36 #include "dinput.h"
37 #include "device_private.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(dinput);
40
41 /******************************************************************************
42  *      Various debugging tools
43  */
44 void _dump_cooperativelevel_DI(DWORD dwFlags) {
45   int   i;
46   const struct {
47     DWORD       mask;
48     const char  *name;
49   } flags[] = {
50 #define FE(x) { x, #x},
51     FE(DISCL_BACKGROUND)
52     FE(DISCL_EXCLUSIVE)
53     FE(DISCL_FOREGROUND)
54     FE(DISCL_NONEXCLUSIVE)
55 #undef FE
56   };
57   for (i=0;i<sizeof(flags)/sizeof(flags[0]);i++)
58     if (flags[i].mask & dwFlags)
59       DPRINTF("%s ",flags[i].name);
60   DPRINTF("\n");
61 }
62
63 void _dump_EnumObjects_flags(DWORD dwFlags) {
64   int   i;
65   const struct {
66     DWORD       mask;
67     const char  *name;
68   } flags[] = {
69 #define FE(x) { x, #x},
70     FE(DIDFT_ABSAXIS)
71     FE(DIDFT_ALL)
72     FE(DIDFT_AXIS)
73     FE(DIDFT_BUTTON)
74     FE(DIDFT_COLLECTION)
75     FE(DIDFT_FFACTUATOR)
76     FE(DIDFT_FFEFFECTTRIGGER)
77     FE(DIDFT_NOCOLLECTION)
78     FE(DIDFT_NODATA)
79     FE(DIDFT_OUTPUT)
80     FE(DIDFT_POV)
81     FE(DIDFT_PSHBUTTON)
82     FE(DIDFT_RELAXIS)
83     FE(DIDFT_TGLBUTTON)
84 #undef FE
85   };
86   if (dwFlags == DIDFT_ALL) {
87     DPRINTF("DIDFT_ALL");
88     return;
89   }
90   for (i=0;i<sizeof(flags)/sizeof(flags[0]);i++)
91     if (flags[i].mask & dwFlags)
92       DPRINTF("%s ",flags[i].name);
93   if (dwFlags & DIDFT_INSTANCEMASK)
94     DPRINTF("Instance(%04lx) ", dwFlags >> 8);
95 }
96
97 void _dump_DIPROPHEADER(DIPROPHEADER *diph) {
98   DPRINTF("  - dwObj = 0x%08lx\n", diph->dwObj);
99   DPRINTF("  - dwHow = %s\n",
100           ((diph->dwHow == DIPH_DEVICE) ? "DIPH_DEVICE" :
101            ((diph->dwHow == DIPH_BYOFFSET) ? "DIPH_BYOFFSET" :
102             ((diph->dwHow == DIPH_BYID)) ? "DIPH_BYID" : "unknown")));
103 }
104
105 void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) {
106   if (TRACE_ON(dinput)) {
107     DPRINTF("    - enumerating : %s - %2ld - 0x%08lx - %s\n",
108             debugstr_guid(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, ddoi->tszName);
109   }
110 }
111
112 void _dump_OBJECTINSTANCEW(DIDEVICEOBJECTINSTANCEW *ddoi) {
113   if (TRACE_ON(dinput)) {
114     DPRINTF("    - enumerating : %s - %2ld - 0x%08lx - %s\n",
115             debugstr_guid(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, debugstr_w(ddoi->tszName));
116   }
117 }
118
119 /* Conversion between internal data buffer and external data buffer */
120 void fill_DataFormat(void *out, void *in, DataFormat *df) {
121   int i;
122   char *in_c = (char *) in;
123   char *out_c = (char *) out;
124
125   if (df->dt == NULL) {
126     /* This means that the app uses Wine's internal data format */
127     memcpy(out, in, df->internal_format_size);
128   } else {
129     for (i = 0; i < df->size; i++) {
130       if (df->dt[i].offset_in >= 0) {
131         switch (df->dt[i].size) {
132         case 1:
133           TRACE("Copying (c) to %d from %d (value %d)\n",
134                 df->dt[i].offset_out, df->dt[i].offset_in, *((char *) (in_c + df->dt[i].offset_in)));
135           *((char *) (out_c + df->dt[i].offset_out)) = *((char *) (in_c + df->dt[i].offset_in));
136           break;
137
138         case 2:
139           TRACE("Copying (s) to %d from %d (value %d)\n",
140                 df->dt[i].offset_out, df->dt[i].offset_in, *((short *) (in_c + df->dt[i].offset_in)));
141           *((short *) (out_c + df->dt[i].offset_out)) = *((short *) (in_c + df->dt[i].offset_in));
142           break;
143
144         case 4:
145           TRACE("Copying (i) to %d from %d (value %d)\n",
146                 df->dt[i].offset_out, df->dt[i].offset_in, *((int *) (in_c + df->dt[i].offset_in)));
147           *((int *) (out_c + df->dt[i].offset_out)) = *((int *) (in_c + df->dt[i].offset_in));
148           break;
149
150         default:
151           memcpy((out_c + df->dt[i].offset_out), (in_c + df->dt[i].offset_in), df->dt[i].size);
152         }
153       } else {
154         switch (df->dt[i].size) {
155         case 1:
156           TRACE("Copying (c) to %d default value %d\n",
157                 df->dt[i].offset_out, df->dt[i].value);
158           *((char *) (out_c + df->dt[i].offset_out)) = (char) df->dt[i].value;
159           break;
160
161         case 2:
162           TRACE("Copying (s) to %d default value %d\n",
163                 df->dt[i].offset_out, df->dt[i].value);
164           *((short *) (out_c + df->dt[i].offset_out)) = (short) df->dt[i].value;
165           break;
166
167         case 4:
168           TRACE("Copying (i) to %d default value %d\n",
169                 df->dt[i].offset_out, df->dt[i].value);
170           *((int *) (out_c + df->dt[i].offset_out)) = (int) df->dt[i].value;
171           break;
172
173         default:
174           memset((out_c + df->dt[i].offset_out), df->dt[i].size, 0);
175         }
176       }
177     }
178   }
179 }
180
181 DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_format, int *offset) {
182   DataFormat *ret;
183   DataTransform *dt;
184   int i, j;
185   int same = 1;
186   int *done;
187   int index = 0;
188
189   ret = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
190
191   done = (int *) HeapAlloc(GetProcessHeap(), 0, sizeof(int) * asked_format->dwNumObjs);
192   memset(done, 0, sizeof(int) * asked_format->dwNumObjs);
193
194   dt = (DataTransform *) HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform));
195
196   TRACE("Creating DataTransform : \n");
197
198   for (i = 0; i < wine_format->dwNumObjs; i++) {
199     offset[i] = -1;
200
201     for (j = 0; j < asked_format->dwNumObjs; j++) {
202       if (done[j] == 1)
203         continue;
204
205       if (((asked_format->rgodf[j].pguid == NULL) || (IsEqualGUID(wine_format->rgodf[i].pguid, asked_format->rgodf[j].pguid)))
206           &&
207           (wine_format->rgodf[i].dwType & asked_format->rgodf[j].dwType)) {
208
209         done[j] = 1;
210
211         TRACE("Matching : \n");
212         TRACE("   - Asked (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n",
213               j, debugstr_guid(asked_format->rgodf[j].pguid),
214               asked_format->rgodf[j].dwOfs,
215               DIDFT_GETTYPE(asked_format->rgodf[j].dwType), DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType));
216
217         TRACE("   - Wine  (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n",
218               j, debugstr_guid(wine_format->rgodf[i].pguid),
219               wine_format->rgodf[i].dwOfs,
220               DIDFT_GETTYPE(wine_format->rgodf[i].dwType), DIDFT_GETINSTANCE(wine_format->rgodf[i].dwType));
221
222         if (wine_format->rgodf[i].dwType & DIDFT_BUTTON)
223           dt[index].size = sizeof(BYTE);
224         else
225           dt[index].size = sizeof(DWORD);
226         dt[index].offset_in  = wine_format ->rgodf[i].dwOfs;
227         dt[index].offset_out = asked_format->rgodf[j].dwOfs;
228         dt[index].value = 0;
229         index++;
230
231         if (wine_format->rgodf[i].dwOfs != asked_format->rgodf[j].dwOfs)
232           same = 0;
233
234         offset[i] = asked_format->rgodf[j].dwOfs;
235         break;
236       }
237     }
238
239     if (j == asked_format->dwNumObjs)
240       same = 0;
241   }
242
243   TRACE("Setting to default value :\n");
244   for (j = 0; j < asked_format->dwNumObjs; j++) {
245     if (done[j] == 0) {
246       TRACE(" - Asked (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n",
247             j, debugstr_guid(asked_format->rgodf[j].pguid),
248             asked_format->rgodf[j].dwOfs,
249             DIDFT_GETTYPE(asked_format->rgodf[j].dwType), DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType));
250
251
252       if (asked_format->rgodf[j].dwType & DIDFT_BUTTON)
253         dt[index].size = sizeof(BYTE);
254       else
255         dt[index].size = sizeof(DWORD);
256       dt[index].offset_in  = -1;
257       dt[index].offset_out = asked_format->rgodf[j].dwOfs;
258       dt[index].value = 0;
259       index++;
260
261       same = 0;
262     }
263   }
264
265   ret->internal_format_size = wine_format->dwDataSize;
266   ret->size = index;
267   if (same) {
268     ret->dt = NULL;
269     HeapFree(GetProcessHeap(), 0, dt);
270   } else {
271     ret->dt = dt;
272   }
273
274   HeapFree(GetProcessHeap(), 0, done);
275
276   return ret;
277 }
278
279 BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA lpddi, LPVOID lpvRef) {
280   DIDEVICEOBJECTINSTANCEW ddtmp;
281   device_enumobjects_AtoWcb_data* data;
282
283   data = (device_enumobjects_AtoWcb_data*) lpvRef;
284   
285   memset(&ddtmp, 0, sizeof(DIDEVICEINSTANCEW)); 
286
287   ddtmp.dwSize = sizeof(DIDEVICEINSTANCEW);
288   ddtmp.guidType     = lpddi->guidType;
289   ddtmp.dwOfs        = lpddi->dwOfs;
290   ddtmp.dwType       = lpddi->dwType;
291   ddtmp.dwFlags      = lpddi->dwFlags;
292   MultiByteToWideChar(CP_ACP, 0, lpddi->tszName, -1, ddtmp.tszName, MAX_PATH);
293
294   if (lpddi->dwSize == sizeof(DIDEVICEINSTANCEA)) {
295     /**
296      * if dwSize < sizeof(DIDEVICEINSTANCEA of DInput version >= 5)
297      *  force feedback and other newer datas aren't available
298      */
299     ddtmp.dwFFMaxForce        = lpddi->dwFFMaxForce;
300     ddtmp.dwFFForceResolution = lpddi->dwFFForceResolution;
301     ddtmp.wCollectionNumber   = lpddi->wCollectionNumber;
302     ddtmp.wDesignatorIndex    = lpddi->wDesignatorIndex;
303     ddtmp.wUsagePage          = lpddi->wUsagePage;
304     ddtmp.wUsage              = lpddi->wUsage;
305     ddtmp.dwDimension         = lpddi->dwDimension;
306     ddtmp.wExponent           = lpddi->wExponent;
307     ddtmp.wReserved           = lpddi->wReserved;
308   }
309   return data->lpCallBack(&ddtmp, data->lpvRef);
310 }
311
312 /******************************************************************************
313  *      IDirectInputDeviceA
314  */
315
316 HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
317         LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df
318 ) {
319   int i;
320   ICOM_THIS(IDirectInputDevice2AImpl,iface);
321
322   TRACE("(this=%p,%p)\n",This,df);
323
324   TRACE("df.dwSize=%ld\n",df->dwSize);
325   TRACE("(df.dwObjsize=%ld)\n",df->dwObjSize);
326   TRACE("(df.dwFlags=0x%08lx)\n",df->dwFlags);
327   TRACE("(df.dwDataSize=%ld)\n",df->dwDataSize);
328   TRACE("(df.dwNumObjs=%ld)\n",df->dwNumObjs);
329
330   for (i=0;i<df->dwNumObjs;i++) {
331     TRACE("df.rgodf[%d].guid %s\n",i,debugstr_guid(df->rgodf[i].pguid));
332     TRACE("df.rgodf[%d].dwOfs %ld\n",i,df->rgodf[i].dwOfs);
333     TRACE("dwType 0x%02x,dwInstance %d\n",DIDFT_GETTYPE(df->rgodf[i].dwType),DIDFT_GETINSTANCE(df->rgodf[i].dwType));
334     TRACE("df.rgodf[%d].dwFlags 0x%08lx\n",i,df->rgodf[i].dwFlags);
335   }
336   return DI_OK;
337 }
338
339 HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
340         LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags
341 ) {
342         ICOM_THIS(IDirectInputDevice2AImpl,iface);
343         TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags);
344         if (TRACE_ON(dinput)) {
345             TRACE(" cooperative level : ");
346             _dump_cooperativelevel_DI(dwflags);
347         }
348         return DI_OK;
349 }
350
351 HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
352         LPDIRECTINPUTDEVICE8A iface,HANDLE hnd
353 ) {
354         ICOM_THIS(IDirectInputDevice2AImpl,iface);
355         FIXME("(this=%p,0x%08lx): stub\n",This,(DWORD)hnd);
356         return DI_OK;
357 }
358
359 ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface)
360 {
361         ICOM_THIS(IDirectInputDevice2AImpl,iface);
362         This->ref--;
363         if (This->ref)
364                 return This->ref;
365         HeapFree(GetProcessHeap(),0,This);
366         return DI_OK;
367 }
368
369 HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(
370         LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj
371 )
372 {
373         ICOM_THIS(IDirectInputDevice2AImpl,iface);
374
375         TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
376         if (IsEqualGUID(&IID_IUnknown,riid)) {
377                 IDirectInputDevice2_AddRef(iface);
378                 *ppobj = This;
379                 return DI_OK;
380         }
381         if (IsEqualGUID(&IID_IDirectInputDeviceA,riid)) {
382                 IDirectInputDevice2_AddRef(iface);
383                 *ppobj = This;
384                 return DI_OK;
385         }
386         if (IsEqualGUID(&IID_IDirectInputDevice2A,riid)) {
387                 IDirectInputDevice2_AddRef(iface);
388                 *ppobj = This;
389                 return DI_OK;
390         }
391         if (IsEqualGUID(&IID_IDirectInputDevice7A,riid)) {
392                 IDirectInputDevice7_AddRef(iface);
393                 *ppobj = This;
394                 return DI_OK;
395         }
396         TRACE("Unsupported interface !\n");
397         return E_FAIL;
398 }
399
400 HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(
401         LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj
402 )
403 {
404         ICOM_THIS(IDirectInputDevice2AImpl,iface);
405
406         TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
407         if (IsEqualGUID(&IID_IUnknown,riid)) {
408                 IDirectInputDevice2_AddRef(iface);
409                 *ppobj = This;
410                 return DI_OK;
411         }
412         if (IsEqualGUID(&IID_IDirectInputDeviceW,riid)) {
413                 IDirectInputDevice2_AddRef(iface);
414                 *ppobj = This;
415                 return DI_OK;
416         }
417         if (IsEqualGUID(&IID_IDirectInputDevice2W,riid)) {
418                 IDirectInputDevice2_AddRef(iface);
419                 *ppobj = This;
420                 return DI_OK;
421         }
422         if (IsEqualGUID(&IID_IDirectInputDevice7W,riid)) {
423                 IDirectInputDevice7_AddRef(iface);
424                 *ppobj = This;
425                 return DI_OK;
426         }
427         TRACE("Unsupported interface !\n");
428         return E_FAIL;
429 }
430
431 ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
432         LPDIRECTINPUTDEVICE8A iface)
433 {
434         ICOM_THIS(IDirectInputDevice2AImpl,iface);
435         return ++This->ref;
436 }
437
438 HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
439         LPDIRECTINPUTDEVICE8A iface,
440         LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
441         LPVOID lpvRef,
442         DWORD dwFlags)
443 {
444         FIXME("(this=%p,%p,%p,%08lx): stub!\n", iface, lpCallback, lpvRef, dwFlags);
445         if (TRACE_ON(dinput)) {
446           DPRINTF("  - flags = ");
447           _dump_EnumObjects_flags(dwFlags);
448           DPRINTF("\n");
449         }
450
451         return DI_OK;
452 }
453
454 HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
455         LPDIRECTINPUTDEVICE8W iface,
456         LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
457         LPVOID lpvRef,
458         DWORD dwFlags)
459 {
460         FIXME("(this=%p,%p,%p,%08lx): stub!\n", iface, lpCallback, lpvRef, dwFlags);
461         if (TRACE_ON(dinput)) {
462           DPRINTF("  - flags = ");
463           _dump_EnumObjects_flags(dwFlags);
464           DPRINTF("\n");
465         }
466
467         return DI_OK;
468 }
469
470 HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
471         LPDIRECTINPUTDEVICE8A iface,
472         REFGUID rguid,
473         LPDIPROPHEADER pdiph)
474 {
475         FIXME("(this=%p,%s,%p): stub!\n",
476               iface, debugstr_guid(rguid), pdiph);
477
478         if (TRACE_ON(dinput))
479           _dump_DIPROPHEADER(pdiph);
480
481         return DI_OK;
482 }
483
484 HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
485         LPDIRECTINPUTDEVICE8A iface,
486         LPDIDEVICEOBJECTINSTANCEA pdidoi,
487         DWORD dwObj,
488         DWORD dwHow)
489 {
490         FIXME("(this=%p,%p,%ld,0x%08lx): stub!\n",
491               iface, pdidoi, dwObj, dwHow);
492
493         return DI_OK;
494 }
495
496 HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(
497         LPDIRECTINPUTDEVICE8W iface,
498         LPDIDEVICEOBJECTINSTANCEW pdidoi,
499         DWORD dwObj,
500         DWORD dwHow)
501 {
502         FIXME("(this=%p,%p,%ld,0x%08lx): stub!\n",
503               iface, pdidoi, dwObj, dwHow);
504
505         return DI_OK;
506 }
507
508 HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
509         LPDIRECTINPUTDEVICE8A iface,
510         LPDIDEVICEINSTANCEA pdidi)
511 {
512         FIXME("(this=%p,%p): stub!\n",
513               iface, pdidi);
514
515         return DI_OK;
516 }
517 HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo(
518         LPDIRECTINPUTDEVICE8W iface,
519         LPDIDEVICEINSTANCEW pdidi)
520 {
521         FIXME("(this=%p,%p): stub!\n",
522               iface, pdidi);
523
524         return DI_OK;
525 }
526
527 HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
528         LPDIRECTINPUTDEVICE8A iface,
529         HWND hwndOwner,
530         DWORD dwFlags)
531 {
532   FIXME("(this=%p,%p,0x%08lx): stub!\n",
533         iface, hwndOwner, dwFlags);
534
535         return DI_OK;
536 }
537
538 HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
539         LPDIRECTINPUTDEVICE8A iface,
540         HINSTANCE hinst,
541         DWORD dwVersion,
542         REFGUID rguid)
543 {
544         FIXME("(this=%p,%p,%ld,%s): stub!\n",
545               iface, hinst, dwVersion, debugstr_guid(rguid));
546         return DI_OK;
547 }
548
549 /******************************************************************************
550  *      IDirectInputDevice2A
551  */
552
553 HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(
554         LPDIRECTINPUTDEVICE8A iface,
555         REFGUID rguid,
556         LPCDIEFFECT lpeff,
557         LPDIRECTINPUTEFFECT *ppdef,
558         LPUNKNOWN pUnkOuter)
559 {
560         FIXME("(this=%p,%s,%p,%p,%p): stub!\n",
561               iface, debugstr_guid(rguid), lpeff, ppdef, pUnkOuter);
562         return DI_OK;
563 }
564
565 HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
566         LPDIRECTINPUTDEVICE8A iface,
567         LPDIENUMEFFECTSCALLBACKA lpCallback,
568         LPVOID lpvRef,
569         DWORD dwFlags)
570 {
571         FIXME("(this=%p,%p,%p,0x%08lx): stub!\n",
572               iface, lpCallback, lpvRef, dwFlags);
573
574         if (lpCallback)
575                 lpCallback(NULL, lpvRef);
576         return DI_OK;
577 }
578
579 HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
580         LPDIRECTINPUTDEVICE8W iface,
581         LPDIENUMEFFECTSCALLBACKW lpCallback,
582         LPVOID lpvRef,
583         DWORD dwFlags)
584 {
585         FIXME("(this=%p,%p,%p,0x%08lx): stub!\n",
586               iface, lpCallback, lpvRef, dwFlags);
587
588         if (lpCallback)
589                 lpCallback(NULL, lpvRef);
590         return DI_OK;
591 }
592
593 HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
594         LPDIRECTINPUTDEVICE8A iface,
595         LPDIEFFECTINFOA lpdei,
596         REFGUID rguid)
597 {
598         FIXME("(this=%p,%p,%s): stub!\n",
599               iface, lpdei, debugstr_guid(rguid));
600         return DI_OK;
601 }
602
603 HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
604         LPDIRECTINPUTDEVICE8W iface,
605         LPDIEFFECTINFOW lpdei,
606         REFGUID rguid)
607 {
608         FIXME("(this=%p,%p,%s): stub!\n",
609               iface, lpdei, debugstr_guid(rguid));
610         return DI_OK;
611 }
612
613 HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
614         LPDIRECTINPUTDEVICE8A iface,
615         LPDWORD pdwOut)
616 {
617         FIXME("(this=%p,%p): stub!\n",
618               iface, pdwOut);
619         return DI_OK;
620 }
621
622 HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
623         LPDIRECTINPUTDEVICE8A iface,
624         DWORD dwFlags)
625 {
626         FIXME("(this=%p,0x%08lx): stub!\n",
627               iface, dwFlags);
628         return DI_OK;
629 }
630
631 HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
632         LPDIRECTINPUTDEVICE8A iface,
633         LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
634         LPVOID lpvRef,
635         DWORD dwFlags)
636 {
637         FIXME("(this=%p,%p,%p,0x%08lx): stub!\n",
638               iface, lpCallback, lpvRef, dwFlags);
639         if (lpCallback)
640                 lpCallback(NULL, lpvRef);
641         return DI_OK;
642 }
643
644 HRESULT WINAPI IDirectInputDevice2AImpl_Escape(
645         LPDIRECTINPUTDEVICE8A iface,
646         LPDIEFFESCAPE lpDIEEsc)
647 {
648         FIXME("(this=%p,%p): stub!\n",
649               iface, lpDIEEsc);
650         return DI_OK;
651 }
652
653 HRESULT WINAPI IDirectInputDevice2AImpl_Poll(
654         LPDIRECTINPUTDEVICE8A iface)
655 {
656         /* Because wine devices do not need to be polled, just return DI_NOEFFECT */
657         return DI_NOEFFECT;
658 }
659
660 HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
661         LPDIRECTINPUTDEVICE8A iface,
662         DWORD cbObjectData,
663         LPCDIDEVICEOBJECTDATA rgdod,
664         LPDWORD pdwInOut,
665         DWORD dwFlags)
666 {
667         FIXME("(this=%p,0x%08lx,%p,%p,0x%08lx): stub!\n",
668               iface, cbObjectData, rgdod, pdwInOut, dwFlags);
669
670         return DI_OK;
671 }
672
673 HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
674                                                           LPCSTR lpszFileName,
675                                                           LPDIENUMEFFECTSINFILECALLBACK pec,
676                                                           LPVOID pvRef,
677                                                           DWORD dwFlags)
678 {
679   FIXME("(%p)->(%s,%p,%p,%08lx): stub !\n", iface, lpszFileName, pec, pvRef, dwFlags);
680
681   return DI_OK;
682 }
683
684 HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
685                                                           LPCWSTR lpszFileName,
686                                                           LPDIENUMEFFECTSINFILECALLBACK pec,
687                                                           LPVOID pvRef,
688                                                           DWORD dwFlags)
689 {
690   FIXME("(%p)->(%s,%p,%p,%08lx): stub !\n", iface, debugstr_w(lpszFileName), pec, pvRef, dwFlags);
691
692   return DI_OK;
693 }
694
695 HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
696                                                           LPCSTR lpszFileName,
697                                                           DWORD dwEntries,
698                                                           LPDIFILEEFFECT rgDiFileEft,
699                                                           DWORD dwFlags)
700 {
701   FIXME("(%p)->(%s,%08lx,%p,%08lx): stub !\n", iface, lpszFileName, dwEntries, rgDiFileEft, dwFlags);
702
703   return DI_OK;
704 }
705
706 HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
707                                                           LPCWSTR lpszFileName,
708                                                           DWORD dwEntries,
709                                                           LPDIFILEEFFECT rgDiFileEft,
710                                                           DWORD dwFlags)
711 {
712   FIXME("(%p)->(%s,%08lx,%p,%08lx): stub !\n", iface, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags);
713
714   return DI_OK;
715 }
716
717 HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
718                                                        LPDIACTIONFORMATA lpdiaf,
719                                                        LPCSTR lpszUserName,
720                                                        DWORD dwFlags)
721 {
722   FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, lpszUserName, dwFlags);
723
724   return DI_OK;
725 }
726
727 HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
728                                                        LPDIACTIONFORMATW lpdiaf,
729                                                        LPCWSTR lpszUserName,
730                                                        DWORD dwFlags)
731 {
732   FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
733
734   return DI_OK;
735 }
736
737 HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
738                                                      LPDIACTIONFORMATA lpdiaf,
739                                                      LPCSTR lpszUserName,
740                                                      DWORD dwFlags)
741 {
742   FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, lpszUserName, dwFlags);
743
744   return DI_OK;
745 }
746
747 HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
748                                                      LPDIACTIONFORMATW lpdiaf,
749                                                      LPCWSTR lpszUserName,
750                                                      DWORD dwFlags)
751 {
752   FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
753
754   return DI_OK;
755 }
756
757 HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
758                                                      LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader)
759 {
760   FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader);
761
762   return DI_OK;
763 }
764
765 HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
766                                                      LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader)
767 {
768   FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader);
769
770   return DI_OK;
771 }