ReactOS  0.4.14-dev-614-gbfd8a84
mouse.c
Go to the documentation of this file.
1 /* DirectInput Mouse device
2  *
3  * Copyright 1998 Marcus Meissner
4  * Copyright 1998,1999 Lionel Ulmer
5  * Copyright 2000-2001 TransGaming Technologies Inc.
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 #include "config.h"
23 #include "wine/port.h"
24 
25 #include <stdarg.h>
26 #include <string.h>
27 
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "wine/winternl.h"
32 #include "winuser.h"
33 #include "winerror.h"
34 #include "winreg.h"
35 #include "dinput.h"
36 
37 #include "dinput_private.h"
38 #include "device_private.h"
39 #include "wine/debug.h"
40 #include "wine/unicode.h"
41 
43 
44 /* Wine mouse driver object instances */
45 #define WINE_MOUSE_X_AXIS_INSTANCE 0
46 #define WINE_MOUSE_Y_AXIS_INSTANCE 1
47 #define WINE_MOUSE_Z_AXIS_INSTANCE 2
48 #define WINE_MOUSE_BUTTONS_INSTANCE 3
49 
50 static const IDirectInputDevice8AVtbl SysMouseAvt;
51 static const IDirectInputDevice8WVtbl SysMouseWvt;
52 
53 typedef struct SysMouseImpl SysMouseImpl;
54 
55 typedef enum
56 {
60 } WARP_MOUSE;
61 
63 {
65 
66  /* SysMouseAImpl */
67  /* These are used in case of relative -> absolute transitions */
70  /* warping: whether we need to move mouse back to middle once we
71  * reach window borders (for e.g. shooters, "surface movement" games) */
74 
75  /* This is for mouse reporting. */
77 
79 };
80 
81 static inline SysMouseImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
82 {
84 }
85 static inline SysMouseImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
86 {
88 }
89 
90 static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(SysMouseImpl *This)
91 {
92  return &This->base.IDirectInputDevice8W_iface;
93 }
94 
96 
97 static void _dump_mouse_state(const DIMOUSESTATE2 *m_state)
98 {
99  int i;
100 
101  if (!TRACE_ON(dinput)) return;
102 
103  TRACE("(X: %d Y: %d Z: %d", m_state->lX, m_state->lY, m_state->lZ);
104  for (i = 0; i < 5; i++) TRACE(" B%d: %02x", i, m_state->rgbButtons[i]);
105  TRACE(")\n");
106 }
107 
109  DWORD dwSize;
110  DIDEVICEINSTANCEA ddi;
111 
112  dwSize = lpddi->dwSize;
113 
114  TRACE("%d %p\n", dwSize, lpddi);
115 
116  memset(lpddi, 0, dwSize);
117  memset(&ddi, 0, sizeof(ddi));
118 
119  ddi.dwSize = dwSize;
120  ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
121  ddi.guidProduct = GUID_SysMouse;
122  if (version >= 0x0800)
124  else
126  strcpy(ddi.tszInstanceName, "Mouse");
127  strcpy(ddi.tszProductName, "Wine Mouse");
128 
129  memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
130 }
131 
133  DWORD dwSize;
134  DIDEVICEINSTANCEW ddi;
135 
136  dwSize = lpddi->dwSize;
137 
138  TRACE("%d %p\n", dwSize, lpddi);
139 
140  memset(lpddi, 0, dwSize);
141  memset(&ddi, 0, sizeof(ddi));
142 
143  ddi.dwSize = dwSize;
144  ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
145  ddi.guidProduct = GUID_SysMouse;
146  if (version >= 0x0800)
148  else
150  MultiByteToWideChar(CP_ACP, 0, "Mouse", -1, ddi.tszInstanceName, MAX_PATH);
151  MultiByteToWideChar(CP_ACP, 0, "Wine Mouse", -1, ddi.tszProductName, MAX_PATH);
152 
153  memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
154 }
155 
157 {
158  if (id != 0)
159  return E_FAIL;
160 
162  return S_FALSE;
163 
164  if ((dwDevType == 0) ||
165  ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
166  (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) {
167  TRACE("Enumerating the mouse device\n");
168 
170 
171  return S_OK;
172  }
173 
174  return S_FALSE;
175 }
176 
178 {
179  if (id != 0)
180  return E_FAIL;
181 
183  return S_FALSE;
184 
185  if ((dwDevType == 0) ||
186  ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
187  (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) {
188  TRACE("Enumerating the mouse device\n");
189 
191 
192  return S_OK;
193  }
194 
195  return S_FALSE;
196 }
197 
199 {
200  SysMouseImpl* newDevice;
201  LPDIDATAFORMAT df = NULL;
202  unsigned i;
203  char buffer[20];
204  HKEY hkey, appkey;
205 
206  newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseImpl));
207  if (!newDevice) return NULL;
208  newDevice->base.IDirectInputDevice8A_iface.lpVtbl = &SysMouseAvt;
209  newDevice->base.IDirectInputDevice8W_iface.lpVtbl = &SysMouseWvt;
210  newDevice->base.ref = 1;
211  newDevice->base.dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
212  newDevice->base.guid = *rguid;
213  InitializeCriticalSection(&newDevice->base.crit);
214  newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysMouseImpl*->base.crit");
215  newDevice->base.dinput = dinput;
216  newDevice->base.event_proc = dinput_mouse_hook;
217 
218  get_app_key(&hkey, &appkey);
219  if (!get_config_key(hkey, appkey, "MouseWarpOverride", buffer, sizeof(buffer)))
220  {
221  if (!_strnicmp(buffer, "disable", -1))
222  newDevice->warp_override = WARP_DISABLE;
223  else if (!_strnicmp(buffer, "force", -1))
224  newDevice->warp_override = WARP_FORCE_ON;
225  }
226  if (appkey) RegCloseKey(appkey);
227  if (hkey) RegCloseKey(hkey);
228 
229  /* Create copy of default data format */
230  if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIMouse2.dwSize))) goto failed;
232  if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto failed;
234 
235  /* Because we don't do any detection yet just modify instance and type */
236  for (i = 0; i < df->dwNumObjs; i++)
237  if (DIDFT_GETTYPE(df->rgodf[i].dwType) & DIDFT_AXIS)
239  else
241 
242  newDevice->base.data_format.wine_df = df;
243  IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface);
244 
246  list_add_tail(&dinput->devices_list, &newDevice->base.entry);
248 
249  return newDevice;
250 
251 failed:
252  if (df) HeapFree(GetProcessHeap(), 0, df->rgodf);
253  HeapFree(GetProcessHeap(), 0, df);
254  HeapFree(GetProcessHeap(), 0, newDevice);
255  return NULL;
256 }
257 
259 {
260  TRACE("%p %s %s %p %i\n", dinput, debugstr_guid(rguid), debugstr_guid(riid), pdev, unicode);
261  *pdev = NULL;
262 
263  if (IsEqualGUID(&GUID_SysMouse, rguid)) /* Wine Mouse */
264  {
266 
267  if (riid == NULL)
268  ;/* nothing */
269  else if (IsEqualGUID(&IID_IDirectInputDeviceA, riid) ||
270  IsEqualGUID(&IID_IDirectInputDevice2A, riid) ||
271  IsEqualGUID(&IID_IDirectInputDevice7A, riid) ||
272  IsEqualGUID(&IID_IDirectInputDevice8A, riid))
273  {
274  unicode = 0;
275  }
276  else if (IsEqualGUID(&IID_IDirectInputDeviceW, riid) ||
277  IsEqualGUID(&IID_IDirectInputDevice2W, riid) ||
278  IsEqualGUID(&IID_IDirectInputDevice7W, riid) ||
279  IsEqualGUID(&IID_IDirectInputDevice8W, riid))
280  {
281  unicode = 1;
282  }
283  else
284  {
285  WARN("no interface\n");
286  return DIERR_NOINTERFACE;
287  }
288 
289  This = alloc_device(rguid, dinput);
290  TRACE("Created a Mouse device (%p)\n", This);
291 
292  if (!This) return DIERR_OUTOFMEMORY;
293 
294  if (unicode)
295  *pdev = &This->base.IDirectInputDevice8W_iface;
296  else
297  *pdev = &This->base.IDirectInputDevice8A_iface;
298 
299  return DI_OK;
300  }
301 
302  return DIERR_DEVICENOTREG;
303 }
304 
305 const struct dinput_device mouse_device = {
306  "Wine mouse driver",
310 };
311 
312 /******************************************************************************
313  * SysMouseA (DInput Mouse support)
314  */
315 
316 /* low-level mouse hook */
318 {
321  int wdata = 0, inst_id = -1, ret = 0;
322 
323  TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);
324 
325  EnterCriticalSection(&This->base.crit);
326 
327  switch(wparam) {
328  case WM_MOUSEMOVE:
329  {
330  POINT pt, pt1;
331 
332  GetCursorPos(&pt);
333  This->m_state.lX += pt.x = hook->pt.x - pt.x;
334  This->m_state.lY += pt.y = hook->pt.y - pt.y;
335 
336  if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS)
337  {
338  pt1.x = This->m_state.lX;
339  pt1.y = This->m_state.lY;
340  } else
341  pt1 = pt;
342 
343  if (pt.x)
344  {
346  wdata = pt1.x;
347  }
348  if (pt.y)
349  {
350  /* Already have X, need to queue it */
351  if (inst_id != -1)
352  queue_event(iface, inst_id,
353  wdata, GetCurrentTime(), This->base.dinput->evsequence);
355  wdata = pt1.y;
356  }
357 
358  if (pt.x || pt.y)
359  {
360  if ((This->warp_override == WARP_FORCE_ON) ||
361  (This->warp_override != WARP_DISABLE && (This->base.dwCoopLevel & DISCL_EXCLUSIVE)))
362  This->need_warp = TRUE;
363  }
364  break;
365  }
366  case WM_MOUSEWHEEL:
368  This->m_state.lZ += wdata = (short)HIWORD(hook->mouseData);
369  /* FarCry crashes if it gets a mouse wheel message */
370  /* FIXME: should probably filter out other messages too */
371  ret = This->clipped;
372  break;
373  case WM_LBUTTONDOWN:
375  This->m_state.rgbButtons[0] = wdata = 0x80;
376  break;
377  case WM_LBUTTONUP:
379  This->m_state.rgbButtons[0] = wdata = 0x00;
380  break;
381  case WM_RBUTTONDOWN:
383  This->m_state.rgbButtons[1] = wdata = 0x80;
384  break;
385  case WM_RBUTTONUP:
387  This->m_state.rgbButtons[1] = wdata = 0x00;
388  break;
389  case WM_MBUTTONDOWN:
391  This->m_state.rgbButtons[2] = wdata = 0x80;
392  break;
393  case WM_MBUTTONUP:
395  This->m_state.rgbButtons[2] = wdata = 0x00;
396  break;
397  case WM_XBUTTONDOWN:
399  This->m_state.rgbButtons[2 + HIWORD(hook->mouseData)] = wdata = 0x80;
400  break;
401  case WM_XBUTTONUP:
403  This->m_state.rgbButtons[2 + HIWORD(hook->mouseData)] = wdata = 0x00;
404  break;
405  }
406 
407 
408  if (inst_id != -1)
409  {
410  _dump_mouse_state(&This->m_state);
411  queue_event(iface, inst_id,
412  wdata, GetCurrentTime(), This->base.dinput->evsequence++);
413  }
414 
415  LeaveCriticalSection(&This->base.crit);
416  return ret;
417 }
418 
419 static void warp_check( SysMouseImpl* This, BOOL force )
420 {
422  const DWORD interval = This->clipped ? 500 : 10;
423 
424  if (force || (This->need_warp && (now - This->last_warped > interval)))
425  {
426  RECT rect, new_rect;
427  POINT mapped_center;
428 
429  This->last_warped = now;
430  This->need_warp = FALSE;
431  if (!GetClientRect(This->base.win, &rect)) return;
432  MapWindowPoints( This->base.win, 0, (POINT *)&rect, 2 );
433  if (!This->clipped)
434  {
435  mapped_center.x = (rect.left + rect.right) / 2;
436  mapped_center.y = (rect.top + rect.bottom) / 2;
437  TRACE("Warping mouse to %d - %d\n", mapped_center.x, mapped_center.y);
438  SetCursorPos( mapped_center.x, mapped_center.y );
439  }
440  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
441  {
442  /* make sure we clip even if the window covers the whole screen */
443  rect.left = max( rect.left, GetSystemMetrics( SM_XVIRTUALSCREEN ) + 1 );
444  rect.top = max( rect.top, GetSystemMetrics( SM_YVIRTUALSCREEN ) + 1 );
445  rect.right = min( rect.right, rect.left + GetSystemMetrics( SM_CXVIRTUALSCREEN ) - 2 );
446  rect.bottom = min( rect.bottom, rect.top + GetSystemMetrics( SM_CYVIRTUALSCREEN ) - 2 );
447  TRACE("Clipping mouse to %s\n", wine_dbgstr_rect( &rect ));
448  ClipCursor( &rect );
449  This->clipped = GetClipCursor( &new_rect ) && EqualRect( &rect, &new_rect );
450  }
451  }
452 }
453 
454 
455 /******************************************************************************
456  * Acquire : gets exclusive control of the mouse
457  */
459 {
461  POINT point;
462  HRESULT res;
463 
464  TRACE("(this=%p)\n",This);
465 
466  if ((res = IDirectInputDevice2WImpl_Acquire(iface)) != DI_OK) return res;
467 
468  /* Init the mouse state */
469  GetCursorPos( &point );
470  if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS)
471  {
472  This->m_state.lX = point.x;
473  This->m_state.lY = point.y;
474  } else {
475  This->m_state.lX = 0;
476  This->m_state.lY = 0;
477  This->org_coords = point;
478  }
479  This->m_state.lZ = 0;
480  This->m_state.rgbButtons[0] = GetKeyState(VK_LBUTTON) & 0x80;
481  This->m_state.rgbButtons[1] = GetKeyState(VK_RBUTTON) & 0x80;
482  This->m_state.rgbButtons[2] = GetKeyState(VK_MBUTTON) & 0x80;
483 
484  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
485  {
486  ShowCursor(FALSE); /* hide cursor */
487  warp_check( This, TRUE );
488  }
489  else if (This->warp_override == WARP_FORCE_ON)
490  {
491  /* Need a window to warp mouse in. */
492  if (!This->base.win) This->base.win = GetDesktopWindow();
493  warp_check( This, TRUE );
494  }
495  else if (This->clipped)
496  {
497  ClipCursor( NULL );
498  This->clipped = FALSE;
499  }
500 
501  return DI_OK;
502 }
503 
505 {
508 }
509 
510 /******************************************************************************
511  * Unacquire : frees the mouse
512  */
514 {
516  HRESULT res;
517 
518  TRACE("(this=%p)\n",This);
519 
520  if ((res = IDirectInputDevice2WImpl_Unacquire(iface)) != DI_OK) return res;
521 
522  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
523  {
524  ClipCursor(NULL);
525  ShowCursor(TRUE); /* show cursor */
526  This->clipped = FALSE;
527  }
528 
529  /* And put the mouse cursor back where it was at acquire time */
530  if (This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON)
531  {
532  TRACE("warping mouse back to %s\n", wine_dbgstr_point(&This->org_coords));
533  SetCursorPos(This->org_coords.x, This->org_coords.y);
534  }
535 
536  return DI_OK;
537 }
538 
540 {
543 }
544 
545 /******************************************************************************
546  * GetDeviceState : returns the "state" of the mouse.
547  *
548  * For the moment, only the "standard" return structure (DIMOUSESTATE) is
549  * supported.
550  */
552 {
554  TRACE("(%p)->(%u,%p)\n", This, len, ptr);
555 
556  if(This->base.acquired == 0) return DIERR_NOTACQUIRED;
557 
559 
560  EnterCriticalSection(&This->base.crit);
561  _dump_mouse_state(&This->m_state);
562 
563  /* Copy the current mouse state */
564  fill_DataFormat(ptr, len, &This->m_state, &This->base.data_format);
565 
566  /* Initialize the buffer when in relative mode */
567  if (!(This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS))
568  {
569  This->m_state.lX = 0;
570  This->m_state.lY = 0;
571  This->m_state.lZ = 0;
572  }
573  LeaveCriticalSection(&This->base.crit);
574 
575  warp_check( This, FALSE );
576  return DI_OK;
577 }
578 
580 {
583 }
584 
585 /******************************************************************************
586  * GetDeviceData : gets buffered input data.
587  */
589  DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
590 {
592  HRESULT res;
593 
594  res = IDirectInputDevice2WImpl_GetDeviceData(iface, dodsize, dod, entries, flags);
595  if (SUCCEEDED(res)) warp_check( This, FALSE );
596  return res;
597 }
598 
600  DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
601 {
603  return SysMouseWImpl_GetDeviceData(IDirectInputDevice8W_from_impl(This), dodsize, dod, entries, flags);
604 }
605 
606 /******************************************************************************
607  * GetProperty : get input device properties
608  */
610 {
612 
613  TRACE("(%p) %s,%p\n", This, debugstr_guid(rguid), pdiph);
614  _dump_DIPROPHEADER(pdiph);
615 
616  if (IS_DIPROP(rguid)) {
617  switch (LOWORD(rguid)) {
618  case (DWORD_PTR) DIPROP_GRANULARITY: {
619  LPDIPROPDWORD pr = (LPDIPROPDWORD) pdiph;
620 
621  if (
622  ((pdiph->dwHow == DIPH_BYOFFSET) &&
623  ((pdiph->dwObj == DIMOFS_X) ||
624  (pdiph->dwObj == DIMOFS_Y)))
625  ||
626  ((pdiph->dwHow == DIPH_BYID) &&
629  ){
630  /* Set granularity of X/Y Axis to 1. See MSDN on DIPROP_GRANULARITY */
631  pr->dwData = 1;
632  } else {
633  /* We'll just assume that the app asks about the Z axis */
634  pr->dwData = WHEEL_DELTA;
635  }
636 
637  break;
638  }
639 
640  case (DWORD_PTR) DIPROP_RANGE: {
641  LPDIPROPRANGE pr = (LPDIPROPRANGE) pdiph;
642 
643  if ((pdiph->dwHow == DIPH_BYID) &&
646  /* Querying the range of either the X or the Y axis. As I do
647  not know the range, do as if the range were
648  unrestricted...*/
649  pr->lMin = DIPROPRANGE_NOMIN;
650  pr->lMax = DIPROPRANGE_NOMAX;
651  }
652 
653  break;
654  }
655 
656  default:
657  return IDirectInputDevice2WImpl_GetProperty(iface, rguid, pdiph);
658  }
659  }
660 
661  return DI_OK;
662 }
663 
665 {
668 }
669 
670 /******************************************************************************
671  * GetCapabilities : get the device capabilities
672  */
674 {
676  DIDEVCAPS devcaps;
677 
678  TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
679 
680  if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) {
681  WARN("invalid parameter\n");
682  return DIERR_INVALIDPARAM;
683  }
684 
685  devcaps.dwSize = lpDIDevCaps->dwSize;
686  devcaps.dwFlags = DIDC_ATTACHED | DIDC_EMULATED;
687  if (This->base.dinput->dwVersion >= 0x0800)
689  else
691  devcaps.dwAxes = 3;
692  devcaps.dwButtons = 8;
693  devcaps.dwPOVs = 0;
694  devcaps.dwFFSamplePeriod = 0;
695  devcaps.dwFFMinTimeResolution = 0;
696  devcaps.dwFirmwareRevision = 100;
697  devcaps.dwHardwareRevision = 100;
698  devcaps.dwFFDriverVersion = 0;
699 
700  memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize);
701 
702  return DI_OK;
703 }
704 
706 {
709 }
710 
711 /******************************************************************************
712  * GetObjectInfo : get information about a device object such as a button
713  * or axis
714  */
716  LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
717 {
718  static const WCHAR x_axisW[] = {'X','-','A','x','i','s',0};
719  static const WCHAR y_axisW[] = {'Y','-','A','x','i','s',0};
720  static const WCHAR wheelW[] = {'W','h','e','e','l',0};
721  static const WCHAR buttonW[] = {'B','u','t','t','o','n',' ','%','d',0};
722  HRESULT res;
723 
724  res = IDirectInputDevice2WImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow);
725  if (res != DI_OK) return res;
726 
727  if (IsEqualGUID(&pdidoi->guidType, &GUID_XAxis)) strcpyW(pdidoi->tszName, x_axisW);
728  else if (IsEqualGUID(&pdidoi->guidType, &GUID_YAxis)) strcpyW(pdidoi->tszName, y_axisW);
729  else if (IsEqualGUID(&pdidoi->guidType, &GUID_ZAxis)) strcpyW(pdidoi->tszName, wheelW);
730  else if (pdidoi->dwType & DIDFT_BUTTON)
731  wsprintfW(pdidoi->tszName, buttonW, DIDFT_GETINSTANCE(pdidoi->dwType) - 3);
732 
733  if(pdidoi->dwType & DIDFT_AXIS)
734  pdidoi->dwFlags |= DIDOI_ASPECTPOSITION;
735 
736  _dump_OBJECTINSTANCEW(pdidoi);
737  return res;
738 }
739 
741  LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow)
742 {
744  HRESULT res;
746  DWORD dwSize = pdidoi->dwSize;
747 
748  didoiW.dwSize = sizeof(didoiW);
750  if (res != DI_OK) return res;
751 
752  memset(pdidoi, 0, pdidoi->dwSize);
753  memcpy(pdidoi, &didoiW, FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW, tszName));
754  pdidoi->dwSize = dwSize;
755  WideCharToMultiByte(CP_ACP, 0, didoiW.tszName, -1, pdidoi->tszName,
756  sizeof(pdidoi->tszName), NULL, NULL);
757 
758  return res;
759 }
760 
761 /******************************************************************************
762  * GetDeviceInfo : get information about a device's identity
763  */
765  LPDIRECTINPUTDEVICE8A iface,
766  LPDIDEVICEINSTANCEA pdidi)
767 {
769  TRACE("(this=%p,%p)\n", This, pdidi);
770 
771  fill_mouse_dideviceinstanceA(pdidi, This->base.dinput->dwVersion);
772 
773  return DI_OK;
774 }
775 
777 {
779  TRACE("(this=%p,%p)\n", This, pdidi);
780 
781  if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
782  WARN(" dinput3 not supported yet...\n");
783  return DI_OK;
784  }
785 
786  fill_mouse_dideviceinstanceW(pdidi, This->base.dinput->dwVersion);
787 
788  return DI_OK;
789 }
790 
792  LPDIACTIONFORMATW lpdiaf,
793  LPCWSTR lpszUserName,
794  DWORD dwFlags)
795 {
796  FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
797 
798  return _build_action_map(iface, lpdiaf, lpszUserName, dwFlags, DIMOUSE_MASK, &c_dfDIMouse2);
799 }
800 
802  LPDIACTIONFORMATA lpdiaf,
803  LPCSTR lpszUserName,
804  DWORD dwFlags)
805 {
807  DIACTIONFORMATW diafW;
808  HRESULT hr;
809  WCHAR *lpszUserNameW = NULL;
810  int username_size;
811 
812  diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
813  _copy_diactionformatAtoW(&diafW, lpdiaf);
814 
815  if (lpszUserName != NULL)
816  {
817  username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
818  lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
819  MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
820  }
821 
822  hr = SysMouseWImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
823 
824  _copy_diactionformatWtoA(lpdiaf, &diafW);
825  HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
826  HeapFree(GetProcessHeap(), 0, lpszUserNameW);
827 
828  return hr;
829 }
830 
832  LPDIACTIONFORMATW lpdiaf,
833  LPCWSTR lpszUserName,
834  DWORD dwFlags)
835 {
837  FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", This, lpdiaf, debugstr_w(lpszUserName), dwFlags);
838 
839  return _set_action_map(iface, lpdiaf, lpszUserName, dwFlags, &c_dfDIMouse2);
840 }
841 
843  LPDIACTIONFORMATA lpdiaf,
844  LPCSTR lpszUserName,
845  DWORD dwFlags)
846 {
848  DIACTIONFORMATW diafW;
849  HRESULT hr;
850  WCHAR *lpszUserNameW = NULL;
851  int username_size;
852 
853  diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
854  _copy_diactionformatAtoW(&diafW, lpdiaf);
855 
856  if (lpszUserName != NULL)
857  {
858  username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
859  lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
860  MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
861  }
862 
863  hr = SysMouseWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
864 
865  lpdiaf->dwCRC = diafW.dwCRC;
866 
867  HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
868  HeapFree(GetProcessHeap(), 0, lpszUserNameW);
869 
870  return hr;
871 }
872 
873 static const IDirectInputDevice8AVtbl SysMouseAvt =
874 {
907 };
908 
909 static const IDirectInputDevice8WVtbl SysMouseWvt =
910 {
943 };
#define WM_MBUTTONUP
Definition: winuser.h:1765
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
Definition: device.c:1537
HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader)
Definition: device.c:1950
HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1352
HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
Definition: device.c:1725
GUID guidInstance
Definition: dinput.h:413
#define IDirectInput_AddRef(p)
Definition: dinput.h:2293
BOOL need_warp
Definition: mouse.c:72
void check_dinput_events(void)
Definition: dinput_main.c:1900
HRESULT WINAPI IDirectInputDevice2AImpl_Poll(LPDIRECTINPUTDEVICE8A iface)
Definition: device.c:1851
#define max(a, b)
Definition: svc.c:63
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
Definition: device.c:1867
static void _dump_mouse_state(const DIMOUSESTATE2 *m_state)
Definition: mouse.c:97
DWORD dwFFMinTimeResolution
Definition: dinput.h:939
static HRESULT mousedev_create_device(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPVOID *pdev, int unicode)
Definition: mouse.c:258
static HRESULT WINAPI SysMouseWImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface, DWORD len, LPVOID ptr)
Definition: mouse.c:551
DWORD dwDevType
Definition: dinput.h:428
#define DIDF_ABSAXIS
Definition: dinput.h:775
HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags)
Definition: device.c:1800
long y
Definition: polytest.cpp:48
#define SM_XVIRTUALSCREEN
Definition: winuser.h:1026
#define DIDC_EMULATED
Definition: dinput.h:947
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
DWORD dwSize
Definition: dinput.h:808
#define DWORD_PTR
Definition: treelist.c:76
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
Definition: scsiwmi.h:51
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static HRESULT WINAPI SysMouseAImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps)
Definition: mouse.c:705
HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: device.c:1386
#define DIPH_BYID
Definition: dinput.h:837
BOOL WINAPI ClipCursor(_In_opt_ LPCRECT)
long x
Definition: polytest.cpp:48
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1028
HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(LPDIRECTINPUTDEVICE8A iface, LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1322
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
static HRESULT WINAPI SysMouseWImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
Definition: mouse.c:791
static const IDirectInputDevice8AVtbl SysMouseAvt
Definition: mouse.c:50
#define VK_LBUTTON
Definition: winuser.h:2165
static void warp_check(SysMouseImpl *This, BOOL force)
Definition: mouse.c:419
#define DIERR_NOTACQUIRED
Definition: dinput.h:167
#define pt(x, y)
Definition: drawing.c:79
REFIID riid
Definition: precomp.h:44
HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df)
Definition: device.c:866
const DIDATAFORMAT c_dfDIMouse2
Definition: data_formats.c:293
#define DIPROPRANGE_NOMIN
Definition: dinput.h:855
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define CP_ACP
Definition: compat.h:99
static HRESULT WINAPI SysMouseAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface, LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags)
Definition: mouse.c:842
static HRESULT mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
Definition: mouse.c:177
DWORD dwNumObjs
Definition: dinput.h:812
HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1076
struct IDirectInputDeviceImpl base
Definition: mouse.c:64
static const WCHAR buttonW[]
Definition: htmlelem.c:24
void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi)
Definition: device.c:191
#define WARN(fmt,...)
Definition: debug.h:111
static void fill_mouse_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version)
Definition: mouse.c:108
#define DIDFT_MAKEINSTANCE(n)
Definition: dinput.h:762
IDirectInputDevice8A IDirectInputDevice8A_iface
static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
Definition: mouse.c:715
BYTE rgbButtons[8]
Definition: dinput.h:2123
#define DIDC_ATTACHED
Definition: dinput.h:945
DWORD dwNumActions
Definition: dinput.h:1311
DWORD dwObjSize
Definition: dinput.h:809
HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(LPDIRECTINPUTDEVICE8A iface, HWND hwndOwner, DWORD dwFlags)
Definition: device.c:1700
GLuint buffer
Definition: glext.h:5915
#define WINE_MOUSE_BUTTONS_INSTANCE
Definition: mouse.c:48
WCHAR tszName[MAX_PATH]
Definition: dinput.h:371
static HRESULT WINAPI SysMouseWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi)
Definition: mouse.c:776
void ShowCursor(void)
Definition: hardware.c:556
struct list devices_list
#define DIEDFL_FORCEFEEDBACK
Definition: dinput.h:192
UINT_PTR WPARAM
Definition: windef.h:207
#define DIPROP_RANGE
Definition: dinput.h:892
HRESULT WINAPI IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1841
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface, LPCWSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags)
Definition: device.c:1912
DWORD dwHow
Definition: dinput.h:831
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
#define E_FAIL
Definition: ddrawi.h:102
ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1308
POINT org_coords
Definition: mouse.c:68
POINTL point
Definition: edittest.c:50
& rect
Definition: startmenu.cpp:1413
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
DWORD dwDevType
Definition: dinput.h:934
LONG y
Definition: windef.h:330
#define DISCL_NONEXCLUSIVE
Definition: dinput.h:964
struct DIPROPRANGE * LPDIPROPRANGE
IDirectInputImpl * dinput
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
DIMOUSESTATE2 m_state
Definition: mouse.c:76
#define WHEEL_DELTA
Definition: treelist.c:99
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
BOOL WINAPI GetClipCursor(_Out_ LPRECT)
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
#define GetCurrentTime
Definition: winbase.h:2056
#define DIDEVTYPE_MOUSE
Definition: dinput.h:198
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
DWORD dwFFSamplePeriod
Definition: dinput.h:938
#define VK_RBUTTON
Definition: winuser.h:2166
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DIDFT_BUTTON
Definition: dinput.h:756
HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
Definition: device.c:1857
time_t now
Definition: finger.c:65
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define debugstr_w
Definition: kernel32.h:32
_Check_return_ _CRTIMP int __cdecl _strnicmp(_In_reads_or_z_(_MaxCount) const char *_Str1, _In_reads_or_z_(_MaxCount) const char *_Str2, _In_ size_t _MaxCount)
#define DIPH_BYOFFSET
Definition: dinput.h:836
#define FIXME(fmt,...)
Definition: debug.h:110
DWORD dwDevType
Definition: dinput.h:415
static PVOID ptr
Definition: dispmode.c:27
static int dinput_mouse_hook(LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam)
Definition: mouse.c:317
#define S_FALSE
Definition: winerror.h:2357
DWORD dwFlags
Definition: dinput.h:933
GUID guidProduct
Definition: dinput.h:414
static HRESULT WINAPI SysMouseWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
Definition: mouse.c:831
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DIMOFS_X
Definition: dinput.h:2126
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:66
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
DWORD dwAxes
Definition: dinput.h:935
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT WINAPI IDirectInputDevice2AImpl_Escape(LPDIRECTINPUTDEVICE8A iface, LPDIEFFESCAPE lpDIEEsc)
Definition: device.c:1835
static SysMouseImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: mouse.c:85
DWORD dwPOVs
Definition: dinput.h:937
BOOL clipped
Definition: mouse.c:69
const char * LPCSTR
Definition: xmlstorage.h:183
static HRESULT WINAPI SysMouseWImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: mouse.c:588
#define DIDEVTYPEMOUSE_TRADITIONAL
Definition: dinput.h:223
#define debugstr_guid
Definition: kernel32.h:35
DWORD dwHardwareRevision
Definition: dinput.h:941
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
WARP_MOUSE warp_override
Definition: mouse.c:78
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1029
HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8A iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1821
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
SHORT WINAPI GetKeyState(_In_ int)
static HRESULT WINAPI SysMouseAImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEINSTANCEA pdidi)
Definition: mouse.c:764
static HRESULT WINAPI SysMouseWImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, LPDIDEVCAPS lpDIDevCaps)
Definition: mouse.c:673
#define DI8DEVCLASS_POINTER
Definition: dinput.h:205
static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
Definition: mouse.c:504
#define DIPROPRANGE_NOMAX
Definition: dinput.h:856
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags)
Definition: device.c:1876
#define DISCL_BACKGROUND
Definition: dinput.h:966
const char * wine_dbgstr_point(const POINT *guid)
HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader)
Definition: device.c:1941
Definition: msg.h:42
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE event)
Definition: device.c:1212
HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags)
Definition: device.c:1692
void _dump_DIPROPHEADER(LPCDIPROPHEADER diph)
Definition: device.c:176
#define GetProcessHeap()
Definition: compat.h:403
HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags)
Definition: device.c:1900
DWORD dwSize
Definition: dinput.h:932
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df)
Definition: device.c:1135
#define DIERR_OUTOFMEMORY
Definition: dinput.h:155
__wchar_t WCHAR
Definition: xmlstorage.h:180
#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:326
DWORD dwFFDriverVersion
Definition: dinput.h:942
static HRESULT WINAPI SysMouseAImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow)
Definition: mouse.c:740
HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(LPDIRECTINPUTDEVICE8A iface, LPDIENUMEFFECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1743
DWORD dwButtons
Definition: dinput.h:936
WINE_DEFAULT_DEBUG_CHANNEL(dinput)
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:6
HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMEFFECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1755
const char * wine_dbgstr_rect(const RECT *rect)
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
int WINAPI GetSystemMetrics(_In_ int)
#define DIERR_DEVICENOTREG
Definition: dinput.h:147
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG x
Definition: windef.h:329
HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid)
Definition: device.c:1706
#define DI8DEVTYPEMOUSE_TRADITIONAL
Definition: dinput.h:251
HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8A iface, DWORD dwFlags)
Definition: device.c:1807
#define WM_RBUTTONUP
Definition: winuser.h:1762
HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: device.c:1629
static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: mouse.c:664
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:1828
#define DIPROP_GRANULARITY
Definition: dinput.h:891
HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8A iface, LPDIEFFECTINFOA lpdei, REFGUID rguid)
Definition: device.c:1767
WCHAR tszProductName[MAX_PATH]
Definition: dinput.h:430
#define WINE_MOUSE_X_AXIS_INSTANCE
Definition: mouse.c:45
static HRESULT WINAPI SysMouseWImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
Definition: mouse.c:513
int ret
HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj)
Definition: device.c:1273
ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface)
Definition: device.c:1267
#define DIDFT_AXIS
Definition: dinput.h:753
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static HRESULT mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
Definition: mouse.c:156
DWORD dwData
Definition: dinput.h:844
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HRESULT WINAPI SysMouseAImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface, LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags)
Definition: mouse.c:801
GLenum GLsizei len
Definition: glext.h:6722
CHAR tszInstanceName[MAX_PATH]
Definition: dinput.h:416
#define WINE_MOUSE_Y_AXIS_INSTANCE
Definition: mouse.c:46
LPDIOBJECTDATAFORMAT rgodf
Definition: dinput.h:813
HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface, REFIID riid, LPVOID *ppobj)
Definition: device.c:1302
uint32_t DWORD_PTR
Definition: typedefs.h:63
WCHAR tszInstanceName[MAX_PATH]
Definition: dinput.h:429
LPDIACTIONW rgoAction
Definition: dinput.h:1330
static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
Definition: mouse.c:539
WARP_MOUSE
Definition: mouse.c:55
#define SM_YVIRTUALSCREEN
Definition: winuser.h:1027
HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIEFFECTINFOW lpdei, REFGUID rguid)
Definition: device.c:1777
#define DIMOUSE_MASK
DWORD get_config_key(HKEY defkey, HKEY appkey, const char *name, char *buffer, DWORD size)
Definition: device.c:313
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8A iface, HWND hwnd, DWORD dwflags)
Definition: device.c:1203
CRITICAL_SECTION crit
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
struct IDirectInputDevice8W * LPDIRECTINPUTDEVICE8W
Definition: dinput.h:106
void _copy_diactionformatAtoW(LPDIACTIONFORMATW to, LPDIACTIONFORMATA from)
Definition: dinput_main.c:339
HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8A iface, LPDWORD pdwOut)
Definition: device.c:1794
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define DIERR_NOINTERFACE
Definition: dinput.h:153
HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags)
Definition: device.c:1167
DWORD last_warped
Definition: mouse.c:73
HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface, LPCWSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags)
Definition: device.c:1888
static HRESULT WINAPI SysMouseWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
Definition: mouse.c:458
static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: mouse.c:599
ULONG WINAPI IDirectInputDevice2AImpl_AddRef(LPDIRECTINPUTDEVICE8A iface)
Definition: device.c:1316
#define WM_LBUTTONUP
Definition: winuser.h:1759
#define WM_MBUTTONDOWN
Definition: winuser.h:1764
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
Definition: device.c:1576
void _copy_diactionformatWtoA(LPDIACTIONFORMATA to, LPDIACTIONFORMATW from)
Definition: dinput_main.c:366
DWORD dwObj
Definition: dinput.h:830
#define min(a, b)
Definition: monoChain.cc:55
#define WM_MOUSEMOVE
Definition: winuser.h:1757
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define DI8DEVTYPE_MOUSE
Definition: dinput.h:210
GUID guidInstance
Definition: dinput.h:426
HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(LPDIRECTINPUTDEVICE8A iface, LPCDIDATAFORMAT df)
Definition: device.c:1156
#define MultiByteToWideChar
Definition: compat.h:100
#define DIMOFS_Y
Definition: dinput.h:2127
BOOL get_app_key(HKEY *defkey, HKEY *appkey)
Definition: device.c:278
HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
Definition: device.c:1736
CHAR tszProductName[MAX_PATH]
Definition: dinput.h:417
void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq)
Definition: device.c:1025
HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df)
Definition: device.c:791
static void fill_mouse_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD version)
Definition: mouse.c:132
struct IDirectInputDevice8A * LPDIRECTINPUTDEVICE8A
Definition: dinput.h:105
HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1813
LONG lMin
Definition: dinput.h:850
static SysMouseImpl * alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
Definition: mouse.c:198
GLuint res
Definition: glext.h:9613
#define DI_OK
Definition: dinput.h:128
uint32_t * LPDWORD
Definition: typedefs.h:57
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
IDirectInputDevice8W IDirectInputDevice8W_iface
DWORD dwFirmwareRevision
Definition: dinput.h:940
#define HIWORD(l)
Definition: typedefs.h:246
HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1108
static HRESULT WINAPI SysMouseAImpl_GetDeviceState(LPDIRECTINPUTDEVICE8A iface, DWORD len, LPVOID ptr)
Definition: mouse.c:579
static HRESULT WINAPI SysMouseWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: mouse.c:609
HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
Definition: device.c:1450
const struct dinput_device mouse_device
Definition: mouse.c:305
LONG lMax
Definition: dinput.h:851
#define IS_DIPROP(x)
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(SysMouseImpl *This)
Definition: mouse.c:90
#define WINE_MOUSE_Z_AXIS_INSTANCE
Definition: mouse.c:47
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static const IDirectInputDevice8WVtbl SysMouseWvt
Definition: mouse.c:51
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define memset(x, y, z)
Definition: compat.h:39
#define VK_MBUTTON
Definition: winuser.h:2168
#define TRACE_ON(x)
Definition: compat.h:65
struct DIPROPDWORD * LPDIPROPDWORD
static SysMouseImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: mouse.c:81
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:402
HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface, HANDLE event)
Definition: device.c:1224
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define DISCL_EXCLUSIVE
Definition: dinput.h:963
HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut)
Definition: device.c:1787
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static UINT WPARAM wparam
Definition: combo.c:716
#define DIDFT_RELAXIS
Definition: dinput.h:751
ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1231
GUID guidProduct
Definition: dinput.h:427
HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(LPDIRECTINPUTDEVICE8A iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid)
Definition: device.c:1714