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