ReactOS  0.4.13-dev-464-g6b95727
device.c
Go to the documentation of this file.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 "winreg.h"
36 #include "winuser.h"
37 #include "winerror.h"
38 #include "dinput.h"
39 #include "device_private.h"
40 #include "dinput_private.h"
41 
42 #define WM_WINE_NOTIFY_ACTIVITY WM_USER
43 
45 
46 static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
47 {
48  return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface);
49 }
50 static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
51 {
52  return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface);
53 }
54 
55 static inline IDirectInputDevice8A *IDirectInputDevice8A_from_impl(IDirectInputDeviceImpl *This)
56 {
57  return &This->IDirectInputDevice8A_iface;
58 }
59 static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
60 {
61  return &This->IDirectInputDevice8W_iface;
62 }
63 
64 /******************************************************************************
65  * Various debugging tools
66  */
68  if (TRACE_ON(dinput)) {
69  unsigned int i;
70  static const struct {
71  DWORD mask;
72  const char *name;
73  } flags[] = {
74 #define FE(x) { x, #x}
80 #undef FE
81  };
82  TRACE(" cooperative level : ");
83  for (i = 0; i < ARRAY_SIZE(flags); i++)
84  if (flags[i].mask & dwFlags)
85  TRACE("%s ",flags[i].name);
86  TRACE("\n");
87  }
88 }
89 
91  unsigned int i;
92  static const struct {
93  DWORD mask;
94  const char *name;
95  } flags[] = {
96 #define FE(x) { x, #x}
101 #undef FE
102  };
103 
104  if (!dwFlags) return;
105 
106  TRACE("Flags:");
107 
108  /* First the flags */
109  for (i = 0; i < ARRAY_SIZE(flags); i++) {
110  if (flags[i].mask & dwFlags)
111  TRACE(" %s",flags[i].name);
112  }
113 
114  /* Now specific values */
115 #define FE(x) case x: TRACE(" "#x); break
116  switch (dwFlags & DIDOI_ASPECTMASK) {
121  }
122 #undef FE
123 
124 }
125 
127  if (TRACE_ON(dinput)) {
128  unsigned int i;
130  static const struct {
131  DWORD mask;
132  const char *name;
133  } flags[] = {
134 #define FE(x) { x, #x}
135  FE(DIDFT_RELAXIS),
136  FE(DIDFT_ABSAXIS),
139  FE(DIDFT_POV),
141  FE(DIDFT_NODATA),
144  FE(DIDFT_OUTPUT),
146  FE(DIDFT_ALIAS),
148 #undef FE
149  };
150  type = (dwFlags & 0xFF0000FF);
151  instance = ((dwFlags >> 8) & 0xFFFF);
152  TRACE("Type:");
153  if (type == DIDFT_ALL) {
154  TRACE(" DIDFT_ALL");
155  } else {
156  for (i = 0; i < ARRAY_SIZE(flags); i++) {
157  if (flags[i].mask & type) {
158  type &= ~flags[i].mask;
159  TRACE(" %s",flags[i].name);
160  }
161  }
162  if (type) {
163  TRACE(" (unhandled: %08x)", type);
164  }
165  }
166  TRACE(" / Instance: ");
167  if (instance == ((DIDFT_ANYINSTANCE >> 8) & 0xFFFF)) {
168  TRACE("DIDFT_ANYINSTANCE");
169  } else {
170  TRACE("%3d", instance);
171  }
172  }
173 }
174 
176  if (TRACE_ON(dinput)) {
177  TRACE(" - dwObj = 0x%08x\n", diph->dwObj);
178  TRACE(" - dwHow = %s\n",
179  ((diph->dwHow == DIPH_DEVICE) ? "DIPH_DEVICE" :
180  ((diph->dwHow == DIPH_BYOFFSET) ? "DIPH_BYOFFSET" :
181  ((diph->dwHow == DIPH_BYID)) ? "DIPH_BYID" : "unknown")));
182  }
183 }
184 
186  TRACE(" - enumerating : %s ('%s') - %2d - 0x%08x - %s - 0x%x\n",
187  debugstr_guid(&ddoi->guidType), _dump_dinput_GUID(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, ddoi->tszName, ddoi->dwFlags);
188 }
189 
191  TRACE(" - enumerating : %s ('%s'), - %2d - 0x%08x - %s - 0x%x\n",
192  debugstr_guid(&ddoi->guidType), _dump_dinput_GUID(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, debugstr_w(ddoi->tszName), ddoi->dwFlags);
193 }
194 
195 /* This function is a helper to convert a GUID into any possible DInput GUID out there */
196 const char *_dump_dinput_GUID(const GUID *guid) {
197  unsigned int i;
198  static const struct {
199  const GUID *guid;
200  const char *name;
201  } guids[] = {
202 #define FE(x) { &x, #x}
203  FE(GUID_XAxis),
204  FE(GUID_YAxis),
205  FE(GUID_ZAxis),
206  FE(GUID_RxAxis),
207  FE(GUID_RyAxis),
208  FE(GUID_RzAxis),
209  FE(GUID_Slider),
210  FE(GUID_Button),
211  FE(GUID_Key),
212  FE(GUID_POV),
213  FE(GUID_Unknown),
214  FE(GUID_SysMouse),
215  FE(GUID_SysKeyboard),
216  FE(GUID_Joystick),
217  FE(GUID_ConstantForce),
218  FE(GUID_RampForce),
219  FE(GUID_Square),
220  FE(GUID_Sine),
221  FE(GUID_Triangle),
222  FE(GUID_SawtoothUp),
223  FE(GUID_SawtoothDown),
224  FE(GUID_Spring),
225  FE(GUID_Damper),
226  FE(GUID_Inertia),
227  FE(GUID_Friction),
228  FE(GUID_CustomForce)
229 #undef FE
230  };
231  if (guid == NULL)
232  return "null GUID";
233  for (i = 0; i < ARRAY_SIZE(guids); i++) {
234  if (IsEqualGUID(guids[i].guid, guid)) {
235  return guids[i].name;
236  }
237  }
238  return debugstr_guid(guid);
239 }
240 
242  unsigned int i;
243 
244  TRACE("Dumping DIDATAFORMAT structure:\n");
245  TRACE(" - dwSize: %d\n", df->dwSize);
246  if (df->dwSize != sizeof(DIDATAFORMAT)) {
247  WARN("Non-standard DIDATAFORMAT structure size %d\n", df->dwSize);
248  }
249  TRACE(" - dwObjsize: %d\n", df->dwObjSize);
250  if (df->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) {
251  WARN("Non-standard DIOBJECTDATAFORMAT structure size %d\n", df->dwObjSize);
252  }
253  TRACE(" - dwFlags: 0x%08x (", df->dwFlags);
254  switch (df->dwFlags) {
255  case DIDF_ABSAXIS: TRACE("DIDF_ABSAXIS"); break;
256  case DIDF_RELAXIS: TRACE("DIDF_RELAXIS"); break;
257  default: TRACE("unknown"); break;
258  }
259  TRACE(")\n");
260  TRACE(" - dwDataSize: %d\n", df->dwDataSize);
261  TRACE(" - dwNumObjs: %d\n", df->dwNumObjs);
262 
263  for (i = 0; i < df->dwNumObjs; i++) {
264  TRACE(" - Object %d:\n", i);
265  TRACE(" * GUID: %s ('%s')\n", debugstr_guid(df->rgodf[i].pguid), _dump_dinput_GUID(df->rgodf[i].pguid));
266  TRACE(" * dwOfs: %d\n", df->rgodf[i].dwOfs);
267  TRACE(" * dwType: 0x%08x\n", df->rgodf[i].dwType);
268  TRACE(" "); _dump_EnumObjects_flags(df->rgodf[i].dwType); TRACE("\n");
269  TRACE(" * dwFlags: 0x%08x\n", df->rgodf[i].dwFlags);
271  }
272 }
273 
274 /******************************************************************************
275  * Get the default and the app-specific config keys.
276  */
277 BOOL get_app_key(HKEY *defkey, HKEY *appkey)
278 {
279  char buffer[MAX_PATH+16];
280  DWORD len;
281 
282  *appkey = 0;
283 
284  /* @@ Wine registry key: HKCU\Software\Wine\DirectInput */
285  if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\DirectInput", defkey))
286  *defkey = 0;
287 
289  if (len && len < MAX_PATH)
290  {
291  HKEY tmpkey;
292 
293  /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectInput */
294  if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey))
295  {
296  char *p, *appname = buffer;
297  if ((p = strrchr(appname, '/'))) appname = p + 1;
298  if ((p = strrchr(appname, '\\'))) appname = p + 1;
299  strcat(appname, "\\DirectInput");
300 
301  if (RegOpenKeyA(tmpkey, appname, appkey)) *appkey = 0;
302  RegCloseKey(tmpkey);
303  }
304  }
305 
306  return *defkey || *appkey;
307 }
308 
309 /******************************************************************************
310  * Get a config key from either the app-specific or the default config
311  */
312 DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
313  char *buffer, DWORD size )
314 {
315  if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)buffer, &size ))
316  return 0;
317 
318  if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE)buffer, &size ))
319  return 0;
320 
321  return ERROR_FILE_NOT_FOUND;
322 }
323 
324 /* Conversion between internal data buffer and external data buffer */
325 void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df)
326 {
327  int i;
328  const char *in_c = in;
329  char *out_c = out;
330 
331  memset(out, 0, size);
332  if (df->dt == NULL) {
333  /* This means that the app uses Wine's internal data format */
335  } else {
336  for (i = 0; i < df->size; i++) {
337  if (df->dt[i].offset_in >= 0) {
338  switch (df->dt[i].size) {
339  case 1:
340  TRACE("Copying (c) to %d from %d (value %d)\n",
341  df->dt[i].offset_out, df->dt[i].offset_in, *(in_c + df->dt[i].offset_in));
342  *(out_c + df->dt[i].offset_out) = *(in_c + df->dt[i].offset_in);
343  break;
344 
345  case 2:
346  TRACE("Copying (s) to %d from %d (value %d)\n",
347  df->dt[i].offset_out, df->dt[i].offset_in, *((const short *)(in_c + df->dt[i].offset_in)));
348  *((short *)(out_c + df->dt[i].offset_out)) = *((const short *)(in_c + df->dt[i].offset_in));
349  break;
350 
351  case 4:
352  TRACE("Copying (i) to %d from %d (value %d)\n",
353  df->dt[i].offset_out, df->dt[i].offset_in, *((const int *)(in_c + df->dt[i].offset_in)));
354  *((int *)(out_c + df->dt[i].offset_out)) = *((const int *)(in_c + df->dt[i].offset_in));
355  break;
356 
357  default:
358  memcpy((out_c + df->dt[i].offset_out), (in_c + df->dt[i].offset_in), df->dt[i].size);
359  break;
360  }
361  } else {
362  switch (df->dt[i].size) {
363  case 1:
364  TRACE("Copying (c) to %d default value %d\n",
365  df->dt[i].offset_out, df->dt[i].value);
366  *(out_c + df->dt[i].offset_out) = (char) df->dt[i].value;
367  break;
368 
369  case 2:
370  TRACE("Copying (s) to %d default value %d\n",
371  df->dt[i].offset_out, df->dt[i].value);
372  *((short *) (out_c + df->dt[i].offset_out)) = (short) df->dt[i].value;
373  break;
374 
375  case 4:
376  TRACE("Copying (i) to %d default value %d\n",
377  df->dt[i].offset_out, df->dt[i].value);
378  *((int *) (out_c + df->dt[i].offset_out)) = df->dt[i].value;
379  break;
380 
381  default:
382  memset((out_c + df->dt[i].offset_out), 0, df->dt[i].size);
383  break;
384  }
385  }
386  }
387  }
388 }
389 
391 {
392  TRACE("Deleting DataFormat: %p\n", format);
393 
394  HeapFree(GetProcessHeap(), 0, format->dt);
395  format->dt = NULL;
396  HeapFree(GetProcessHeap(), 0, format->offsets);
397  format->offsets = NULL;
398  HeapFree(GetProcessHeap(), 0, format->user_df);
399  format->user_df = NULL;
400 }
401 
403 {
404  if (idx < 0 || idx >= df->dwNumObjs) return NULL;
405  return (LPDIOBJECTDATAFORMAT)((LPBYTE)df->rgodf + idx * df->dwObjSize);
406 }
407 
408 /* dataformat_to_odf_by_type
409  * Find the Nth object of the selected type in the DataFormat
410  */
412 {
413  int i, nfound = 0;
414 
415  for (i=0; i < df->dwNumObjs; i++)
416  {
418 
419  if (odf->dwType & type)
420  {
421  if (n == nfound)
422  return odf;
423 
424  nfound++;
425  }
426  }
427 
428  return NULL;
429 }
430 
432 {
433  DataTransform *dt;
434  unsigned int i, j;
435  int same = 1;
436  int *done;
437  int index = 0;
438  DWORD next = 0;
439 
440  if (!format->wine_df) return DIERR_INVALIDPARAM;
441  done = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, asked_format->dwNumObjs * sizeof(int));
442  dt = HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform));
443  if (!dt || !done) goto failed;
444 
445  if (!(format->offsets = HeapAlloc(GetProcessHeap(), 0, format->wine_df->dwNumObjs * sizeof(int))))
446  goto failed;
447 
448  if (!(format->user_df = HeapAlloc(GetProcessHeap(), 0, asked_format->dwSize)))
449  goto failed;
450  memcpy(format->user_df, asked_format, asked_format->dwSize);
451 
452  TRACE("Creating DataTransform :\n");
453 
454  for (i = 0; i < format->wine_df->dwNumObjs; i++)
455  {
456  format->offsets[i] = -1;
457 
458  for (j = 0; j < asked_format->dwNumObjs; j++) {
459  if (done[j] == 1)
460  continue;
461 
462  if (/* Check if the application either requests any GUID and if not, it if matches
463  * the GUID of the Wine object.
464  */
465  ((asked_format->rgodf[j].pguid == NULL) ||
466  (format->wine_df->rgodf[i].pguid == NULL) ||
467  (IsEqualGUID(format->wine_df->rgodf[i].pguid, asked_format->rgodf[j].pguid)))
468  &&
469  (/* Then check if it accepts any instance id, and if not, if it matches Wine's
470  * instance id.
471  */
472  ((asked_format->rgodf[j].dwType & DIDFT_INSTANCEMASK) == DIDFT_ANYINSTANCE) ||
473  (DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == 0x00FF) || /* This is mentioned in no DX docs, but it works fine - tested on WinXP */
474  (DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == DIDFT_GETINSTANCE(format->wine_df->rgodf[i].dwType)))
475  &&
476  ( /* Then if the asked type matches the one Wine provides */
477  DIDFT_GETTYPE(asked_format->rgodf[j].dwType) & format->wine_df->rgodf[i].dwType))
478  {
479  done[j] = 1;
480 
481  TRACE("Matching :\n");
482  TRACE(" - Asked (%d) :\n", j);
483  TRACE(" * GUID: %s ('%s')\n",
484  debugstr_guid(asked_format->rgodf[j].pguid),
485  _dump_dinput_GUID(asked_format->rgodf[j].pguid));
486  TRACE(" * Offset: %3d\n", asked_format->rgodf[j].dwOfs);
487  TRACE(" * dwType: 0x%08x\n", asked_format->rgodf[j].dwType);
488  TRACE(" "); _dump_EnumObjects_flags(asked_format->rgodf[j].dwType); TRACE("\n");
489  TRACE(" * dwFlags: 0x%08x\n", asked_format->rgodf[j].dwFlags);
490  TRACE(" "); _dump_ObjectDataFormat_flags(asked_format->rgodf[j].dwFlags); TRACE("\n");
491 
492  TRACE(" - Wine (%d) :\n", i);
493  TRACE(" * GUID: %s ('%s')\n",
494  debugstr_guid(format->wine_df->rgodf[i].pguid),
495  _dump_dinput_GUID(format->wine_df->rgodf[i].pguid));
496  TRACE(" * Offset: %3d\n", format->wine_df->rgodf[i].dwOfs);
497  TRACE(" * dwType: 0x%08x\n", format->wine_df->rgodf[i].dwType);
498  TRACE(" "); _dump_EnumObjects_flags(format->wine_df->rgodf[i].dwType); TRACE("\n");
499  TRACE(" * dwFlags: 0x%08x\n", format->wine_df->rgodf[i].dwFlags);
500  TRACE(" "); _dump_ObjectDataFormat_flags(format->wine_df->rgodf[i].dwFlags); TRACE("\n");
501 
502  if (format->wine_df->rgodf[i].dwType & DIDFT_BUTTON)
503  dt[index].size = sizeof(BYTE);
504  else
505  dt[index].size = sizeof(DWORD);
506  dt[index].offset_in = format->wine_df->rgodf[i].dwOfs;
507  dt[index].offset_out = asked_format->rgodf[j].dwOfs;
508  format->offsets[i] = asked_format->rgodf[j].dwOfs;
509  dt[index].value = 0;
510  next = next + dt[index].size;
511 
512  if (format->wine_df->rgodf[i].dwOfs != dt[index].offset_out)
513  same = 0;
514 
515  index++;
516  break;
517  }
518  }
519  }
520 
521  TRACE("Setting to default value :\n");
522  for (j = 0; j < asked_format->dwNumObjs; j++) {
523  if (done[j] == 0) {
524  TRACE(" - Asked (%d) :\n", j);
525  TRACE(" * GUID: %s ('%s')\n",
526  debugstr_guid(asked_format->rgodf[j].pguid),
527  _dump_dinput_GUID(asked_format->rgodf[j].pguid));
528  TRACE(" * Offset: %3d\n", asked_format->rgodf[j].dwOfs);
529  TRACE(" * dwType: 0x%08x\n", asked_format->rgodf[j].dwType);
530  TRACE(" "); _dump_EnumObjects_flags(asked_format->rgodf[j].dwType); TRACE("\n");
531  TRACE(" * dwFlags: 0x%08x\n", asked_format->rgodf[j].dwFlags);
532  TRACE(" "); _dump_ObjectDataFormat_flags(asked_format->rgodf[j].dwFlags); TRACE("\n");
533 
534  if (asked_format->rgodf[j].dwType & DIDFT_BUTTON)
535  dt[index].size = sizeof(BYTE);
536  else
537  dt[index].size = sizeof(DWORD);
538  dt[index].offset_in = -1;
539  dt[index].offset_out = asked_format->rgodf[j].dwOfs;
540  if (asked_format->rgodf[j].dwType & DIDFT_POV)
541  dt[index].value = -1;
542  else
543  dt[index].value = 0;
544  index++;
545 
546  same = 0;
547  }
548  }
549 
550  format->internal_format_size = format->wine_df->dwDataSize;
551  format->size = index;
552  if (same) {
553  HeapFree(GetProcessHeap(), 0, dt);
554  dt = NULL;
555  }
556  format->dt = dt;
557 
558  HeapFree(GetProcessHeap(), 0, done);
559 
560  return DI_OK;
561 
562 failed:
563  HeapFree(GetProcessHeap(), 0, done);
564  HeapFree(GetProcessHeap(), 0, dt);
565  format->dt = NULL;
566  HeapFree(GetProcessHeap(), 0, format->offsets);
567  format->offsets = NULL;
568  HeapFree(GetProcessHeap(), 0, format->user_df);
569  format->user_df = NULL;
570 
571  return DIERR_OUTOFMEMORY;
572 }
573 
574 /* find an object by its offset in a data format */
575 static int offset_to_object(const DataFormat *df, int offset)
576 {
577  int i;
578 
579  if (!df->offsets) return -1;
580 
581  for (i = 0; i < df->wine_df->dwNumObjs; i++)
582  if (df->offsets[i] == offset) return i;
583 
584  return -1;
585 }
586 
588 {
589  int i;
590 
591  id &= 0x00ffffff;
592  for (i = 0; i < df->dwNumObjs; i++)
593  if ((dataformat_to_odf(df, i)->dwType & 0x00ffffff) == id)
594  return i;
595 
596  return -1;
597 }
598 
599 static int id_to_offset(const DataFormat *df, int id)
600 {
601  int obj = id_to_object(df->wine_df, id);
602 
603  return obj >= 0 && df->offsets ? df->offsets[obj] : -1;
604 }
605 
607 {
608  switch (ph->dwHow)
609  {
610  case DIPH_BYID: return id_to_object(df->wine_df, ph->dwObj);
611  case DIPH_BYOFFSET: return offset_to_object(df, ph->dwObj);
612  }
613  FIXME("Unhandled ph->dwHow=='%04X'\n", (unsigned int)ph->dwHow);
614 
615  return -1;
616 }
617 
619 {
620  DWORD type = (0x0000ff00 & dwSemantic) >> 8;
621  DWORD offset = 0x000000ff & dwSemantic;
622  DWORD obj_instance = 0;
623  BOOL found = FALSE;
624  int i;
625 
626  for (i = 0; i < This->data_format.wine_df->dwNumObjs; i++)
627  {
628  LPDIOBJECTDATAFORMAT odf = dataformat_to_odf(This->data_format.wine_df, i);
629 
630  if (odf->dwOfs == offset)
631  {
632  obj_instance = DIDFT_GETINSTANCE(odf->dwType);
633  found = TRUE;
634  break;
635  }
636  }
637 
638  if (!found) return 0;
639 
642 
643  return type | (0x0000ff00 & (obj_instance << 8));
644 }
645 
646 /*
647  * get_mapping_key
648  * Retrieves an open registry key to save the mapping, parametrized for an username,
649  * specific device and specific action mapping guid.
650  */
651 static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WCHAR *guid)
652 {
653  static const WCHAR subkey[] = {
654  'S','o','f','t','w','a','r','e','\\',
655  'W','i','n','e','\\',
656  'D','i','r','e','c','t','I','n','p','u','t','\\',
657  'M','a','p','p','i','n','g','s','\\','%','s','\\','%','s','\\','%','s','\0'};
658  HKEY hkey;
659  WCHAR *keyname;
660 
661  keyname = HeapAlloc(GetProcessHeap(), 0,
662  sizeof(WCHAR) * (lstrlenW(subkey) + strlenW(username) + strlenW(device) + strlenW(guid)));
663  sprintfW(keyname, subkey, username, device, guid);
664 
665  /* The key used is HKCU\Software\Wine\DirectInput\Mappings\[username]\[device]\[mapping_guid] */
666  if (RegCreateKeyW(HKEY_CURRENT_USER, keyname, &hkey))
667  hkey = 0;
668 
669  HeapFree(GetProcessHeap(), 0, keyname);
670 
671  return hkey;
672 }
673 
674 static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUsername)
675 {
676  WCHAR *guid_str = NULL;
677  DIDEVICEINSTANCEW didev;
678  HKEY hkey;
679  int i;
680 
681  didev.dwSize = sizeof(didev);
682  IDirectInputDevice8_GetDeviceInfo(iface, &didev);
683 
684  if (StringFromCLSID(&lpdiaf->guidActionMap, &guid_str) != S_OK)
685  return DI_SETTINGSNOTSAVED;
686 
687  hkey = get_mapping_key(didev.tszInstanceName, lpszUsername, guid_str);
688 
689  if (!hkey)
690  {
691  CoTaskMemFree(guid_str);
692  return DI_SETTINGSNOTSAVED;
693  }
694 
695  /* Write each of the actions mapped for this device.
696  Format is "dwSemantic"="dwObjID" and key is of type REG_DWORD
697  */
698  for (i = 0; i < lpdiaf->dwNumActions; i++)
699  {
700  static const WCHAR format[] = {'%','x','\0'};
701  WCHAR label[9];
702 
703  if (IsEqualGUID(&didev.guidInstance, &lpdiaf->rgoAction[i].guidInstance) &&
704  lpdiaf->rgoAction[i].dwHow != DIAH_UNMAPPED)
705  {
707  RegSetValueExW(hkey, label, 0, REG_DWORD, (const BYTE*) &lpdiaf->rgoAction[i].dwObjID, sizeof(DWORD));
708  }
709  }
710 
711  RegCloseKey(hkey);
712  CoTaskMemFree(guid_str);
713 
714  return DI_OK;
715 }
716 
718 {
719  HKEY hkey;
720  WCHAR *guid_str;
721  DIDEVICEINSTANCEW didev;
722  int i, mapped = 0;
723 
724  didev.dwSize = sizeof(didev);
725  IDirectInputDevice8_GetDeviceInfo(&This->IDirectInputDevice8W_iface, &didev);
726 
727  if (StringFromCLSID(&lpdiaf->guidActionMap, &guid_str) != S_OK)
728  return FALSE;
729 
730  hkey = get_mapping_key(didev.tszInstanceName, username, guid_str);
731 
732  if (!hkey)
733  {
734  CoTaskMemFree(guid_str);
735  return FALSE;
736  }
737 
738  /* Try to read each action in the DIACTIONFORMAT from registry */
739  for (i = 0; i < lpdiaf->dwNumActions; i++)
740  {
741  static const WCHAR format[] = {'%','x','\0'};
742  DWORD id, size = sizeof(DWORD);
743  WCHAR label[9];
744 
746 
747  if (!RegQueryValueExW(hkey, label, 0, NULL, (LPBYTE) &id, &size))
748  {
749  lpdiaf->rgoAction[i].dwObjID = id;
750  lpdiaf->rgoAction[i].guidInstance = didev.guidInstance;
751  lpdiaf->rgoAction[i].dwHow = DIAH_DEFAULT;
752  mapped += 1;
753  }
754  }
755 
756  RegCloseKey(hkey);
757  CoTaskMemFree(guid_str);
758 
759  return mapped > 0;
760 }
761 
763 {
766  DWORD username_size = MAX_PATH;
767  int i;
768  BOOL load_success = FALSE, has_actions = FALSE;
769 
770  /* Unless asked the contrary by these flags, try to load a previous mapping */
771  if (!(dwFlags & DIDBAM_HWDEFAULTS))
772  {
773  /* Retrieve logged user name if necessary */
774  if (lpszUserName == NULL)
775  GetUserNameW(username, &username_size);
776  else
777  lstrcpynW(username, lpszUserName, MAX_PATH);
778 
779  load_success = load_mapping_settings(This, lpdiaf, username);
780  }
781 
782  if (load_success) return DI_OK;
783 
784  for (i=0; i < lpdiaf->dwNumActions; i++)
785  {
786  /* Don't touch a user configured action */
787  if (lpdiaf->rgoAction[i].dwHow == DIAH_USERCONFIG) continue;
788 
789  if ((lpdiaf->rgoAction[i].dwSemantic & devMask) == devMask)
790  {
791  DWORD obj_id = semantic_to_obj_id(This, lpdiaf->rgoAction[i].dwSemantic);
792  DWORD type = DIDFT_GETTYPE(obj_id);
793  DWORD inst = DIDFT_GETINSTANCE(obj_id);
794 
796 
798  if (type == DIDFT_RELAXIS) type = DIDFT_AXIS;
799 
800  /* Make sure the object exists */
801  odf = dataformat_to_odf_by_type(df, inst, type);
802 
803  if (odf != NULL)
804  {
805  lpdiaf->rgoAction[i].dwObjID = obj_id;
806  lpdiaf->rgoAction[i].guidInstance = This->guid;
807  lpdiaf->rgoAction[i].dwHow = DIAH_DEFAULT;
808  has_actions = TRUE;
809  }
810  }
811  else if (!(dwFlags & DIDBAM_PRESERVE))
812  {
813  /* We must clear action data belonging to other devices */
814  memset(&lpdiaf->rgoAction[i].guidInstance, 0, sizeof(GUID));
815  lpdiaf->rgoAction[i].dwHow = DIAH_UNMAPPED;
816  }
817  }
818 
819  if (!has_actions) return DI_NOEFFECT;
820 
821  return IDirectInputDevice8WImpl_BuildActionMap(iface, lpdiaf, lpszUserName, dwFlags);
822 }
823 
825 {
828  DIOBJECTDATAFORMAT *obj_df = NULL;
829  DIPROPDWORD dp;
830  DIPROPRANGE dpr;
831  DIPROPSTRING dps;
833  DWORD username_size = MAX_PATH;
834  int i, action = 0, num_actions = 0;
835  unsigned int offset = 0;
836 
837  if (This->acquired) return DIERR_ACQUIRED;
838 
839  data_format.dwSize = sizeof(data_format);
843 
844  /* Count the actions */
845  for (i=0; i < lpdiaf->dwNumActions; i++)
846  if (IsEqualGUID(&This->guid, &lpdiaf->rgoAction[i].guidInstance))
847  num_actions++;
848 
849  if (num_actions == 0) return DI_NOEFFECT;
850 
851  This->num_actions = num_actions;
852 
853  /* Construct the dataformat and actionmap */
854  obj_df = HeapAlloc(GetProcessHeap(), 0, sizeof(DIOBJECTDATAFORMAT)*num_actions);
856  data_format.dwNumObjs = num_actions;
857 
858  HeapFree(GetProcessHeap(), 0, This->action_map);
859  This->action_map = HeapAlloc(GetProcessHeap(), 0, sizeof(ActionMap)*num_actions);
860 
861  for (i = 0; i < lpdiaf->dwNumActions; i++)
862  {
863  if (IsEqualGUID(&This->guid, &lpdiaf->rgoAction[i].guidInstance))
864  {
865  DWORD inst = DIDFT_GETINSTANCE(lpdiaf->rgoAction[i].dwObjID);
868 
870  if (type == DIDFT_RELAXIS) type = DIDFT_AXIS;
871 
872  obj = dataformat_to_odf_by_type(df, inst, type);
873 
874  memcpy(&obj_df[action], obj, df->dwObjSize);
875 
876  This->action_map[action].uAppData = lpdiaf->rgoAction[i].uAppData;
877  This->action_map[action].offset = offset;
878  obj_df[action].dwOfs = offset;
879  offset += (type & DIDFT_BUTTON) ? 1 : 4;
880 
881  action++;
882  }
883  }
884 
886 
887  HeapFree(GetProcessHeap(), 0, obj_df);
888 
889  /* Set the device properties according to the action format */
890  dpr.diph.dwSize = sizeof(DIPROPRANGE);
891  dpr.lMin = lpdiaf->lAxisMin;
892  dpr.lMax = lpdiaf->lAxisMax;
893  dpr.diph.dwHeaderSize = sizeof(DIPROPHEADER);
894  dpr.diph.dwHow = DIPH_DEVICE;
896 
897  if (lpdiaf->dwBufferSize > 0)
898  {
899  dp.diph.dwSize = sizeof(DIPROPDWORD);
900  dp.dwData = lpdiaf->dwBufferSize;
901  dp.diph.dwHeaderSize = sizeof(DIPROPHEADER);
902  dp.diph.dwHow = DIPH_DEVICE;
904  }
905 
906  /* Retrieve logged user name if necessary */
907  if (lpszUserName == NULL)
908  GetUserNameW(username, &username_size);
909  else
910  lstrcpynW(username, lpszUserName, MAX_PATH);
911 
912  dps.diph.dwSize = sizeof(dps);
913  dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
914  dps.diph.dwObj = 0;
915  dps.diph.dwHow = DIPH_DEVICE;
916  if (dwFlags & DIDSAM_NOUSER)
917  dps.wsz[0] = '\0';
918  else
919  lstrcpynW(dps.wsz, username, ARRAY_SIZE(dps.wsz));
921 
922  /* Save the settings to disk */
923  save_mapping_settings(iface, lpdiaf, username);
924 
925  return DI_OK;
926 }
927 
928 /******************************************************************************
929  * queue_event - add new event to the ring queue
930  */
931 
932 void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq)
933 {
935  int next_pos, ofs = id_to_offset(&This->data_format, inst_id);
936 
937  /* Event is being set regardless of the queue state */
938  if (This->hEvent) SetEvent(This->hEvent);
939 
941 
942  if (!This->queue_len || This->overflow || ofs < 0) return;
943 
944  next_pos = (This->queue_head + 1) % This->queue_len;
945  if (next_pos == This->queue_tail)
946  {
947  TRACE(" queue overflowed\n");
948  This->overflow = TRUE;
949  return;
950  }
951 
952  TRACE(" queueing %d at offset %d (queue head %d / size %d)\n",
953  data, ofs, This->queue_head, This->queue_len);
954 
955  This->data_queue[This->queue_head].dwOfs = ofs;
956  This->data_queue[This->queue_head].dwData = data;
957  This->data_queue[This->queue_head].dwTimeStamp = time;
958  This->data_queue[This->queue_head].dwSequence = seq;
959 
960  /* Set uAppData by means of action mapping */
961  if (This->num_actions > 0)
962  {
963  int i;
964  for (i=0; i < This->num_actions; i++)
965  {
966  if (This->action_map[i].offset == ofs)
967  {
968  TRACE("Offset %d mapped to uAppData %lu\n", ofs, This->action_map[i].uAppData);
969  This->data_queue[This->queue_head].uAppData = This->action_map[i].uAppData;
970  break;
971  }
972  }
973  }
974 
975  This->queue_head = next_pos;
976  /* Send event if asked */
977 }
978 
979 /******************************************************************************
980  * Acquire
981  */
982 
984 {
986  HRESULT res;
987 
988  TRACE("(%p)\n", This);
989 
990  if (!This->data_format.user_df) return DIERR_INVALIDPARAM;
991  if (This->dwCoopLevel & DISCL_FOREGROUND && This->win != GetForegroundWindow())
992  return DIERR_OTHERAPPHASPRIO;
993 
994  EnterCriticalSection(&This->crit);
995  res = This->acquired ? S_FALSE : DI_OK;
996  This->acquired = 1;
997  LeaveCriticalSection(&This->crit);
998  if (res == DI_OK)
999  check_dinput_hooks(iface, TRUE);
1000 
1001  return res;
1002 }
1003 
1005 {
1008 }
1009 
1010 
1011 /******************************************************************************
1012  * Unacquire
1013  */
1014 
1016 {
1018  HRESULT res;
1019 
1020  TRACE("(%p)\n", This);
1021 
1022  EnterCriticalSection(&This->crit);
1023  res = !This->acquired ? DI_NOEFFECT : DI_OK;
1024  This->acquired = 0;
1025  LeaveCriticalSection(&This->crit);
1026  if (res == DI_OK)
1027  check_dinput_hooks(iface, FALSE);
1028 
1029  return res;
1030 }
1031 
1033 {
1036 }
1037 
1038 /******************************************************************************
1039  * IDirectInputDeviceA
1040  */
1041 
1043 {
1045  HRESULT res = DI_OK;
1046 
1047  if (!df) return E_POINTER;
1048  TRACE("(%p) %p\n", This, df);
1049  _dump_DIDATAFORMAT(df);
1050 
1051  if (df->dwSize != sizeof(DIDATAFORMAT)) return DIERR_INVALIDPARAM;
1052  if (This->acquired) return DIERR_ACQUIRED;
1053 
1054  EnterCriticalSection(&This->crit);
1055 
1056  release_DataFormat(&This->data_format);
1057  res = create_DataFormat(df, &This->data_format);
1058 
1059  LeaveCriticalSection(&This->crit);
1060  return res;
1061 }
1062 
1064 {
1067 }
1068 
1069 /******************************************************************************
1070  * SetCooperativeLevel
1071  *
1072  * Set cooperative level and the source window for the events.
1073  */
1075 {
1077 
1078  TRACE("(%p) %p,0x%08x\n", This, hwnd, dwflags);
1080 
1081  if ((dwflags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == 0 ||
1083  (dwflags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == 0 ||
1085  return DIERR_INVALIDPARAM;
1086 
1087  if (hwnd && GetWindowLongW(hwnd, GWL_STYLE) & WS_CHILD) return E_HANDLE;
1088 
1090  hwnd = GetDesktopWindow();
1091 
1092  if (!IsWindow(hwnd)) return E_HANDLE;
1093 
1094  /* For security reasons native does not allow exclusive background level
1095  for mouse and keyboard only */
1097  (IsEqualGUID(&This->guid, &GUID_SysMouse) ||
1098  IsEqualGUID(&This->guid, &GUID_SysKeyboard)))
1099  return DIERR_UNSUPPORTED;
1100 
1101  /* Store the window which asks for the mouse */
1102  EnterCriticalSection(&This->crit);
1103  This->win = hwnd;
1104  This->dwCoopLevel = dwflags;
1105  LeaveCriticalSection(&This->crit);
1106 
1107  return DI_OK;
1108 }
1109 
1111 {
1114 }
1115 
1116 /******************************************************************************
1117  * SetEventNotification : specifies event to be sent on state change
1118  */
1120 {
1122 
1123  TRACE("(%p) %p\n", This, event);
1124 
1125  EnterCriticalSection(&This->crit);
1126  This->hEvent = event;
1127  LeaveCriticalSection(&This->crit);
1128  return DI_OK;
1129 }
1130 
1132 {
1135 }
1136 
1137 
1139 {
1141  ULONG ref = InterlockedDecrement(&(This->ref));
1142 
1143  TRACE("(%p) releasing from %d\n", This, ref + 1);
1144 
1145  if (ref) return ref;
1146 
1148  /* Reset the FF state, free all effects, etc */
1150 
1151  HeapFree(GetProcessHeap(), 0, This->data_queue);
1152 
1153  /* Free data format */
1154  HeapFree(GetProcessHeap(), 0, This->data_format.wine_df->rgodf);
1155  HeapFree(GetProcessHeap(), 0, This->data_format.wine_df);
1156  release_DataFormat(&This->data_format);
1157 
1158  /* Free action mapping */
1159  HeapFree(GetProcessHeap(), 0, This->action_map);
1160 
1161  EnterCriticalSection( &This->dinput->crit );
1162  list_remove( &This->entry );
1163  LeaveCriticalSection( &This->dinput->crit );
1164 
1165  IDirectInput_Release(&This->dinput->IDirectInput7A_iface);
1166  This->crit.DebugInfo->Spare[0] = 0;
1167  DeleteCriticalSection(&This->crit);
1168 
1169  HeapFree(GetProcessHeap(), 0, This);
1170 
1171  return DI_OK;
1172 }
1173 
1175 {
1178 }
1179 
1181 {
1183 
1184  TRACE("(%p this=%p,%s,%p)\n", iface, This, debugstr_guid(riid), ppobj);
1185  if (IsEqualGUID(&IID_IUnknown, riid) ||
1186  IsEqualGUID(&IID_IDirectInputDeviceA, riid) ||
1187  IsEqualGUID(&IID_IDirectInputDevice2A, riid) ||
1188  IsEqualGUID(&IID_IDirectInputDevice7A, riid) ||
1189  IsEqualGUID(&IID_IDirectInputDevice8A, riid))
1190  {
1193  return DI_OK;
1194  }
1195  if (IsEqualGUID(&IID_IDirectInputDeviceW, riid) ||
1196  IsEqualGUID(&IID_IDirectInputDevice2W, riid) ||
1197  IsEqualGUID(&IID_IDirectInputDevice7W, riid) ||
1198  IsEqualGUID(&IID_IDirectInputDevice8W, riid))
1199  {
1202  return DI_OK;
1203  }
1204 
1205  WARN("Unsupported interface!\n");
1206  return E_FAIL;
1207 }
1208 
1210 {
1213 }
1214 
1216 {
1218  return InterlockedIncrement(&This->ref);
1219 }
1220 
1222 {
1225 }
1226 
1228  LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags)
1229 {
1232  int i;
1233 
1234  TRACE("(%p) %p,%p flags:%08x)\n", iface, lpCallback, lpvRef, dwFlags);
1235  TRACE(" - flags = ");
1237  TRACE("\n");
1238 
1239  /* Only the fields till dwFFMaxForce are relevant */
1240  memset(&ddoi, 0, sizeof(ddoi));
1241  ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
1242 
1243  for (i = 0; i < This->data_format.wine_df->dwNumObjs; i++)
1244  {
1245  LPDIOBJECTDATAFORMAT odf = dataformat_to_odf(This->data_format.wine_df, i);
1246 
1247  if (dwFlags != DIDFT_ALL && !(dwFlags & DIDFT_GETTYPE(odf->dwType))) continue;
1248  if (IDirectInputDevice_GetObjectInfo(iface, &ddoi, odf->dwType, DIPH_BYID) != DI_OK)
1249  continue;
1250 
1251  if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) break;
1252  }
1253 
1254  return DI_OK;
1255 }
1256 
1258  LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags)
1259 {
1262  int i;
1263 
1264  TRACE("(%p) %p,%p flags:%08x)\n", iface, lpCallback, lpvRef, dwFlags);
1265  TRACE(" - flags = ");
1267  TRACE("\n");
1268 
1269  /* Only the fields till dwFFMaxForce are relevant */
1270  memset(&ddoi, 0, sizeof(ddoi));
1271  ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW, dwFFMaxForce);
1272 
1273  for (i = 0; i < This->data_format.wine_df->dwNumObjs; i++)
1274  {
1275  LPDIOBJECTDATAFORMAT odf = dataformat_to_odf(This->data_format.wine_df, i);
1276 
1277  if (dwFlags != DIDFT_ALL && !(dwFlags & DIDFT_GETTYPE(odf->dwType))) continue;
1278  if (IDirectInputDevice_GetObjectInfo(iface, &ddoi, odf->dwType, DIPH_BYID) != DI_OK)
1279  continue;
1280 
1281  if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) break;
1282  }
1283 
1284  return DI_OK;
1285 }
1286 
1287 /******************************************************************************
1288  * GetProperty
1289  */
1290 
1292 {
1294 
1295  TRACE("(%p) %s,%p\n", iface, debugstr_guid(rguid), pdiph);
1296  _dump_DIPROPHEADER(pdiph);
1297 
1298  if (!IS_DIPROP(rguid)) return DI_OK;
1299 
1300  switch (LOWORD(rguid))
1301  {
1303  {
1304  LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
1305 
1306  if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
1307 
1308  pd->dwData = This->queue_len;
1309  TRACE("buffersize = %d\n", pd->dwData);
1310  break;
1311  }
1312  case (DWORD_PTR) DIPROP_USERNAME:
1313  {
1314  LPDIPROPSTRING ps = (LPDIPROPSTRING)pdiph;
1315  struct DevicePlayer *device_player;
1316 
1317  if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
1318 
1319  LIST_FOR_EACH_ENTRY(device_player, &This->dinput->device_players,
1320  struct DevicePlayer, entry)
1321  {
1322  if (IsEqualGUID(&device_player->instance_guid, &This->guid))
1323  {
1324  if (*device_player->username)
1325  {
1326  lstrcpynW(ps->wsz, device_player->username, ARRAY_SIZE(ps->wsz));
1327  return DI_OK;
1328  }
1329  else break;
1330  }
1331  }
1332  return S_FALSE;
1333  }
1334  case (DWORD_PTR) DIPROP_VIDPID:
1335  FIXME("DIPROP_VIDPID not implemented\n");
1336  return DIERR_UNSUPPORTED;
1337  default:
1338  FIXME("Unknown property %s\n", debugstr_guid(rguid));
1339  return DIERR_INVALIDPARAM;
1340  }
1341 
1342  return DI_OK;
1343 }
1344 
1346 {
1349 }
1350 
1351 /******************************************************************************
1352  * SetProperty
1353  */
1354 
1356  LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
1357 {
1359 
1360  TRACE("(%p) %s,%p\n", iface, debugstr_guid(rguid), pdiph);
1361  _dump_DIPROPHEADER(pdiph);
1362 
1363  if (!IS_DIPROP(rguid)) return DI_OK;
1364 
1365  switch (LOWORD(rguid))
1366  {
1367  case (DWORD_PTR) DIPROP_AXISMODE:
1368  {
1369  LPCDIPROPDWORD pd = (LPCDIPROPDWORD)pdiph;
1370 
1371  if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
1372  if (pdiph->dwHow == DIPH_DEVICE && pdiph->dwObj) return DIERR_INVALIDPARAM;
1373  if (This->acquired) return DIERR_ACQUIRED;
1374  if (pdiph->dwHow != DIPH_DEVICE) return DIERR_UNSUPPORTED;
1375  if (!This->data_format.user_df) return DI_OK;
1376 
1377  TRACE("Axis mode: %s\n", pd->dwData == DIPROPAXISMODE_ABS ? "absolute" :
1378  "relative");
1379 
1380  EnterCriticalSection(&This->crit);
1381  This->data_format.user_df->dwFlags &= ~DIDFT_AXIS;
1382  This->data_format.user_df->dwFlags |= pd->dwData == DIPROPAXISMODE_ABS ?
1384  LeaveCriticalSection(&This->crit);
1385  break;
1386  }
1388  {
1389  LPCDIPROPDWORD pd = (LPCDIPROPDWORD)pdiph;
1390 
1391  if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
1392  if (This->acquired) return DIERR_ACQUIRED;
1393 
1394  TRACE("buffersize = %d\n", pd->dwData);
1395 
1396  EnterCriticalSection(&This->crit);
1397  HeapFree(GetProcessHeap(), 0, This->data_queue);
1398 
1399  This->data_queue = !pd->dwData ? NULL : HeapAlloc(GetProcessHeap(), 0,
1400  pd->dwData * sizeof(DIDEVICEOBJECTDATA));
1401  This->queue_head = This->queue_tail = This->overflow = 0;
1402  This->queue_len = pd->dwData;
1403 
1404  LeaveCriticalSection(&This->crit);
1405  break;
1406  }
1407  case (DWORD_PTR) DIPROP_USERNAME:
1408  {
1409  LPCDIPROPSTRING ps = (LPCDIPROPSTRING)pdiph;
1410  struct DevicePlayer *device_player;
1411  BOOL found = FALSE;
1412 
1413  if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
1414 
1415  LIST_FOR_EACH_ENTRY(device_player, &This->dinput->device_players,
1416  struct DevicePlayer, entry)
1417  {
1418  if (IsEqualGUID(&device_player->instance_guid, &This->guid))
1419  {
1420  found = TRUE;
1421  break;
1422  }
1423  }
1424  if (!found && (device_player =
1425  HeapAlloc(GetProcessHeap(), 0, sizeof(struct DevicePlayer))))
1426  {
1427  list_add_tail(&This->dinput->device_players, &device_player->entry);
1428  device_player->instance_guid = This->guid;
1429  }
1430  if (device_player)
1431  lstrcpynW(device_player->username, ps->wsz, ARRAY_SIZE(device_player->username));
1432  break;
1433  }
1434  default:
1435  WARN("Unknown property %s\n", debugstr_guid(rguid));
1436  return DIERR_UNSUPPORTED;
1437  }
1438 
1439  return DI_OK;
1440 }
1441 
1443  LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
1444 {
1447 }
1448 
1450  LPDIRECTINPUTDEVICE8A iface,
1452  DWORD dwObj,
1453  DWORD dwHow)
1454 {
1456  DIDEVICEOBJECTINSTANCEW didoiW;
1457  HRESULT res;
1458 
1459  if (!pdidoi ||
1460  (pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEA) &&
1461  pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3A)))
1462  return DIERR_INVALIDPARAM;
1463 
1464  didoiW.dwSize = sizeof(didoiW);
1466  if (res == DI_OK)
1467  {
1468  DWORD dwSize = pdidoi->dwSize;
1469 
1470  memset(pdidoi, 0, pdidoi->dwSize);
1471  pdidoi->dwSize = dwSize;
1472  pdidoi->guidType = didoiW.guidType;
1473  pdidoi->dwOfs = didoiW.dwOfs;
1474  pdidoi->dwType = didoiW.dwType;
1475  pdidoi->dwFlags = didoiW.dwFlags;
1476  }
1477 
1478  return res;
1479 }
1480 
1482  LPDIRECTINPUTDEVICE8W iface,
1484  DWORD dwObj,
1485  DWORD dwHow)
1486 {
1488  DWORD dwSize;
1490  int idx = -1;
1491 
1492  TRACE("(%p) %d(0x%08x) -> %p\n", This, dwHow, dwObj, pdidoi);
1493 
1494  if (!pdidoi ||
1495  (pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEW) &&
1496  pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3W)))
1497  return DIERR_INVALIDPARAM;
1498 
1499  switch (dwHow)
1500  {
1501  case DIPH_BYOFFSET:
1502  if (!This->data_format.offsets) break;
1503  for (idx = This->data_format.wine_df->dwNumObjs - 1; idx >= 0; idx--)
1504  if (This->data_format.offsets[idx] == dwObj) break;
1505  break;
1506  case DIPH_BYID:
1507  dwObj &= 0x00ffffff;
1508  for (idx = This->data_format.wine_df->dwNumObjs - 1; idx >= 0; idx--)
1509  if ((dataformat_to_odf(This->data_format.wine_df, idx)->dwType & 0x00ffffff) == dwObj)
1510  break;
1511  break;
1512 
1513  case DIPH_BYUSAGE:
1514  FIXME("dwHow = DIPH_BYUSAGE not implemented\n");
1515  break;
1516  default:
1517  WARN("invalid parameter: dwHow = %08x\n", dwHow);
1518  return DIERR_INVALIDPARAM;
1519  }
1520  if (idx < 0) return DIERR_OBJECTNOTFOUND;
1521 
1522  odf = dataformat_to_odf(This->data_format.wine_df, idx);
1523  dwSize = pdidoi->dwSize; /* save due to memset below */
1524  memset(pdidoi, 0, pdidoi->dwSize);
1525  pdidoi->dwSize = dwSize;
1526  if (odf->pguid) pdidoi->guidType = *odf->pguid;
1527  pdidoi->dwOfs = This->data_format.offsets ? This->data_format.offsets[idx] : odf->dwOfs;
1528  pdidoi->dwType = odf->dwType;
1529  pdidoi->dwFlags = odf->dwFlags;
1530 
1531  return DI_OK;
1532 }
1533 
1535  LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
1536 {
1538  HRESULT ret = DI_OK;
1539  int len;
1540 
1541  TRACE("(%p) %p -> %p(%d) x%d, 0x%08x\n",
1542  This, dod, entries, entries ? *entries : 0, dodsize, flags);
1543 
1544  if (This->dinput->dwVersion == 0x0800 || dodsize == sizeof(DIDEVICEOBJECTDATA_DX3))
1545  {
1546  if (!This->queue_len) return DIERR_NOTBUFFERED;
1547  if (!This->acquired) return DIERR_NOTACQUIRED;
1548  }
1549 
1550  if (!This->queue_len)
1551  return DI_OK;
1552  if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3))
1553  return DIERR_INVALIDPARAM;
1554 
1555  IDirectInputDevice2_Poll(iface);
1556  EnterCriticalSection(&This->crit);
1557 
1558  len = This->queue_head - This->queue_tail;
1559  if (len < 0) len += This->queue_len;
1560 
1561  if ((*entries != INFINITE) && (len > *entries)) len = *entries;
1562 
1563  if (dod)
1564  {
1565  int i;
1566  for (i = 0; i < len; i++)
1567  {
1568  int n = (This->queue_tail + i) % This->queue_len;
1569  memcpy((char *)dod + dodsize * i, This->data_queue + n, dodsize);
1570  }
1571  }
1572  *entries = len;
1573 
1574  if (This->overflow && This->dinput->dwVersion == 0x0800)
1576 
1577  if (!(flags & DIGDD_PEEK))
1578  {
1579  /* Advance reading position */
1580  This->queue_tail = (This->queue_tail + len) % This->queue_len;
1581  This->overflow = FALSE;
1582  }
1583 
1584  LeaveCriticalSection(&This->crit);
1585 
1586  TRACE("Returning %d events queued\n", *entries);
1587  return ret;
1588 }
1589 
1591  LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
1592 {
1595 }
1596 
1598 {
1599  FIXME("(this=%p,%p,0x%08x): stub!\n", iface, hwndOwner, dwFlags);
1600 
1601  return DI_OK;
1602 }
1603 
1605 {
1608 }
1609 
1611  REFGUID rguid)
1612 {
1613  FIXME("(this=%p,%p,%d,%s): stub!\n", iface, hinst, dwVersion, debugstr_guid(rguid));
1614  return DI_OK;
1615 }
1616 
1618  REFGUID rguid)
1619 {
1622 }
1623 
1624 /******************************************************************************
1625  * IDirectInputDevice2A
1626  */
1627 
1629  LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
1630 {
1631  FIXME("(this=%p,%s,%p,%p,%p): stub!\n", iface, debugstr_guid(rguid), lpeff, ppdef, pUnkOuter);
1632 
1633  FIXME("not available in the generic implementation\n");
1634  *ppdef = NULL;
1635  return DIERR_UNSUPPORTED;
1636 }
1637 
1639  LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
1640 {
1642  return IDirectInputDevice2WImpl_CreateEffect(IDirectInputDevice8W_from_impl(This), rguid, lpeff, ppdef, pUnkOuter);
1643 }
1644 
1646  LPDIRECTINPUTDEVICE8A iface,
1647  LPDIENUMEFFECTSCALLBACKA lpCallback,
1648  LPVOID lpvRef,
1649  DWORD dwFlags)
1650 {
1651  FIXME("(this=%p,%p,%p,0x%08x): stub!\n",
1652  iface, lpCallback, lpvRef, dwFlags);
1653 
1654  return DI_OK;
1655 }
1656 
1658  LPDIRECTINPUTDEVICE8W iface,
1659  LPDIENUMEFFECTSCALLBACKW lpCallback,
1660  LPVOID lpvRef,
1661  DWORD dwFlags)
1662 {
1663  FIXME("(this=%p,%p,%p,0x%08x): stub!\n",
1664  iface, lpCallback, lpvRef, dwFlags);
1665 
1666  return DI_OK;
1667 }
1668 
1670  LPDIRECTINPUTDEVICE8A iface,
1671  LPDIEFFECTINFOA lpdei,
1672  REFGUID rguid)
1673 {
1674  FIXME("(this=%p,%p,%s): stub!\n",
1675  iface, lpdei, debugstr_guid(rguid));
1676  return DI_OK;
1677 }
1678 
1680  LPDIRECTINPUTDEVICE8W iface,
1681  LPDIEFFECTINFOW lpdei,
1682  REFGUID rguid)
1683 {
1684  FIXME("(this=%p,%p,%s): stub!\n",
1685  iface, lpdei, debugstr_guid(rguid));
1686  return DI_OK;
1687 }
1688 
1690 {
1691  FIXME("(this=%p,%p): stub!\n", iface, pdwOut);
1692  return DI_OK;
1693 }
1694 
1696 {
1699 }
1700 
1702 {
1703  TRACE("(%p) 0x%08x:\n", iface, dwFlags);
1704  return DI_NOEFFECT;
1705 }
1706 
1708 {
1711 }
1712 
1715 {
1716  FIXME("(this=%p,%p,%p,0x%08x): stub!\n", iface, lpCallback, lpvRef, dwFlags);
1717  return DI_OK;
1718 }
1719 
1722 {
1725 }
1726 
1728 {
1729  FIXME("(this=%p,%p): stub!\n", iface, lpDIEEsc);
1730  return DI_OK;
1731 }
1732 
1734 {
1737 }
1738 
1740 {
1742 
1743  if (!This->acquired) return DIERR_NOTACQUIRED;
1744 
1746  return DI_OK;
1747 }
1748 
1750 {
1753 }
1754 
1756  LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut,
1757  DWORD dwFlags)
1758 {
1759  FIXME("(this=%p,0x%08x,%p,%p,0x%08x): stub!\n", iface, cbObjectData, rgdod, pdwInOut, dwFlags);
1760 
1761  return DI_OK;
1762 }
1763 
1765  LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut,
1766  DWORD dwFlags)
1767 {
1770  pdwInOut, dwFlags);
1771 }
1772 
1774  LPCSTR lpszFileName,
1776  LPVOID pvRef,
1777  DWORD dwFlags)
1778 {
1779  FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", iface, lpszFileName, pec, pvRef, dwFlags);
1780 
1781  return DI_OK;
1782 }
1783 
1785  LPCWSTR lpszFileName,
1787  LPVOID pvRef,
1788  DWORD dwFlags)
1789 {
1790  FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", iface, debugstr_w(lpszFileName), pec, pvRef, dwFlags);
1791 
1792  return DI_OK;
1793 }
1794 
1796  LPCSTR lpszFileName,
1797  DWORD dwEntries,
1798  LPDIFILEEFFECT rgDiFileEft,
1799  DWORD dwFlags)
1800 {
1801  FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", iface, lpszFileName, dwEntries, rgDiFileEft, dwFlags);
1802 
1803  return DI_OK;
1804 }
1805 
1807  LPCWSTR lpszFileName,
1808  DWORD dwEntries,
1809  LPDIFILEEFFECT rgDiFileEft,
1810  DWORD dwFlags)
1811 {
1812  FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", iface, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags);
1813 
1814  return DI_OK;
1815 }
1816 
1818  LPDIACTIONFORMATW lpdiaf,
1819  LPCWSTR lpszUserName,
1820  DWORD dwFlags)
1821 {
1822  FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
1823 #define X(x) if (dwFlags & x) FIXME("\tdwFlags =|"#x"\n");
1824  X(DIDBAM_DEFAULT)
1828 #undef X
1829 
1830  return DI_OK;
1831 }
1832 
1834  LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader)
1835 {
1836  FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader);
1837 
1838  return DI_OK;
1839 }
1840 
1842  LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader)
1843 {
1844  FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader);
1845 
1846  return DI_OK;
1847 }
HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
Definition: device.c:1442
HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader)
Definition: device.c:1841
#define DIDFT_TGLBUTTON
Definition: dinput.h:755
char * name
Definition: wpp.c:36
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1257
HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
Definition: device.c:1628
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
#define DIDBAM_PRESERVE
Definition: dinput.h:1355
HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: device.c:1590
void check_dinput_events(void)
Definition: dinput_main.c:1870
HRESULT WINAPI IDirectInputDevice2AImpl_Poll(LPDIRECTINPUTDEVICE8A iface)
Definition: device.c:1749
LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD type)
Definition: device.c:411
struct DIPROPSTRING * LPDIPROPSTRING
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
Definition: device.c:1764
DWORD dwSize
Definition: dinput.h:828
#define DIDF_ABSAXIS
Definition: dinput.h:775
HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags)
Definition: device.c:1701
#define DIPROPAXISMODE_ABS
Definition: dinput.h:888
DWORD dwObjID
Definition: dinput.h:1286
#define E_HANDLE
Definition: winerror.h:2850
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
void _dump_OBJECTINSTANCEA(const DIDEVICEOBJECTINSTANCEA *ddoi)
Definition: device.c:185
DWORD dwSize
Definition: dinput.h:808
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:59
Definition: scsiwmi.h:51
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: device.c:1291
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define IDirectInputDevice2_AddRef(p)
Definition: dinput.h:1726
BOOL(CALLBACK * LPDIENUMCREATEDEFFECTOBJECTSCALLBACK)(LPDIRECTINPUTEFFECT, LPVOID)
Definition: dinput.h:468
#define DIPH_BYUSAGE
Definition: dinput.h:838
#define DIPH_BYID
Definition: dinput.h:837
const char * _dump_dinput_GUID(const GUID *guid)
Definition: device.c:196
HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(LPDIRECTINPUTDEVICE8A iface, LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1227
#define DIDFT_INSTANCEMASK
Definition: dinput.h:761
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
#define DIERR_NOTACQUIRED
Definition: dinput.h:167
REFIID riid
Definition: precomp.h:44
HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df)
Definition: device.c:824
BOOL(CALLBACK * LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID)
Definition: dinput.h:464
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define DIDOI_FFEFFECTTRIGGER
Definition: dinput.h:818
DWORD dwNumObjs
Definition: dinput.h:812
HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:983
int internal_format_size
void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi)
Definition: device.c:190
#define IDirectInputDevice8_SendForceFeedbackCommand(p, a)
Definition: dinput.h:2060
#define WARN(fmt,...)
Definition: debug.h:111
BOOL(CALLBACK * LPDIENUMEFFECTSCALLBACKA)(LPCDIEFFECTINFOA, LPVOID)
Definition: dinput.h:1150
BOOL(CALLBACK * LPDIENUMEFFECTSINFILECALLBACK)(LPCDIFILEEFFECT, LPVOID)
Definition: dinput.h:1260
WCHAR username[MAX_PATH]
GLintptr offset
Definition: glext.h:5920
static HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *format)
Definition: device.c:431
GLdouble n
Definition: glext.h:7729
BOOL(CALLBACK * LPDIENUMEFFECTSCALLBACKW)(LPCDIEFFECTINFOW, LPVOID)
Definition: dinput.h:1151
DWORD dwObjSize
Definition: dinput.h:809
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(LPDIRECTINPUTDEVICE8A iface, HWND hwndOwner, DWORD dwFlags)
Definition: device.c:1604
GLuint buffer
Definition: glext.h:5915
WCHAR tszName[MAX_PATH]
Definition: dinput.h:371
static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUsername)
Definition: device.c:674
GUID guidInstance
Definition: dinput.h:1285
#define WS_CHILD
Definition: pedump.c:617
#define DIPROP_RANGE
Definition: dinput.h:892
static void _dump_EnumObjects_flags(DWORD dwFlags)
Definition: device.c:126
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
__u16 time
Definition: mkdosfs.c:366
HRESULT WINAPI IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1739
#define DIDFT_COLLECTION
Definition: dinput.h:758
HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
Definition: device.c:1817
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface, LPCWSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags)
Definition: device.c:1806
#define DIDBAM_INITIALIZE
Definition: dinput.h:1356
DWORD dwHow
Definition: dinput.h:831
#define lstrlenW
Definition: compat.h:407
#define E_FAIL
Definition: ddrawi.h:102
struct list entry
ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1215
#define DWORD
Definition: nt_native.h:44
void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
Definition: dinput_main.c:1833
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:546
Definition: send.c:47
static void _dump_ObjectDataFormat_flags(DWORD dwFlags)
Definition: device.c:90
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:46
#define DIDFT_ABSAXIS
Definition: dinput.h:752
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define DIDBAM_DEFAULT
Definition: dinput.h:1354
#define DIPH_DEVICE
Definition: dinput.h:835
#define lstrcpynW
Definition: compat.h:397
const DIPROPSTRING * LPCDIPROPSTRING
Definition: dinput.h:877
#define DIERR_UNSUPPORTED
Definition: dinput.h:156
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
#define DISCL_NONEXCLUSIVE
Definition: dinput.h:966
HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: device.c:1345
#define DI_BUFFEROVERFLOW
Definition: dinput.h:130
struct _DIOBJECTDATAFORMAT * LPDIOBJECTDATAFORMAT
LPDIDATAFORMAT wine_df
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
const DIPROPDWORD * LPCDIPROPDWORD
Definition: dinput.h:846
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DIPROPHEADER diph
Definition: dinput.h:843
const GUID * guid
GLenum GLint GLuint mask
Definition: glext.h:6028
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
struct DIPROPRANGE DIPROPRANGE
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
#define DIDFT_BUTTON
Definition: dinput.h:756
HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
Definition: device.c:1755
static LPUNKNOWN
Definition: ndr_ole.c:49
static LPDIOBJECTDATAFORMAT dataformat_to_odf(LPCDIDATAFORMAT df, int idx)
Definition: device.c:402
#define DIDF_RELAXIS
Definition: dinput.h:776
#define debugstr_w
Definition: kernel32.h:32
GLenum GLint ref
Definition: glext.h:6028
#define DIPH_BYOFFSET
Definition: dinput.h:836
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL(CALLBACK * LPDIENUMDEVICEOBJECTSCALLBACKW)(LPCDIDEVICEOBJECTINSTANCEW, LPVOID)
Definition: dinput.h:465
unsigned int idx
Definition: utils.c:41
#define S_FALSE
Definition: winerror.h:2357
#define DIDOI_FFACTUATOR
Definition: dinput.h:817
#define IDirectInputDevice_GetObjectInfo(p, a, b, c)
Definition: dinput.h:1617
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define DIDFT_FFEFFECTTRIGGER
Definition: dinput.h:766
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
static IDirectInputDevice8A * IDirectInputDevice8A_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:55
static int offset_to_object(const DataFormat *df, int offset)
Definition: device.c:575
HRESULT WINAPI IDirectInputDevice2AImpl_Escape(LPDIRECTINPUTDEVICE8A iface, LPDIEFFESCAPE lpDIEEsc)
Definition: device.c:1733
#define DIDOI_ASPECTMASK
Definition: dinput.h:824
#define DIDSAM_NOUSER
Definition: dinput.h:1360
static const DIDATAFORMAT data_format
Definition: device.c:49
GLuint index
Definition: glext.h:6031
const char * LPCSTR
Definition: xmlstorage.h:183
#define debugstr_guid
Definition: kernel32.h:35
#define DISCL_NOWINKEY
Definition: dinput.h:969
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
int find_property(const DataFormat *df, LPCDIPROPHEADER ph)
Definition: device.c:606
#define DISFFC_RESET
Definition: dinput.h:972
HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8A iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1720
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static WCHAR username[]
Definition: url.c:32
static void _dump_cooperativelevel_DI(DWORD dwFlags)
Definition: device.c:67
static int id_to_offset(const DataFormat *df, int id)
Definition: device.c:599
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define DIPROP_BUFFERSIZE
Definition: dinput.h:885
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags)
Definition: device.c:1773
DWORD dwDataSize
Definition: dinput.h:1330
#define DISCL_BACKGROUND
Definition: dinput.h:968
WINE_DEFAULT_DEBUG_CHANNEL(d3d8)
HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader)
Definition: device.c:1833
#define DIAH_UNMAPPED
Definition: dinput.h:1301
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
void _dump_DIDATAFORMAT(const DIDATAFORMAT *df)
Definition: device.c:241
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE event)
Definition: device.c:1119
HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags)
Definition: device.c:1597
DIPROPHEADER diph
Definition: dinput.h:849
#define IDirectInput_Release(p)
Definition: dinput.h:2241
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:50
#define DIERR_ACQUIRED
Definition: dinput.h:165
void _dump_DIPROPHEADER(LPCDIPROPHEADER diph)
Definition: device.c:175
GLsizeiptr size
Definition: glext.h:5919
#define DIDFT_ANYINSTANCE
Definition: dinput.h:760
#define GetProcessHeap()
Definition: compat.h:395
HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags)
Definition: device.c:1795
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df)
Definition: device.c:1042
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define DIERR_OUTOFMEMORY
Definition: dinput.h:155
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DI_SETTINGSNOTSAVED
Definition: dinput.h:137
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define DIDOI_ASPECTPOSITION
Definition: dinput.h:820
LONG HRESULT
Definition: typedefs.h:77
void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df)
Definition: device.c:325
#define DIGDD_PEEK
Definition: dinput.h:778
const GUID IID_IUnknown
#define DIDOI_ASPECTACCEL
Definition: dinput.h:822
HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(LPDIRECTINPUTDEVICE8A iface, LPDIENUMEFFECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1645
#define DIDFT_ALIAS
Definition: dinput.h:769
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
#define DIDFT_OPTIONAL
Definition: dinput.h:771
HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMEFFECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1657
#define DIDOI_POLLED
Definition: dinput.h:819
static FILE * out
Definition: regtests2xml.c:44
#define DIDFT_OUTPUT
Definition: dinput.h:767
unsigned long DWORD
Definition: ntddk_ex.h:95
DataTransform * dt
#define DIDOI_ASPECTFORCE
Definition: dinput.h:823
WCHAR wsz[MAX_PATH]
Definition: dinput.h:875
#define DIDFT_NODATA
Definition: dinput.h:759
#define IDirectInputDevice8_GetDeviceInfo(p, a)
Definition: dinput.h:2052
#define DISCL_FOREGROUND
Definition: dinput.h:967
HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid)
Definition: device.c:1610
#define IDirectInputDevice2_Poll(p)
Definition: dinput.h:1752
HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8A iface, DWORD dwFlags)
Definition: device.c:1707
struct IDirectInputEffect * LPDIRECTINPUTEFFECT
Definition: dinput.h:107
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: device.c:1534
CHAR tszName[MAX_PATH]
Definition: dinput.h:352
GLbitfield flags
Definition: glext.h:7161
HRESULT WINAPI IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc)
Definition: device.c:1727
DWORD dwFlags
Definition: dinput.h:810
HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8A iface, LPDIEFFECTINFOA lpdei, REFGUID rguid)
Definition: device.c:1669
struct _DIOBJECTDATAFORMAT DIOBJECTDATAFORMAT
int ret
#define index(s, c)
Definition: various.h:29
#define InterlockedDecrement
Definition: armddk.h:52
HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj)
Definition: device.c:1180
HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
Definition: device.c:1032
ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface)
Definition: device.c:1174
#define DIDBAM_HWDEFAULTS
Definition: dinput.h:1357
#define DIDFT_AXIS
Definition: dinput.h:753
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
uint32_t entry
Definition: isohybrid.c:63
DWORD dwData
Definition: dinput.h:844
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define DI_NOEFFECT
Definition: dinput.h:132
LPDIOBJECTDATAFORMAT rgodf
Definition: dinput.h:813
static _In_ DWORD dwflags
Definition: dispmode.c:64
#define X(x)
HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface, REFIID riid, LPVOID *ppobj)
Definition: device.c:1209
struct _cl_event * event
Definition: glext.h:7739
uint32_t DWORD_PTR
Definition: typedefs.h:63
WCHAR tszInstanceName[MAX_PATH]
Definition: dinput.h:429
LPDIACTIONW rgoAction
Definition: dinput.h:1332
uint8_t label[11]
Definition: fsck.fat.h:65
DWORD dwBufferSize
Definition: dinput.h:1335
HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIEFFECTINFOW lpdei, REFGUID rguid)
Definition: device.c:1679
#define GWL_STYLE
Definition: winuser.h:846
struct DIPROPHEADER DIPROPHEADER
DWORD get_config_key(HKEY defkey, HKEY appkey, const char *name, char *buffer, DWORD size)
Definition: device.c:312
#define DIDFT_VENDORDEFINED
Definition: dinput.h:768
void release_DataFormat(DataFormat *format)
Definition: device.c:390
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8A iface, HWND hwnd, DWORD dwflags)
Definition: device.c:1110
struct IDirectInputDevice8W * LPDIRECTINPUTDEVICE8W
Definition: dinput.h:106
#define DIPROP_AXISMODE
Definition: dinput.h:886
static unsigned __int64 next
Definition: rand_nt.c:6
const WCHAR * action
Definition: action.c:7783
#define InterlockedIncrement
Definition: armddk.h:53
HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8A iface, LPDWORD pdwOut)
Definition: device.c:1695
#define DIERR_OTHERAPPHASPRIO
Definition: dinput.h:162
GLuint in
Definition: glext.h:9616
const GUID * pguid
Definition: dinput.h:800
#define DIAH_USERCONFIG
Definition: dinput.h:1302
HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags)
Definition: device.c:1074
DWORD dwDataSize
Definition: dinput.h:811
HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface, LPCWSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags)
Definition: device.c:1784
#define ARRAY_SIZE(a)
Definition: main.h:24
#define DIDFT_POV
Definition: dinput.h:757
ULONG WINAPI IDirectInputDevice2AImpl_AddRef(LPDIRECTINPUTDEVICE8A iface)
Definition: device.c:1221
static HINSTANCE instance
Definition: main.c:40
#define sprintfW
Definition: unicode.h:58
#define DIDOI_GUIDISUSAGE
Definition: dinput.h:825
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
Definition: device.c:1481
DWORD dwObj
Definition: dinput.h:830
#define min(a, b)
Definition: monoChain.cc:55
HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
Definition: device.c:1004
#define DIAH_DEFAULT
Definition: dinput.h:1306
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
GUID guidActionMap
Definition: dinput.h:1333
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
#define DIERR_NOTBUFFERED
Definition: dinput.h:181
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
GUID guidInstance
Definition: dinput.h:426
HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(LPDIRECTINPUTDEVICE8A iface, LPCDIDATAFORMAT df)
Definition: device.c:1063
#define IDirectInputDevice8_SetDataFormat(p, a)
Definition: dinput.h:2048
BOOL get_app_key(HKEY *defkey, HKEY *appkey)
Definition: device.c:277
HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
Definition: device.c:1638
UINT_PTR uAppData
Definition: dinput.h:1278
void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq)
Definition: device.c:932
HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df)
Definition: device.c:762
struct IDirectInputDevice8A * LPDIRECTINPUTDEVICE8A
Definition: dinput.h:105
HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1713
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: name.c:36
#define DIPROP_USERNAME
Definition: dinput.h:921
LONG lMin
Definition: dinput.h:850
GLuint res
Definition: glext.h:9613
#define DI_OK
Definition: dinput.h:128
#define DIENUM_CONTINUE
Definition: dinput.h:188
uint32_t * LPDWORD
Definition: typedefs.h:57
#define IDirectInputDevice_Unacquire(p)
Definition: dinput.h:1611
DWORD dwHeaderSize
Definition: dinput.h:829
HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1015
unsigned int ULONG
Definition: retypes.h:1
GLenum GLuint id
Definition: glext.h:5579
static DWORD semantic_to_obj_id(IDirectInputDeviceImpl *This, DWORD dwSemantic)
Definition: device.c:618
HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow)
Definition: device.c:1449
static HINSTANCE hinst
Definition: edit.c:551
DWORD dwHow
Definition: dinput.h:1287
HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
Definition: device.c:1355
LONG lMax
Definition: dinput.h:851
static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username)
Definition: device.c:717
_Out_ PDWORD pdwOut
Definition: ntgdi.h:1813
#define IS_DIPROP(x)
int id_to_object(LPCDIDATAFORMAT df, int id)
Definition: device.c:587
DWORD dwNumActions
Definition: dinput.h:1331
#define DIDFT_ALL
Definition: dinput.h:750
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define DIDFT_FFACTUATOR
Definition: dinput.h:765
GLfloat GLfloat p
Definition: glext.h:8902
static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WCHAR *guid)
Definition: device.c:651
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define E_POINTER
Definition: winerror.h:2365
#define INFINITE
Definition: serial.h:102
struct DIPROPDWORD DIPROPDWORD
#define memset(x, y, z)
Definition: compat.h:39
#define REG_DWORD
Definition: sdbapi.c:596
#define DIPROP_VIDPID
Definition: dinput.h:920
#define TRACE_ON(x)
Definition: compat.h:65
DIPROPHEADER diph
Definition: dinput.h:874
struct DIPROPDWORD * LPDIPROPDWORD
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface, HANDLE event)
Definition: device.c:1131
#define DIERR_OBJECTNOTFOUND
Definition: dinput.h:150
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define DISCL_EXCLUSIVE
Definition: dinput.h:965
HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut)
Definition: device.c:1689
#define WM_WINE_NOTIFY_ACTIVITY
Definition: device.c:42
#define IDirectInputDevice8_SetProperty(p, a, b)
Definition: dinput.h:2043
#define DIDFT_RELAXIS
Definition: dinput.h:751
#define DIDOI_ASPECTVELOCITY
Definition: dinput.h:821
DWORD dwSemantic
Definition: dinput.h:1279
ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1138
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2321
#define FE(x)
HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(LPDIRECTINPUTDEVICE8A iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid)
Definition: device.c:1617
GLuint const GLchar * name
Definition: glext.h:6031