ReactOS  0.4.13-dev-66-gc714b7f
dinput_main.c
Go to the documentation of this file.
1 /* DirectInput
2  *
3  * Copyright 1998 Marcus Meissner
4  * Copyright 1998,1999 Lionel Ulmer
5  * Copyright 2000-2002 TransGaming Technologies Inc.
6  * Copyright 2007 Vitaliy Margolen
7  *
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 /* Status:
24  *
25  * - Tomb Raider 2 Demo:
26  * Playable using keyboard only.
27  * - WingCommander Prophecy Demo:
28  * Doesn't get Input Focus.
29  *
30  * - Fallout : works great in X and DGA mode
31  */
32 
33 #include "config.h"
34 #include <assert.h>
35 #include <stdarg.h>
36 #include <string.h>
37 
38 #define COBJMACROS
39 #define NONAMELESSUNION
40 
41 #include "wine/debug.h"
42 #include "wine/unicode.h"
43 #include "windef.h"
44 #include "winbase.h"
45 #include "winuser.h"
46 #include "winerror.h"
47 #include "objbase.h"
48 #include "rpcproxy.h"
49 #include "initguid.h"
50 #include "dinput_private.h"
51 #include "device_private.h"
52 #include "dinputd.h"
53 
55 
56 static const IDirectInput7AVtbl ddi7avt;
57 static const IDirectInput7WVtbl ddi7wvt;
58 static const IDirectInput8AVtbl ddi8avt;
59 static const IDirectInput8WVtbl ddi8wvt;
60 static const IDirectInputJoyConfig8Vtbl JoyConfig8vt;
61 
62 static inline IDirectInputImpl *impl_from_IDirectInput7A( IDirectInput7A *iface )
63 {
64  return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInput7A_iface );
65 }
66 
67 static inline IDirectInputImpl *impl_from_IDirectInput7W( IDirectInput7W *iface )
68 {
69  return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInput7W_iface );
70 }
71 
72 static inline IDirectInputImpl *impl_from_IDirectInput8A( IDirectInput8A *iface )
73 {
74  return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInput8A_iface );
75 }
76 
77 static inline IDirectInputImpl *impl_from_IDirectInput8W( IDirectInput8W *iface )
78 {
79  return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInput8W_iface );
80 }
81 
82 static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
83 {
84  return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface);
85 }
86 
87 static const struct dinput_device *dinput_devices[] =
88 {
89  &mouse_device,
94 };
95 
97 
98 static BOOL check_hook_thread(void);
101 
104 
106 {
108  HRESULT hr;
109 
110  if (!This)
111  return E_OUTOFMEMORY;
112 
113  This->IDirectInput7A_iface.lpVtbl = &ddi7avt;
114  This->IDirectInput7W_iface.lpVtbl = &ddi7wvt;
115  This->IDirectInput8A_iface.lpVtbl = &ddi8avt;
116  This->IDirectInput8W_iface.lpVtbl = &ddi8wvt;
117  This->IDirectInputJoyConfig8_iface.lpVtbl = &JoyConfig8vt;
118 
119  hr = IDirectInput_QueryInterface( &This->IDirectInput7A_iface, riid, ppDI );
120  if (FAILED(hr))
121  {
122  HeapFree( GetProcessHeap(), 0, This );
123  return hr;
124  }
125 
126  if (out) *out = This;
127  return DI_OK;
128 }
129 
130 /******************************************************************************
131  * DirectInputCreateEx (DINPUT.@)
132  */
134  HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI,
135  LPUNKNOWN punkOuter)
136 {
138  HRESULT hr;
139 
140  TRACE("(%p,%04x,%s,%p,%p)\n", hinst, dwVersion, debugstr_guid(riid), ppDI, punkOuter);
141 
142  if (IsEqualGUID( &IID_IDirectInputA, riid ) ||
143  IsEqualGUID( &IID_IDirectInput2A, riid ) ||
144  IsEqualGUID( &IID_IDirectInput7A, riid ) ||
145  IsEqualGUID( &IID_IDirectInputW, riid ) ||
146  IsEqualGUID( &IID_IDirectInput2W, riid ) ||
147  IsEqualGUID( &IID_IDirectInput7W, riid ))
148  {
150  if (FAILED(hr))
151  return hr;
152  }
153  else
154  return DIERR_NOINTERFACE;
155 
156  hr = IDirectInput_Initialize( &This->IDirectInput7A_iface, hinst, dwVersion );
157  if (FAILED(hr))
158  {
159  IDirectInput_Release( &This->IDirectInput7A_iface );
160  *ppDI = NULL;
161  return hr;
162  }
163 
164  return DI_OK;
165 }
166 
167 /******************************************************************************
168  * DirectInput8Create (DINPUT8.@)
169  */
171  DWORD version, REFIID iid, void **out, IUnknown *outer)
172 {
174  HRESULT hr;
175 
176  TRACE("hinst %p, version %#x, iid %s, out %p, outer %p.\n",
177  hinst, version, debugstr_guid(iid), out, outer);
178 
179  if (!out)
180  return E_POINTER;
181 
182  if (!IsEqualGUID(&IID_IDirectInput8A, iid) &&
183  !IsEqualGUID(&IID_IDirectInput8W, iid) &&
184  !IsEqualGUID(&IID_IUnknown, iid))
185  {
186  *out = NULL;
187  return DIERR_NOINTERFACE;
188  }
189 
191 
192  if (FAILED(hr))
193  {
194  ERR("Failed to create DirectInput, hr %#x.\n", hr);
195  return hr;
196  }
197 
198  /* When aggregation is used, the application needs to manually call Initialize(). */
199  if (!outer && IsEqualGUID(&IID_IDirectInput8A, iid))
200  {
201  hr = IDirectInput8_Initialize(&This->IDirectInput8A_iface, hinst, version);
202  if (FAILED(hr))
203  {
204  IDirectInput8_Release(&This->IDirectInput8A_iface);
205  *out = NULL;
206  return hr;
207  }
208  }
209 
210  if (!outer && IsEqualGUID(&IID_IDirectInput8W, iid))
211  {
212  hr = IDirectInput8_Initialize(&This->IDirectInput8W_iface, hinst, version);
213  if (FAILED(hr))
214  {
215  IDirectInput8_Release(&This->IDirectInput8W_iface);
216  *out = NULL;
217  return hr;
218  }
219  }
220 
221  return S_OK;
222 }
223 
224 /******************************************************************************
225  * DirectInputCreateA (DINPUT.@)
226  */
228 {
229  return DirectInputCreateEx(hinst, dwVersion, &IID_IDirectInput7A, (LPVOID *)ppDI, punkOuter);
230 }
231 
232 /******************************************************************************
233  * DirectInputCreateW (DINPUT.@)
234  */
236 {
237  return DirectInputCreateEx(hinst, dwVersion, &IID_IDirectInput7W, (LPVOID *)ppDI, punkOuter);
238 }
239 
240 static const char *_dump_DIDEVTYPE_value(DWORD dwDevType, DWORD dwVersion)
241 {
242  if (dwVersion < 0x0800) {
243  switch (dwDevType) {
244  case 0: return "All devices";
245  case DIDEVTYPE_MOUSE: return "DIDEVTYPE_MOUSE";
246  case DIDEVTYPE_KEYBOARD: return "DIDEVTYPE_KEYBOARD";
247  case DIDEVTYPE_JOYSTICK: return "DIDEVTYPE_JOYSTICK";
248  case DIDEVTYPE_DEVICE: return "DIDEVTYPE_DEVICE";
249  default: return "Unknown";
250  }
251  } else {
252  switch (dwDevType) {
253  case DI8DEVCLASS_ALL: return "All devices";
254  case DI8DEVCLASS_POINTER: return "DI8DEVCLASS_POINTER";
255  case DI8DEVCLASS_KEYBOARD: return "DI8DEVCLASS_KEYBOARD";
256  case DI8DEVCLASS_DEVICE: return "DI8DEVCLASS_DEVICE";
257  case DI8DEVCLASS_GAMECTRL: return "DI8DEVCLASS_GAMECTRL";
258  default: return "Unknown";
259  }
260  }
261 }
262 
264 {
265  if (TRACE_ON(dinput)) {
266  unsigned int i;
267  static const struct {
268  DWORD mask;
269  const char *name;
270  } flags[] = {
271 #define FE(x) { x, #x}
278 #undef FE
279  };
280  TRACE(" flags: ");
281  if (dwFlags == 0) {
282  TRACE("DIEDFL_ALLDEVICES\n");
283  return;
284  }
285  for (i = 0; i < ARRAY_SIZE(flags); i++)
286  if (flags[i].mask & dwFlags)
287  TRACE("%s ",flags[i].name);
288  }
289  TRACE("\n");
290 }
291 
292 static void _dump_diactionformatA(LPDIACTIONFORMATA lpdiActionFormat)
293 {
294  unsigned int i;
295 
296  TRACE("diaf.dwSize = %d\n", lpdiActionFormat->dwSize);
297  TRACE("diaf.dwActionSize = %d\n", lpdiActionFormat->dwActionSize);
298  TRACE("diaf.dwDataSize = %d\n", lpdiActionFormat->dwDataSize);
299  TRACE("diaf.dwNumActions = %d\n", lpdiActionFormat->dwNumActions);
300  TRACE("diaf.rgoAction = %p\n", lpdiActionFormat->rgoAction);
301  TRACE("diaf.guidActionMap = %s\n", debugstr_guid(&lpdiActionFormat->guidActionMap));
302  TRACE("diaf.dwGenre = 0x%08x\n", lpdiActionFormat->dwGenre);
303  TRACE("diaf.dwBufferSize = %d\n", lpdiActionFormat->dwBufferSize);
304  TRACE("diaf.lAxisMin = %d\n", lpdiActionFormat->lAxisMin);
305  TRACE("diaf.lAxisMax = %d\n", lpdiActionFormat->lAxisMax);
306  TRACE("diaf.hInstString = %p\n", lpdiActionFormat->hInstString);
307  TRACE("diaf.ftTimeStamp ...\n");
308  TRACE("diaf.dwCRC = 0x%x\n", lpdiActionFormat->dwCRC);
309  TRACE("diaf.tszActionMap = %s\n", debugstr_a(lpdiActionFormat->tszActionMap));
310  for (i = 0; i < lpdiActionFormat->dwNumActions; i++)
311  {
312  TRACE("diaf.rgoAction[%u]:\n", i);
313  TRACE("\tuAppData=0x%lx\n", lpdiActionFormat->rgoAction[i].uAppData);
314  TRACE("\tdwSemantic=0x%08x\n", lpdiActionFormat->rgoAction[i].dwSemantic);
315  TRACE("\tdwFlags=0x%x\n", lpdiActionFormat->rgoAction[i].dwFlags);
316  TRACE("\tszActionName=%s\n", debugstr_a(lpdiActionFormat->rgoAction[i].u.lptszActionName));
317  TRACE("\tguidInstance=%s\n", debugstr_guid(&lpdiActionFormat->rgoAction[i].guidInstance));
318  TRACE("\tdwObjID=0x%x\n", lpdiActionFormat->rgoAction[i].dwObjID);
319  TRACE("\tdwHow=0x%x\n", lpdiActionFormat->rgoAction[i].dwHow);
320  }
321 }
322 
324 {
325  int i;
326 
327  to->dwSize = sizeof(DIACTIONFORMATW);
328  to->dwActionSize = sizeof(DIACTIONW);
329  to->dwDataSize = from->dwDataSize;
330  to->dwNumActions = from->dwNumActions;
331  to->guidActionMap = from->guidActionMap;
332  to->dwGenre = from->dwGenre;
333  to->dwBufferSize = from->dwBufferSize;
334  to->lAxisMin = from->lAxisMin;
335  to->lAxisMax = from->lAxisMax;
336  to->dwCRC = from->dwCRC;
337  to->ftTimeStamp = from->ftTimeStamp;
338 
339  for (i=0; i < to->dwNumActions; i++)
340  {
341  to->rgoAction[i].uAppData = from->rgoAction[i].uAppData;
342  to->rgoAction[i].dwSemantic = from->rgoAction[i].dwSemantic;
343  to->rgoAction[i].dwFlags = from->rgoAction[i].dwFlags;
344  to->rgoAction[i].guidInstance = from->rgoAction[i].guidInstance;
345  to->rgoAction[i].dwObjID = from->rgoAction[i].dwObjID;
346  to->rgoAction[i].dwHow = from->rgoAction[i].dwHow;
347  }
348 }
349 
351 {
352  int i;
353 
354  to->dwSize = sizeof(DIACTIONFORMATA);
355  to->dwActionSize = sizeof(DIACTIONA);
356  to->dwDataSize = from->dwDataSize;
357  to->dwNumActions = from->dwNumActions;
358  to->guidActionMap = from->guidActionMap;
359  to->dwGenre = from->dwGenre;
360  to->dwBufferSize = from->dwBufferSize;
361  to->lAxisMin = from->lAxisMin;
362  to->lAxisMax = from->lAxisMax;
363  to->dwCRC = from->dwCRC;
364  to->ftTimeStamp = from->ftTimeStamp;
365 
366  for (i=0; i < to->dwNumActions; i++)
367  {
368  to->rgoAction[i].uAppData = from->rgoAction[i].uAppData;
369  to->rgoAction[i].dwSemantic = from->rgoAction[i].dwSemantic;
370  to->rgoAction[i].dwFlags = from->rgoAction[i].dwFlags;
371  to->rgoAction[i].guidInstance = from->rgoAction[i].guidInstance;
372  to->rgoAction[i].dwObjID = from->rgoAction[i].dwObjID;
373  to->rgoAction[i].dwHow = from->rgoAction[i].dwHow;
374  }
375 }
376 
377 /* diactionformat_priority
378  *
379  * Given a DIACTIONFORMAT structure and a DI genre, returns the enumeration
380  * priority. Joysticks should pass the game genre, and mouse or keyboard their
381  * respective DI*_MASK
382  */
384 {
385  int i;
386  DWORD priorityFlags = 0;
387 
388  /* If there's at least one action for the device it's priority 1 */
389  for(i=0; i < lpdiaf->dwNumActions; i++)
390  if ((lpdiaf->rgoAction[i].dwSemantic & genre) == genre)
391  priorityFlags |= DIEDBS_MAPPEDPRI1;
392 
393  return priorityFlags;
394 }
395 
397 {
398  int i;
399  DWORD priorityFlags = 0;
400 
401  /* If there's at least one action for the device it's priority 1 */
402  for(i=0; i < lpdiaf->dwNumActions; i++)
403  if ((lpdiaf->rgoAction[i].dwSemantic & genre) == genre)
404  priorityFlags |= DIEDBS_MAPPEDPRI1;
405 
406  return priorityFlags;
407 }
408 
409 #if defined __i386__ && defined _MSC_VER
410 __declspec(naked) BOOL enum_callback_wrapper(void *callback, const void *instance, void *ref)
411 {
412  __asm
413  {
414  push ebp
415  mov ebp, esp
416  push [ebp+16]
417  push [ebp+12]
418  call [ebp+8]
419  leave
420  ret
421  }
422 }
423 #elif defined __i386__ && defined __GNUC__
424 extern BOOL enum_callback_wrapper(void *callback, const void *instance, void *ref);
426  "pushl %ebp\n\t"
427  __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
428  __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
429  "movl %esp,%ebp\n\t"
430  __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
431  "pushl 16(%ebp)\n\t"
432  "pushl 12(%ebp)\n\t"
433  "call *8(%ebp)\n\t"
434  "leave\n\t"
435  __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
436  __ASM_CFI(".cfi_same_value %ebp\n\t")
437  "ret" )
438 #else
439 #define enum_callback_wrapper(callback, instance, ref) (callback)((instance), (ref))
440 #endif
441 
442 /******************************************************************************
443  * IDirectInputA_EnumDevices
444  */
446  LPDIRECTINPUT7A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback,
447  LPVOID pvRef, DWORD dwFlags)
448 {
450  DIDEVICEINSTANCEA devInstance;
451  unsigned int i;
452  int j;
453  HRESULT r;
454 
455  TRACE("(this=%p,0x%04x '%s',%p,%p,0x%04x)\n",
456  This, dwDevType, _dump_DIDEVTYPE_value(dwDevType, This->dwVersion),
457  lpCallback, pvRef, dwFlags);
459 
460  if (!lpCallback ||
462  (dwDevType > DI8DEVCLASS_GAMECTRL && dwDevType < DI8DEVTYPE_DEVICE) || dwDevType > DI8DEVTYPE_SUPPLEMENTAL)
463  return DIERR_INVALIDPARAM;
464 
465  if (!This->initialized)
466  return DIERR_NOTINITIALIZED;
467 
468  for (i = 0; i < ARRAY_SIZE(dinput_devices); i++) {
469  if (!dinput_devices[i]->enum_deviceA) continue;
470  for (j = 0, r = S_OK; SUCCEEDED(r); j++) {
471  devInstance.dwSize = sizeof(devInstance);
472  TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
473  r = dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->dwVersion, j);
474  if (r == S_OK)
475  if (enum_callback_wrapper(lpCallback, &devInstance, pvRef) == DIENUM_STOP)
476  return S_OK;
477  }
478  }
479 
480  return S_OK;
481 }
482 /******************************************************************************
483  * IDirectInputW_EnumDevices
484  */
486  LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback,
487  LPVOID pvRef, DWORD dwFlags)
488 {
490  DIDEVICEINSTANCEW devInstance;
491  unsigned int i;
492  int j;
493  HRESULT r;
494 
495  TRACE("(this=%p,0x%04x '%s',%p,%p,0x%04x)\n",
496  This, dwDevType, _dump_DIDEVTYPE_value(dwDevType, This->dwVersion),
497  lpCallback, pvRef, dwFlags);
499 
500  if (!lpCallback ||
502  (dwDevType > DI8DEVCLASS_GAMECTRL && dwDevType < DI8DEVTYPE_DEVICE) || dwDevType > DI8DEVTYPE_SUPPLEMENTAL)
503  return DIERR_INVALIDPARAM;
504 
505  if (!This->initialized)
506  return DIERR_NOTINITIALIZED;
507 
508  for (i = 0; i < ARRAY_SIZE(dinput_devices); i++) {
509  if (!dinput_devices[i]->enum_deviceW) continue;
510  for (j = 0, r = S_OK; SUCCEEDED(r); j++) {
511  devInstance.dwSize = sizeof(devInstance);
512  TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
513  r = dinput_devices[i]->enum_deviceW(dwDevType, dwFlags, &devInstance, This->dwVersion, j);
514  if (r == S_OK)
515  if (enum_callback_wrapper(lpCallback, &devInstance, pvRef) == DIENUM_STOP)
516  return S_OK;
517  }
518  }
519 
520  return S_OK;
521 }
522 
524 {
527 
528  TRACE( "(%p) incrementing from %d\n", This, ref - 1);
529  return ref;
530 }
531 
533 {
535  return IDirectInputAImpl_AddRef( &This->IDirectInput7A_iface );
536 }
537 
539 {
541  ULONG ref = InterlockedDecrement( &This->ref );
542 
543  TRACE( "(%p) releasing from %d\n", This, ref + 1 );
544 
545  if (ref == 0)
546  {
548  HeapFree( GetProcessHeap(), 0, This );
549  }
550 
551  return ref;
552 }
553 
555 {
557  return IDirectInputAImpl_Release( &This->IDirectInput7A_iface );
558 }
559 
561 {
563 
564  TRACE( "(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppobj );
565 
566  if (!riid || !ppobj)
567  return E_POINTER;
568 
569  if (IsEqualGUID( &IID_IUnknown, riid ) ||
570  IsEqualGUID( &IID_IDirectInputA, riid ) ||
571  IsEqualGUID( &IID_IDirectInput2A, riid ) ||
572  IsEqualGUID( &IID_IDirectInput7A, riid ))
573  {
574  *ppobj = &This->IDirectInput7A_iface;
575  IUnknown_AddRef( (IUnknown*)*ppobj );
576 
577  return DI_OK;
578  }
579 
580  if (IsEqualGUID( &IID_IDirectInputW, riid ) ||
581  IsEqualGUID( &IID_IDirectInput2W, riid ) ||
582  IsEqualGUID( &IID_IDirectInput7W, riid ))
583  {
584  *ppobj = &This->IDirectInput7W_iface;
585  IUnknown_AddRef( (IUnknown*)*ppobj );
586 
587  return DI_OK;
588  }
589 
590  if (IsEqualGUID( &IID_IDirectInput8A, riid ))
591  {
592  *ppobj = &This->IDirectInput8A_iface;
593  IUnknown_AddRef( (IUnknown*)*ppobj );
594 
595  return DI_OK;
596  }
597 
598  if (IsEqualGUID( &IID_IDirectInput8W, riid ))
599  {
600  *ppobj = &This->IDirectInput8W_iface;
601  IUnknown_AddRef( (IUnknown*)*ppobj );
602 
603  return DI_OK;
604  }
605 
606  if (IsEqualGUID( &IID_IDirectInputJoyConfig8, riid ))
607  {
608  *ppobj = &This->IDirectInputJoyConfig8_iface;
609  IUnknown_AddRef( (IUnknown*)*ppobj );
610 
611  return DI_OK;
612  }
613 
614  FIXME( "Unsupported interface: %s\n", debugstr_guid(riid));
615  *ppobj = NULL;
616  return E_NOINTERFACE;
617 }
618 
620 {
622  return IDirectInputAImpl_QueryInterface( &This->IDirectInput7A_iface, riid, ppobj );
623 }
624 
626 {
627  if (!This->initialized)
628  {
629  This->dwVersion = dwVersion;
630  This->evsequence = 1;
631 
633  This->crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDirectInputImpl*->crit");
634 
635  list_init( &This->devices_list );
636  list_init( &This->device_players );
637 
638  /* Add self to the list of the IDirectInputs */
640  list_add_head( &direct_input_list, &This->entry );
642 
643  This->initialized = TRUE;
644 
645  if (!check_hook_thread())
646  {
648  return DIERR_GENERIC;
649  }
650  }
651 
652  return DI_OK;
653 }
654 
656 {
657  if (This->initialized)
658  {
659  struct DevicePlayer *device_player, *device_player2;
660  /* Remove self from the list of the IDirectInputs */
662  list_remove( &This->entry );
664 
665  LIST_FOR_EACH_ENTRY_SAFE( device_player, device_player2,
666  &This->device_players, struct DevicePlayer, entry )
667  HeapFree(GetProcessHeap(), 0, device_player);
668 
670 
671  This->crit.DebugInfo->Spare[0] = 0;
672  DeleteCriticalSection( &This->crit );
673 
674  This->initialized = FALSE;
675  }
676 }
677 
679 {
687 };
688 
690 {
692 
693  TRACE("(%p)->(%p, 0x%04x)\n", iface, hinst, version);
694 
695  if (!hinst)
696  return DIERR_INVALIDPARAM;
697  else if (version == 0)
698  return DIERR_NOTINITIALIZED;
699  else if (version > DIRECTINPUT_VERSION_700)
706 
708 }
709 
711 {
713  return IDirectInputAImpl_Initialize( &This->IDirectInput7A_iface, hinst, x );
714 }
715 
717 {
719  HRESULT hr;
721 
722  TRACE( "(%p)->(%s)\n", This, debugstr_guid(rguid) );
723 
724  if (!rguid) return E_POINTER;
725  if (!This->initialized)
726  return DIERR_NOTINITIALIZED;
727 
728  hr = IDirectInput_CreateDevice( iface, rguid, &device, NULL );
729  if (hr != DI_OK) return DI_NOTATTACHED;
730 
731  IUnknown_Release( device );
732 
733  return DI_OK;
734 }
735 
737 {
739  return IDirectInputAImpl_GetDeviceStatus( &This->IDirectInput7A_iface, rguid );
740 }
741 
743  HWND hwndOwner,
744  DWORD dwFlags)
745 {
746  WCHAR control_exeW[] = {'c','o','n','t','r','o','l','.','e','x','e',0};
747  STARTUPINFOW si = {0};
749 
751 
752  TRACE( "(%p)->(%p, %08x)\n", This, hwndOwner, dwFlags );
753 
754  if (hwndOwner && !IsWindow(hwndOwner))
755  return E_HANDLE;
756 
757  if (dwFlags)
758  return DIERR_INVALIDPARAM;
759 
760  if (!This->initialized)
761  return DIERR_NOTINITIALIZED;
762 
763  if (!CreateProcessW(NULL, control_exeW, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &si, &pi))
765 
766  return DI_OK;
767 }
768 
770 {
772  return IDirectInputAImpl_RunControlPanel( &This->IDirectInput7A_iface, hwndOwner, dwFlags );
773 }
774 
776  LPCSTR pszName, LPGUID pguidInstance)
777 {
779 
780  FIXME( "(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), pszName, pguidInstance );
781 
782  return DI_OK;
783 }
784 
786  LPCWSTR pszName, LPGUID pguidInstance)
787 {
789 
790  FIXME( "(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), debugstr_w(pszName), pguidInstance );
791 
792  return DI_OK;
793 }
794 
796 {
797  unsigned int i;
798 
799  if (pvOut)
800  *pvOut = NULL;
801 
802  if (!rguid || !pvOut)
803  return E_POINTER;
804 
805  if (!This->initialized)
806  return DIERR_NOTINITIALIZED;
807 
808  /* Loop on all the devices to see if anyone matches the given GUID */
809  for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
810  {
811  HRESULT ret;
812 
813  if (!dinput_devices[i]->create_device) continue;
814  if ((ret = dinput_devices[i]->create_device(This, rguid, riid, pvOut, unicode)) == DI_OK)
815  return DI_OK;
816  }
817 
818  WARN("invalid device GUID %s\n", debugstr_guid(rguid));
819  return DIERR_DEVICENOTREG;
820 }
821 
823  REFIID riid, LPVOID* pvOut, LPUNKNOWN lpUnknownOuter)
824 {
826 
827  TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter);
828 
829  return create_device(This, rguid, riid, pvOut, FALSE);
830 }
831 
833  REFIID riid, LPVOID* pvOut, LPUNKNOWN lpUnknownOuter)
834 {
836 
837  TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter);
838 
839  return create_device(This, rguid, riid, pvOut, TRUE);
840 }
841 
843  LPDIRECTINPUTDEVICEA* pdev, LPUNKNOWN punk)
844 {
845  return IDirectInput7AImpl_CreateDeviceEx(iface, rguid, NULL, (LPVOID*)pdev, punk);
846 }
847 
849  LPDIRECTINPUTDEVICEW* pdev, LPUNKNOWN punk)
850 {
851  return IDirectInput7WImpl_CreateDeviceEx(iface, rguid, NULL, (LPVOID*)pdev, punk);
852 }
853 
854 /*******************************************************************************
855  * DirectInput8
856  */
857 
859 {
861  return IDirectInputAImpl_AddRef( &This->IDirectInput7A_iface );
862 }
863 
865 {
867  return IDirectInputAImpl_AddRef( &This->IDirectInput7A_iface );
868 }
869 
871 {
873  return IDirectInputAImpl_QueryInterface( &This->IDirectInput7A_iface, riid, ppobj );
874 }
875 
877 {
879  return IDirectInputAImpl_QueryInterface( &This->IDirectInput7A_iface, riid, ppobj );
880 }
881 
883 {
885  return IDirectInputAImpl_Release( &This->IDirectInput7A_iface );
886 }
887 
889 {
891  return IDirectInputAImpl_Release( &This->IDirectInput7A_iface );
892 }
893 
895  LPDIRECTINPUTDEVICE8A* pdev, LPUNKNOWN punk)
896 {
898  return IDirectInput7AImpl_CreateDeviceEx( &This->IDirectInput7A_iface, rguid, NULL, (LPVOID*)pdev, punk );
899 }
900 
902  LPDIRECTINPUTDEVICE8W* pdev, LPUNKNOWN punk)
903 {
905  return IDirectInput7WImpl_CreateDeviceEx( &This->IDirectInput7W_iface, rguid, NULL, (LPVOID*)pdev, punk );
906 }
907 
909  LPVOID pvRef, DWORD dwFlags)
910 {
912  return IDirectInputAImpl_EnumDevices( &This->IDirectInput7A_iface, dwDevType, lpCallback, pvRef, dwFlags );
913 }
914 
916  LPVOID pvRef, DWORD dwFlags)
917 {
919  return IDirectInputWImpl_EnumDevices( &This->IDirectInput7W_iface, dwDevType, lpCallback, pvRef, dwFlags );
920 }
921 
923 {
925  return IDirectInputAImpl_GetDeviceStatus( &This->IDirectInput7A_iface, rguid );
926 }
927 
929 {
931  return IDirectInputAImpl_GetDeviceStatus( &This->IDirectInput7A_iface, rguid );
932 }
933 
935 {
937  return IDirectInputAImpl_RunControlPanel( &This->IDirectInput7A_iface, hwndOwner, dwFlags );
938 }
939 
941 {
943  return IDirectInputAImpl_RunControlPanel( &This->IDirectInput7A_iface, hwndOwner, dwFlags );
944 }
945 
947 {
949 
950  TRACE("(%p)->(%p, 0x%04x)\n", iface, hinst, version);
951 
952  if (!hinst)
953  return DIERR_INVALIDPARAM;
954  else if (version == 0)
955  return DIERR_NOTINITIALIZED;
956  else if (version < DIRECTINPUT_VERSION)
958  else if (version > DIRECTINPUT_VERSION)
960 
962 }
963 
965 {
967  return IDirectInput8AImpl_Initialize( &This->IDirectInput8A_iface, hinst, version );
968 }
969 
971 {
973  return IDirectInput2AImpl_FindDevice( &This->IDirectInput7A_iface, rguid, pszName, pguidInstance );
974 }
975 
977 {
979  return IDirectInput2WImpl_FindDevice( &This->IDirectInput7W_iface, rguid, pszName, pguidInstance );
980 }
981 
983  struct list *device_players, REFGUID guid)
984 {
985  BOOL should_enumerate = TRUE;
986  struct DevicePlayer *device_player;
987 
988  /* Check if user owns this device */
990  {
991  should_enumerate = FALSE;
992  LIST_FOR_EACH_ENTRY(device_player, device_players, struct DevicePlayer, entry)
993  {
994  if (IsEqualGUID(&device_player->instance_guid, guid))
995  {
996  if (*device_player->username && !lstrcmpW(username, device_player->username))
997  return TRUE; /* Device username matches */
998  break;
999  }
1000  }
1001  }
1002 
1003  /* Check if this device is not owned by anyone */
1005  BOOL found = FALSE;
1006  should_enumerate = FALSE;
1007  LIST_FOR_EACH_ENTRY(device_player, device_players, struct DevicePlayer, entry)
1008  {
1009  if (IsEqualGUID(&device_player->instance_guid, guid))
1010  {
1011  if (*device_player->username)
1012  found = TRUE;
1013  break;
1014  }
1015  }
1016  if (!found)
1017  return TRUE; /* Device does not have a username */
1018  }
1019 
1020  return should_enumerate;
1021 }
1022 
1024  LPDIRECTINPUT8A iface, LPCSTR ptszUserName, LPDIACTIONFORMATA lpdiActionFormat,
1025  LPDIENUMDEVICESBYSEMANTICSCBA lpCallback,
1026  LPVOID pvRef, DWORD dwFlags
1027 )
1028 {
1029  static REFGUID guids[2] = { &GUID_SysKeyboard, &GUID_SysMouse };
1030  static const DWORD actionMasks[] = { DIKEYBOARD_MASK, DIMOUSE_MASK };
1032  DIDEVICEINSTANCEA didevi;
1033  LPDIRECTINPUTDEVICE8A lpdid;
1034  DWORD callbackFlags;
1035  int i, j;
1036  int device_count = 0;
1037  int remain;
1038  DIDEVICEINSTANCEA *didevis = 0;
1039  WCHAR *username_w = 0;
1040 
1041  FIXME("(this=%p,%s,%p,%p,%p,%04x): semi-stub\n", This, debugstr_a(ptszUserName), lpdiActionFormat,
1042  lpCallback, pvRef, dwFlags);
1043 #define X(x) if (dwFlags & x) FIXME("\tdwFlags |= "#x"\n");
1050 #undef X
1051 
1052  _dump_diactionformatA(lpdiActionFormat);
1053 
1054  didevi.dwSize = sizeof(didevi);
1055 
1056  if (ptszUserName)
1057  {
1058  int len = MultiByteToWideChar(CP_ACP, 0, ptszUserName, -1, 0, 0);
1059 
1060  username_w = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len);
1061  MultiByteToWideChar(CP_ACP, 0, ptszUserName, -1, username_w, len);
1062  }
1063 
1064  /* Enumerate all the joysticks */
1065  for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
1066  {
1067  HRESULT enumSuccess;
1068 
1069  if (!dinput_devices[i]->enum_deviceA) continue;
1070 
1071  for (j = 0, enumSuccess = S_OK; SUCCEEDED(enumSuccess); j++)
1072  {
1073  TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
1074 
1075  /* Default behavior is to enumerate attached game controllers */
1076  enumSuccess = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
1077  if (enumSuccess == S_OK &&
1078  should_enumerate_device(username_w, dwFlags, &This->device_players, &didevi.guidInstance))
1079  {
1080  if (device_count++)
1081  didevis = HeapReAlloc(GetProcessHeap(), 0, didevis, sizeof(DIDEVICEINSTANCEA)*device_count);
1082  else
1083  didevis = HeapAlloc(GetProcessHeap(), 0, sizeof(DIDEVICEINSTANCEA)*device_count);
1084  didevis[device_count-1] = didevi;
1085  }
1086  }
1087  }
1088 
1089  remain = device_count;
1090  /* Add keyboard and mouse to remaining device count */
1092  {
1093  for (i = 0; i < ARRAY_SIZE(guids); i++)
1094  {
1095  if (should_enumerate_device(username_w, dwFlags, &This->device_players, guids[i]))
1096  remain++;
1097  }
1098  }
1099 
1100  for (i = 0; i < device_count; i++)
1101  {
1102  callbackFlags = diactionformat_priorityA(lpdiActionFormat, lpdiActionFormat->dwGenre);
1103  IDirectInput_CreateDevice(iface, &didevis[i].guidInstance, &lpdid, NULL);
1104 
1105  if (lpCallback(&didevis[i], lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP)
1106  {
1107  HeapFree(GetProcessHeap(), 0, didevis);
1108  HeapFree(GetProcessHeap(), 0, username_w);
1109  return DI_OK;
1110  }
1111  }
1112 
1113  HeapFree(GetProcessHeap(), 0, didevis);
1114 
1116  {
1117  HeapFree(GetProcessHeap(), 0, username_w);
1118  return DI_OK;
1119  }
1120 
1121  /* Enumerate keyboard and mouse */
1122  for (i = 0; i < ARRAY_SIZE(guids); i++)
1123  {
1124  if (should_enumerate_device(username_w, dwFlags, &This->device_players, guids[i]))
1125  {
1126  callbackFlags = diactionformat_priorityA(lpdiActionFormat, actionMasks[i]);
1127 
1128  IDirectInput_CreateDevice(iface, guids[i], &lpdid, NULL);
1129  IDirectInputDevice_GetDeviceInfo(lpdid, &didevi);
1130 
1131  if (lpCallback(&didevi, lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP)
1132  {
1133  HeapFree(GetProcessHeap(), 0, username_w);
1134  return DI_OK;
1135  }
1136  }
1137  }
1138 
1139  HeapFree(GetProcessHeap(), 0, username_w);
1140  return DI_OK;
1141 }
1142 
1144  LPDIRECTINPUT8W iface, LPCWSTR ptszUserName, LPDIACTIONFORMATW lpdiActionFormat,
1145  LPDIENUMDEVICESBYSEMANTICSCBW lpCallback,
1146  LPVOID pvRef, DWORD dwFlags
1147 )
1148 {
1149  static REFGUID guids[2] = { &GUID_SysKeyboard, &GUID_SysMouse };
1150  static const DWORD actionMasks[] = { DIKEYBOARD_MASK, DIMOUSE_MASK };
1152  DIDEVICEINSTANCEW didevi;
1153  LPDIRECTINPUTDEVICE8W lpdid;
1154  DWORD callbackFlags;
1155  int i, j;
1156  int device_count = 0;
1157  int remain;
1158  DIDEVICEINSTANCEW *didevis = 0;
1159 
1160  FIXME("(this=%p,%s,%p,%p,%p,%04x): semi-stub\n", This, debugstr_w(ptszUserName), lpdiActionFormat,
1161  lpCallback, pvRef, dwFlags);
1162 
1163  didevi.dwSize = sizeof(didevi);
1164 
1165  /* Enumerate all the joysticks */
1166  for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
1167  {
1168  HRESULT enumSuccess;
1169 
1170  if (!dinput_devices[i]->enum_deviceW) continue;
1171 
1172  for (j = 0, enumSuccess = S_OK; SUCCEEDED(enumSuccess); j++)
1173  {
1174  TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
1175 
1176  /* Default behavior is to enumerate attached game controllers */
1177  enumSuccess = dinput_devices[i]->enum_deviceW(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
1178  if (enumSuccess == S_OK &&
1179  should_enumerate_device(ptszUserName, dwFlags, &This->device_players, &didevi.guidInstance))
1180  {
1181  if (device_count++)
1182  didevis = HeapReAlloc(GetProcessHeap(), 0, didevis, sizeof(DIDEVICEINSTANCEW)*device_count);
1183  else
1184  didevis = HeapAlloc(GetProcessHeap(), 0, sizeof(DIDEVICEINSTANCEW)*device_count);
1185  didevis[device_count-1] = didevi;
1186  }
1187  }
1188  }
1189 
1190  remain = device_count;
1191  /* Add keyboard and mouse to remaining device count */
1193  {
1194  for (i = 0; i < ARRAY_SIZE(guids); i++)
1195  {
1196  if (should_enumerate_device(ptszUserName, dwFlags, &This->device_players, guids[i]))
1197  remain++;
1198  }
1199  }
1200 
1201  for (i = 0; i < device_count; i++)
1202  {
1203  callbackFlags = diactionformat_priorityW(lpdiActionFormat, lpdiActionFormat->dwGenre);
1204  IDirectInput_CreateDevice(iface, &didevis[i].guidInstance, &lpdid, NULL);
1205 
1206  if (lpCallback(&didevis[i], lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP)
1207  {
1208  HeapFree(GetProcessHeap(), 0, didevis);
1209  return DI_OK;
1210  }
1211  }
1212 
1213  HeapFree(GetProcessHeap(), 0, didevis);
1214 
1215  if (dwFlags & DIEDBSFL_FORCEFEEDBACK) return DI_OK;
1216 
1217  /* Enumerate keyboard and mouse */
1218  for (i = 0; i < ARRAY_SIZE(guids); i++)
1219  {
1220  if (should_enumerate_device(ptszUserName, dwFlags, &This->device_players, guids[i]))
1221  {
1222  callbackFlags = diactionformat_priorityW(lpdiActionFormat, actionMasks[i]);
1223 
1224  IDirectInput_CreateDevice(iface, guids[i], &lpdid, NULL);
1225  IDirectInputDevice_GetDeviceInfo(lpdid, &didevi);
1226 
1227  if (lpCallback(&didevi, lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP)
1228  return DI_OK;
1229  }
1230  }
1231 
1232  return DI_OK;
1233 }
1234 
1236  LPDIRECTINPUT8W iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback,
1237  LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData
1238 )
1239 {
1241 
1242  FIXME("(this=%p,%p,%p,%04x,%p): stub\n", This, lpdiCallback, lpdiCDParams, dwFlags, pvRefData);
1243 
1244  /* Call helper function in config.c to do the real work */
1245  return _configure_devices(iface, lpdiCallback, lpdiCDParams, dwFlags, pvRefData);
1246 }
1247 
1249  LPDIRECTINPUT8A iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback,
1250  LPDICONFIGUREDEVICESPARAMSA lpdiCDParams, DWORD dwFlags, LPVOID pvRefData
1251 )
1252 {
1254  DIACTIONFORMATW diafW;
1255  DICONFIGUREDEVICESPARAMSW diCDParamsW;
1256  HRESULT hr;
1257  int i;
1258 
1259  FIXME("(this=%p,%p,%p,%04x,%p): stub\n", This, lpdiCallback, lpdiCDParams, dwFlags, pvRefData);
1260 
1261  /* Copy parameters */
1262  diCDParamsW.dwSize = sizeof(DICONFIGUREDEVICESPARAMSW);
1263  diCDParamsW.dwcFormats = lpdiCDParams->dwcFormats;
1264  diCDParamsW.lprgFormats = &diafW;
1265  diCDParamsW.hwnd = lpdiCDParams->hwnd;
1266 
1267  diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiCDParams->lprgFormats->dwNumActions);
1268  _copy_diactionformatAtoW(&diafW, lpdiCDParams->lprgFormats);
1269 
1270  /* Copy action names */
1271  for (i=0; i < diafW.dwNumActions; i++)
1272  {
1273  const char* from = lpdiCDParams->lprgFormats->rgoAction[i].u.lptszActionName;
1274  int len = MultiByteToWideChar(CP_ACP, 0, from , -1, NULL , 0);
1275  WCHAR *to = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len);
1276 
1277  MultiByteToWideChar(CP_ACP, 0, from , -1, to , len);
1278  diafW.rgoAction[i].u.lptszActionName = to;
1279  }
1280 
1281  hr = IDirectInput8WImpl_ConfigureDevices(&This->IDirectInput8W_iface, lpdiCallback, &diCDParamsW, dwFlags, pvRefData);
1282 
1283  /* Copy back configuration */
1284  if (SUCCEEDED(hr))
1285  _copy_diactionformatWtoA(lpdiCDParams->lprgFormats, &diafW);
1286 
1287  /* Free memory */
1288  for (i=0; i < diafW.dwNumActions; i++)
1289  HeapFree(GetProcessHeap(), 0, (void*) diafW.rgoAction[i].u.lptszActionName);
1290 
1291  HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
1292 
1293  return hr;
1294 }
1295 
1296 /*****************************************************************************
1297  * IDirectInputJoyConfig8 interface
1298  */
1299 
1300 static inline IDirectInputImpl *impl_from_IDirectInputJoyConfig8(IDirectInputJoyConfig8 *iface)
1301 {
1302  return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInputJoyConfig8_iface );
1303 }
1304 
1305 static HRESULT WINAPI JoyConfig8Impl_QueryInterface(IDirectInputJoyConfig8 *iface, REFIID riid, void** ppobj)
1306 {
1308  return IDirectInputAImpl_QueryInterface( &This->IDirectInput7A_iface, riid, ppobj );
1309 }
1310 
1311 static ULONG WINAPI JoyConfig8Impl_AddRef(IDirectInputJoyConfig8 *iface)
1312 {
1314  return IDirectInputAImpl_AddRef( &This->IDirectInput7A_iface );
1315 }
1316 
1317 static ULONG WINAPI JoyConfig8Impl_Release(IDirectInputJoyConfig8 *iface)
1318 {
1320  return IDirectInputAImpl_Release( &This->IDirectInput7A_iface );
1321 }
1322 
1323 static HRESULT WINAPI JoyConfig8Impl_Acquire(IDirectInputJoyConfig8 *iface)
1324 {
1325  FIXME( "(%p): stub!\n", iface );
1326  return E_NOTIMPL;
1327 }
1328 
1329 static HRESULT WINAPI JoyConfig8Impl_Unacquire(IDirectInputJoyConfig8 *iface)
1330 {
1331  FIXME( "(%p): stub!\n", iface );
1332  return E_NOTIMPL;
1333 }
1334 
1335 static HRESULT WINAPI JoyConfig8Impl_SetCooperativeLevel(IDirectInputJoyConfig8 *iface, HWND hwnd, DWORD flags)
1336 {
1337  FIXME( "(%p)->(%p, 0x%08x): stub!\n", iface, hwnd, flags );
1338  return E_NOTIMPL;
1339 }
1340 
1341 static HRESULT WINAPI JoyConfig8Impl_SendNotify(IDirectInputJoyConfig8 *iface)
1342 {
1343  FIXME( "(%p): stub!\n", iface );
1344  return E_NOTIMPL;
1345 }
1346 
1347 static HRESULT WINAPI JoyConfig8Impl_EnumTypes(IDirectInputJoyConfig8 *iface, LPDIJOYTYPECALLBACK cb, void *ref)
1348 {
1349  FIXME( "(%p)->(%p, %p): stub!\n", iface, cb, ref );
1350  return E_NOTIMPL;
1351 }
1352 
1354 {
1355  FIXME( "(%p)->(%s, %p, 0x%08x): stub!\n", iface, debugstr_w(name), info, flags );
1356  return E_NOTIMPL;
1357 }
1358 
1360  LPWSTR new_name)
1361 {
1362  FIXME( "(%p)->(%s, %p, 0x%08x, %s): stub!\n", iface, debugstr_w(name), info, flags, debugstr_w(new_name) );
1363  return E_NOTIMPL;
1364 }
1365 
1366 static HRESULT WINAPI JoyConfig8Impl_DeleteType(IDirectInputJoyConfig8 *iface, LPCWSTR name)
1367 {
1368  FIXME( "(%p)->(%s): stub!\n", iface, debugstr_w(name) );
1369  return E_NOTIMPL;
1370 }
1371 
1372 static HRESULT WINAPI JoyConfig8Impl_GetConfig(IDirectInputJoyConfig8 *iface, UINT id, LPDIJOYCONFIG info, DWORD flags)
1373 {
1375  UINT found = 0;
1376  int i, j;
1377  HRESULT r;
1378 
1379  FIXME("(%p)->(%d, %p, 0x%08x): semi-stub!\n", iface, id, info, flags);
1380 
1381 #define X(x) if (flags & x) FIXME("\tflags |= "#x"\n");
1384  X(DIJC_GAIN)
1385  X(DIJC_CALLOUT)
1386 #undef X
1387 
1388  /* Enumerate all joysticks in order */
1389  for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
1390  {
1391  if (!dinput_devices[i]->enum_deviceA) continue;
1392 
1393  for (j = 0, r = S_OK; SUCCEEDED(r); j++)
1394  {
1396  dev.dwSize = sizeof(dev);
1397  if ((r = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL, 0, &dev, di->dwVersion, j)) == S_OK)
1398  {
1399  /* Only take into account the chosen id */
1400  if (found == id)
1401  {
1402  if (flags & DIJC_GUIDINSTANCE)
1403  info->guidInstance = dev.guidInstance;
1404 
1405  return DI_OK;
1406  }
1407  found += 1;
1408  }
1409  }
1410  }
1411 
1412  return DIERR_NOMOREITEMS;
1413 }
1414 
1415 static HRESULT WINAPI JoyConfig8Impl_SetConfig(IDirectInputJoyConfig8 *iface, UINT id, LPCDIJOYCONFIG info, DWORD flags)
1416 {
1417  FIXME( "(%p)->(%d, %p, 0x%08x): stub!\n", iface, id, info, flags );
1418  return E_NOTIMPL;
1419 }
1420 
1421 static HRESULT WINAPI JoyConfig8Impl_DeleteConfig(IDirectInputJoyConfig8 *iface, UINT id)
1422 {
1423  FIXME( "(%p)->(%d): stub!\n", iface, id );
1424  return E_NOTIMPL;
1425 }
1426 
1428 {
1429  FIXME( "(%p)->(%p, 0x%08x): stub!\n", iface, info, flags );
1430  return E_NOTIMPL;
1431 }
1432 
1434 {
1435  FIXME( "(%p)->(%p, 0x%08x): stub!\n", iface, info, flags );
1436  return E_NOTIMPL;
1437 }
1438 
1439 static HRESULT WINAPI JoyConfig8Impl_AddNewHardware(IDirectInputJoyConfig8 *iface, HWND hwnd, REFGUID guid)
1440 {
1441  FIXME( "(%p)->(%p, %s): stub!\n", iface, hwnd, debugstr_guid(guid) );
1442  return E_NOTIMPL;
1443 }
1444 
1445 static HRESULT WINAPI JoyConfig8Impl_OpenTypeKey(IDirectInputJoyConfig8 *iface, LPCWSTR name, DWORD security, PHKEY key)
1446 {
1447  FIXME( "(%p)->(%s, 0x%08x, %p): stub!\n", iface, debugstr_w(name), security, key );
1448  return E_NOTIMPL;
1449 }
1450 
1451 static HRESULT WINAPI JoyConfig8Impl_OpenAppStatusKey(IDirectInputJoyConfig8 *iface, PHKEY key)
1452 {
1453  FIXME( "(%p)->(%p): stub!\n", iface, key );
1454  return E_NOTIMPL;
1455 }
1456 
1457 static const IDirectInput7AVtbl ddi7avt = {
1468 };
1469 
1470 static const IDirectInput7WVtbl ddi7wvt = {
1481 };
1482 
1483 static const IDirectInput8AVtbl ddi8avt = {
1495 };
1496 
1497 static const IDirectInput8WVtbl ddi8wvt = {
1509 };
1510 
1511 static const IDirectInputJoyConfig8Vtbl JoyConfig8vt =
1512 {
1532 };
1533 
1534 /*******************************************************************************
1535  * DirectInput ClassFactory
1536  */
1537 typedef struct
1538 {
1539  /* IUnknown fields */
1540  IClassFactory IClassFactory_iface;
1541  LONG ref;
1543 
1545 {
1546  return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
1547 }
1548 
1549 static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
1551 
1552  FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
1553  return E_NOINTERFACE;
1554 }
1555 
1556 static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface) {
1558  return InterlockedIncrement(&(This->ref));
1559 }
1560 
1561 static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface) {
1563  /* static class, won't be freed */
1564  return InterlockedDecrement(&(This->ref));
1565 }
1566 
1568  LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
1569 ) {
1571 
1572  TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
1573  if ( IsEqualGUID( &IID_IUnknown, riid ) ||
1574  IsEqualGUID( &IID_IDirectInputA, riid ) ||
1575  IsEqualGUID( &IID_IDirectInputW, riid ) ||
1576  IsEqualGUID( &IID_IDirectInput2A, riid ) ||
1577  IsEqualGUID( &IID_IDirectInput2W, riid ) ||
1578  IsEqualGUID( &IID_IDirectInput7A, riid ) ||
1579  IsEqualGUID( &IID_IDirectInput7W, riid ) ||
1580  IsEqualGUID( &IID_IDirectInput8A, riid ) ||
1581  IsEqualGUID( &IID_IDirectInput8W, riid ) )
1582  {
1583  return create_directinput_instance(riid, ppobj, NULL);
1584  }
1585 
1586  FIXME("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
1587  return E_NOINTERFACE;
1588 }
1589 
1590 static HRESULT WINAPI DICF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
1592  FIXME("(%p)->(%d),stub!\n",This,dolock);
1593  return S_OK;
1594 }
1595 
1596 static const IClassFactoryVtbl DICF_Vtbl = {
1598  DICF_AddRef,
1599  DICF_Release,
1602 };
1604 
1605 /***********************************************************************
1606  * DllCanUnloadNow (DINPUT.@)
1607  */
1609 {
1610  return S_FALSE;
1611 }
1612 
1613 /***********************************************************************
1614  * DllGetClassObject (DINPUT.@)
1615  */
1617 {
1618  TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
1619  if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
1620  *ppv = &DINPUT_CF;
1621  IClassFactory_AddRef((IClassFactory*)*ppv);
1622  return S_OK;
1623  }
1624 
1625  FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
1627 }
1628 
1629 /***********************************************************************
1630  * DllRegisterServer (DINPUT.@)
1631  */
1633 {
1635 }
1636 
1637 /***********************************************************************
1638  * DllUnregisterServer (DINPUT.@)
1639  */
1641 {
1643 }
1644 
1645 /******************************************************************************
1646  * DInput hook thread
1647  */
1648 
1650 {
1651  IDirectInputImpl *dinput;
1652  int skip = 0;
1653 
1654  if (code != HC_ACTION) return CallNextHookEx( 0, code, wparam, lparam );
1655 
1658  {
1660 
1661  EnterCriticalSection( &dinput->crit );
1663  if (dev->acquired && dev->event_proc)
1664  {
1665  TRACE("calling %p->%p (%lx %lx)\n", dev, dev->event_proc, wparam, lparam);
1666  skip |= dev->event_proc( &dev->IDirectInputDevice8A_iface, wparam, lparam );
1667  }
1668  LeaveCriticalSection( &dinput->crit );
1669  }
1671 
1672  return skip ? 1 : CallNextHookEx( 0, code, wparam, lparam );
1673 }
1674 
1676 {
1677  CWPSTRUCT *msg = (CWPSTRUCT *)lparam;
1678  IDirectInputImpl *dinput;
1679  HWND foreground;
1680 
1681  if (code != HC_ACTION || (msg->message != WM_KILLFOCUS &&
1682  msg->message != WM_ACTIVATEAPP && msg->message != WM_ACTIVATE))
1683  return CallNextHookEx( 0, code, wparam, lparam );
1684 
1685  foreground = GetForegroundWindow();
1686 
1688 
1690  {
1692 
1693  EnterCriticalSection( &dinput->crit );
1695  {
1696  if (!dev->acquired) continue;
1697 
1698  if (msg->hwnd == dev->win && msg->hwnd != foreground)
1699  {
1700  TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev );
1701  IDirectInputDevice_Unacquire( &dev->IDirectInputDevice8A_iface );
1702  }
1703  }
1704  LeaveCriticalSection( &dinput->crit );
1705  }
1707 
1708  return CallNextHookEx( 0, code, wparam, lparam );
1709 }
1710 
1712 {
1713  static HHOOK kbd_hook, mouse_hook;
1714  MSG msg;
1715 
1716  /* Force creation of the message queue */
1717  PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE );
1718  SetEvent(param);
1719 
1720  while (GetMessageW( &msg, 0, 0, 0 ))
1721  {
1722  UINT kbd_cnt = 0, mice_cnt = 0;
1723 
1724  if (msg.message == WM_USER+0x10)
1725  {
1726  IDirectInputImpl *dinput;
1727 
1728  TRACE( "Processing hook change notification lp:%ld\n", msg.lParam );
1729 
1730  if (!msg.wParam && !msg.lParam)
1731  {
1733  if (mouse_hook) UnhookWindowsHookEx( mouse_hook );
1734  kbd_hook = mouse_hook = NULL;
1735  break;
1736  }
1737 
1739 
1740  /* Count acquired keyboards and mice*/
1742  {
1744 
1745  EnterCriticalSection( &dinput->crit );
1747  {
1748  if (!dev->acquired || !dev->event_proc) continue;
1749 
1750  if (IsEqualGUID( &dev->guid, &GUID_SysKeyboard ))
1751  kbd_cnt++;
1752  else
1753  if (IsEqualGUID( &dev->guid, &GUID_SysMouse ))
1754  mice_cnt++;
1755  }
1756  LeaveCriticalSection( &dinput->crit );
1757  }
1759 
1760  if (kbd_cnt && !kbd_hook)
1762  else if (!kbd_cnt && kbd_hook)
1763  {
1765  kbd_hook = NULL;
1766  }
1767 
1768  if (mice_cnt && !mouse_hook)
1770  else if (!mice_cnt && mouse_hook)
1771  {
1772  UnhookWindowsHookEx( mouse_hook );
1773  mouse_hook = NULL;
1774  }
1775  }
1778  }
1779 
1780  return 0;
1781 }
1782 
1785 
1787 {
1788  0, 0, &dinput_hook_crit,
1790  0, 0, { (DWORD_PTR)(__FILE__ ": dinput_hook_crit") }
1791 };
1792 static CRITICAL_SECTION dinput_hook_crit = { &dinput_critsect_debug, -1, 0, 0, 0, 0 };
1793 
1795 {
1796  static HANDLE hook_thread;
1797 
1799 
1800  TRACE("IDirectInputs left: %d\n", list_count(&direct_input_list));
1801  if (!list_empty(&direct_input_list) && !hook_thread)
1802  {
1806  }
1807  else if (list_empty(&direct_input_list) && hook_thread)
1808  {
1810 
1811  if (hook_thread_event) /* if thread is not started yet */
1812  {
1816  }
1817 
1818  hook_thread_id = 0;
1819  PostThreadMessageW(tid, WM_USER+0x10, 0, 0);
1821 
1822  /* wait for hook thread to exit */
1823  WaitForSingleObject(hook_thread, INFINITE);
1824  CloseHandle(hook_thread);
1825  hook_thread = NULL;
1826  }
1827  else
1829 
1830  return hook_thread_id != 0;
1831 }
1832 
1834 {
1835  static HHOOK callwndproc_hook;
1836  static ULONG foreground_cnt;
1838 
1840 
1841  if (dev->dwCoopLevel & DISCL_FOREGROUND)
1842  {
1843  if (acquired)
1844  foreground_cnt++;
1845  else
1846  foreground_cnt--;
1847  }
1848 
1849  if (foreground_cnt && !callwndproc_hook)
1850  callwndproc_hook = SetWindowsHookExW( WH_CALLWNDPROC, callwndproc_proc,
1852  else if (!foreground_cnt && callwndproc_hook)
1853  {
1854  UnhookWindowsHookEx( callwndproc_hook );
1855  callwndproc_hook = NULL;
1856  }
1857 
1858  if (hook_thread_event) /* if thread is not started yet */
1859  {
1863  }
1864 
1865  PostThreadMessageW( hook_thread_id, WM_USER+0x10, 1, 0 );
1866 
1868 }
1869 
1871 {
1872  /* Windows does not do that, but our current implementation of winex11
1873  * requires periodic event polling to forward events to the wineserver.
1874  *
1875  * We have to call this function from multiple places, because:
1876  * - some games do not explicitly poll for mouse events
1877  * (for example Culpa Innata)
1878  * - some games only poll the device, and neither keyboard nor mouse
1879  * (for example Civilization: Call to Power 2)
1880  */
1881 #ifndef __REACTOS__
1883 #endif
1884 }
1885 
1887 {
1888  switch(reason)
1889  {
1890  case DLL_PROCESS_ATTACH:
1892  DINPUT_instance = inst;
1893  break;
1894  case DLL_PROCESS_DETACH:
1895  if (reserved) break;
1897  break;
1898  }
1899  return TRUE;
1900 }
static HRESULT WINAPI IDirectInputAImpl_GetDeviceStatus(LPDIRECTINPUT7A iface, REFGUID rguid)
Definition: dinput_main.c:716
BOOL(CALLBACK * LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW, LPVOID)
Definition: dinput.h:442
GUID guidInstance
Definition: dinput.h:413
static HRESULT WINAPI JoyConfig8Impl_AddNewHardware(IDirectInputJoyConfig8 *iface, HWND hwnd, REFGUID guid)
Definition: dinput_main.c:1439
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD dwBufferSize
Definition: dinput.h:1317
struct IDirectInputW * LPDIRECTINPUTW
Definition: dinput.h:92
static HRESULT WINAPI IDirectInput8WImpl_FindDevice(LPDIRECTINPUT8W iface, REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance)
Definition: dinput_main.c:976
DWORD dwObjID
Definition: dinput.h:1272
static const IDirectInput7AVtbl ddi7avt
Definition: dinput_main.c:56
void check_dinput_events(void)
Definition: dinput_main.c:1870
static ULONG WINAPI JoyConfig8Impl_AddRef(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1311
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define DIERR_NOTINITIALIZED
Definition: dinput.h:157
#define DIJC_CALLOUT
Definition: dinputd.h:133
HRESULT WINAPI DllUnregisterServer(void)
Definition: dinput_main.c:1640
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
DWORD dwObjID
Definition: dinput.h:1286
#define E_HANDLE
Definition: winerror.h:2850
static HRESULT WINAPI DICF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
Definition: dinput_main.c:1590
#define DWORD_PTR
Definition: treelist.c:76
HRESULT hr
Definition: shlfolder.c:183
Definition: scsiwmi.h:51
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI IsWindow(_In_opt_ HWND)
static HRESULT WINAPI IDirectInput2AImpl_FindDevice(LPDIRECTINPUT7A iface, REFGUID rguid, LPCSTR pszName, LPGUID pguidInstance)
Definition: dinput_main.c:775
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx eax jnz xchgl ecx incl TEMP esp ecx subl ebx pushl ecx ecx edx ecx ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 mm1 mm5 paddd mm0 paddd mm4 mm0 mm4 packssdw mm0 packssdw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz popl ecx ecx jecxz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 mm1 paddd mm0 mm0 packssdw mm0 movd eax movw edi esi edx esi ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 mm1 mm5 paddd mm1 paddd mm5 mm1 mm5 packssdw mm1 packssdw mm5 psubd mm0 psubd mm4 psubsw mm0 psubsw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 mm1 paddd mm1 mm1 packssdw mm1 psubd mm0 psubsw mm0 movd eax movw edi emms popl ebx popl esi popl edi mov ebp
Definition: synth_sse3d.h:248
BOOL(CALLBACK * LPDIJOYTYPECALLBACK)(LPCWSTR, LPVOID)
Definition: dinputd.h:34
static const char * _dump_DIDEVTYPE_value(DWORD dwDevType, DWORD dwVersion)
Definition: dinput_main.c:240
static HRESULT WINAPI IDirectInputWImpl_EnumDevices(LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:485
REFIID riid
Definition: precomp.h:44
CHAR tszActionMap[MAX_PATH]
Definition: dinput.h:1323
DWORD dwFlags
Definition: dinput.h:1266
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HRESULT WINAPI JoyConfig8Impl_SendNotify(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1341
#define REFCLSID
Definition: guiddef.h:112
#define IDirectInput_CreateDevice(p, a, b, c)
Definition: dinput.h:2243
static HRESULT WINAPI JoyConfig8Impl_GetTypeInfo(IDirectInputJoyConfig8 *iface, LPCWSTR name, LPDIJOYTYPEINFO info, DWORD flags)
Definition: dinput_main.c:1353
#define CP_ACP
Definition: compat.h:99
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define DIEDBSFL_MULTIMICEKEYBOARDS
Definition: dinput.h:454
static HRESULT WINAPI JoyConfig8Impl_Acquire(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1323
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
uint8_t entry
Definition: isohybrid.c:63
#define WARN(fmt,...)
Definition: debug.h:111
WCHAR username[MAX_PATH]
static CRITICAL_SECTION dinput_hook_crit
Definition: dinput_main.c:99
HRESULT _configure_devices(IDirectInput8W *iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData)
Definition: config.c:441
#define CALLBACK
Definition: compat.h:27
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
static IDirectInputImpl * impl_from_IDirectInput8A(IDirectInput8A *iface)
Definition: dinput_main.c:72
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define DI_NOTATTACHED
Definition: dinput.h:129
#define IDirectInput_QueryInterface(p, a, b)
Definition: dinput.h:2239
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
DWORD dwNumActions
Definition: dinput.h:1313
#define DIDEVTYPE_DEVICE
Definition: dinput.h:197
struct IDirectInput7W * LPDIRECTINPUT7W
Definition: dinput.h:96
static HRESULT WINAPI IDirectInputWImpl_QueryInterface(LPDIRECTINPUT7W iface, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:619
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: dinput_main.c:1544
static ULONG WINAPI IDirectInputWImpl_AddRef(LPDIRECTINPUT7W iface)
Definition: dinput_main.c:532
struct _DIACTIONFORMATA DIACTIONFORMATA
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static BOOL should_enumerate_device(const WCHAR *username, DWORD dwFlags, struct list *device_players, REFGUID guid)
Definition: dinput_main.c:982
struct _EXCEPTION_POINTERS *_CRTIMP __declspec(noreturn) void __cdecl terminate(void)
Definition: eh.h:27
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
struct list devices_list
struct IDirectInput8A * LPDIRECTINPUT8A
Definition: dinput.h:97
HRESULT WINAPI DirectInputCreateEx(HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI, LPUNKNOWN punkOuter)
Definition: dinput_main.c:133
#define DIEDFL_FORCEFEEDBACK
Definition: dinput.h:192
UINT_PTR WPARAM
Definition: windef.h:207
GUID guidInstance
Definition: dinput.h:1285
UINT_PTR uAppData
Definition: dinput.h:1264
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static HRESULT WINAPI IDirectInput8WImpl_EnumDevices(LPDIRECTINPUT8W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:915
HINSTANCE DINPUT_instance
Definition: dinput_main.c:96
#define DIERR_NOMOREITEMS
Definition: dinputd.h:47
static HRESULT initialize_directinput_instance(IDirectInputImpl *This, DWORD dwVersion)
Definition: dinput_main.c:625
struct _DIACTIONW DIACTIONW
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
Definition: dinput_main.c:1833
Definition: send.c:47
static int dev
Definition: mkdosfs.c:536
static ULONG WINAPI IDirectInput8WImpl_Release(LPDIRECTINPUT8W iface)
Definition: dinput_main.c:888
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
BOOL(CALLBACK * LPDIENUMDEVICESBYSEMANTICSCBA)(LPCDIDEVICEINSTANCEA, LPDIRECTINPUTDEVICE8A, DWORD, DWORD, LPVOID)
Definition: dinput.h:458
DWORD dwDataSize
Definition: dinput.h:1312
#define PM_NOREMOVE
Definition: winuser.h:1181
static HRESULT WINAPI JoyConfig8Impl_GetConfig(IDirectInputJoyConfig8 *iface, UINT id, LPDIJOYCONFIG info, DWORD flags)
Definition: dinput_main.c:1372
struct tagIClassFactoryImpl IClassFactoryImpl
static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(LPDIRECTINPUT8A iface, LPCSTR ptszUserName, LPDIACTIONFORMATA lpdiActionFormat, LPDIENUMDEVICESBYSEMANTICSCBA lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:1023
static DWORD WINAPI hook_thread_proc(void *param)
Definition: dinput_main.c:1711
#define DIEDBSFL_FORCEFEEDBACK
Definition: dinput.h:452
#define __ASM_GLOBAL_FUNC(name, code)
Definition: port.h:201
HRESULT WINAPI DECLSPEC_HOTPATCH DirectInput8Create(HINSTANCE hinst, DWORD version, REFIID iid, void **out, IUnknown *outer)
Definition: dinput_main.c:170
HINSTANCE hInstString
Definition: dinput.h:1320
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
static HRESULT WINAPI IDirectInput8AImpl_EnumDevices(LPDIRECTINPUT8A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:908
#define WH_MOUSE_LL
Definition: winuser.h:44
static DWORD diactionformat_priorityW(LPDIACTIONFORMATW lpdiaf, DWORD genre)
Definition: dinput_main.c:396
static const IDirectInput7WVtbl ddi7wvt
Definition: dinput_main.c:57
static HRESULT WINAPI JoyConfig8Impl_SetTypeInfo(IDirectInputJoyConfig8 *iface, LPCWSTR name, LPCDIJOYTYPEINFO info, DWORD flags, LPWSTR new_name)
Definition: dinput_main.c:1359
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
DWORD WINAPI MsgWaitForMultipleObjectsEx(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask, _In_ DWORD dwFlags)
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: dinput_main.c:1616
static HRESULT WINAPI IDirectInput7AImpl_CreateDeviceEx(LPDIRECTINPUT7A iface, REFGUID rguid, REFIID riid, LPVOID *pvOut, LPUNKNOWN lpUnknownOuter)
Definition: dinput_main.c:822
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
const GUID * guid
static HRESULT WINAPI IDirectInputAImpl_Initialize(LPDIRECTINPUT7A iface, HINSTANCE hinst, DWORD version)
Definition: dinput_main.c:689
#define DIDEVTYPE_MOUSE
Definition: dinput.h:198
GLenum GLint GLuint mask
Definition: glext.h:6028
#define X(x)
static HRESULT WINAPI IDirectInputAImpl_EnumDevices(LPDIRECTINPUT7A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:445
static HRESULT WINAPI IDirectInput8AImpl_GetDeviceStatus(LPDIRECTINPUT8A iface, REFGUID rguid)
Definition: dinput_main.c:922
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
unsigned int BOOL
Definition: ntddk_ex.h:94
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
Definition: list.h:155
GUID guidInstance
Definition: dinput.h:1271
long LONG
Definition: pedump.c:60
Definition: devices.h:37
static HRESULT WINAPI JoyConfig8Impl_SetConfig(IDirectInputJoyConfig8 *iface, UINT id, LPCDIJOYCONFIG info, DWORD flags)
Definition: dinput_main.c:1415
static LPUNKNOWN
Definition: ndr_ole.c:49
FILETIME ftTimeStamp
Definition: dinput.h:1339
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
const struct dinput_device keyboard_device
Definition: keyboard.c:349
static HRESULT WINAPI IDirectInput8AImpl_CreateDevice(LPDIRECTINPUT8A iface, REFGUID rguid, LPDIRECTINPUTDEVICE8A *pdev, LPUNKNOWN punk)
Definition: dinput_main.c:894
#define debugstr_w
Definition: kernel32.h:32
GLenum GLint ref
Definition: glext.h:6028
#define FIXME(fmt,...)
Definition: debug.h:110
r reserved
Definition: btrfs.c:2655
static HRESULT WINAPI IDirectInput8AImpl_FindDevice(LPDIRECTINPUT8A iface, REFGUID rguid, LPCSTR pszName, LPGUID pguidInstance)
Definition: dinput_main.c:970
#define S_FALSE
Definition: winerror.h:2357
struct _DIACTIONA DIACTIONA
static IClassFactoryImpl DINPUT_CF
Definition: dinput_main.c:1603
static HRESULT WINAPI IDirectInputAImpl_CreateDevice(LPDIRECTINPUT7A iface, REFGUID rguid, LPDIRECTINPUTDEVICEA *pdev, LPUNKNOWN punk)
Definition: dinput_main.c:842
FILETIME ftTimeStamp
Definition: dinput.h:1321
#define DIENUM_STOP
Definition: dinput.h:187
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:112
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
static HRESULT WINAPI JoyConfig8Impl_QueryInterface(IDirectInputJoyConfig8 *iface, REFIID riid, void **ppobj)
Definition: dinput_main.c:1305
smooth NULL
Definition: ftsmooth.c:416
static CRITICAL_SECTION_DEBUG dinput_critsect_debug
Definition: dinput_main.c:1786
static const WCHAR version[]
Definition: asmname.c:64
struct _DIACTIONFORMATW DIACTIONFORMATW
static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(LPDIRECTINPUT8W iface, LPCWSTR ptszUserName, LPDIACTIONFORMATW lpdiActionFormat, LPDIENUMDEVICESBYSEMANTICSCBW lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:1143
static HRESULT WINAPI IDirectInput8WImpl_QueryInterface(LPDIRECTINPUT8W iface, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:876
LONG_PTR LPARAM
Definition: windef.h:208
LPCSTR lptszActionName
Definition: dinput.h:1268
static IDirectInputImpl * impl_from_IDirectInputJoyConfig8(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1300
#define IDirectInput8_Initialize(p, a, b)
Definition: dinput.h:2464
static DWORD hook_thread_id
Definition: dinput_main.c:1783
struct IDirectInputDeviceA * LPDIRECTINPUTDEVICEA
Definition: dinput.h:99
const char * LPCSTR
Definition: xmlstorage.h:183
#define debugstr_guid
Definition: kernel32.h:35
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
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:421
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4623
#define DLL_PROCESS_DETACH
Definition: compat.h:119
static BOOL check_hook_thread(void)
Definition: dinput_main.c:1794
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
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:224
struct IDirectInputDeviceW * LPDIRECTINPUTDEVICEW
Definition: dinput.h:100
#define DI8DEVCLASS_POINTER
Definition: dinput.h:205
static HRESULT WINAPI IDirectInputAImpl_QueryInterface(LPDIRECTINPUT7A iface, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:560
#define DIEDFL_ATTACHEDONLY
Definition: dinput.h:191
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
DWORD dwDataSize
Definition: dinput.h:1330
DWORD dwHow
Definition: dinput.h:1273
static HRESULT WINAPI JoyConfig8Impl_OpenAppStatusKey(IDirectInputJoyConfig8 *iface, PHKEY key)
Definition: dinput_main.c:1451
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
static HRESULT WINAPI IDirectInput8WImpl_Initialize(LPDIRECTINPUT8W iface, HINSTANCE hinst, DWORD version)
Definition: dinput_main.c:964
#define DIERR_GENERIC
Definition: dinput.h:154
#define TRACE(s)
Definition: solgame.cpp:4
BOOL(CALLBACK * LPDIENUMDEVICESBYSEMANTICSCBW)(LPCDIDEVICEINSTANCEW, LPDIRECTINPUTDEVICE8W, DWORD, DWORD, LPVOID)
Definition: dinput.h:459
#define IDirectInput_Release(p)
Definition: dinput.h:2241
#define WM_KILLFOCUS
Definition: winuser.h:1596
static HRESULT WINAPI JoyConfig8Impl_SetUserValues(IDirectInputJoyConfig8 *iface, LPCDIJOYUSERVALUES info, DWORD flags)
Definition: dinput_main.c:1433
static HRESULT WINAPI IDirectInput8AImpl_Initialize(LPDIRECTINPUT8A iface, HINSTANCE hinst, DWORD version)
Definition: dinput_main.c:946
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define WH_KEYBOARD_LL
Definition: winuser.h:43
static const IDirectInput8WVtbl ddi8wvt
Definition: dinput_main.c:59
#define DIERR_OLDDIRECTINPUTVERSION
Definition: dinput.h:141
#define LIST_INIT(head)
Definition: queue.h:197
__wchar_t WCHAR
Definition: xmlstorage.h:180
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define debugstr_a
Definition: kernel32.h:31
struct IDirectInputA * LPDIRECTINPUTA
Definition: dinput.h:91
LONG HRESULT
Definition: typedefs.h:77
#define DIJC_GUIDINSTANCE
Definition: dinputd.h:130
const GUID IID_IUnknown
LPDIACTIONFORMATA lprgFormats
Definition: dinput.h:1389
LPDIACTIONFORMATW lprgFormats
Definition: dinput.h:1401
BOOL(CALLBACK * LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA, LPVOID)
Definition: dinput.h:441
GLfloat param
Definition: glext.h:5796
#define WINAPI
Definition: msvc.h:8
static FILE * out
Definition: regtests2xml.c:44
#define DIERR_DEVICENOTREG
Definition: dinput.h:147
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DI8DEVCLASS_ALL
Definition: dinput.h:203
#define enum_callback_wrapper(callback, instance, ref)
Definition: dinput_main.c:439
static IDirectInputImpl * impl_from_IDirectInput7A(IDirectInput7A *iface)
Definition: dinput_main.c:62
#define DIDEVTYPE_JOYSTICK
Definition: dinput.h:200
#define DISCL_FOREGROUND
Definition: dinput.h:967
static DWORD cb
Definition: integrity.c:41
static HRESULT WINAPI JoyConfig8Impl_EnumTypes(IDirectInputJoyConfig8 *iface, LPDIJOYTYPECALLBACK cb, void *ref)
Definition: dinput_main.c:1347
GLbitfield flags
Definition: glext.h:7161
#define DIRECTINPUT_VERSION
Definition: precomp.h:4
WINE_DEFAULT_DEBUG_CHANNEL(dinput)
static DWORD pi
Definition: protocol.c:150
#define DI8DEVCLASS_KEYBOARD
Definition: dinput.h:206
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define DIDEVTYPE_KEYBOARD
Definition: dinput.h:199
#define DIEDFL_INCLUDEPHANTOMS
Definition: dinput.h:194
int ret
static const struct dinput_device * dinput_devices[]
Definition: dinput_main.c:87
#define WH_CALLWNDPROC
Definition: winuser.h:34
#define InterlockedDecrement
Definition: armddk.h:52
HRESULT WINAPI DECLSPEC_HOTPATCH DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter)
Definition: dinput_main.c:235
static HRESULT create_directinput_instance(REFIID riid, LPVOID *ppDI, IDirectInputImpl **out)
Definition: dinput_main.c:105
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110
static IDirectInputImpl * impl_from_IDirectInput8W(IDirectInput8W *iface)
Definition: dinput_main.c:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI8DEVCLASS_DEVICE
Definition: dinput.h:204
#define DIEDBSFL_NONGAMINGDEVICES
Definition: dinput.h:455
static HRESULT WINAPI JoyConfig8Impl_DeleteType(IDirectInputJoyConfig8 *iface, LPCWSTR name)
Definition: dinput_main.c:1366
GLenum GLsizei len
Definition: glext.h:6722
#define DIEDFL_INCLUDEALIASES
Definition: dinput.h:193
Definition: _list.h:228
struct IDirectInput7A * LPDIRECTINPUT7A
Definition: dinput.h:95
static ULONG WINAPI IDirectInput8WImpl_AddRef(LPDIRECTINPUT8W iface)
Definition: dinput_main.c:864
#define DIKEYBOARD_MASK
static ULONG WINAPI IDirectInputWImpl_Release(LPDIRECTINPUT7W iface)
Definition: dinput_main.c:554
static IDirectInputImpl * impl_from_IDirectInput7W(IDirectInput7W *iface)
Definition: dinput_main.c:67
static HRESULT WINAPI IDirectInputWImpl_Initialize(LPDIRECTINPUT7W iface, HINSTANCE hinst, DWORD x)
Definition: dinput_main.c:710
LIST_ENTRY ProcessLocksList
Definition: winbase.h:848
static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface)
Definition: dinput_main.c:1561
LPDIACTIONW rgoAction
Definition: dinput.h:1332
static HRESULT WINAPI IDirectInputWImpl_CreateDevice(LPDIRECTINPUT7W iface, REFGUID rguid, LPDIRECTINPUTDEVICEW *pdev, LPUNKNOWN punk)
Definition: dinput_main.c:848
#define DIEDFL_ALLDEVICES
Definition: dinput.h:190
static HRESULT WINAPI IDirectInput8AImpl_QueryInterface(LPDIRECTINPUT8A iface, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:870
static HRESULT WINAPI IDirectInput8WImpl_ConfigureDevices(LPDIRECTINPUT8W iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData)
Definition: dinput_main.c:1235
DWORD dwBufferSize
Definition: dinput.h:1335
#define WM_USER
Definition: winuser.h:1856
static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx(LPDIRECTINPUT7W iface, REFGUID rguid, REFIID riid, LPVOID *pvOut, LPUNKNOWN lpUnknownOuter)
Definition: dinput_main.c:832
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
static void _dump_EnumDevices_dwFlags(DWORD dwFlags)
Definition: dinput_main.c:263
static const IDirectInputJoyConfig8Vtbl JoyConfig8vt
Definition: dinput_main.c:60
#define DIEDFL_INCLUDEHIDDEN
Definition: dinput.h:195
static HRESULT WINAPI IDirectInput8WImpl_GetDeviceStatus(LPDIRECTINPUT8W iface, REFGUID rguid)
Definition: dinput_main.c:928
static ULONG WINAPI IDirectInputAImpl_Release(LPDIRECTINPUT7A iface)
Definition: dinput_main.c:538
static const IClassFactoryVtbl DICF_Vtbl
Definition: dinput_main.c:1596
#define DIMOUSE_MASK
#define ERR(fmt,...)
Definition: debug.h:109
const struct dinput_device joystick_linuxinput_device
DWORD dwFlags
Definition: dinput.h:1280
static const IDirectInput8AVtbl ddi8avt
Definition: dinput_main.c:58
#define DIEDBS_MAPPEDPRI1
Definition: dinput.h:445
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
#define S_OK
Definition: intsafe.h:59
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
Definition: msg.c:151
CRITICAL_SECTION crit
struct IDirectInputDevice8W * LPDIRECTINPUTDEVICE8W
Definition: dinput.h:106
static HRESULT WINAPI JoyConfig8Impl_GetUserValues(IDirectInputJoyConfig8 *iface, LPDIJOYUSERVALUES info, DWORD flags)
Definition: dinput_main.c:1427
void _copy_diactionformatAtoW(LPDIACTIONFORMATW to, LPDIACTIONFORMATA from)
Definition: dinput_main.c:323
static HRESULT WINAPI JoyConfig8Impl_SetCooperativeLevel(IDirectInputJoyConfig8 *iface, HWND hwnd, DWORD flags)
Definition: dinput_main.c:1335
#define WM_ACTIVATEAPP
Definition: winuser.h:1614
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
directinput_versions
Definition: dinput_main.c:678
#define InterlockedIncrement
Definition: armddk.h:53
struct _DICONFIGUREDEVICESPARAMSW DICONFIGUREDEVICESPARAMSW
#define WM_ACTIVATE
Definition: winuser.h:1594
static HRESULT WINAPI JoyConfig8Impl_Unacquire(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1329
#define DIERR_NOINTERFACE
Definition: dinput.h:153
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: dinput_main.c:82
static HRESULT WINAPI IDirectInputWImpl_RunControlPanel(LPDIRECTINPUT7W iface, HWND hwndOwner, DWORD dwFlags)
Definition: dinput_main.c:769
const struct dinput_device joystick_osx_device
#define ARRAY_SIZE(a)
Definition: main.h:24
#define HC_ACTION
Definition: winuser.h:48
BOOL(CALLBACK * LPDICONFIGUREDEVICESCALLBACK)(LPUNKNOWN, LPVOID)
Definition: dinput.h:462
#define QS_ALLINPUT
Definition: winuser.h:874
#define HeapReAlloc
Definition: compat.h:393
DWORD dwActionSize
Definition: dinput.h:1311
static HINSTANCE instance
Definition: main.c:40
#define E_NOTIMPL
Definition: ddrawi.h:99
#define DETACHED_PROCESS
Definition: winbase.h:179
#define DIEDBSFL_AVAILABLEDEVICES
Definition: dinput.h:453
#define DI8DEVTYPE_DEVICE
Definition: dinput.h:209
void _copy_diactionformatWtoA(LPDIACTIONFORMATA to, LPDIACTIONFORMATW from)
Definition: dinput_main.c:350
static ULONG WINAPI IDirectInput8AImpl_AddRef(LPDIRECTINPUT8A iface)
Definition: dinput_main.c:858
#define IDirectInputDevice_GetDeviceInfo(p, a)
Definition: dinput.h:1618
static HRESULT WINAPI JoyConfig8Impl_OpenTypeKey(IDirectInputJoyConfig8 *iface, LPCWSTR name, DWORD security, PHKEY key)
Definition: dinput_main.c:1445
LPDIACTIONA rgoAction
Definition: dinput.h:1314
unsigned int UINT
Definition: ndis.h:50
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 DIEDBSFL_THISUSER
Definition: dinput.h:451
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define DI8DEVTYPE_SUPPLEMENTAL
Definition: dinput.h:220
GUID guidInstance
Definition: dinput.h:426
#define MultiByteToWideChar
Definition: compat.h:100
#define FE(x)
static LRESULT CALLBACK LL_hook_proc(int code, WPARAM wparam, LPARAM lparam)
Definition: dinput_main.c:1649
#define skip(...)
static ULONG WINAPI JoyConfig8Impl_Release(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1317
UINT_PTR uAppData
Definition: dinput.h:1278
#define msg(x)
Definition: auth_time.c:54
static DWORD diactionformat_priorityA(LPDIACTIONFORMATA lpdiaf, DWORD genre)
Definition: dinput_main.c:383
struct IDirectInputDevice8A * LPDIRECTINPUTDEVICE8A
Definition: dinput.h:105
Definition: name.c:36
HHOOK WINAPI SetWindowsHookExW(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
DWORD dwSemantic
Definition: dinput.h:1265
#define DI_OK
Definition: dinput.h:128
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define IDirectInputDevice_Unacquire(p)
Definition: dinput.h:1611
static HRESULT WINAPI IDirectInputWImpl_GetDeviceStatus(LPDIRECTINPUT7W iface, REFGUID rguid)
Definition: dinput_main.c:736
static HRESULT WINAPI IDirectInput8AImpl_RunControlPanel(LPDIRECTINPUT8A iface, HWND hwndOwner, DWORD dwFlags)
Definition: dinput_main.c:934
unsigned int ULONG
Definition: retypes.h:1
static HRESULT WINAPI JoyConfig8Impl_DeleteConfig(IDirectInputJoyConfig8 *iface, UINT id)
Definition: dinput_main.c:1421
static HRESULT WINAPI IDirectInput8WImpl_RunControlPanel(LPDIRECTINPUT8W iface, HWND hwndOwner, DWORD dwFlags)
Definition: dinput_main.c:940
static HINSTANCE hinst
Definition: edit.c:551
DWORD dwHow
Definition: dinput.h:1287
static HRESULT WINAPI IDirectInput8WImpl_CreateDevice(LPDIRECTINPUT8W iface, REFGUID rguid, LPDIRECTINPUTDEVICE8W *pdev, LPUNKNOWN punk)
Definition: dinput_main.c:901
const struct dinput_device mouse_device
Definition: mouse.c:298
HRESULT WINAPI DllRegisterServer(void)
Definition: dinput_main.c:1632
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
Definition: dinput_main.c:1886
static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface)
Definition: dinput_main.c:1556
DWORD dwNumActions
Definition: dinput.h:1331
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define DI8DEVCLASS_GAMECTRL
Definition: dinput.h:207
static HRESULT WINAPI IDirectInputAImpl_RunControlPanel(LPDIRECTINPUT7A iface, HWND hwndOwner, DWORD dwFlags)
Definition: dinput_main.c:742
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static struct list direct_input_list
Definition: dinput_main.c:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:1549
static void uninitialize_directinput_instance(IDirectInputImpl *This)
Definition: dinput_main.c:655
LONG_PTR LRESULT
Definition: windef.h:209
static void _dump_diactionformatA(LPDIACTIONFORMATA lpdiActionFormat)
Definition: dinput_main.c:292
CardRegion * from
Definition: spigame.cpp:19
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
#define E_POINTER
Definition: winerror.h:2365
HRESULT WINAPI DllCanUnloadNow(void)
Definition: dinput_main.c:1608
#define INFINITE
Definition: serial.h:102
const GUID IID_IClassFactory
#define TRACE_ON(x)
Definition: compat.h:65
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91
#define IDirectInput_Initialize(p, a, b)
Definition: dinput.h:2247
#define __ASM_CFI(str)
Definition: config.h:1320
static HANDLE hook_thread_event
Definition: dinput_main.c:1784
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface)
Definition: dinput_main.c:523
static TfClientId tid
HRESULT WINAPI DECLSPEC_HOTPATCH DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter)
Definition: dinput_main.c:227
#define DIEDBSFL_ATTACHEDONLY
Definition: dinput.h:450
#define DIERR_BETADIRECTINPUTVERSION
Definition: dinput.h:143
#define HeapFree(x, y, z)
Definition: compat.h:394
DWORD dwActionSize
Definition: dinput.h:1329
static LRESULT CALLBACK callwndproc_proc(int code, WPARAM wparam, LPARAM lparam)
Definition: dinput_main.c:1675
static ULONG WINAPI IDirectInput8AImpl_Release(LPDIRECTINPUT8A iface)
Definition: dinput_main.c:882
static HRESULT WINAPI IDirectInput2WImpl_FindDevice(LPDIRECTINPUT7W iface, REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance)
Definition: dinput_main.c:785
static HRESULT WINAPI DICF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:1567
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define DIJC_GAIN
Definition: dinputd.h:132
static UINT WPARAM wparam
Definition: combo.c:716
static HRESULT create_device(IDirectInputImpl *This, REFGUID rguid, REFIID riid, LPVOID *pvOut, BOOL unicode)
Definition: dinput_main.c:795
static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(LPDIRECTINPUT8A iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSA lpdiCDParams, DWORD dwFlags, LPVOID pvRefData)
Definition: dinput_main.c:1248
Definition: path.c:42
struct IDirectInput8W * LPDIRECTINPUT8W
Definition: dinput.h:98
#define IDirectInput8_Release(p)
Definition: dinput.h:2458
GUID guidActionMap
Definition: dinput.h:1315
DWORD dwSemantic
Definition: dinput.h:1279
LPCWSTR lptszActionName
Definition: dinput.h:1282
#define DIJC_REGHWCONFIGTYPE
Definition: dinputd.h:131
GLuint const GLchar * name
Definition: glext.h:6031
const struct dinput_device joystick_linux_device