3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998,1999 Lionel Ulmer
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 /* This file contains all the Device specific functions that can be used as stubs
23 by real device implementations.
25 It also contains all the helper functions.
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
39 #include "device_private.h"
40 #include "dinput_private.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(dinput
);
44 static inline IDirectInputDeviceImpl
*impl_from_IDirectInputDevice8A(IDirectInputDevice8A
*iface
)
46 return CONTAINING_RECORD(iface
, IDirectInputDeviceImpl
, IDirectInputDevice8A_iface
);
48 static inline IDirectInputDeviceImpl
*impl_from_IDirectInputDevice8W(IDirectInputDevice8W
*iface
)
50 return CONTAINING_RECORD(iface
, IDirectInputDeviceImpl
, IDirectInputDevice8W_iface
);
53 static inline IDirectInputDevice8A
*IDirectInputDevice8A_from_impl(IDirectInputDeviceImpl
*This
)
55 return &This
->IDirectInputDevice8A_iface
;
57 static inline IDirectInputDevice8W
*IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl
*This
)
59 return &This
->IDirectInputDevice8W_iface
;
62 /******************************************************************************
63 * Various debugging tools
65 static void _dump_cooperativelevel_DI(DWORD dwFlags
) {
66 if (TRACE_ON(dinput
)) {
72 #define FE(x) { x, #x}
76 FE(DISCL_NONEXCLUSIVE
),
80 TRACE(" cooperative level : ");
81 for (i
= 0; i
< (sizeof(flags
) / sizeof(flags
[0])); i
++)
82 if (flags
[i
].mask
& dwFlags
)
83 TRACE("%s ",flags
[i
].name
);
88 static void _dump_EnumObjects_flags(DWORD dwFlags
) {
89 if (TRACE_ON(dinput
)) {
96 #define FE(x) { x, #x}
102 FE(DIDFT_COLLECTION
),
104 FE(DIDFT_FFACTUATOR
),
105 FE(DIDFT_FFEFFECTTRIGGER
),
107 FE(DIDFT_VENDORDEFINED
),
112 type
= (dwFlags
& 0xFF0000FF);
113 instance
= ((dwFlags
>> 8) & 0xFFFF);
115 if (type
== DIDFT_ALL
) {
118 for (i
= 0; i
< (sizeof(flags
) / sizeof(flags
[0])); i
++) {
119 if (flags
[i
].mask
& type
) {
120 type
&= ~flags
[i
].mask
;
121 TRACE(" %s",flags
[i
].name
);
125 TRACE(" (unhandled: %08x)", type
);
128 TRACE(" / Instance: ");
129 if (instance
== ((DIDFT_ANYINSTANCE
>> 8) & 0xFFFF)) {
130 TRACE("DIDFT_ANYINSTANCE");
132 TRACE("%3d", instance
);
137 void _dump_DIPROPHEADER(LPCDIPROPHEADER diph
) {
138 if (TRACE_ON(dinput
)) {
139 TRACE(" - dwObj = 0x%08x\n", diph
->dwObj
);
140 TRACE(" - dwHow = %s\n",
141 ((diph
->dwHow
== DIPH_DEVICE
) ? "DIPH_DEVICE" :
142 ((diph
->dwHow
== DIPH_BYOFFSET
) ? "DIPH_BYOFFSET" :
143 ((diph
->dwHow
== DIPH_BYID
)) ? "DIPH_BYID" : "unknown")));
147 void _dump_OBJECTINSTANCEA(const DIDEVICEOBJECTINSTANCEA
*ddoi
) {
148 TRACE(" - enumerating : %s ('%s') - %2d - 0x%08x - %s - 0x%x\n",
149 debugstr_guid(&ddoi
->guidType
), _dump_dinput_GUID(&ddoi
->guidType
), ddoi
->dwOfs
, ddoi
->dwType
, ddoi
->tszName
, ddoi
->dwFlags
);
152 void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW
*ddoi
) {
153 TRACE(" - enumerating : %s ('%s'), - %2d - 0x%08x - %s - 0x%x\n",
154 debugstr_guid(&ddoi
->guidType
), _dump_dinput_GUID(&ddoi
->guidType
), ddoi
->dwOfs
, ddoi
->dwType
, debugstr_w(ddoi
->tszName
), ddoi
->dwFlags
);
157 /* This function is a helper to convert a GUID into any possible DInput GUID out there */
158 const char *_dump_dinput_GUID(const GUID
*guid
) {
160 static const struct {
164 #define FE(x) { &x, #x}
177 FE(GUID_SysKeyboard
),
179 FE(GUID_ConstantForce
),
185 FE(GUID_SawtoothDown
),
195 for (i
= 0; i
< (sizeof(guids
) / sizeof(guids
[0])); i
++) {
196 if (IsEqualGUID(guids
[i
].guid
, guid
)) {
197 return guids
[i
].name
;
200 return debugstr_guid(guid
);
203 void _dump_DIDATAFORMAT(const DIDATAFORMAT
*df
) {
206 TRACE("Dumping DIDATAFORMAT structure:\n");
207 TRACE(" - dwSize: %d\n", df
->dwSize
);
208 if (df
->dwSize
!= sizeof(DIDATAFORMAT
)) {
209 WARN("Non-standard DIDATAFORMAT structure size %d\n", df
->dwSize
);
211 TRACE(" - dwObjsize: %d\n", df
->dwObjSize
);
212 if (df
->dwObjSize
!= sizeof(DIOBJECTDATAFORMAT
)) {
213 WARN("Non-standard DIOBJECTDATAFORMAT structure size %d\n", df
->dwObjSize
);
215 TRACE(" - dwFlags: 0x%08x (", df
->dwFlags
);
216 switch (df
->dwFlags
) {
217 case DIDF_ABSAXIS
: TRACE("DIDF_ABSAXIS"); break;
218 case DIDF_RELAXIS
: TRACE("DIDF_RELAXIS"); break;
219 default: TRACE("unknown"); break;
222 TRACE(" - dwDataSize: %d\n", df
->dwDataSize
);
223 TRACE(" - dwNumObjs: %d\n", df
->dwNumObjs
);
225 for (i
= 0; i
< df
->dwNumObjs
; i
++) {
226 TRACE(" - Object %d:\n", i
);
227 TRACE(" * GUID: %s ('%s')\n", debugstr_guid(df
->rgodf
[i
].pguid
), _dump_dinput_GUID(df
->rgodf
[i
].pguid
));
228 TRACE(" * dwOfs: %d\n", df
->rgodf
[i
].dwOfs
);
229 TRACE(" * dwType: 0x%08x\n", df
->rgodf
[i
].dwType
);
230 TRACE(" "); _dump_EnumObjects_flags(df
->rgodf
[i
].dwType
); TRACE("\n");
231 TRACE(" * dwFlags: 0x%08x\n", df
->rgodf
[i
].dwFlags
);
235 /******************************************************************************
236 * Get the default and the app-specific config keys.
238 BOOL
get_app_key(HKEY
*defkey
, HKEY
*appkey
)
240 char buffer
[MAX_PATH
+16];
245 /* @@ Wine registry key: HKCU\Software\Wine\DirectInput */
246 if (RegOpenKeyA(HKEY_CURRENT_USER
, "Software\\Wine\\DirectInput", defkey
))
249 len
= GetModuleFileNameA(0, buffer
, MAX_PATH
);
250 if (len
&& len
< MAX_PATH
)
254 /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectInput */
255 if (!RegOpenKeyA(HKEY_CURRENT_USER
, "Software\\Wine\\AppDefaults", &tmpkey
))
257 char *p
, *appname
= buffer
;
258 if ((p
= strrchr(appname
, '/'))) appname
= p
+ 1;
259 if ((p
= strrchr(appname
, '\\'))) appname
= p
+ 1;
260 strcat(appname
, "\\DirectInput");
262 if (RegOpenKeyA(tmpkey
, appname
, appkey
)) *appkey
= 0;
267 return *defkey
|| *appkey
;
270 /******************************************************************************
271 * Get a config key from either the app-specific or the default config
273 DWORD
get_config_key( HKEY defkey
, HKEY appkey
, const char *name
,
274 char *buffer
, DWORD size
)
276 if (appkey
&& !RegQueryValueExA( appkey
, name
, 0, NULL
, (LPBYTE
)buffer
, &size
))
279 if (defkey
&& !RegQueryValueExA( defkey
, name
, 0, NULL
, (LPBYTE
)buffer
, &size
))
282 return ERROR_FILE_NOT_FOUND
;
285 /* Conversion between internal data buffer and external data buffer */
286 void fill_DataFormat(void *out
, DWORD size
, const void *in
, const DataFormat
*df
)
289 const char *in_c
= in
;
292 memset(out
, 0, size
);
293 if (df
->dt
== NULL
) {
294 /* This means that the app uses Wine's internal data format */
295 memcpy(out
, in
, min(size
, df
->internal_format_size
));
297 for (i
= 0; i
< df
->size
; i
++) {
298 if (df
->dt
[i
].offset_in
>= 0) {
299 switch (df
->dt
[i
].size
) {
301 TRACE("Copying (c) to %d from %d (value %d)\n",
302 df
->dt
[i
].offset_out
, df
->dt
[i
].offset_in
, *(in_c
+ df
->dt
[i
].offset_in
));
303 *(out_c
+ df
->dt
[i
].offset_out
) = *(in_c
+ df
->dt
[i
].offset_in
);
307 TRACE("Copying (s) to %d from %d (value %d)\n",
308 df
->dt
[i
].offset_out
, df
->dt
[i
].offset_in
, *((const short *)(in_c
+ df
->dt
[i
].offset_in
)));
309 *((short *)(out_c
+ df
->dt
[i
].offset_out
)) = *((const short *)(in_c
+ df
->dt
[i
].offset_in
));
313 TRACE("Copying (i) to %d from %d (value %d)\n",
314 df
->dt
[i
].offset_out
, df
->dt
[i
].offset_in
, *((const int *)(in_c
+ df
->dt
[i
].offset_in
)));
315 *((int *)(out_c
+ df
->dt
[i
].offset_out
)) = *((const int *)(in_c
+ df
->dt
[i
].offset_in
));
319 memcpy((out_c
+ df
->dt
[i
].offset_out
), (in_c
+ df
->dt
[i
].offset_in
), df
->dt
[i
].size
);
323 switch (df
->dt
[i
].size
) {
325 TRACE("Copying (c) to %d default value %d\n",
326 df
->dt
[i
].offset_out
, df
->dt
[i
].value
);
327 *(out_c
+ df
->dt
[i
].offset_out
) = (char) df
->dt
[i
].value
;
331 TRACE("Copying (s) to %d default value %d\n",
332 df
->dt
[i
].offset_out
, df
->dt
[i
].value
);
333 *((short *) (out_c
+ df
->dt
[i
].offset_out
)) = (short) df
->dt
[i
].value
;
337 TRACE("Copying (i) to %d default value %d\n",
338 df
->dt
[i
].offset_out
, df
->dt
[i
].value
);
339 *((int *) (out_c
+ df
->dt
[i
].offset_out
)) = df
->dt
[i
].value
;
343 memset((out_c
+ df
->dt
[i
].offset_out
), 0, df
->dt
[i
].size
);
351 void release_DataFormat(DataFormat
* format
)
353 TRACE("Deleting DataFormat: %p\n", format
);
355 HeapFree(GetProcessHeap(), 0, format
->dt
);
357 HeapFree(GetProcessHeap(), 0, format
->offsets
);
358 format
->offsets
= NULL
;
359 HeapFree(GetProcessHeap(), 0, format
->user_df
);
360 format
->user_df
= NULL
;
363 static inline LPDIOBJECTDATAFORMAT
dataformat_to_odf(LPCDIDATAFORMAT df
, int idx
)
365 if (idx
< 0 || idx
>= df
->dwNumObjs
) return NULL
;
366 return (LPDIOBJECTDATAFORMAT
)((LPBYTE
)df
->rgodf
+ idx
* df
->dwObjSize
);
369 /* dataformat_to_odf_by_type
370 * Find the Nth object of the selected type in the DataFormat
372 LPDIOBJECTDATAFORMAT
dataformat_to_odf_by_type(LPCDIDATAFORMAT df
, int n
, DWORD type
)
376 for (i
=0; i
< df
->dwNumObjs
; i
++)
378 LPDIOBJECTDATAFORMAT odf
= dataformat_to_odf(df
, i
);
380 if (odf
->dwType
& type
)
392 static HRESULT
create_DataFormat(LPCDIDATAFORMAT asked_format
, DataFormat
*format
)
401 if (!format
->wine_df
) return DIERR_INVALIDPARAM
;
402 done
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, asked_format
->dwNumObjs
* sizeof(int));
403 dt
= HeapAlloc(GetProcessHeap(), 0, asked_format
->dwNumObjs
* sizeof(DataTransform
));
404 if (!dt
|| !done
) goto failed
;
406 if (!(format
->offsets
= HeapAlloc(GetProcessHeap(), 0, format
->wine_df
->dwNumObjs
* sizeof(int))))
409 if (!(format
->user_df
= HeapAlloc(GetProcessHeap(), 0, asked_format
->dwSize
)))
411 memcpy(format
->user_df
, asked_format
, asked_format
->dwSize
);
413 TRACE("Creating DataTransform :\n");
415 for (i
= 0; i
< format
->wine_df
->dwNumObjs
; i
++)
417 format
->offsets
[i
] = -1;
419 for (j
= 0; j
< asked_format
->dwNumObjs
; j
++) {
423 if (/* Check if the application either requests any GUID and if not, it if matches
424 * the GUID of the Wine object.
426 ((asked_format
->rgodf
[j
].pguid
== NULL
) ||
427 (format
->wine_df
->rgodf
[i
].pguid
== NULL
) ||
428 (IsEqualGUID(format
->wine_df
->rgodf
[i
].pguid
, asked_format
->rgodf
[j
].pguid
)))
430 (/* Then check if it accepts any instance id, and if not, if it matches Wine's
433 ((asked_format
->rgodf
[j
].dwType
& DIDFT_INSTANCEMASK
) == DIDFT_ANYINSTANCE
) ||
434 (DIDFT_GETINSTANCE(asked_format
->rgodf
[j
].dwType
) == 0x00FF) || /* This is mentioned in no DX docs, but it works fine - tested on WinXP */
435 (DIDFT_GETINSTANCE(asked_format
->rgodf
[j
].dwType
) == DIDFT_GETINSTANCE(format
->wine_df
->rgodf
[i
].dwType
)))
437 ( /* Then if the asked type matches the one Wine provides */
438 DIDFT_GETTYPE(asked_format
->rgodf
[j
].dwType
) & format
->wine_df
->rgodf
[i
].dwType
))
442 TRACE("Matching :\n");
443 TRACE(" - Asked (%d) :\n", j
);
444 TRACE(" * GUID: %s ('%s')\n",
445 debugstr_guid(asked_format
->rgodf
[j
].pguid
),
446 _dump_dinput_GUID(asked_format
->rgodf
[j
].pguid
));
447 TRACE(" * Offset: %3d\n", asked_format
->rgodf
[j
].dwOfs
);
448 TRACE(" * dwType: %08x\n", asked_format
->rgodf
[j
].dwType
);
449 TRACE(" "); _dump_EnumObjects_flags(asked_format
->rgodf
[j
].dwType
); TRACE("\n");
451 TRACE(" - Wine (%d) :\n", i
);
452 TRACE(" * GUID: %s ('%s')\n",
453 debugstr_guid(format
->wine_df
->rgodf
[i
].pguid
),
454 _dump_dinput_GUID(format
->wine_df
->rgodf
[i
].pguid
));
455 TRACE(" * Offset: %3d\n", format
->wine_df
->rgodf
[i
].dwOfs
);
456 TRACE(" * dwType: %08x\n", format
->wine_df
->rgodf
[i
].dwType
);
457 TRACE(" "); _dump_EnumObjects_flags(format
->wine_df
->rgodf
[i
].dwType
); TRACE("\n");
459 if (format
->wine_df
->rgodf
[i
].dwType
& DIDFT_BUTTON
)
460 dt
[index
].size
= sizeof(BYTE
);
462 dt
[index
].size
= sizeof(DWORD
);
463 dt
[index
].offset_in
= format
->wine_df
->rgodf
[i
].dwOfs
;
464 dt
[index
].offset_out
= asked_format
->rgodf
[j
].dwOfs
;
465 format
->offsets
[i
] = asked_format
->rgodf
[j
].dwOfs
;
467 next
= next
+ dt
[index
].size
;
469 if (format
->wine_df
->rgodf
[i
].dwOfs
!= dt
[index
].offset_out
)
478 TRACE("Setting to default value :\n");
479 for (j
= 0; j
< asked_format
->dwNumObjs
; j
++) {
481 TRACE(" - Asked (%d) :\n", j
);
482 TRACE(" * GUID: %s ('%s')\n",
483 debugstr_guid(asked_format
->rgodf
[j
].pguid
),
484 _dump_dinput_GUID(asked_format
->rgodf
[j
].pguid
));
485 TRACE(" * Offset: %3d\n", asked_format
->rgodf
[j
].dwOfs
);
486 TRACE(" * dwType: %08x\n", asked_format
->rgodf
[j
].dwType
);
487 TRACE(" "); _dump_EnumObjects_flags(asked_format
->rgodf
[j
].dwType
); TRACE("\n");
489 if (asked_format
->rgodf
[j
].dwType
& DIDFT_BUTTON
)
490 dt
[index
].size
= sizeof(BYTE
);
492 dt
[index
].size
= sizeof(DWORD
);
493 dt
[index
].offset_in
= -1;
494 dt
[index
].offset_out
= asked_format
->rgodf
[j
].dwOfs
;
495 if (asked_format
->rgodf
[j
].dwType
& DIDFT_POV
)
496 dt
[index
].value
= -1;
505 format
->internal_format_size
= format
->wine_df
->dwDataSize
;
506 format
->size
= index
;
508 HeapFree(GetProcessHeap(), 0, dt
);
513 HeapFree(GetProcessHeap(), 0, done
);
518 HeapFree(GetProcessHeap(), 0, done
);
519 HeapFree(GetProcessHeap(), 0, dt
);
521 HeapFree(GetProcessHeap(), 0, format
->offsets
);
522 format
->offsets
= NULL
;
523 HeapFree(GetProcessHeap(), 0, format
->user_df
);
524 format
->user_df
= NULL
;
526 return DIERR_OUTOFMEMORY
;
529 /* find an object by it's offset in a data format */
530 static int offset_to_object(const DataFormat
*df
, int offset
)
534 if (!df
->offsets
) return -1;
536 for (i
= 0; i
< df
->wine_df
->dwNumObjs
; i
++)
537 if (df
->offsets
[i
] == offset
) return i
;
542 int id_to_object(LPCDIDATAFORMAT df
, int id
)
547 for (i
= 0; i
< df
->dwNumObjs
; i
++)
548 if ((dataformat_to_odf(df
, i
)->dwType
& 0x00ffffff) == id
)
554 static int id_to_offset(const DataFormat
*df
, int id
)
556 int obj
= id_to_object(df
->wine_df
, id
);
558 return obj
>= 0 && df
->offsets
? df
->offsets
[obj
] : -1;
561 int find_property(const DataFormat
*df
, LPCDIPROPHEADER ph
)
565 case DIPH_BYID
: return id_to_object(df
->wine_df
, ph
->dwObj
);
566 case DIPH_BYOFFSET
: return offset_to_object(df
, ph
->dwObj
);
568 FIXME("Unhandled ph->dwHow=='%04X'\n", (unsigned int)ph
->dwHow
);
573 static DWORD
semantic_to_obj_id(IDirectInputDeviceImpl
* This
, DWORD dwSemantic
)
575 DWORD type
= (0x0000ff00 & dwSemantic
) >> 8;
576 DWORD offset
= 0x000000ff & dwSemantic
;
577 DWORD obj_instance
= 0;
581 for (i
= 0; i
< This
->data_format
.wine_df
->dwNumObjs
; i
++)
583 LPDIOBJECTDATAFORMAT odf
= dataformat_to_odf(This
->data_format
.wine_df
, i
);
585 if (odf
->dwOfs
== offset
)
587 obj_instance
= DIDFT_GETINSTANCE(odf
->dwType
);
593 if (!found
) return 0;
595 if (type
& DIDFT_AXIS
) type
= DIDFT_RELAXIS
;
596 if (type
& DIDFT_BUTTON
) type
= DIDFT_PSHBUTTON
;
598 return type
| (0x0000ff00 & (obj_instance
<< 8));
603 * Retrieves an open registry key to save the mapping, parametrized for an username,
604 * specific device and specific action mapping guid.
606 static HKEY
get_mapping_key(const WCHAR
*device
, const WCHAR
*username
, const WCHAR
*guid
)
608 static const WCHAR subkey
[] = {
609 'S','o','f','t','w','a','r','e','\\',
610 'W','i','n','e','\\',
611 'D','i','r','e','c','t','I','n','p','u','t','\\',
612 'M','a','p','p','i','n','g','s','\\','%','s','\\','%','s','\\','%','s','\0'};
616 keyname
= HeapAlloc(GetProcessHeap(), 0,
617 sizeof(WCHAR
) * (lstrlenW(subkey
) + strlenW(username
) + strlenW(device
) + strlenW(guid
)));
618 sprintfW(keyname
, subkey
, username
, device
, guid
);
620 /* The key used is HKCU\Software\Wine\DirectInput\Mappings\[username]\[device]\[mapping_guid] */
621 if (RegCreateKeyW(HKEY_CURRENT_USER
, keyname
, &hkey
))
624 HeapFree(GetProcessHeap(), 0, keyname
);
629 static HRESULT
save_mapping_settings(IDirectInputDevice8W
*iface
, LPDIACTIONFORMATW lpdiaf
, LPCWSTR lpszUsername
)
631 WCHAR
*guid_str
= NULL
;
632 DIDEVICEINSTANCEW didev
;
636 didev
.dwSize
= sizeof(didev
);
637 IDirectInputDevice8_GetDeviceInfo(iface
, &didev
);
639 if (StringFromCLSID(&lpdiaf
->guidActionMap
, &guid_str
) != S_OK
)
640 return DI_SETTINGSNOTSAVED
;
642 hkey
= get_mapping_key(didev
.tszInstanceName
, lpszUsername
, guid_str
);
646 CoTaskMemFree(guid_str
);
647 return DI_SETTINGSNOTSAVED
;
650 /* Write each of the actions mapped for this device.
651 Format is "dwSemantic"="dwObjID" and key is of type REG_DWORD
653 for (i
= 0; i
< lpdiaf
->dwNumActions
; i
++)
655 static const WCHAR format
[] = {'%','x','\0'};
658 if (IsEqualGUID(&didev
.guidInstance
, &lpdiaf
->rgoAction
[i
].guidInstance
) &&
659 lpdiaf
->rgoAction
[i
].dwHow
!= DIAH_UNMAPPED
)
661 sprintfW(label
, format
, lpdiaf
->rgoAction
[i
].dwSemantic
);
662 RegSetValueExW(hkey
, label
, 0, REG_DWORD
, (const BYTE
*) &lpdiaf
->rgoAction
[i
].dwObjID
, sizeof(DWORD
));
667 CoTaskMemFree(guid_str
);
672 static BOOL
load_mapping_settings(IDirectInputDeviceImpl
*This
, LPDIACTIONFORMATW lpdiaf
, const WCHAR
*username
)
676 DIDEVICEINSTANCEW didev
;
679 didev
.dwSize
= sizeof(didev
);
680 IDirectInputDevice8_GetDeviceInfo(&This
->IDirectInputDevice8W_iface
, &didev
);
682 if (StringFromCLSID(&lpdiaf
->guidActionMap
, &guid_str
) != S_OK
)
685 hkey
= get_mapping_key(didev
.tszInstanceName
, username
, guid_str
);
689 CoTaskMemFree(guid_str
);
693 /* Try to read each action in the DIACTIONFORMAT from registry */
694 for (i
= 0; i
< lpdiaf
->dwNumActions
; i
++)
696 static const WCHAR format
[] = {'%','x','\0'};
697 DWORD id
, size
= sizeof(DWORD
);
700 sprintfW(label
, format
, lpdiaf
->rgoAction
[i
].dwSemantic
);
702 if (!RegQueryValueExW(hkey
, label
, 0, NULL
, (LPBYTE
) &id
, &size
))
704 lpdiaf
->rgoAction
[i
].dwObjID
= id
;
705 lpdiaf
->rgoAction
[i
].guidInstance
= didev
.guidInstance
;
706 lpdiaf
->rgoAction
[i
].dwHow
= DIAH_DEFAULT
;
712 CoTaskMemFree(guid_str
);
717 HRESULT
_build_action_map(LPDIRECTINPUTDEVICE8W iface
, LPDIACTIONFORMATW lpdiaf
, LPCWSTR lpszUserName
, DWORD dwFlags
, DWORD devMask
, LPCDIDATAFORMAT df
)
719 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
720 WCHAR username
[MAX_PATH
];
721 DWORD username_size
= MAX_PATH
;
723 BOOL load_success
= FALSE
, has_actions
= FALSE
;
725 /* Unless asked the contrary by these flags, try to load a previous mapping */
726 if (!(dwFlags
& DIDBAM_HWDEFAULTS
))
728 /* Retrieve logged user name if necessary */
729 if (lpszUserName
== NULL
)
730 GetUserNameW(username
, &username_size
);
732 lstrcpynW(username
, lpszUserName
, MAX_PATH
);
734 load_success
= load_mapping_settings(This
, lpdiaf
, username
);
737 if (load_success
) return DI_OK
;
739 for (i
=0; i
< lpdiaf
->dwNumActions
; i
++)
741 /* Don't touch a user configured action */
742 if (lpdiaf
->rgoAction
[i
].dwHow
== DIAH_USERCONFIG
) continue;
744 if ((lpdiaf
->rgoAction
[i
].dwSemantic
& devMask
) == devMask
)
746 DWORD obj_id
= semantic_to_obj_id(This
, lpdiaf
->rgoAction
[i
].dwSemantic
);
747 DWORD type
= DIDFT_GETTYPE(obj_id
);
748 DWORD inst
= DIDFT_GETINSTANCE(obj_id
);
750 LPDIOBJECTDATAFORMAT odf
;
752 if (type
== DIDFT_PSHBUTTON
) type
= DIDFT_BUTTON
;
753 if (type
== DIDFT_RELAXIS
) type
= DIDFT_AXIS
;
755 /* Make sure the object exists */
756 odf
= dataformat_to_odf_by_type(df
, inst
, type
);
760 lpdiaf
->rgoAction
[i
].dwObjID
= obj_id
;
761 lpdiaf
->rgoAction
[i
].guidInstance
= This
->guid
;
762 lpdiaf
->rgoAction
[i
].dwHow
= DIAH_DEFAULT
;
766 else if (!(dwFlags
& DIDBAM_PRESERVE
))
768 /* We must clear action data belonging to other devices */
769 memset(&lpdiaf
->rgoAction
[i
].guidInstance
, 0, sizeof(GUID
));
770 lpdiaf
->rgoAction
[i
].dwHow
= DIAH_UNMAPPED
;
774 if (!has_actions
) return DI_NOEFFECT
;
776 return IDirectInputDevice8WImpl_BuildActionMap(iface
, lpdiaf
, lpszUserName
, dwFlags
);
779 HRESULT
_set_action_map(LPDIRECTINPUTDEVICE8W iface
, LPDIACTIONFORMATW lpdiaf
, LPCWSTR lpszUserName
, DWORD dwFlags
, LPCDIDATAFORMAT df
)
781 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
782 DIDATAFORMAT data_format
;
783 DIOBJECTDATAFORMAT
*obj_df
= NULL
;
787 WCHAR username
[MAX_PATH
];
788 DWORD username_size
= MAX_PATH
;
789 int i
, action
= 0, num_actions
= 0;
790 unsigned int offset
= 0;
792 if (This
->acquired
) return DIERR_ACQUIRED
;
794 data_format
.dwSize
= sizeof(data_format
);
795 data_format
.dwObjSize
= sizeof(DIOBJECTDATAFORMAT
);
796 data_format
.dwFlags
= DIDF_RELAXIS
;
797 data_format
.dwDataSize
= lpdiaf
->dwDataSize
;
799 /* Count the actions */
800 for (i
=0; i
< lpdiaf
->dwNumActions
; i
++)
801 if (IsEqualGUID(&This
->guid
, &lpdiaf
->rgoAction
[i
].guidInstance
))
804 if (num_actions
== 0) return DI_NOEFFECT
;
806 This
->num_actions
= num_actions
;
808 /* Construct the dataformat and actionmap */
809 obj_df
= HeapAlloc(GetProcessHeap(), 0, sizeof(DIOBJECTDATAFORMAT
)*num_actions
);
810 data_format
.rgodf
= (LPDIOBJECTDATAFORMAT
)obj_df
;
811 data_format
.dwNumObjs
= num_actions
;
813 HeapFree(GetProcessHeap(), 0, This
->action_map
);
814 This
->action_map
= HeapAlloc(GetProcessHeap(), 0, sizeof(ActionMap
)*num_actions
);
816 for (i
= 0; i
< lpdiaf
->dwNumActions
; i
++)
818 if (IsEqualGUID(&This
->guid
, &lpdiaf
->rgoAction
[i
].guidInstance
))
820 DWORD inst
= DIDFT_GETINSTANCE(lpdiaf
->rgoAction
[i
].dwObjID
);
821 DWORD type
= DIDFT_GETTYPE(lpdiaf
->rgoAction
[i
].dwObjID
);
822 LPDIOBJECTDATAFORMAT obj
;
824 if (type
== DIDFT_PSHBUTTON
) type
= DIDFT_BUTTON
;
825 if (type
== DIDFT_RELAXIS
) type
= DIDFT_AXIS
;
827 obj
= dataformat_to_odf_by_type(df
, inst
, type
);
829 memcpy(&obj_df
[action
], obj
, df
->dwObjSize
);
831 This
->action_map
[action
].uAppData
= lpdiaf
->rgoAction
[i
].uAppData
;
832 This
->action_map
[action
].offset
= offset
;
833 obj_df
[action
].dwOfs
= offset
;
834 offset
+= (type
& DIDFT_BUTTON
) ? 1 : 4;
840 IDirectInputDevice8_SetDataFormat(iface
, &data_format
);
842 HeapFree(GetProcessHeap(), 0, obj_df
);
844 /* Set the device properties according to the action format */
845 dpr
.diph
.dwSize
= sizeof(DIPROPRANGE
);
846 dpr
.lMin
= lpdiaf
->lAxisMin
;
847 dpr
.lMax
= lpdiaf
->lAxisMax
;
848 dpr
.diph
.dwHeaderSize
= sizeof(DIPROPHEADER
);
849 dpr
.diph
.dwHow
= DIPH_DEVICE
;
850 IDirectInputDevice8_SetProperty(iface
, DIPROP_RANGE
, &dpr
.diph
);
852 if (lpdiaf
->dwBufferSize
> 0)
854 dp
.diph
.dwSize
= sizeof(DIPROPDWORD
);
855 dp
.dwData
= lpdiaf
->dwBufferSize
;
856 dp
.diph
.dwHeaderSize
= sizeof(DIPROPHEADER
);
857 dp
.diph
.dwHow
= DIPH_DEVICE
;
858 IDirectInputDevice8_SetProperty(iface
, DIPROP_BUFFERSIZE
, &dp
.diph
);
861 /* Retrieve logged user name if necessary */
862 if (lpszUserName
== NULL
)
863 GetUserNameW(username
, &username_size
);
865 lstrcpynW(username
, lpszUserName
, MAX_PATH
);
867 dps
.diph
.dwSize
= sizeof(dps
);
868 dps
.diph
.dwHeaderSize
= sizeof(DIPROPHEADER
);
870 dps
.diph
.dwHow
= DIPH_DEVICE
;
871 if (dwFlags
& DIDSAM_NOUSER
)
874 lstrcpynW(dps
.wsz
, username
, sizeof(dps
.wsz
)/sizeof(WCHAR
));
875 IDirectInputDevice8_SetProperty(iface
, DIPROP_USERNAME
, &dps
.diph
);
877 /* Save the settings to disk */
878 save_mapping_settings(iface
, lpdiaf
, username
);
883 /******************************************************************************
884 * queue_event - add new event to the ring queue
887 void queue_event(LPDIRECTINPUTDEVICE8A iface
, int inst_id
, DWORD data
, DWORD time
, DWORD seq
)
889 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
890 int next_pos
, ofs
= id_to_offset(&This
->data_format
, inst_id
);
892 /* Event is being set regardless of the queue state */
893 if (This
->hEvent
) SetEvent(This
->hEvent
);
895 if (!This
->queue_len
|| This
->overflow
|| ofs
< 0) return;
897 next_pos
= (This
->queue_head
+ 1) % This
->queue_len
;
898 if (next_pos
== This
->queue_tail
)
900 TRACE(" queue overflowed\n");
901 This
->overflow
= TRUE
;
905 TRACE(" queueing %d at offset %d (queue head %d / size %d)\n",
906 data
, ofs
, This
->queue_head
, This
->queue_len
);
908 This
->data_queue
[This
->queue_head
].dwOfs
= ofs
;
909 This
->data_queue
[This
->queue_head
].dwData
= data
;
910 This
->data_queue
[This
->queue_head
].dwTimeStamp
= time
;
911 This
->data_queue
[This
->queue_head
].dwSequence
= seq
;
913 /* Set uAppData by means of action mapping */
914 if (This
->num_actions
> 0)
917 for (i
=0; i
< This
->num_actions
; i
++)
919 if (This
->action_map
[i
].offset
== ofs
)
921 TRACE("Offset %d mapped to uAppData %lu\n", ofs
, This
->action_map
[i
].uAppData
);
922 This
->data_queue
[This
->queue_head
].uAppData
= This
->action_map
[i
].uAppData
;
928 This
->queue_head
= next_pos
;
929 /* Send event if asked */
932 /******************************************************************************
936 HRESULT WINAPI
IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface
)
938 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
941 TRACE("(%p)\n", This
);
943 if (!This
->data_format
.user_df
) return DIERR_INVALIDPARAM
;
944 if (This
->dwCoopLevel
& DISCL_FOREGROUND
&& This
->win
!= GetForegroundWindow())
945 return DIERR_OTHERAPPHASPRIO
;
947 EnterCriticalSection(&This
->crit
);
948 res
= This
->acquired
? S_FALSE
: DI_OK
;
951 check_dinput_hooks(iface
);
952 LeaveCriticalSection(&This
->crit
);
957 HRESULT WINAPI
IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface
)
959 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
960 return IDirectInputDevice2WImpl_Acquire(IDirectInputDevice8W_from_impl(This
));
964 /******************************************************************************
968 HRESULT WINAPI
IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface
)
970 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
973 TRACE("(%p)\n", This
);
975 EnterCriticalSection(&This
->crit
);
976 res
= !This
->acquired
? DI_NOEFFECT
: DI_OK
;
979 check_dinput_hooks(iface
);
980 LeaveCriticalSection(&This
->crit
);
985 HRESULT WINAPI
IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface
)
987 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
988 return IDirectInputDevice2WImpl_Unacquire(IDirectInputDevice8W_from_impl(This
));
991 /******************************************************************************
992 * IDirectInputDeviceA
995 HRESULT WINAPI
IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface
, LPCDIDATAFORMAT df
)
997 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1000 if (!df
) return E_POINTER
;
1001 TRACE("(%p) %p\n", This
, df
);
1002 _dump_DIDATAFORMAT(df
);
1004 if (df
->dwSize
!= sizeof(DIDATAFORMAT
)) return DIERR_INVALIDPARAM
;
1005 if (This
->acquired
) return DIERR_ACQUIRED
;
1007 EnterCriticalSection(&This
->crit
);
1009 release_DataFormat(&This
->data_format
);
1010 res
= create_DataFormat(df
, &This
->data_format
);
1012 LeaveCriticalSection(&This
->crit
);
1016 HRESULT WINAPI
IDirectInputDevice2AImpl_SetDataFormat(LPDIRECTINPUTDEVICE8A iface
, LPCDIDATAFORMAT df
)
1018 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1019 return IDirectInputDevice2WImpl_SetDataFormat(IDirectInputDevice8W_from_impl(This
), df
);
1022 /******************************************************************************
1023 * SetCooperativeLevel
1025 * Set cooperative level and the source window for the events.
1027 HRESULT WINAPI
IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface
, HWND hwnd
, DWORD dwflags
)
1029 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1031 TRACE("(%p) %p,0x%08x\n", This
, hwnd
, dwflags
);
1032 _dump_cooperativelevel_DI(dwflags
);
1034 if ((dwflags
& (DISCL_EXCLUSIVE
| DISCL_NONEXCLUSIVE
)) == 0 ||
1035 (dwflags
& (DISCL_EXCLUSIVE
| DISCL_NONEXCLUSIVE
)) == (DISCL_EXCLUSIVE
| DISCL_NONEXCLUSIVE
) ||
1036 (dwflags
& (DISCL_FOREGROUND
| DISCL_BACKGROUND
)) == 0 ||
1037 (dwflags
& (DISCL_FOREGROUND
| DISCL_BACKGROUND
)) == (DISCL_FOREGROUND
| DISCL_BACKGROUND
))
1038 return DIERR_INVALIDPARAM
;
1040 if (hwnd
&& GetWindowLongW(hwnd
, GWL_STYLE
) & WS_CHILD
) return E_HANDLE
;
1042 if (!hwnd
&& dwflags
== (DISCL_NONEXCLUSIVE
| DISCL_BACKGROUND
))
1043 hwnd
= GetDesktopWindow();
1045 if (!IsWindow(hwnd
)) return E_HANDLE
;
1047 /* For security reasons native does not allow exclusive background level
1048 for mouse and keyboard only */
1049 if (dwflags
& DISCL_EXCLUSIVE
&& dwflags
& DISCL_BACKGROUND
&&
1050 (IsEqualGUID(&This
->guid
, &GUID_SysMouse
) ||
1051 IsEqualGUID(&This
->guid
, &GUID_SysKeyboard
)))
1052 return DIERR_UNSUPPORTED
;
1054 /* Store the window which asks for the mouse */
1055 EnterCriticalSection(&This
->crit
);
1057 This
->dwCoopLevel
= dwflags
;
1058 LeaveCriticalSection(&This
->crit
);
1063 HRESULT WINAPI
IDirectInputDevice2AImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8A iface
, HWND hwnd
, DWORD dwflags
)
1065 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1066 return IDirectInputDevice2WImpl_SetCooperativeLevel(IDirectInputDevice8W_from_impl(This
), hwnd
, dwflags
);
1069 /******************************************************************************
1070 * SetEventNotification : specifies event to be sent on state change
1072 HRESULT WINAPI
IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface
, HANDLE event
)
1074 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1076 TRACE("(%p) %p\n", This
, event
);
1078 EnterCriticalSection(&This
->crit
);
1079 This
->hEvent
= event
;
1080 LeaveCriticalSection(&This
->crit
);
1084 HRESULT WINAPI
IDirectInputDevice2AImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface
, HANDLE event
)
1086 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1087 return IDirectInputDevice2WImpl_SetEventNotification(IDirectInputDevice8W_from_impl(This
), event
);
1091 ULONG WINAPI
IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface
)
1093 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1094 ULONG ref
= InterlockedDecrement(&(This
->ref
));
1096 TRACE("(%p) releasing from %d\n", This
, ref
+ 1);
1098 if (ref
) return ref
;
1100 IDirectInputDevice_Unacquire(iface
);
1101 /* Reset the FF state, free all effects, etc */
1102 IDirectInputDevice8_SendForceFeedbackCommand(iface
, DISFFC_RESET
);
1104 HeapFree(GetProcessHeap(), 0, This
->data_queue
);
1106 /* Free data format */
1107 HeapFree(GetProcessHeap(), 0, This
->data_format
.wine_df
->rgodf
);
1108 HeapFree(GetProcessHeap(), 0, This
->data_format
.wine_df
);
1109 release_DataFormat(&This
->data_format
);
1111 /* Free action mapping */
1112 HeapFree(GetProcessHeap(), 0, This
->action_map
);
1114 EnterCriticalSection( &This
->dinput
->crit
);
1115 list_remove( &This
->entry
);
1116 LeaveCriticalSection( &This
->dinput
->crit
);
1118 IDirectInput_Release(&This
->dinput
->IDirectInput7A_iface
);
1119 This
->crit
.DebugInfo
->Spare
[0] = 0;
1120 DeleteCriticalSection(&This
->crit
);
1122 HeapFree(GetProcessHeap(), 0, This
);
1127 ULONG WINAPI
IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface
)
1129 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1130 return IDirectInputDevice2WImpl_Release(IDirectInputDevice8W_from_impl(This
));
1133 HRESULT WINAPI
IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface
, REFIID riid
, LPVOID
*ppobj
)
1135 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1137 TRACE("(%p this=%p,%s,%p)\n", iface
, This
, debugstr_guid(riid
), ppobj
);
1138 if (IsEqualGUID(&IID_IUnknown
, riid
) ||
1139 IsEqualGUID(&IID_IDirectInputDeviceA
, riid
) ||
1140 IsEqualGUID(&IID_IDirectInputDevice2A
, riid
) ||
1141 IsEqualGUID(&IID_IDirectInputDevice7A
, riid
) ||
1142 IsEqualGUID(&IID_IDirectInputDevice8A
, riid
))
1144 IDirectInputDevice2_AddRef(iface
);
1145 *ppobj
= IDirectInputDevice8A_from_impl(This
);
1148 if (IsEqualGUID(&IID_IDirectInputDeviceW
, riid
) ||
1149 IsEqualGUID(&IID_IDirectInputDevice2W
, riid
) ||
1150 IsEqualGUID(&IID_IDirectInputDevice7W
, riid
) ||
1151 IsEqualGUID(&IID_IDirectInputDevice8W
, riid
))
1153 IDirectInputDevice2_AddRef(iface
);
1154 *ppobj
= IDirectInputDevice8W_from_impl(This
);
1158 WARN("Unsupported interface!\n");
1162 HRESULT WINAPI
IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface
, REFIID riid
, LPVOID
*ppobj
)
1164 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1165 return IDirectInputDevice2WImpl_QueryInterface(IDirectInputDevice8W_from_impl(This
), riid
, ppobj
);
1168 ULONG WINAPI
IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface
)
1170 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1171 return InterlockedIncrement(&This
->ref
);
1174 ULONG WINAPI
IDirectInputDevice2AImpl_AddRef(LPDIRECTINPUTDEVICE8A iface
)
1176 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1177 return IDirectInputDevice2WImpl_AddRef(IDirectInputDevice8W_from_impl(This
));
1180 HRESULT WINAPI
IDirectInputDevice2AImpl_EnumObjects(LPDIRECTINPUTDEVICE8A iface
,
1181 LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback
, LPVOID lpvRef
, DWORD dwFlags
)
1183 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1184 DIDEVICEOBJECTINSTANCEA ddoi
;
1187 TRACE("(%p) %p,%p flags:%08x)\n", iface
, lpCallback
, lpvRef
, dwFlags
);
1188 TRACE(" - flags = ");
1189 _dump_EnumObjects_flags(dwFlags
);
1192 /* Only the fields till dwFFMaxForce are relevant */
1193 memset(&ddoi
, 0, sizeof(ddoi
));
1194 ddoi
.dwSize
= FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA
, dwFFMaxForce
);
1196 for (i
= 0; i
< This
->data_format
.wine_df
->dwNumObjs
; i
++)
1198 LPDIOBJECTDATAFORMAT odf
= dataformat_to_odf(This
->data_format
.wine_df
, i
);
1200 if (dwFlags
!= DIDFT_ALL
&& !(dwFlags
& DIDFT_GETTYPE(odf
->dwType
))) continue;
1201 if (IDirectInputDevice_GetObjectInfo(iface
, &ddoi
, odf
->dwType
, DIPH_BYID
) != DI_OK
)
1204 if (lpCallback(&ddoi
, lpvRef
) != DIENUM_CONTINUE
) break;
1210 HRESULT WINAPI
IDirectInputDevice2WImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface
,
1211 LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback
, LPVOID lpvRef
, DWORD dwFlags
)
1213 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1214 DIDEVICEOBJECTINSTANCEW ddoi
;
1217 TRACE("(%p) %p,%p flags:%08x)\n", iface
, lpCallback
, lpvRef
, dwFlags
);
1218 TRACE(" - flags = ");
1219 _dump_EnumObjects_flags(dwFlags
);
1222 /* Only the fields till dwFFMaxForce are relevant */
1223 memset(&ddoi
, 0, sizeof(ddoi
));
1224 ddoi
.dwSize
= FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW
, dwFFMaxForce
);
1226 for (i
= 0; i
< This
->data_format
.wine_df
->dwNumObjs
; i
++)
1228 LPDIOBJECTDATAFORMAT odf
= dataformat_to_odf(This
->data_format
.wine_df
, i
);
1230 if (dwFlags
!= DIDFT_ALL
&& !(dwFlags
& DIDFT_GETTYPE(odf
->dwType
))) continue;
1231 if (IDirectInputDevice_GetObjectInfo(iface
, &ddoi
, odf
->dwType
, DIPH_BYID
) != DI_OK
)
1234 if (lpCallback(&ddoi
, lpvRef
) != DIENUM_CONTINUE
) break;
1240 /******************************************************************************
1244 HRESULT WINAPI
IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface
, REFGUID rguid
, LPDIPROPHEADER pdiph
)
1246 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1248 TRACE("(%p) %s,%p\n", iface
, debugstr_guid(rguid
), pdiph
);
1249 _dump_DIPROPHEADER(pdiph
);
1251 if (!IS_DIPROP(rguid
)) return DI_OK
;
1253 switch (LOWORD(rguid
))
1255 case (DWORD_PTR
) DIPROP_BUFFERSIZE
:
1257 LPDIPROPDWORD pd
= (LPDIPROPDWORD
)pdiph
;
1259 if (pdiph
->dwSize
!= sizeof(DIPROPDWORD
)) return DIERR_INVALIDPARAM
;
1261 pd
->dwData
= This
->queue_len
;
1262 TRACE("buffersize = %d\n", pd
->dwData
);
1265 case (DWORD_PTR
) DIPROP_USERNAME
:
1267 LPDIPROPSTRING ps
= (LPDIPROPSTRING
)pdiph
;
1269 if (pdiph
->dwSize
!= sizeof(DIPROPSTRING
)) return DIERR_INVALIDPARAM
;
1271 lstrcpynW(ps
->wsz
, This
->username
, sizeof(ps
->wsz
)/sizeof(WCHAR
));
1274 case (DWORD_PTR
) DIPROP_VIDPID
:
1275 FIXME("DIPROP_VIDPID not implemented\n");
1276 return DIERR_UNSUPPORTED
;
1278 FIXME("Unknown property %s\n", debugstr_guid(rguid
));
1279 return DIERR_INVALIDPARAM
;
1285 HRESULT WINAPI
IDirectInputDevice2AImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface
, REFGUID rguid
, LPDIPROPHEADER pdiph
)
1287 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1288 return IDirectInputDevice2WImpl_GetProperty(IDirectInputDevice8W_from_impl(This
), rguid
, pdiph
);
1291 /******************************************************************************
1295 HRESULT WINAPI
IDirectInputDevice2WImpl_SetProperty(
1296 LPDIRECTINPUTDEVICE8W iface
, REFGUID rguid
, LPCDIPROPHEADER pdiph
)
1298 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1300 TRACE("(%p) %s,%p\n", iface
, debugstr_guid(rguid
), pdiph
);
1301 _dump_DIPROPHEADER(pdiph
);
1303 if (!IS_DIPROP(rguid
)) return DI_OK
;
1305 switch (LOWORD(rguid
))
1307 case (DWORD_PTR
) DIPROP_AXISMODE
:
1309 LPCDIPROPDWORD pd
= (LPCDIPROPDWORD
)pdiph
;
1311 if (pdiph
->dwSize
!= sizeof(DIPROPDWORD
)) return DIERR_INVALIDPARAM
;
1312 if (pdiph
->dwHow
== DIPH_DEVICE
&& pdiph
->dwObj
) return DIERR_INVALIDPARAM
;
1313 if (This
->acquired
) return DIERR_ACQUIRED
;
1314 if (pdiph
->dwHow
!= DIPH_DEVICE
) return DIERR_UNSUPPORTED
;
1315 if (!This
->data_format
.user_df
) return DI_OK
;
1317 TRACE("Axis mode: %s\n", pd
->dwData
== DIPROPAXISMODE_ABS
? "absolute" :
1320 EnterCriticalSection(&This
->crit
);
1321 This
->data_format
.user_df
->dwFlags
&= ~DIDFT_AXIS
;
1322 This
->data_format
.user_df
->dwFlags
|= pd
->dwData
== DIPROPAXISMODE_ABS
?
1323 DIDF_ABSAXIS
: DIDF_RELAXIS
;
1324 LeaveCriticalSection(&This
->crit
);
1327 case (DWORD_PTR
) DIPROP_BUFFERSIZE
:
1329 LPCDIPROPDWORD pd
= (LPCDIPROPDWORD
)pdiph
;
1331 if (pdiph
->dwSize
!= sizeof(DIPROPDWORD
)) return DIERR_INVALIDPARAM
;
1332 if (This
->acquired
) return DIERR_ACQUIRED
;
1334 TRACE("buffersize = %d\n", pd
->dwData
);
1336 EnterCriticalSection(&This
->crit
);
1337 HeapFree(GetProcessHeap(), 0, This
->data_queue
);
1339 This
->data_queue
= !pd
->dwData
? NULL
: HeapAlloc(GetProcessHeap(), 0,
1340 pd
->dwData
* sizeof(DIDEVICEOBJECTDATA
));
1341 This
->queue_head
= This
->queue_tail
= This
->overflow
= 0;
1342 This
->queue_len
= pd
->dwData
;
1344 LeaveCriticalSection(&This
->crit
);
1347 case (DWORD_PTR
) DIPROP_USERNAME
:
1349 LPCDIPROPSTRING ps
= (LPCDIPROPSTRING
)pdiph
;
1351 if (pdiph
->dwSize
!= sizeof(DIPROPSTRING
)) return DIERR_INVALIDPARAM
;
1353 lstrcpynW(This
->username
, ps
->wsz
, sizeof(This
->username
)/sizeof(WCHAR
));
1357 WARN("Unknown property %s\n", debugstr_guid(rguid
));
1358 return DIERR_UNSUPPORTED
;
1364 HRESULT WINAPI
IDirectInputDevice2AImpl_SetProperty(
1365 LPDIRECTINPUTDEVICE8A iface
, REFGUID rguid
, LPCDIPROPHEADER pdiph
)
1367 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1368 return IDirectInputDevice2WImpl_SetProperty(IDirectInputDevice8W_from_impl(This
), rguid
, pdiph
);
1371 HRESULT WINAPI
IDirectInputDevice2AImpl_GetObjectInfo(
1372 LPDIRECTINPUTDEVICE8A iface
,
1373 LPDIDEVICEOBJECTINSTANCEA pdidoi
,
1377 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1378 DIDEVICEOBJECTINSTANCEW didoiW
;
1382 (pdidoi
->dwSize
!= sizeof(DIDEVICEOBJECTINSTANCEA
) &&
1383 pdidoi
->dwSize
!= sizeof(DIDEVICEOBJECTINSTANCE_DX3A
)))
1384 return DIERR_INVALIDPARAM
;
1386 didoiW
.dwSize
= sizeof(didoiW
);
1387 res
= IDirectInputDevice2WImpl_GetObjectInfo(IDirectInputDevice8W_from_impl(This
), &didoiW
, dwObj
, dwHow
);
1390 DWORD dwSize
= pdidoi
->dwSize
;
1392 memset(pdidoi
, 0, pdidoi
->dwSize
);
1393 pdidoi
->dwSize
= dwSize
;
1394 pdidoi
->guidType
= didoiW
.guidType
;
1395 pdidoi
->dwOfs
= didoiW
.dwOfs
;
1396 pdidoi
->dwType
= didoiW
.dwType
;
1397 pdidoi
->dwFlags
= didoiW
.dwFlags
;
1403 HRESULT WINAPI
IDirectInputDevice2WImpl_GetObjectInfo(
1404 LPDIRECTINPUTDEVICE8W iface
,
1405 LPDIDEVICEOBJECTINSTANCEW pdidoi
,
1409 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1411 LPDIOBJECTDATAFORMAT odf
;
1414 TRACE("(%p) %d(0x%08x) -> %p\n", This
, dwHow
, dwObj
, pdidoi
);
1417 (pdidoi
->dwSize
!= sizeof(DIDEVICEOBJECTINSTANCEW
) &&
1418 pdidoi
->dwSize
!= sizeof(DIDEVICEOBJECTINSTANCE_DX3W
)))
1419 return DIERR_INVALIDPARAM
;
1424 if (!This
->data_format
.offsets
) break;
1425 for (idx
= This
->data_format
.wine_df
->dwNumObjs
- 1; idx
>= 0; idx
--)
1426 if (This
->data_format
.offsets
[idx
] == dwObj
) break;
1429 dwObj
&= 0x00ffffff;
1430 for (idx
= This
->data_format
.wine_df
->dwNumObjs
- 1; idx
>= 0; idx
--)
1431 if ((dataformat_to_odf(This
->data_format
.wine_df
, idx
)->dwType
& 0x00ffffff) == dwObj
)
1436 FIXME("dwHow = DIPH_BYUSAGE not implemented\n");
1439 WARN("invalid parameter: dwHow = %08x\n", dwHow
);
1440 return DIERR_INVALIDPARAM
;
1442 if (idx
< 0) return DIERR_OBJECTNOTFOUND
;
1444 odf
= dataformat_to_odf(This
->data_format
.wine_df
, idx
);
1445 dwSize
= pdidoi
->dwSize
; /* save due to memset below */
1446 memset(pdidoi
, 0, pdidoi
->dwSize
);
1447 pdidoi
->dwSize
= dwSize
;
1448 if (odf
->pguid
) pdidoi
->guidType
= *odf
->pguid
;
1449 pdidoi
->dwOfs
= This
->data_format
.offsets
? This
->data_format
.offsets
[idx
] : odf
->dwOfs
;
1450 pdidoi
->dwType
= odf
->dwType
;
1451 pdidoi
->dwFlags
= odf
->dwFlags
;
1456 HRESULT WINAPI
IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface
, DWORD dodsize
,
1457 LPDIDEVICEOBJECTDATA dod
, LPDWORD entries
, DWORD flags
)
1459 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1460 HRESULT ret
= DI_OK
;
1463 TRACE("(%p) %p -> %p(%d) x%d, 0x%08x\n",
1464 This
, dod
, entries
, entries
? *entries
: 0, dodsize
, flags
);
1466 if (This
->dinput
->dwVersion
== 0x0800 || dodsize
== sizeof(DIDEVICEOBJECTDATA_DX3
))
1468 if (!This
->queue_len
) return DIERR_NOTBUFFERED
;
1469 if (!This
->acquired
) return DIERR_NOTACQUIRED
;
1472 if (!This
->queue_len
)
1474 if (dodsize
< sizeof(DIDEVICEOBJECTDATA_DX3
))
1475 return DIERR_INVALIDPARAM
;
1477 IDirectInputDevice2_Poll(iface
);
1478 EnterCriticalSection(&This
->crit
);
1480 len
= This
->queue_head
- This
->queue_tail
;
1481 if (len
< 0) len
+= This
->queue_len
;
1483 if ((*entries
!= INFINITE
) && (len
> *entries
)) len
= *entries
;
1488 for (i
= 0; i
< len
; i
++)
1490 int n
= (This
->queue_tail
+ i
) % This
->queue_len
;
1491 memcpy((char *)dod
+ dodsize
* i
, This
->data_queue
+ n
, dodsize
);
1496 if (This
->overflow
&& This
->dinput
->dwVersion
== 0x0800)
1497 ret
= DI_BUFFEROVERFLOW
;
1499 if (!(flags
& DIGDD_PEEK
))
1501 /* Advance reading position */
1502 This
->queue_tail
= (This
->queue_tail
+ len
) % This
->queue_len
;
1503 This
->overflow
= FALSE
;
1506 LeaveCriticalSection(&This
->crit
);
1508 TRACE("Returning %d events queued\n", *entries
);
1512 HRESULT WINAPI
IDirectInputDevice2AImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface
, DWORD dodsize
,
1513 LPDIDEVICEOBJECTDATA dod
, LPDWORD entries
, DWORD flags
)
1515 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1516 return IDirectInputDevice2WImpl_GetDeviceData(IDirectInputDevice8W_from_impl(This
), dodsize
, dod
, entries
, flags
);
1519 HRESULT WINAPI
IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface
, HWND hwndOwner
, DWORD dwFlags
)
1521 FIXME("(this=%p,%p,0x%08x): stub!\n", iface
, hwndOwner
, dwFlags
);
1526 HRESULT WINAPI
IDirectInputDevice2AImpl_RunControlPanel(LPDIRECTINPUTDEVICE8A iface
, HWND hwndOwner
, DWORD dwFlags
)
1528 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1529 return IDirectInputDevice2WImpl_RunControlPanel(IDirectInputDevice8W_from_impl(This
), hwndOwner
, dwFlags
);
1532 HRESULT WINAPI
IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface
, HINSTANCE hinst
, DWORD dwVersion
,
1535 FIXME("(this=%p,%p,%d,%s): stub!\n", iface
, hinst
, dwVersion
, debugstr_guid(rguid
));
1539 HRESULT WINAPI
IDirectInputDevice2AImpl_Initialize(LPDIRECTINPUTDEVICE8A iface
, HINSTANCE hinst
, DWORD dwVersion
,
1542 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1543 return IDirectInputDevice2WImpl_Initialize(IDirectInputDevice8W_from_impl(This
), hinst
, dwVersion
, rguid
);
1546 /******************************************************************************
1547 * IDirectInputDevice2A
1550 HRESULT WINAPI
IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface
, REFGUID rguid
, LPCDIEFFECT lpeff
,
1551 LPDIRECTINPUTEFFECT
*ppdef
, LPUNKNOWN pUnkOuter
)
1553 FIXME("(this=%p,%s,%p,%p,%p): stub!\n", iface
, debugstr_guid(rguid
), lpeff
, ppdef
, pUnkOuter
);
1557 HRESULT WINAPI
IDirectInputDevice2AImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface
, REFGUID rguid
, LPCDIEFFECT lpeff
,
1558 LPDIRECTINPUTEFFECT
*ppdef
, LPUNKNOWN pUnkOuter
)
1560 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1561 return IDirectInputDevice2WImpl_CreateEffect(IDirectInputDevice8W_from_impl(This
), rguid
, lpeff
, ppdef
, pUnkOuter
);
1564 HRESULT WINAPI
IDirectInputDevice2AImpl_EnumEffects(
1565 LPDIRECTINPUTDEVICE8A iface
,
1566 LPDIENUMEFFECTSCALLBACKA lpCallback
,
1570 FIXME("(this=%p,%p,%p,0x%08x): stub!\n",
1571 iface
, lpCallback
, lpvRef
, dwFlags
);
1576 HRESULT WINAPI
IDirectInputDevice2WImpl_EnumEffects(
1577 LPDIRECTINPUTDEVICE8W iface
,
1578 LPDIENUMEFFECTSCALLBACKW lpCallback
,
1582 FIXME("(this=%p,%p,%p,0x%08x): stub!\n",
1583 iface
, lpCallback
, lpvRef
, dwFlags
);
1588 HRESULT WINAPI
IDirectInputDevice2AImpl_GetEffectInfo(
1589 LPDIRECTINPUTDEVICE8A iface
,
1590 LPDIEFFECTINFOA lpdei
,
1593 FIXME("(this=%p,%p,%s): stub!\n",
1594 iface
, lpdei
, debugstr_guid(rguid
));
1598 HRESULT WINAPI
IDirectInputDevice2WImpl_GetEffectInfo(
1599 LPDIRECTINPUTDEVICE8W iface
,
1600 LPDIEFFECTINFOW lpdei
,
1603 FIXME("(this=%p,%p,%s): stub!\n",
1604 iface
, lpdei
, debugstr_guid(rguid
));
1608 HRESULT WINAPI
IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface
, LPDWORD pdwOut
)
1610 FIXME("(this=%p,%p): stub!\n", iface
, pdwOut
);
1614 HRESULT WINAPI
IDirectInputDevice2AImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8A iface
, LPDWORD pdwOut
)
1616 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1617 return IDirectInputDevice2WImpl_GetForceFeedbackState(IDirectInputDevice8W_from_impl(This
), pdwOut
);
1620 HRESULT WINAPI
IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface
, DWORD dwFlags
)
1622 TRACE("(%p) 0x%08x:\n", iface
, dwFlags
);
1626 HRESULT WINAPI
IDirectInputDevice2AImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8A iface
, DWORD dwFlags
)
1628 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1629 return IDirectInputDevice2WImpl_SendForceFeedbackCommand(IDirectInputDevice8W_from_impl(This
), dwFlags
);
1632 HRESULT WINAPI
IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface
,
1633 LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback
, LPVOID lpvRef
, DWORD dwFlags
)
1635 FIXME("(this=%p,%p,%p,0x%08x): stub!\n", iface
, lpCallback
, lpvRef
, dwFlags
);
1639 HRESULT WINAPI
IDirectInputDevice2AImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8A iface
,
1640 LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback
, LPVOID lpvRef
, DWORD dwFlags
)
1642 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1643 return IDirectInputDevice2WImpl_EnumCreatedEffectObjects(IDirectInputDevice8W_from_impl(This
), lpCallback
, lpvRef
, dwFlags
);
1646 HRESULT WINAPI
IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface
, LPDIEFFESCAPE lpDIEEsc
)
1648 FIXME("(this=%p,%p): stub!\n", iface
, lpDIEEsc
);
1652 HRESULT WINAPI
IDirectInputDevice2AImpl_Escape(LPDIRECTINPUTDEVICE8A iface
, LPDIEFFESCAPE lpDIEEsc
)
1654 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1655 return IDirectInputDevice2WImpl_Escape(IDirectInputDevice8W_from_impl(This
), lpDIEEsc
);
1658 HRESULT WINAPI
IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface
)
1660 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1662 if (!This
->acquired
) return DIERR_NOTACQUIRED
;
1664 check_dinput_events();
1668 HRESULT WINAPI
IDirectInputDevice2AImpl_Poll(LPDIRECTINPUTDEVICE8A iface
)
1670 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1671 return IDirectInputDevice2WImpl_Poll(IDirectInputDevice8W_from_impl(This
));
1674 HRESULT WINAPI
IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface
, DWORD cbObjectData
,
1675 LPCDIDEVICEOBJECTDATA rgdod
, LPDWORD pdwInOut
,
1678 FIXME("(this=%p,0x%08x,%p,%p,0x%08x): stub!\n", iface
, cbObjectData
, rgdod
, pdwInOut
, dwFlags
);
1683 HRESULT WINAPI
IDirectInputDevice2AImpl_SendDeviceData(LPDIRECTINPUTDEVICE8A iface
, DWORD cbObjectData
,
1684 LPCDIDEVICEOBJECTDATA rgdod
, LPDWORD pdwInOut
,
1687 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1688 return IDirectInputDevice2WImpl_SendDeviceData(IDirectInputDevice8W_from_impl(This
), cbObjectData
, rgdod
,
1692 HRESULT WINAPI
IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface
,
1693 LPCSTR lpszFileName
,
1694 LPDIENUMEFFECTSINFILECALLBACK pec
,
1698 FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", iface
, lpszFileName
, pec
, pvRef
, dwFlags
);
1703 HRESULT WINAPI
IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface
,
1704 LPCWSTR lpszFileName
,
1705 LPDIENUMEFFECTSINFILECALLBACK pec
,
1709 FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", iface
, debugstr_w(lpszFileName
), pec
, pvRef
, dwFlags
);
1714 HRESULT WINAPI
IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface
,
1715 LPCSTR lpszFileName
,
1717 LPDIFILEEFFECT rgDiFileEft
,
1720 FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", iface
, lpszFileName
, dwEntries
, rgDiFileEft
, dwFlags
);
1725 HRESULT WINAPI
IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface
,
1726 LPCWSTR lpszFileName
,
1728 LPDIFILEEFFECT rgDiFileEft
,
1731 FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", iface
, debugstr_w(lpszFileName
), dwEntries
, rgDiFileEft
, dwFlags
);
1736 HRESULT WINAPI
IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface
,
1737 LPDIACTIONFORMATW lpdiaf
,
1738 LPCWSTR lpszUserName
,
1741 FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface
, lpdiaf
, debugstr_w(lpszUserName
), dwFlags
);
1742 #define X(x) if (dwFlags & x) FIXME("\tdwFlags =|"#x"\n");
1745 X(DIDBAM_INITIALIZE
)
1746 X(DIDBAM_HWDEFAULTS
)
1752 HRESULT WINAPI
IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface
,
1753 LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader
)
1755 FIXME("(%p)->(%p): stub !\n", iface
, lpdiDevImageInfoHeader
);
1760 HRESULT WINAPI
IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface
,
1761 LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader
)
1763 FIXME("(%p)->(%p): stub !\n", iface
, lpdiDevImageInfoHeader
);