ReactOS  0.4.14-dev-317-g96040ec
device.c File Reference
#include "config.h"
#include <stdarg.h>
#include <string.h>
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/heap.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "winerror.h"
#include "dinput.h"
#include "device_private.h"
#include "dinput_private.h"
Include dependency graph for device.c:

Go to the source code of this file.

Macros

#define WM_WINE_NOTIFY_ACTIVITY   WM_USER
 
#define FE(x)   { x, #x}
 
#define FE(x)   { x, #x}
 
#define FE(x)   case x: TRACE(" "#x); break
 
#define FE(x)   { x, #x}
 
#define FE(x)   { &x, #x}
 
#define X(x)   if (dwFlags & x) FIXME("\tdwFlags =|"#x"\n");
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dinput)
 
static IDirectInputDeviceImplimpl_from_IDirectInputDevice8A (IDirectInputDevice8A *iface)
 
static IDirectInputDeviceImplimpl_from_IDirectInputDevice8W (IDirectInputDevice8W *iface)
 
static IDirectInputDevice8A * IDirectInputDevice8A_from_impl (IDirectInputDeviceImpl *This)
 
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl (IDirectInputDeviceImpl *This)
 
static void _dump_cooperativelevel_DI (DWORD dwFlags)
 
static void _dump_ObjectDataFormat_flags (DWORD dwFlags)
 
static void _dump_EnumObjects_flags (DWORD dwFlags)
 
void _dump_DIPROPHEADER (LPCDIPROPHEADER diph)
 
void _dump_OBJECTINSTANCEA (const DIDEVICEOBJECTINSTANCEA *ddoi)
 
void _dump_OBJECTINSTANCEW (const DIDEVICEOBJECTINSTANCEW *ddoi)
 
const char_dump_dinput_GUID (const GUID *guid)
 
void _dump_DIDATAFORMAT (const DIDATAFORMAT *df)
 
BOOL get_app_key (HKEY *defkey, HKEY *appkey)
 
DWORD get_config_key (HKEY defkey, HKEY appkey, const char *name, char *buffer, DWORD size)
 
void fill_DataFormat (void *out, DWORD size, const void *in, const DataFormat *df)
 
void release_DataFormat (DataFormat *format)
 
static LPDIOBJECTDATAFORMAT dataformat_to_odf (LPCDIDATAFORMAT df, int idx)
 
LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type (LPCDIDATAFORMAT df, int n, DWORD type)
 
static HRESULT create_DataFormat (LPCDIDATAFORMAT asked_format, DataFormat *format)
 
static int offset_to_object (const DataFormat *df, int offset)
 
int id_to_object (LPCDIDATAFORMAT df, int id)
 
static int id_to_offset (const DataFormat *df, int id)
 
int find_property (const DataFormat *df, LPCDIPROPHEADER ph)
 
static DWORD semantic_to_obj_id (IDirectInputDeviceImpl *This, DWORD dwSemantic)
 
static void del_mapping_key (const WCHAR *device, const WCHAR *username, const WCHAR *guid)
 
static HKEY get_mapping_key (const WCHAR *device, const WCHAR *username, const WCHAR *guid, BOOL create)
 
HRESULT save_mapping_settings (IDirectInputDevice8W *iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUsername)
 
BOOL load_mapping_settings (IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username)
 
HRESULT _build_action_map (LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df)
 
HRESULT _set_action_map (LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df)
 
void queue_event (LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq)
 
HRESULT WINAPI IDirectInputDevice2WImpl_Acquire (LPDIRECTINPUTDEVICE8W iface)
 
HRESULT WINAPI IDirectInputDevice2AImpl_Acquire (LPDIRECTINPUTDEVICE8A iface)
 
HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire (LPDIRECTINPUTDEVICE8W iface)
 
HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire (LPDIRECTINPUTDEVICE8A iface)
 
HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat (LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df)
 
HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat (LPDIRECTINPUTDEVICE8A iface, LPCDIDATAFORMAT df)
 
HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel (LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags)
 
HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel (LPDIRECTINPUTDEVICE8A iface, HWND hwnd, DWORD dwflags)
 
HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification (LPDIRECTINPUTDEVICE8W iface, HANDLE event)
 
HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification (LPDIRECTINPUTDEVICE8A iface, HANDLE event)
 
ULONG WINAPI IDirectInputDevice2WImpl_Release (LPDIRECTINPUTDEVICE8W iface)
 
ULONG WINAPI IDirectInputDevice2AImpl_Release (LPDIRECTINPUTDEVICE8A iface)
 
HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface (LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj)
 
HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface (LPDIRECTINPUTDEVICE8A iface, REFIID riid, LPVOID *ppobj)
 
ULONG WINAPI IDirectInputDevice2WImpl_AddRef (LPDIRECTINPUTDEVICE8W iface)
 
ULONG WINAPI IDirectInputDevice2AImpl_AddRef (LPDIRECTINPUTDEVICE8A iface)
 
HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects (LPDIRECTINPUTDEVICE8A iface, LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects (LPDIRECTINPUTDEVICE8W iface, LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty (LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
 
HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty (LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph)
 
HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty (LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
 
HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty (LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
 
HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo (LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow)
 
HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo (LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
 
HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData (LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
 
HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData (LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
 
HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel (LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel (LPDIRECTINPUTDEVICE8A iface, HWND hwndOwner, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice2WImpl_Initialize (LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid)
 
HRESULT WINAPI IDirectInputDevice2AImpl_Initialize (LPDIRECTINPUTDEVICE8A iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid)
 
HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect (LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
 
HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect (LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
 
HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects (LPDIRECTINPUTDEVICE8A iface, LPDIENUMEFFECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects (LPDIRECTINPUTDEVICE8W iface, LPDIENUMEFFECTSCALLBACKW lpCallback, LPVOID lpvRef, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo (LPDIRECTINPUTDEVICE8A iface, LPDIEFFECTINFOA lpdei, REFGUID rguid)
 
HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo (LPDIRECTINPUTDEVICE8W iface, LPDIEFFECTINFOW lpdei, REFGUID rguid)
 
HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState (LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut)
 
HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState (LPDIRECTINPUTDEVICE8A iface, LPDWORD pdwOut)
 
HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand (LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand (LPDIRECTINPUTDEVICE8A iface, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects (LPDIRECTINPUTDEVICE8W iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects (LPDIRECTINPUTDEVICE8A iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice2WImpl_Escape (LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc)
 
HRESULT WINAPI IDirectInputDevice2AImpl_Escape (LPDIRECTINPUTDEVICE8A iface, LPDIEFFESCAPE lpDIEEsc)
 
HRESULT WINAPI IDirectInputDevice2WImpl_Poll (LPDIRECTINPUTDEVICE8W iface)
 
HRESULT WINAPI IDirectInputDevice2AImpl_Poll (LPDIRECTINPUTDEVICE8A iface)
 
HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData (LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData (LPDIRECTINPUTDEVICE8A iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile (LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile (LPDIRECTINPUTDEVICE8W iface, LPCWSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile (LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile (LPDIRECTINPUTDEVICE8W iface, LPCWSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap (LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
 
HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo (LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader)
 
HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo (LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader)
 

Macro Definition Documentation

◆ FE [1/5]

#define FE (   x)    { x, #x}

◆ FE [2/5]

#define FE (   x)    { x, #x}

◆ FE [3/5]

#define FE (   x)    case x: TRACE(" "#x); break

◆ FE [4/5]

#define FE (   x)    { x, #x}

◆ FE [5/5]

#define FE (   x)    { &x, #x}

◆ WM_WINE_NOTIFY_ACTIVITY

#define WM_WINE_NOTIFY_ACTIVITY   WM_USER

Definition at line 43 of file device.c.

◆ X

#define X (   x)    if (dwFlags & x) FIXME("\tdwFlags =|"#x"\n");

Function Documentation

◆ _build_action_map()

HRESULT _build_action_map ( LPDIRECTINPUTDEVICE8W  iface,
LPDIACTIONFORMATW  lpdiaf,
LPCWSTR  lpszUserName,
DWORD  dwFlags,
DWORD  devMask,
LPCDIDATAFORMAT  df 
)

Definition at line 791 of file device.c.

792 {
795  DWORD username_size = MAX_PATH;
796  int i;
797  BOOL load_success = FALSE, has_actions = FALSE;
798 
799  /* Unless asked the contrary by these flags, try to load a previous mapping */
800  if (!(dwFlags & DIDBAM_HWDEFAULTS))
801  {
802  /* Retrieve logged user name if necessary */
803  if (lpszUserName == NULL)
804  GetUserNameW(username, &username_size);
805  else
806  lstrcpynW(username, lpszUserName, MAX_PATH);
807 
808  load_success = load_mapping_settings(This, lpdiaf, username);
809  }
810 
811  if (load_success) {
812  /* Update dwCRC to track if action format has changed */
813  for (i=0; i < lpdiaf->dwNumActions; i++)
814  {
815  lpdiaf->dwCRC ^= (lpdiaf->rgoAction[i].dwObjID << i * 2) | (lpdiaf->rgoAction[i].dwObjID >> (sizeof(lpdiaf->dwCRC) * 8 - i * 2));
816  lpdiaf->dwCRC ^= (lpdiaf->rgoAction[i].dwSemantic << (i * 2 + 5)) | (lpdiaf->rgoAction[i].dwSemantic >> (sizeof(lpdiaf->dwCRC) * 8 - (i * 2 + 5)));
817  }
818  return DI_OK;
819  }
820 
821  for (i=0; i < lpdiaf->dwNumActions; i++)
822  {
823  if ((lpdiaf->rgoAction[i].dwSemantic & devMask) == devMask)
824  {
825  DWORD obj_id = semantic_to_obj_id(This, lpdiaf->rgoAction[i].dwSemantic);
826  DWORD type = DIDFT_GETTYPE(obj_id);
827  DWORD inst = DIDFT_GETINSTANCE(obj_id);
828 
830 
832  if (type == DIDFT_RELAXIS) type = DIDFT_AXIS;
833 
834  /* Make sure the object exists */
835  odf = dataformat_to_odf_by_type(df, inst, type);
836 
837  if (odf != NULL)
838  {
839  lpdiaf->rgoAction[i].dwObjID = obj_id;
840  lpdiaf->rgoAction[i].guidInstance = This->guid;
841  lpdiaf->rgoAction[i].dwHow = DIAH_DEFAULT;
842  has_actions = TRUE;
843  }
844  }
845  else if (!(dwFlags & DIDBAM_PRESERVE))
846  {
847  /* We must clear action data belonging to other devices */
848  memset(&lpdiaf->rgoAction[i].guidInstance, 0, sizeof(GUID));
849  lpdiaf->rgoAction[i].dwHow = DIAH_UNMAPPED;
850  }
851  }
852 
853  /* Update dwCRC to track if action format has changed */
854  lpdiaf->dwCRC = 0;
855  for (i=0; i < lpdiaf->dwNumActions; i++)
856  {
857  lpdiaf->dwCRC ^= (lpdiaf->rgoAction[i].dwObjID << i * 2) | (lpdiaf->rgoAction[i].dwObjID >> (sizeof(lpdiaf->dwCRC) * 8 - i * 2));
858  lpdiaf->dwCRC ^= (lpdiaf->rgoAction[i].dwSemantic << (i * 2 + 5)) | (lpdiaf->rgoAction[i].dwSemantic >> (sizeof(lpdiaf->dwCRC) * 8 - (i * 2 + 5)));
859  }
860 
861  if (!has_actions) return DI_NOEFFECT;
862 
863  return IDirectInputDevice8WImpl_BuildActionMap(iface, lpdiaf, lpszUserName, dwFlags);
864 }
#define DIDBAM_PRESERVE
Definition: dinput.h:1353
LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD type)
Definition: device.c:412
#define TRUE
Definition: types.h:120
DWORD dwObjID
Definition: dinput.h:1284
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GUID guidInstance
Definition: dinput.h:1283
HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags)
Definition: device.c:1924
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
#define lstrcpynW
Definition: compat.h:397
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DIDFT_BUTTON
Definition: dinput.h:756
smooth NULL
Definition: ftsmooth.c:416
static WCHAR username[]
Definition: url.c:32
#define DIAH_UNMAPPED
Definition: dinput.h:1299
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DIDBAM_HWDEFAULTS
Definition: dinput.h:1355
#define DIDFT_AXIS
Definition: dinput.h:753
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI_NOEFFECT
Definition: dinput.h:132
LPDIACTIONW rgoAction
Definition: dinput.h:1330
BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username)
Definition: device.c:740
#define DIAH_DEFAULT
Definition: dinput.h:1304
#define DI_OK
Definition: dinput.h:128
static DWORD semantic_to_obj_id(IDirectInputDeviceImpl *This, DWORD dwSemantic)
Definition: device.c:619
DWORD dwHow
Definition: dinput.h:1285
DWORD dwNumActions
Definition: dinput.h:1329
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define memset(x, y, z)
Definition: compat.h:39
#define DIDFT_RELAXIS
Definition: dinput.h:751
DWORD dwSemantic
Definition: dinput.h:1277

Referenced by SysKeyboardWImpl_BuildActionMap(), and SysMouseWImpl_BuildActionMap().

◆ _dump_cooperativelevel_DI()

static void _dump_cooperativelevel_DI ( DWORD  dwFlags)
static

Definition at line 68 of file device.c.

68  {
69  if (TRACE_ON(dinput)) {
70  unsigned int i;
71  static const struct {
72  DWORD mask;
73  const char *name;
74  } flags[] = {
75 #define FE(x) { x, #x}
81 #undef FE
82  };
83  TRACE(" cooperative level : ");
84  for (i = 0; i < ARRAY_SIZE(flags); i++)
85  if (flags[i].mask & dwFlags)
86  TRACE("%s ",flags[i].name);
87  TRACE("\n");
88  }
89 }
#define DISCL_NONEXCLUSIVE
Definition: dinput.h:964
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
GLenum GLint GLuint mask
Definition: glext.h:6028
#define DISCL_NOWINKEY
Definition: dinput.h:967
#define DISCL_BACKGROUND
Definition: dinput.h:966
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DISCL_FOREGROUND
Definition: dinput.h:965
GLbitfield flags
Definition: glext.h:7161
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: name.c:36
#define TRACE_ON(x)
Definition: compat.h:65
#define DISCL_EXCLUSIVE
Definition: dinput.h:963
#define FE(x)
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by IDirectInputDevice2WImpl_SetCooperativeLevel().

◆ _dump_DIDATAFORMAT()

void _dump_DIDATAFORMAT ( const DIDATAFORMAT df)

Definition at line 242 of file device.c.

242  {
243  unsigned int i;
244 
245  TRACE("Dumping DIDATAFORMAT structure:\n");
246  TRACE(" - dwSize: %d\n", df->dwSize);
247  if (df->dwSize != sizeof(DIDATAFORMAT)) {
248  WARN("Non-standard DIDATAFORMAT structure size %d\n", df->dwSize);
249  }
250  TRACE(" - dwObjsize: %d\n", df->dwObjSize);
251  if (df->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) {
252  WARN("Non-standard DIOBJECTDATAFORMAT structure size %d\n", df->dwObjSize);
253  }
254  TRACE(" - dwFlags: 0x%08x (", df->dwFlags);
255  switch (df->dwFlags) {
256  case DIDF_ABSAXIS: TRACE("DIDF_ABSAXIS"); break;
257  case DIDF_RELAXIS: TRACE("DIDF_RELAXIS"); break;
258  default: TRACE("unknown"); break;
259  }
260  TRACE(")\n");
261  TRACE(" - dwDataSize: %d\n", df->dwDataSize);
262  TRACE(" - dwNumObjs: %d\n", df->dwNumObjs);
263 
264  for (i = 0; i < df->dwNumObjs; i++) {
265  TRACE(" - Object %d:\n", i);
266  TRACE(" * GUID: %s ('%s')\n", debugstr_guid(df->rgodf[i].pguid), _dump_dinput_GUID(df->rgodf[i].pguid));
267  TRACE(" * dwOfs: %d\n", df->rgodf[i].dwOfs);
268  TRACE(" * dwType: 0x%08x\n", df->rgodf[i].dwType);
269  TRACE(" "); _dump_EnumObjects_flags(df->rgodf[i].dwType); TRACE("\n");
270  TRACE(" * dwFlags: 0x%08x\n", df->rgodf[i].dwFlags);
272  }
273 }
#define DIDF_ABSAXIS
Definition: dinput.h:775
DWORD dwSize
Definition: dinput.h:808
const char * _dump_dinput_GUID(const GUID *guid)
Definition: device.c:197
DWORD dwNumObjs
Definition: dinput.h:812
#define WARN(fmt,...)
Definition: debug.h:111
DWORD dwObjSize
Definition: dinput.h:809
static void _dump_EnumObjects_flags(DWORD dwFlags)
Definition: device.c:127
static void _dump_ObjectDataFormat_flags(DWORD dwFlags)
Definition: device.c:91
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 DIDF_RELAXIS
Definition: dinput.h:776
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwFlags
Definition: dinput.h:810
LPDIOBJECTDATAFORMAT rgodf
Definition: dinput.h:813
const GUID * pguid
Definition: dinput.h:800
DWORD dwDataSize
Definition: dinput.h:811

Referenced by IDirectInputDevice2WImpl_SetDataFormat().

◆ _dump_dinput_GUID()

const char* _dump_dinput_GUID ( const GUID guid)

Definition at line 197 of file device.c.

197  {
198  unsigned int i;
199  static const struct {
200  const GUID *guid;
201  const char *name;
202  } guids[] = {
203 #define FE(x) { &x, #x}
204  FE(GUID_XAxis),
205  FE(GUID_YAxis),
206  FE(GUID_ZAxis),
207  FE(GUID_RxAxis),
208  FE(GUID_RyAxis),
209  FE(GUID_RzAxis),
210  FE(GUID_Slider),
211  FE(GUID_Button),
212  FE(GUID_Key),
213  FE(GUID_POV),
214  FE(GUID_Unknown),
215  FE(GUID_SysMouse),
216  FE(GUID_SysKeyboard),
217  FE(GUID_Joystick),
218  FE(GUID_ConstantForce),
219  FE(GUID_RampForce),
220  FE(GUID_Square),
221  FE(GUID_Sine),
222  FE(GUID_Triangle),
223  FE(GUID_SawtoothUp),
224  FE(GUID_SawtoothDown),
225  FE(GUID_Spring),
226  FE(GUID_Damper),
227  FE(GUID_Inertia),
228  FE(GUID_Friction),
229  FE(GUID_CustomForce)
230 #undef FE
231  };
232  if (guid == NULL)
233  return "null GUID";
234  for (i = 0; i < ARRAY_SIZE(guids); i++) {
235  if (IsEqualGUID(guids[i].guid, guid)) {
236  return guids[i].name;
237  }
238  }
239  return debugstr_guid(guid);
240 }
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
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
char * name
Definition: compiler.c:66
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define FE(x)
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by _dump_DIDATAFORMAT(), _dump_OBJECTINSTANCEA(), _dump_OBJECTINSTANCEW(), create_DataFormat(), and typeFromGUID().

◆ _dump_DIPROPHEADER()

void _dump_DIPROPHEADER ( LPCDIPROPHEADER  diph)

Definition at line 176 of file device.c.

176  {
177  if (TRACE_ON(dinput)) {
178  TRACE(" - dwObj = 0x%08x\n", diph->dwObj);
179  TRACE(" - dwHow = %s\n",
180  ((diph->dwHow == DIPH_DEVICE) ? "DIPH_DEVICE" :
181  ((diph->dwHow == DIPH_BYOFFSET) ? "DIPH_BYOFFSET" :
182  ((diph->dwHow == DIPH_BYID)) ? "DIPH_BYID" : "unknown")));
183  }
184 }
#define DIPH_BYID
Definition: dinput.h:837
DWORD dwHow
Definition: dinput.h:831
#define DIPH_DEVICE
Definition: dinput.h:835
#define DIPH_BYOFFSET
Definition: dinput.h:836
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwObj
Definition: dinput.h:830
#define TRACE_ON(x)
Definition: compat.h:65

Referenced by IDirectInputDevice2WImpl_GetProperty(), IDirectInputDevice2WImpl_SetProperty(), JoystickWGenericImpl_GetProperty(), JoystickWGenericImpl_SetProperty(), SysKeyboardWImpl_GetProperty(), and SysMouseWImpl_GetProperty().

◆ _dump_EnumObjects_flags()

static void _dump_EnumObjects_flags ( DWORD  dwFlags)
static

Definition at line 127 of file device.c.

127  {
128  if (TRACE_ON(dinput)) {
129  unsigned int i;
131  static const struct {
132  DWORD mask;
133  const char *name;
134  } flags[] = {
135 #define FE(x) { x, #x}
136  FE(DIDFT_RELAXIS),
137  FE(DIDFT_ABSAXIS),
140  FE(DIDFT_POV),
142  FE(DIDFT_NODATA),
145  FE(DIDFT_OUTPUT),
147  FE(DIDFT_ALIAS),
149 #undef FE
150  };
151  type = (dwFlags & 0xFF0000FF);
152  instance = ((dwFlags >> 8) & 0xFFFF);
153  TRACE("Type:");
154  if (type == DIDFT_ALL) {
155  TRACE(" DIDFT_ALL");
156  } else {
157  for (i = 0; i < ARRAY_SIZE(flags); i++) {
158  if (flags[i].mask & type) {
159  type &= ~flags[i].mask;
160  TRACE(" %s",flags[i].name);
161  }
162  }
163  if (type) {
164  TRACE(" (unhandled: %08x)", type);
165  }
166  }
167  TRACE(" / Instance: ");
168  if (instance == ((DIDFT_ANYINSTANCE >> 8) & 0xFFFF)) {
169  TRACE("DIDFT_ANYINSTANCE");
170  } else {
171  TRACE("%3d", instance);
172  }
173  }
174 }
#define DIDFT_TGLBUTTON
Definition: dinput.h:755
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define DIDFT_COLLECTION
Definition: dinput.h:758
#define DIDFT_ABSAXIS
Definition: dinput.h:752
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
GLenum GLint GLuint mask
Definition: glext.h:6028
#define DIDFT_FFEFFECTTRIGGER
Definition: dinput.h:766
#define TRACE(s)
Definition: solgame.cpp:4
#define DIDFT_ANYINSTANCE
Definition: dinput.h:760
#define DIDFT_ALIAS
Definition: dinput.h:769
#define DIDFT_OPTIONAL
Definition: dinput.h:771
#define DIDFT_OUTPUT
Definition: dinput.h:767
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DIDFT_NODATA
Definition: dinput.h:759
GLbitfield flags
Definition: glext.h:7161
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DIDFT_VENDORDEFINED
Definition: dinput.h:768
#define ARRAY_SIZE(a)
Definition: main.h:24
#define DIDFT_POV
Definition: dinput.h:757
static HINSTANCE instance
Definition: main.c:40
Definition: name.c:36
#define DIDFT_ALL
Definition: dinput.h:750
#define DIDFT_FFACTUATOR
Definition: dinput.h:765
#define TRACE_ON(x)
Definition: compat.h:65
#define DIDFT_RELAXIS
Definition: dinput.h:751
#define FE(x)
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by _dump_DIDATAFORMAT(), create_DataFormat(), IDirectInputDevice2AImpl_EnumObjects(), and IDirectInputDevice2WImpl_EnumObjects().

◆ _dump_ObjectDataFormat_flags()

static void _dump_ObjectDataFormat_flags ( DWORD  dwFlags)
static

Definition at line 91 of file device.c.

91  {
92  unsigned int i;
93  static const struct {
94  DWORD mask;
95  const char *name;
96  } flags[] = {
97 #define FE(x) { x, #x}
100  FE(DIDOI_POLLED),
102 #undef FE
103  };
104 
105  if (!dwFlags) return;
106 
107  TRACE("Flags:");
108 
109  /* First the flags */
110  for (i = 0; i < ARRAY_SIZE(flags); i++) {
111  if (flags[i].mask & dwFlags)
112  TRACE(" %s",flags[i].name);
113  }
114 
115  /* Now specific values */
116 #define FE(x) case x: TRACE(" "#x); break
117  switch (dwFlags & DIDOI_ASPECTMASK) {
122  }
123 #undef FE
124 
125 }
#define DIDOI_FFEFFECTTRIGGER
Definition: dinput.h:818
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
GLenum GLint GLuint mask
Definition: glext.h:6028
#define DIDOI_FFACTUATOR
Definition: dinput.h:817
#define DIDOI_ASPECTMASK
Definition: dinput.h:824
#define TRACE(s)
Definition: solgame.cpp:4
#define DIDOI_ASPECTPOSITION
Definition: dinput.h:820
#define DIDOI_ASPECTACCEL
Definition: dinput.h:822
#define DIDOI_POLLED
Definition: dinput.h:819
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DIDOI_ASPECTFORCE
Definition: dinput.h:823
GLbitfield flags
Definition: glext.h:7161
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ARRAY_SIZE(a)
Definition: main.h:24
#define DIDOI_GUIDISUSAGE
Definition: dinput.h:825
Definition: name.c:36
#define DIDOI_ASPECTVELOCITY
Definition: dinput.h:821
#define FE(x)
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by _dump_DIDATAFORMAT(), and create_DataFormat().

◆ _dump_OBJECTINSTANCEA()

void _dump_OBJECTINSTANCEA ( const DIDEVICEOBJECTINSTANCEA ddoi)

Definition at line 186 of file device.c.

186  {
187  TRACE(" - enumerating : %s ('%s') - %2d - 0x%08x - %s - 0x%x\n",
188  debugstr_guid(&ddoi->guidType), _dump_dinput_GUID(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, ddoi->tszName, ddoi->dwFlags);
189 }
const char * _dump_dinput_GUID(const GUID *guid)
Definition: device.c:197
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
CHAR tszName[MAX_PATH]
Definition: dinput.h:352

Referenced by SysKeyboardAImpl_GetObjectInfo().

◆ _dump_OBJECTINSTANCEW()

void _dump_OBJECTINSTANCEW ( const DIDEVICEOBJECTINSTANCEW ddoi)

Definition at line 191 of file device.c.

191  {
192  TRACE(" - enumerating : %s ('%s'), - %2d - 0x%08x - %s - 0x%x\n",
193  debugstr_guid(&ddoi->guidType), _dump_dinput_GUID(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, debugstr_w(ddoi->tszName), ddoi->dwFlags);
194 }
const char * _dump_dinput_GUID(const GUID *guid)
Definition: device.c:197
WCHAR tszName[MAX_PATH]
Definition: dinput.h:371
#define debugstr_w
Definition: kernel32.h:32
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by JoystickWGenericImpl_GetObjectInfo(), SysKeyboardWImpl_GetObjectInfo(), and SysMouseWImpl_GetObjectInfo().

◆ _set_action_map()

HRESULT _set_action_map ( LPDIRECTINPUTDEVICE8W  iface,
LPDIACTIONFORMATW  lpdiaf,
LPCWSTR  lpszUserName,
DWORD  dwFlags,
LPCDIDATAFORMAT  df 
)

Definition at line 866 of file device.c.

867 {
870  DIOBJECTDATAFORMAT *obj_df = NULL;
871  DIPROPDWORD dp;
872  DIPROPRANGE dpr;
873  DIPROPSTRING dps;
875  DWORD username_size = MAX_PATH;
876  DWORD new_crc = 0;
877  int i, action = 0, num_actions = 0;
878  unsigned int offset = 0;
879 
880  if (This->acquired) return DIERR_ACQUIRED;
881 
882  data_format.dwSize = sizeof(data_format);
886 
887  /* Calculate checksum for actionformat */
888  for (i=0; i < lpdiaf->dwNumActions; i++)
889  {
890  new_crc ^= (lpdiaf->rgoAction[i].dwObjID << i * 2) | (lpdiaf->rgoAction[i].dwObjID >> (sizeof(lpdiaf->dwCRC) * 8 - i * 2));
891  new_crc ^= (lpdiaf->rgoAction[i].dwSemantic << (i * 2 + 5)) | (lpdiaf->rgoAction[i].dwSemantic >> (sizeof(lpdiaf->dwCRC) * 8 - (i * 2 + 5)));
892  }
893 
894  /* Count the actions */
895  for (i=0; i < lpdiaf->dwNumActions; i++)
896  {
897  if (IsEqualGUID(&This->guid, &lpdiaf->rgoAction[i].guidInstance) ||
898  (IsEqualGUID(&IID_NULL, &lpdiaf->rgoAction[i].guidInstance) &&
899  ((lpdiaf->rgoAction[i].dwSemantic & lpdiaf->dwGenre) == lpdiaf->dwGenre ||
900  (lpdiaf->rgoAction[i].dwSemantic & 0xff000000) == 0xff000000 /* Any Axis */) ))
901  {
902  num_actions++;
903  }
904  }
905 
906  /* Should return DI_NOEFFECT if we dont have any actions and actionformat has not changed */
907  if (num_actions == 0 && lpdiaf->dwCRC == new_crc && !(dwFlags & DIDSAM_FORCESAVE)) return DI_NOEFFECT;
908 
909  /* update dwCRC to track if action format has changed */
910  lpdiaf->dwCRC = new_crc;
911 
912  This->num_actions = num_actions;
913 
914  /* Construct the dataformat and actionmap */
915  obj_df = HeapAlloc(GetProcessHeap(), 0, sizeof(DIOBJECTDATAFORMAT)*num_actions);
917  data_format.dwNumObjs = num_actions;
918 
919  HeapFree(GetProcessHeap(), 0, This->action_map);
920  This->action_map = HeapAlloc(GetProcessHeap(), 0, sizeof(ActionMap)*num_actions);
921 
922  for (i = 0; i < lpdiaf->dwNumActions; i++)
923  {
924  if (IsEqualGUID(&This->guid, &lpdiaf->rgoAction[i].guidInstance))
925  {
926  DWORD inst = DIDFT_GETINSTANCE(lpdiaf->rgoAction[i].dwObjID);
929 
931  if (type == DIDFT_RELAXIS) type = DIDFT_AXIS;
932 
933  obj = dataformat_to_odf_by_type(df, inst, type);
934 
935  memcpy(&obj_df[action], obj, df->dwObjSize);
936 
937  This->action_map[action].uAppData = lpdiaf->rgoAction[i].uAppData;
938  This->action_map[action].offset = offset;
939  obj_df[action].dwOfs = offset;
940  offset += (type & DIDFT_BUTTON) ? 1 : 4;
941 
942  action++;
943  }
944  else if ((lpdiaf->rgoAction[i].dwSemantic & lpdiaf->dwGenre) == lpdiaf->dwGenre ||
945  (lpdiaf->rgoAction[i].dwSemantic & 0xff000000) == 0xff000000 /* Any Axis */)
946  {
947  DWORD obj_id = semantic_to_obj_id(This, lpdiaf->rgoAction[i].dwSemantic);
948  DWORD type = DIDFT_GETTYPE(obj_id);
949  DWORD inst = DIDFT_GETINSTANCE(obj_id);
951 
953  else if (type == DIDFT_RELAXIS) type = DIDFT_AXIS;
954 
955  obj = dataformat_to_odf_by_type(df, inst, type);
956  TRACE("obj %p, inst 0x%08x, type 0x%08x\n", obj, inst, type);
957  if(obj)
958  {
959  memcpy(&obj_df[action], obj, df->dwObjSize);
960 
961  This->action_map[action].uAppData = lpdiaf->rgoAction[i].uAppData;
962  This->action_map[action].offset = offset;
963  obj_df[action].dwOfs = offset;
964  offset += (type & DIDFT_BUTTON) ? 1 : 4;
965 
966  action++;
967  }
968  }
969  }
970 
971  if (action == 0)
972  {
973  HeapFree(GetProcessHeap(), 0, obj_df);
974  return DI_NOEFFECT;
975  }
977 
979 
980  HeapFree(GetProcessHeap(), 0, obj_df);
981 
982  /* Set the device properties according to the action format */
983  dpr.diph.dwSize = sizeof(DIPROPRANGE);
984  dpr.lMin = lpdiaf->lAxisMin;
985  dpr.lMax = lpdiaf->lAxisMax;
986  dpr.diph.dwHeaderSize = sizeof(DIPROPHEADER);
987  dpr.diph.dwHow = DIPH_DEVICE;
989 
990  if (lpdiaf->dwBufferSize > 0)
991  {
992  dp.diph.dwSize = sizeof(DIPROPDWORD);
993  dp.dwData = lpdiaf->dwBufferSize;
994  dp.diph.dwHeaderSize = sizeof(DIPROPHEADER);
995  dp.diph.dwHow = DIPH_DEVICE;
997  }
998 
999  /* Retrieve logged user name if necessary */
1000  if (lpszUserName == NULL)
1001  GetUserNameW(username, &username_size);
1002  else
1003  lstrcpynW(username, lpszUserName, MAX_PATH);
1004 
1005  dps.diph.dwSize = sizeof(dps);
1006  dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
1007  dps.diph.dwObj = 0;
1008  dps.diph.dwHow = DIPH_DEVICE;
1009  if (dwFlags & DIDSAM_NOUSER)
1010  dps.wsz[0] = '\0';
1011  else
1012  lstrcpynW(dps.wsz, username, ARRAY_SIZE(dps.wsz));
1014 
1015  /* Save the settings to disk */
1016  save_mapping_settings(iface, lpdiaf, username);
1017 
1018  return DI_OK;
1019 }
LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD type)
Definition: device.c:412
DWORD dwSize
Definition: dinput.h:828
DWORD dwObjID
Definition: dinput.h:1284
DWORD dwSize
Definition: dinput.h:808
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
DWORD dwNumObjs
Definition: dinput.h:812
GLintptr offset
Definition: glext.h:5920
DWORD dwObjSize
Definition: dinput.h:809
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GUID guidInstance
Definition: dinput.h:1283
#define DIPROP_RANGE
Definition: dinput.h:892
DWORD dwHow
Definition: dinput.h:831
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
#define DIPH_DEVICE
Definition: dinput.h:835
#define lstrcpynW
Definition: compat.h:397
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
struct _DIOBJECTDATAFORMAT * LPDIOBJECTDATAFORMAT
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DIPROPHEADER diph
Definition: dinput.h:843
struct DIPROPRANGE DIPROPRANGE
#define DIDFT_BUTTON
Definition: dinput.h:756
#define DIDF_RELAXIS
Definition: dinput.h:776
smooth NULL
Definition: ftsmooth.c:416
#define DIDSAM_NOUSER
Definition: dinput.h:1358
static const DIDATAFORMAT data_format
Definition: device.c:49
static WCHAR username[]
Definition: url.c:32
#define DIPROP_BUFFERSIZE
Definition: dinput.h:885
DWORD dwDataSize
Definition: dinput.h:1328
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define TRACE(s)
Definition: solgame.cpp:4
DIPROPHEADER diph
Definition: dinput.h:849
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define DIERR_ACQUIRED
Definition: dinput.h:165
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR wsz[MAX_PATH]
Definition: dinput.h:875
HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUsername)
Definition: device.c:695
DWORD dwFlags
Definition: dinput.h:810
struct _DIOBJECTDATAFORMAT DIOBJECTDATAFORMAT
#define IID_NULL
Definition: guiddef.h:98
#define DIDFT_AXIS
Definition: dinput.h:753
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
DWORD dwData
Definition: dinput.h:844
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define DI_NOEFFECT
Definition: dinput.h:132
LPDIOBJECTDATAFORMAT rgodf
Definition: dinput.h:813
LPDIACTIONW rgoAction
Definition: dinput.h:1330
DWORD dwBufferSize
Definition: dinput.h:1333
struct DIPROPHEADER DIPROPHEADER
const WCHAR * action
Definition: action.c:7783
DWORD dwDataSize
Definition: dinput.h:811
#define ARRAY_SIZE(a)
Definition: main.h:24
DWORD dwObj
Definition: dinput.h:830
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define IDirectInputDevice8_SetDataFormat(p, a)
Definition: dinput.h:2046
UINT_PTR uAppData
Definition: dinput.h:1276
#define DIPROP_USERNAME
Definition: dinput.h:919
LONG lMin
Definition: dinput.h:850
#define DI_OK
Definition: dinput.h:128
DWORD dwHeaderSize
Definition: dinput.h:829
static DWORD semantic_to_obj_id(IDirectInputDeviceImpl *This, DWORD dwSemantic)
Definition: device.c:619
LONG lMax
Definition: dinput.h:851
DWORD dwNumActions
Definition: dinput.h:1329
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
struct DIPROPDWORD DIPROPDWORD
DIPROPHEADER diph
Definition: dinput.h:874
#define HeapFree(x, y, z)
Definition: compat.h:394
#define DIDSAM_FORCESAVE
Definition: dinput.h:1359
#define IDirectInputDevice8_SetProperty(p, a, b)
Definition: dinput.h:2041
#define DIDFT_RELAXIS
Definition: dinput.h:751
DWORD dwSemantic
Definition: dinput.h:1277

Referenced by JoystickWGenericImpl_SetActionMap(), SysKeyboardWImpl_SetActionMap(), and SysMouseWImpl_SetActionMap().

◆ create_DataFormat()

static HRESULT create_DataFormat ( LPCDIDATAFORMAT  asked_format,
DataFormat format 
)
static

Definition at line 432 of file device.c.

433 {
434  DataTransform *dt;
435  unsigned int i, j;
436  int same = 1;
437  int *done;
438  int index = 0;
439  DWORD next = 0;
440 
441  if (!format->wine_df) return DIERR_INVALIDPARAM;
442  done = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, asked_format->dwNumObjs * sizeof(int));
443  dt = HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform));
444  if (!dt || !done) goto failed;
445 
446  if (!(format->offsets = HeapAlloc(GetProcessHeap(), 0, format->wine_df->dwNumObjs * sizeof(int))))
447  goto failed;
448 
449  if (!(format->user_df = HeapAlloc(GetProcessHeap(), 0, asked_format->dwSize)))
450  goto failed;
451  memcpy(format->user_df, asked_format, asked_format->dwSize);
452 
453  TRACE("Creating DataTransform :\n");
454 
455  for (i = 0; i < format->wine_df->dwNumObjs; i++)
456  {
457  format->offsets[i] = -1;
458 
459  for (j = 0; j < asked_format->dwNumObjs; j++) {
460  if (done[j] == 1)
461  continue;
462 
463  if (/* Check if the application either requests any GUID and if not, it if matches
464  * the GUID of the Wine object.
465  */
466  ((asked_format->rgodf[j].pguid == NULL) ||
467  (format->wine_df->rgodf[i].pguid == NULL) ||
468  (IsEqualGUID(format->wine_df->rgodf[i].pguid, asked_format->rgodf[j].pguid)))
469  &&
470  (/* Then check if it accepts any instance id, and if not, if it matches Wine's
471  * instance id.
472  */
473  ((asked_format->rgodf[j].dwType & DIDFT_INSTANCEMASK) == DIDFT_ANYINSTANCE) ||
474  (DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == 0x00FF) || /* This is mentioned in no DX docs, but it works fine - tested on WinXP */
475  (DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == DIDFT_GETINSTANCE(format->wine_df->rgodf[i].dwType)))
476  &&
477  ( /* Then if the asked type matches the one Wine provides */
478  DIDFT_GETTYPE(asked_format->rgodf[j].dwType) & format->wine_df->rgodf[i].dwType))
479  {
480  done[j] = 1;
481 
482  TRACE("Matching :\n");
483  TRACE(" - Asked (%d) :\n", j);
484  TRACE(" * GUID: %s ('%s')\n",
485  debugstr_guid(asked_format->rgodf[j].pguid),
486  _dump_dinput_GUID(asked_format->rgodf[j].pguid));
487  TRACE(" * Offset: %3d\n", asked_format->rgodf[j].dwOfs);
488  TRACE(" * dwType: 0x%08x\n", asked_format->rgodf[j].dwType);
489  TRACE(" "); _dump_EnumObjects_flags(asked_format->rgodf[j].dwType); TRACE("\n");
490  TRACE(" * dwFlags: 0x%08x\n", asked_format->rgodf[j].dwFlags);
491  TRACE(" "); _dump_ObjectDataFormat_flags(asked_format->rgodf[j].dwFlags); TRACE("\n");
492 
493  TRACE(" - Wine (%d) :\n", i);
494  TRACE(" * GUID: %s ('%s')\n",
495  debugstr_guid(format->wine_df->rgodf[i].pguid),
496  _dump_dinput_GUID(format->wine_df->rgodf[i].pguid));
497  TRACE(" * Offset: %3d\n", format->wine_df->rgodf[i].dwOfs);
498  TRACE(" * dwType: 0x%08x\n", format->wine_df->rgodf[i].dwType);
499  TRACE(" "); _dump_EnumObjects_flags(format->wine_df->rgodf[i].dwType); TRACE("\n");
500  TRACE(" * dwFlags: 0x%08x\n", format->wine_df->rgodf[i].dwFlags);
501  TRACE(" "); _dump_ObjectDataFormat_flags(format->wine_df->rgodf[i].dwFlags); TRACE("\n");
502 
503  if (format->wine_df->rgodf[i].dwType & DIDFT_BUTTON)
504  dt[index].size = sizeof(BYTE);
505  else
506  dt[index].size = sizeof(DWORD);
507  dt[index].offset_in = format->wine_df->rgodf[i].dwOfs;
508  dt[index].offset_out = asked_format->rgodf[j].dwOfs;
509  format->offsets[i] = asked_format->rgodf[j].dwOfs;
510  dt[index].value = 0;
511  next = next + dt[index].size;
512 
513  if (format->wine_df->rgodf[i].dwOfs != dt[index].offset_out)
514  same = 0;
515 
516  index++;
517  break;
518  }
519  }
520  }
521 
522  TRACE("Setting to default value :\n");
523  for (j = 0; j < asked_format->dwNumObjs; j++) {
524  if (done[j] == 0) {
525  TRACE(" - Asked (%d) :\n", j);
526  TRACE(" * GUID: %s ('%s')\n",
527  debugstr_guid(asked_format->rgodf[j].pguid),
528  _dump_dinput_GUID(asked_format->rgodf[j].pguid));
529  TRACE(" * Offset: %3d\n", asked_format->rgodf[j].dwOfs);
530  TRACE(" * dwType: 0x%08x\n", asked_format->rgodf[j].dwType);
531  TRACE(" "); _dump_EnumObjects_flags(asked_format->rgodf[j].dwType); TRACE("\n");
532  TRACE(" * dwFlags: 0x%08x\n", asked_format->rgodf[j].dwFlags);
533  TRACE(" "); _dump_ObjectDataFormat_flags(asked_format->rgodf[j].dwFlags); TRACE("\n");
534 
535  if (asked_format->rgodf[j].dwType & DIDFT_BUTTON)
536  dt[index].size = sizeof(BYTE);
537  else
538  dt[index].size = sizeof(DWORD);
539  dt[index].offset_in = -1;
540  dt[index].offset_out = asked_format->rgodf[j].dwOfs;
541  if (asked_format->rgodf[j].dwType & DIDFT_POV)
542  dt[index].value = -1;
543  else
544  dt[index].value = 0;
545  index++;
546 
547  same = 0;
548  }
549  }
550 
551  format->internal_format_size = format->wine_df->dwDataSize;
552  format->size = index;
553  if (same) {
554  HeapFree(GetProcessHeap(), 0, dt);
555  dt = NULL;
556  }
557  format->dt = dt;
558 
559  HeapFree(GetProcessHeap(), 0, done);
560 
561  return DI_OK;
562 
563 failed:
564  HeapFree(GetProcessHeap(), 0, done);
565  HeapFree(GetProcessHeap(), 0, dt);
566  format->dt = NULL;
567  HeapFree(GetProcessHeap(), 0, format->offsets);
568  format->offsets = NULL;
569  HeapFree(GetProcessHeap(), 0, format->user_df);
570  format->user_df = NULL;
571 
572  return DIERR_OUTOFMEMORY;
573 }
DWORD dwSize
Definition: dinput.h:808
const char * _dump_dinput_GUID(const GUID *guid)
Definition: device.c:197
#define DIDFT_INSTANCEMASK
Definition: dinput.h:761
DWORD dwNumObjs
Definition: dinput.h:812
static void _dump_EnumObjects_flags(DWORD dwFlags)
Definition: device.c:127
#define DWORD
Definition: nt_native.h:44
static void _dump_ObjectDataFormat_flags(DWORD dwFlags)
Definition: device.c:91
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
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 DIDFT_BUTTON
Definition: dinput.h:756
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define debugstr_guid
Definition: kernel32.h:35
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
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
#define TRACE(s)
Definition: solgame.cpp:4
#define DIDFT_ANYINSTANCE
Definition: dinput.h:760
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define DIERR_OUTOFMEMORY
Definition: dinput.h:155
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
LPDIOBJECTDATAFORMAT rgodf
Definition: dinput.h:813
static unsigned __int64 next
Definition: rand_nt.c:6
const GUID * pguid
Definition: dinput.h:800
#define DIDFT_POV
Definition: dinput.h:757
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define DI_OK
Definition: dinput.h:128
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by IDirectInputDevice2WImpl_SetDataFormat().

◆ dataformat_to_odf()

static LPDIOBJECTDATAFORMAT dataformat_to_odf ( LPCDIDATAFORMAT  df,
int  idx 
)
inlinestatic

Definition at line 403 of file device.c.

404 {
405  if (idx < 0 || idx >= df->dwNumObjs) return NULL;
406  return (LPDIOBJECTDATAFORMAT)((LPBYTE)df->rgodf + idx * df->dwObjSize);
407 }
DWORD dwNumObjs
Definition: dinput.h:812
DWORD dwObjSize
Definition: dinput.h:809
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
LPDIOBJECTDATAFORMAT rgodf
Definition: dinput.h:813

Referenced by dataformat_to_odf_by_type(), id_to_object(), IDirectInputDevice2AImpl_EnumObjects(), IDirectInputDevice2WImpl_EnumObjects(), IDirectInputDevice2WImpl_GetObjectInfo(), and semantic_to_obj_id().

◆ dataformat_to_odf_by_type()

LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type ( LPCDIDATAFORMAT  df,
int  n,
DWORD  type 
)

Definition at line 412 of file device.c.

413 {
414  int i, nfound = 0;
415 
416  for (i=0; i < df->dwNumObjs; i++)
417  {
419 
420  if (odf->dwType & type)
421  {
422  if (n == nfound)
423  return odf;
424 
425  nfound++;
426  }
427  }
428 
429  return NULL;
430 }
DWORD dwNumObjs
Definition: dinput.h:812
GLdouble n
Definition: glext.h:7729
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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
static LPDIOBJECTDATAFORMAT dataformat_to_odf(LPCDIDATAFORMAT df, int idx)
Definition: device.c:403
smooth NULL
Definition: ftsmooth.c:416

Referenced by _build_action_map(), _set_action_map(), and JoystickWGenericImpl_BuildActionMap().

◆ del_mapping_key()

static void del_mapping_key ( const WCHAR device,
const WCHAR username,
const WCHAR guid 
)
static

Definition at line 647 of file device.c.

647  {
648  static const WCHAR subkey[] = {
649  'S','o','f','t','w','a','r','e','\\',
650  'W','i','n','e','\\',
651  'D','i','r','e','c','t','I','n','p','u','t','\\',
652  'M','a','p','p','i','n','g','s','\\','%','s','\\','%','s','\\','%','s','\0'};
653  WCHAR *keyname;
654 
655  keyname = heap_alloc(sizeof(WCHAR) * (lstrlenW(subkey) + strlenW(username) + strlenW(device) + strlenW(guid)));
656  sprintfW(keyname, subkey, username, device, guid);
657 
658  /* Remove old key mappings so there will be no overlapping mappings */
660 
661  heap_free(keyname);
662 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
#define lstrlenW
Definition: compat.h:407
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const GUID * guid
Definition: devices.h:37
static WCHAR username[]
Definition: url.c:32
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define sprintfW
Definition: unicode.h:58
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by save_mapping_settings().

◆ fill_DataFormat()

void fill_DataFormat ( void out,
DWORD  size,
const void in,
const DataFormat df 
)

Definition at line 326 of file device.c.

327 {
328  int i;
329  const char *in_c = in;
330  char *out_c = out;
331 
332  memset(out, 0, size);
333  if (df->dt == NULL) {
334  /* This means that the app uses Wine's internal data format */
336  } else {
337  for (i = 0; i < df->size; i++) {
338  if (df->dt[i].offset_in >= 0) {
339  switch (df->dt[i].size) {
340  case 1:
341  TRACE("Copying (c) to %d from %d (value %d)\n",
342  df->dt[i].offset_out, df->dt[i].offset_in, *(in_c + df->dt[i].offset_in));
343  *(out_c + df->dt[i].offset_out) = *(in_c + df->dt[i].offset_in);
344  break;
345 
346  case 2:
347  TRACE("Copying (s) to %d from %d (value %d)\n",
348  df->dt[i].offset_out, df->dt[i].offset_in, *((const short *)(in_c + df->dt[i].offset_in)));
349  *((short *)(out_c + df->dt[i].offset_out)) = *((const short *)(in_c + df->dt[i].offset_in));
350  break;
351 
352  case 4:
353  TRACE("Copying (i) to %d from %d (value %d)\n",
354  df->dt[i].offset_out, df->dt[i].offset_in, *((const int *)(in_c + df->dt[i].offset_in)));
355  *((int *)(out_c + df->dt[i].offset_out)) = *((const int *)(in_c + df->dt[i].offset_in));
356  break;
357 
358  default:
359  memcpy((out_c + df->dt[i].offset_out), (in_c + df->dt[i].offset_in), df->dt[i].size);
360  break;
361  }
362  } else {
363  switch (df->dt[i].size) {
364  case 1:
365  TRACE("Copying (c) to %d default value %d\n",
366  df->dt[i].offset_out, df->dt[i].value);
367  *(out_c + df->dt[i].offset_out) = (char) df->dt[i].value;
368  break;
369 
370  case 2:
371  TRACE("Copying (s) to %d default value %d\n",
372  df->dt[i].offset_out, df->dt[i].value);
373  *((short *) (out_c + df->dt[i].offset_out)) = (short) df->dt[i].value;
374  break;
375 
376  case 4:
377  TRACE("Copying (i) to %d default value %d\n",
378  df->dt[i].offset_out, df->dt[i].value);
379  *((int *) (out_c + df->dt[i].offset_out)) = df->dt[i].value;
380  break;
381 
382  default:
383  memset((out_c + df->dt[i].offset_out), 0, df->dt[i].size);
384  break;
385  }
386  }
387  }
388  }
389 }
int internal_format_size
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static FILE * out
Definition: regtests2xml.c:44
DataTransform * dt
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLuint in
Definition: glext.h:9616
#define min(a, b)
Definition: monoChain.cc:55
#define memset(x, y, z)
Definition: compat.h:39

Referenced by JoystickWGenericImpl_GetDeviceState(), SysKeyboardWImpl_GetDeviceState(), and SysMouseWImpl_GetDeviceState().

◆ find_property()

int find_property ( const DataFormat df,
LPCDIPROPHEADER  ph 
)

Definition at line 607 of file device.c.

608 {
609  switch (ph->dwHow)
610  {
611  case DIPH_BYID: return id_to_object(df->wine_df, ph->dwObj);
612  case DIPH_BYOFFSET: return offset_to_object(df, ph->dwObj);
613  }
614  FIXME("Unhandled ph->dwHow=='%04X'\n", (unsigned int)ph->dwHow);
615 
616  return -1;
617 }
#define DIPH_BYID
Definition: dinput.h:837
DWORD dwHow
Definition: dinput.h:831
LPDIDATAFORMAT wine_df
#define DIPH_BYOFFSET
Definition: dinput.h:836
#define FIXME(fmt,...)
Definition: debug.h:110
static int offset_to_object(const DataFormat *df, int offset)
Definition: device.c:576
DWORD dwObj
Definition: dinput.h:830
int id_to_object(LPCDIDATAFORMAT df, int id)
Definition: device.c:588

Referenced by JoystickWGenericImpl_GetProperty(), and JoystickWGenericImpl_SetProperty().

◆ get_app_key()

BOOL get_app_key ( HKEY defkey,
HKEY appkey 
)

Definition at line 278 of file device.c.

279 {
280  char buffer[MAX_PATH+16];
281  DWORD len;
282 
283  *appkey = 0;
284 
285  /* @@ Wine registry key: HKCU\Software\Wine\DirectInput */
286  if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\DirectInput", defkey))
287  *defkey = 0;
288 
290  if (len && len < MAX_PATH)
291  {
292  HKEY tmpkey;
293 
294  /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectInput */
295  if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey))
296  {
297  char *p, *appname = buffer;
298  if ((p = strrchr(appname, '/'))) appname = p + 1;
299  if ((p = strrchr(appname, '\\'))) appname = p + 1;
300  strcat(appname, "\\DirectInput");
301 
302  if (RegOpenKeyA(tmpkey, appname, appkey)) *appkey = 0;
303  RegCloseKey(tmpkey);
304  }
305  }
306 
307  return *defkey || *appkey;
308 }
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define HKEY_CURRENT_USER
Definition: winreg.h:11
GLuint buffer
Definition: glext.h:5915
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:548
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by alloc_device(), device_disabled_registry(), and setup_dinput_options().

◆ get_config_key()

DWORD get_config_key ( HKEY  defkey,
HKEY  appkey,
const char name,
char buffer,
DWORD  size 
)

Definition at line 313 of file device.c.

315 {
316  if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)buffer, &size ))
317  return 0;
318 
319  if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE)buffer, &size ))
320  return 0;
321 
322  return ERROR_FILE_NOT_FOUND;
323 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
GLuint buffer
Definition: glext.h:5915
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
GLsizeiptr size
Definition: glext.h:5919
Definition: name.c:36

Referenced by alloc_device(), device_disabled_registry(), and setup_dinput_options().

◆ get_mapping_key()

static HKEY get_mapping_key ( const WCHAR device,
const WCHAR username,
const WCHAR guid,
BOOL  create 
)
static

Definition at line 669 of file device.c.

670 {
671  static const WCHAR subkey[] = {
672  'S','o','f','t','w','a','r','e','\\',
673  'W','i','n','e','\\',
674  'D','i','r','e','c','t','I','n','p','u','t','\\',
675  'M','a','p','p','i','n','g','s','\\','%','s','\\','%','s','\\','%','s','\0'};
676  HKEY hkey;
677  WCHAR *keyname;
678 
679  keyname = HeapAlloc(GetProcessHeap(), 0,
680  sizeof(WCHAR) * (lstrlenW(subkey) + strlenW(username) + strlenW(device) + strlenW(guid)));
681  sprintfW(keyname, subkey, username, device, guid);
682 
683  /* The key used is HKCU\Software\Wine\DirectInput\Mappings\[username]\[device]\[mapping_guid] */
684  if (create) {
685  if (RegCreateKeyW(HKEY_CURRENT_USER, keyname, &hkey))
686  hkey = 0;
687  } else if (RegOpenKeyW(HKEY_CURRENT_USER, keyname, &hkey))
688  hkey = 0;
689 
690  HeapFree(GetProcessHeap(), 0, keyname);
691 
692  return hkey;
693 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define lstrlenW
Definition: compat.h:407
const GUID * guid
Definition: devices.h:37
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
static WCHAR username[]
Definition: url.c:32
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define sprintfW
Definition: unicode.h:58
static const struct access_res create[16]
Definition: package.c:7720
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by load_mapping_settings(), and save_mapping_settings().

◆ id_to_object()

int id_to_object ( LPCDIDATAFORMAT  df,
int  id 
)

Definition at line 588 of file device.c.

589 {
590  int i;
591 
592  id &= 0x00ffffff;
593  for (i = 0; i < df->dwNumObjs; i++)
594  if ((dataformat_to_odf(df, i)->dwType & 0x00ffffff) == id)
595  return i;
596 
597  return -1;
598 }
DWORD dwNumObjs
Definition: dinput.h:812
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
static LPDIOBJECTDATAFORMAT dataformat_to_odf(LPCDIDATAFORMAT df, int idx)
Definition: device.c:403

Referenced by find_property(), and id_to_offset().

◆ id_to_offset()

static int id_to_offset ( const DataFormat df,
int  id 
)
static

Definition at line 600 of file device.c.

601 {
602  int obj = id_to_object(df->wine_df, id);
603 
604  return obj >= 0 && df->offsets ? df->offsets[obj] : -1;
605 }
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
LPDIDATAFORMAT wine_df
int id_to_object(LPCDIDATAFORMAT df, int id)
Definition: device.c:588

Referenced by queue_event().

◆ IDirectInputDevice2AImpl_Acquire()

HRESULT WINAPI IDirectInputDevice2AImpl_Acquire ( LPDIRECTINPUTDEVICE8A  iface)

Definition at line 1097 of file device.c.

1098 {
1101 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1076
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47

◆ IDirectInputDevice2AImpl_AddRef()

ULONG WINAPI IDirectInputDevice2AImpl_AddRef ( LPDIRECTINPUTDEVICE8A  iface)

Definition at line 1316 of file device.c.

1317 {
1320 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1308
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47

◆ IDirectInputDevice2AImpl_CreateEffect()

HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect ( LPDIRECTINPUTDEVICE8A  iface,
REFGUID  rguid,
LPCDIEFFECT  lpeff,
LPDIRECTINPUTEFFECT ppdef,
LPUNKNOWN  pUnkOuter 
)

Definition at line 1736 of file device.c.

1738 {
1740  return IDirectInputDevice2WImpl_CreateEffect(IDirectInputDevice8W_from_impl(This), rguid, lpeff, ppdef, pUnkOuter);
1741 }
HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter)
Definition: device.c:1725
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47

◆ IDirectInputDevice2AImpl_EnumCreatedEffectObjects()

HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects ( LPDIRECTINPUTDEVICE8A  iface,
LPDIENUMCREATEDEFFECTOBJECTSCALLBACK  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1821 of file device.c.

1823 {
1826 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
Definition: device.c:1813

◆ IDirectInputDevice2AImpl_EnumEffects()

HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects ( LPDIRECTINPUTDEVICE8A  iface,
LPDIENUMEFFECTSCALLBACKA  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1743 of file device.c.

1748 {
1750  FIXME("%p)->(%p,%p,0x%08x): stub!\n", This, lpCallback, lpvRef, dwFlags);
1751 
1752  return DI_OK;
1753 }
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
#define FIXME(fmt,...)
Definition: debug.h:110
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI_OK
Definition: dinput.h:128

◆ IDirectInputDevice2AImpl_EnumObjects()

HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects ( LPDIRECTINPUTDEVICE8A  iface,
LPDIENUMDEVICEOBJECTSCALLBACKA  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1322 of file device.c.

1324 {
1327  int i;
1328 
1329  TRACE("(%p)->(%p,%p flags:%08x)\n", This, lpCallback, lpvRef, dwFlags);
1330  TRACE(" - flags = ");
1332  TRACE("\n");
1333 
1334  /* Only the fields till dwFFMaxForce are relevant */
1335  memset(&ddoi, 0, sizeof(ddoi));
1336  ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
1337 
1338  for (i = 0; i < This->data_format.wine_df->dwNumObjs; i++)
1339  {
1340  LPDIOBJECTDATAFORMAT odf = dataformat_to_odf(This->data_format.wine_df, i);
1341 
1342  if (dwFlags != DIDFT_ALL && !(dwFlags & DIDFT_GETTYPE(odf->dwType))) continue;
1343  if (IDirectInputDevice_GetObjectInfo(iface, &ddoi, odf->dwType, DIPH_BYID) != DI_OK)
1344  continue;
1345 
1346  if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) break;
1347  }
1348 
1349  return DI_OK;
1350 }
#define DIPH_BYID
Definition: dinput.h:837
static void _dump_EnumObjects_flags(DWORD dwFlags)
Definition: device.c:127
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
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
static LPDIOBJECTDATAFORMAT dataformat_to_odf(LPCDIDATAFORMAT df, int idx)
Definition: device.c:403
#define IDirectInputDevice_GetObjectInfo(p, a, b, c)
Definition: dinput.h:1615
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define DI_OK
Definition: dinput.h:128
#define DIENUM_CONTINUE
Definition: dinput.h:188
#define DIDFT_ALL
Definition: dinput.h:750
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define memset(x, y, z)
Definition: compat.h:39

◆ IDirectInputDevice2AImpl_Escape()

HRESULT WINAPI IDirectInputDevice2AImpl_Escape ( LPDIRECTINPUTDEVICE8A  iface,
LPDIEFFESCAPE  lpDIEEsc 
)

Definition at line 1835 of file device.c.

1836 {
1839 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
HRESULT WINAPI IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc)
Definition: device.c:1828

◆ IDirectInputDevice2AImpl_GetDeviceData()

HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData ( LPDIRECTINPUTDEVICE8A  iface,
DWORD  dodsize,
LPDIDEVICEOBJECTDATA  dod,
LPDWORD  entries,
DWORD  flags 
)

Definition at line 1685 of file device.c.

1687 {
1690 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags)
Definition: device.c:1629
GLbitfield flags
Definition: glext.h:7161

◆ IDirectInputDevice2AImpl_GetEffectInfo()

HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo ( LPDIRECTINPUTDEVICE8A  iface,
LPDIEFFECTINFOA  lpdei,
REFGUID  rguid 
)

Definition at line 1767 of file device.c.

1771 {
1773  FIXME("(%p)->(%p,%s): stub!\n", This, lpdei, debugstr_guid(rguid));
1774  return DI_OK;
1775 }
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
#define DI_OK
Definition: dinput.h:128

◆ IDirectInputDevice2AImpl_GetForceFeedbackState()

HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState ( LPDIRECTINPUTDEVICE8A  iface,
LPDWORD  pdwOut 
)

Definition at line 1794 of file device.c.

1795 {
1798 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
_Out_ PDWORD pdwOut
Definition: ntgdi.h:1813
HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut)
Definition: device.c:1787

◆ IDirectInputDevice2AImpl_GetObjectInfo()

HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo ( LPDIRECTINPUTDEVICE8A  iface,
LPDIDEVICEOBJECTINSTANCEA  pdidoi,
DWORD  dwObj,
DWORD  dwHow 
)

Definition at line 1544 of file device.c.

1549 {
1551  DIDEVICEOBJECTINSTANCEW didoiW;
1552  HRESULT res;
1553 
1554  if (!pdidoi ||
1555  (pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEA) &&
1556  pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3A)))
1557  return DIERR_INVALIDPARAM;
1558 
1559  didoiW.dwSize = sizeof(didoiW);
1561  if (res == DI_OK)
1562  {
1563  DWORD dwSize = pdidoi->dwSize;
1564 
1565  memset(pdidoi, 0, pdidoi->dwSize);
1566  pdidoi->dwSize = dwSize;
1567  pdidoi->guidType = didoiW.guidType;
1568  pdidoi->dwOfs = didoiW.dwOfs;
1569  pdidoi->dwType = didoiW.dwType;
1570  pdidoi->dwFlags = didoiW.dwFlags;
1571  }
1572 
1573  return res;
1574 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
Definition: device.c:1576
GLuint res
Definition: glext.h:9613
#define DI_OK
Definition: dinput.h:128
#define memset(x, y, z)
Definition: compat.h:39
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by SysKeyboardAImpl_GetObjectInfo().

◆ IDirectInputDevice2AImpl_GetProperty()

HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty ( LPDIRECTINPUTDEVICE8A  iface,
REFGUID  rguid,
LPDIPROPHEADER  pdiph 
)

Definition at line 1440 of file device.c.

1441 {
1444 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
Definition: device.c:1386
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47

Referenced by SysKeyboardWImpl_GetProperty().

◆ IDirectInputDevice2AImpl_Initialize()

HRESULT WINAPI IDirectInputDevice2AImpl_Initialize ( LPDIRECTINPUTDEVICE8A  iface,
HINSTANCE  hinst,
DWORD  dwVersion,
REFGUID  rguid 
)

Definition at line 1714 of file device.c.

1716 {
1719 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid)
Definition: device.c:1706
static HINSTANCE hinst
Definition: edit.c:551

◆ IDirectInputDevice2AImpl_Poll()

HRESULT WINAPI IDirectInputDevice2AImpl_Poll ( LPDIRECTINPUTDEVICE8A  iface)

Definition at line 1851 of file device.c.

1852 {
1855 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
HRESULT WINAPI IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1841
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47

◆ IDirectInputDevice2AImpl_QueryInterface()

HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface ( LPDIRECTINPUTDEVICE8A  iface,
REFIID  riid,
LPVOID ppobj 
)

Definition at line 1302 of file device.c.

1303 {
1306 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
REFIID riid
Definition: precomp.h:44
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj)
Definition: device.c:1273

◆ IDirectInputDevice2AImpl_Release()

ULONG WINAPI IDirectInputDevice2AImpl_Release ( LPDIRECTINPUTDEVICE8A  iface)

Definition at line 1267 of file device.c.

1268 {
1271 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1231

◆ IDirectInputDevice2AImpl_RunControlPanel()

HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel ( LPDIRECTINPUTDEVICE8A  iface,
HWND  hwndOwner,
DWORD  dwFlags 
)

Definition at line 1700 of file device.c.

1701 {
1704 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags)
Definition: device.c:1692
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ IDirectInputDevice2AImpl_SendDeviceData()

HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData ( LPDIRECTINPUTDEVICE8A  iface,
DWORD  cbObjectData,
LPCDIDEVICEOBJECTDATA  rgdod,
LPDWORD  pdwInOut,
DWORD  dwFlags 
)

Definition at line 1867 of file device.c.

1870 {
1873  pdwInOut, dwFlags);
1874 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
Definition: device.c:1857
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ IDirectInputDevice2AImpl_SendForceFeedbackCommand()

HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand ( LPDIRECTINPUTDEVICE8A  iface,
DWORD  dwFlags 
)

Definition at line 1807 of file device.c.

1808 {
1811 }
HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags)
Definition: device.c:1800
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ IDirectInputDevice2AImpl_SetCooperativeLevel()

HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel ( LPDIRECTINPUTDEVICE8A  iface,
HWND  hwnd,
DWORD  dwflags 
)

Definition at line 1203 of file device.c.

1204 {
1207 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
static _In_ DWORD dwflags
Definition: dispmode.c:64
HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags)
Definition: device.c:1167

◆ IDirectInputDevice2AImpl_SetDataFormat()

HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat ( LPDIRECTINPUTDEVICE8A  iface,
LPCDIDATAFORMAT  df 
)

Definition at line 1156 of file device.c.

1157 {
1160 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df)
Definition: device.c:1135

◆ IDirectInputDevice2AImpl_SetEventNotification()

HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification ( LPDIRECTINPUTDEVICE8A  iface,
HANDLE  event 
)

Definition at line 1224 of file device.c.

1225 {
1228 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE event)
Definition: device.c:1212
struct _cl_event * event
Definition: glext.h:7739

◆ IDirectInputDevice2AImpl_SetProperty()

HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty ( LPDIRECTINPUTDEVICE8A  iface,
REFGUID  rguid,
LPCDIPROPHEADER  pdiph 
)

Definition at line 1537 of file device.c.

1539 {
1542 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph)
Definition: device.c:1450

◆ IDirectInputDevice2AImpl_Unacquire()

HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire ( LPDIRECTINPUTDEVICE8A  iface)

Definition at line 1125 of file device.c.

1126 {
1129 }
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
Definition: device.c:1108

◆ IDirectInputDevice2WImpl_Acquire()

HRESULT WINAPI IDirectInputDevice2WImpl_Acquire ( LPDIRECTINPUTDEVICE8W  iface)

Definition at line 1076 of file device.c.

1077 {
1079  HRESULT res;
1080 
1081  TRACE("(%p)\n", This);
1082 
1083  if (!This->data_format.user_df) return DIERR_INVALIDPARAM;
1084  if (This->dwCoopLevel & DISCL_FOREGROUND && This->win != GetForegroundWindow())
1085  return DIERR_OTHERAPPHASPRIO;
1086 
1087  EnterCriticalSection(&This->crit);
1088  res = This->acquired ? S_FALSE : DI_OK;
1089  This->acquired = 1;
1090  LeaveCriticalSection(&This->crit);
1091  if (res == DI_OK)
1092  check_dinput_hooks(iface, TRUE);
1093 
1094  return res;
1095 }
#define TRUE
Definition: types.h:120
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
Definition: dinput_main.c:1863
#define S_FALSE
Definition: winerror.h:2357
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
LONG HRESULT
Definition: typedefs.h:77
#define DISCL_FOREGROUND
Definition: dinput.h:965
#define DIERR_OTHERAPPHASPRIO
Definition: dinput.h:162
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
GLuint res
Definition: glext.h:9613
#define DI_OK
Definition: dinput.h:128
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by IDirectInputDevice2AImpl_Acquire(), SysKeyboardWImpl_Acquire(), and SysMouseWImpl_Acquire().

◆ IDirectInputDevice2WImpl_AddRef()

ULONG WINAPI IDirectInputDevice2WImpl_AddRef ( LPDIRECTINPUTDEVICE8W  iface)

Definition at line 1308 of file device.c.

1309 {
1312  TRACE( "(%p) ref %d\n", This, ref );
1313  return ref;
1314 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

Referenced by IDirectInputDevice2AImpl_AddRef().

◆ IDirectInputDevice2WImpl_CreateEffect()

HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect ( LPDIRECTINPUTDEVICE8W  iface,
REFGUID  rguid,
LPCDIEFFECT  lpeff,
LPDIRECTINPUTEFFECT ppdef,
LPUNKNOWN  pUnkOuter 
)

Definition at line 1725 of file device.c.

1727 {
1729  FIXME("(%p)->(%s,%p,%p,%p): stub!\n", This, debugstr_guid(rguid), lpeff, ppdef, pUnkOuter);
1730 
1731  FIXME("not available in the generic implementation\n");
1732  *ppdef = NULL;
1733  return DIERR_UNSUPPORTED;
1734 }
#define DIERR_UNSUPPORTED
Definition: dinput.h:156
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51

Referenced by IDirectInputDevice2AImpl_CreateEffect().

◆ IDirectInputDevice2WImpl_EnumCreatedEffectObjects()

HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects ( LPDIRECTINPUTDEVICE8W  iface,
LPDIENUMCREATEDEFFECTOBJECTSCALLBACK  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1813 of file device.c.

1815 {
1817  FIXME("(%p)0>(%p,%p,0x%08x): stub!\n", This, lpCallback, lpvRef, dwFlags);
1818  return DI_OK;
1819 }
#define FIXME(fmt,...)
Definition: debug.h:110
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI_OK
Definition: dinput.h:128

Referenced by IDirectInputDevice2AImpl_EnumCreatedEffectObjects().

◆ IDirectInputDevice2WImpl_EnumEffects()

HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects ( LPDIRECTINPUTDEVICE8W  iface,
LPDIENUMEFFECTSCALLBACKW  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1755 of file device.c.

1760 {
1762  FIXME("(%p)->(%p,%p,0x%08x): stub!\n", This, lpCallback, lpvRef, dwFlags);
1763 
1764  return DI_OK;
1765 }
#define FIXME(fmt,...)
Definition: debug.h:110
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI_OK
Definition: dinput.h:128

◆ IDirectInputDevice2WImpl_EnumObjects()

HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects ( LPDIRECTINPUTDEVICE8W  iface,
LPDIENUMDEVICEOBJECTSCALLBACKW  lpCallback,
LPVOID  lpvRef,
DWORD  dwFlags 
)

Definition at line 1352 of file device.c.

1354 {
1357  int i;
1358 
1359  TRACE("(%p)->(%p,%p flags:%08x)\n", This, lpCallback, lpvRef, dwFlags);
1360  TRACE(" - flags = ");
1362  TRACE("\n");
1363 
1364  /* Only the fields till dwFFMaxForce are relevant */
1365  memset(&ddoi, 0, sizeof(ddoi));
1366  ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW, dwFFMaxForce);
1367 
1368  for (i = 0; i < This->data_format.wine_df->dwNumObjs; i++)
1369  {
1370  LPDIOBJECTDATAFORMAT odf = dataformat_to_odf(This->data_format.wine_df, i);
1371 
1372  if (dwFlags != DIDFT_ALL && !(dwFlags & DIDFT_GETTYPE(odf->dwType))) continue;
1373  if (IDirectInputDevice_GetObjectInfo(iface, &ddoi, odf->dwType, DIPH_BYID) != DI_OK)
1374  continue;
1375 
1376  if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) break;
1377  }
1378 
1379  return DI_OK;
1380 }
#define DIPH_BYID
Definition: dinput.h:837
static void _dump_EnumObjects_flags(DWORD dwFlags)
Definition: device.c:127
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
static LPDIOBJECTDATAFORMAT dataformat_to_odf(LPCDIDATAFORMAT df, int idx)
Definition: device.c:403
#define IDirectInputDevice_GetObjectInfo(p, a, b, c)
Definition: dinput.h:1615
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define DI_OK
Definition: dinput.h:128
#define DIENUM_CONTINUE
Definition: dinput.h:188
#define DIDFT_ALL
Definition: dinput.h:750
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define memset(x, y, z)
Definition: compat.h:39

◆ IDirectInputDevice2WImpl_Escape()

HRESULT WINAPI IDirectInputDevice2WImpl_Escape ( LPDIRECTINPUTDEVICE8W  iface,
LPDIEFFESCAPE  lpDIEEsc 
)

Definition at line 1828 of file device.c.

1829 {
1831  FIXME("(%p)->(%p): stub!\n", This, lpDIEEsc);
1832  return DI_OK;
1833 }
#define FIXME(fmt,...)
Definition: debug.h:110
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define DI_OK
Definition: dinput.h:128

Referenced by IDirectInputDevice2AImpl_Escape().

◆ IDirectInputDevice2WImpl_GetDeviceData()

HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData ( LPDIRECTINPUTDEVICE8W  iface,
DWORD  dodsize,
LPDIDEVICEOBJECTDATA  dod,
LPDWORD  entries,
DWORD  flags 
)

Definition at line 1629 of file device.c.

1631 {
1633  HRESULT ret = DI_OK;
1634  int len;
1635 
1636  TRACE("(%p) %p -> %p(%d) x%d, 0x%08x\n",
1637  This, dod, entries, entries ? *entries : 0, dodsize, flags);
1638 
1639  if (This->dinput->dwVersion == 0x0800 || dodsize == sizeof(DIDEVICEOBJECTDATA_DX3))
1640  {
1641  if (!This->queue_len) return DIERR_NOTBUFFERED;
1642  if (!This->acquired) return DIERR_NOTACQUIRED;
1643  }
1644 
1645  if (!This->queue_len)
1646  return DI_OK;
1647  if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3))
1648  return DIERR_INVALIDPARAM;
1649 
1650  IDirectInputDevice2_Poll(iface);
1651  EnterCriticalSection(&This->crit);
1652 
1653  len = This->queue_head - This->queue_tail;
1654  if (len < 0) len += This->queue_len;
1655 
1656  if ((*entries != INFINITE) && (len > *entries)) len = *entries;
1657 
1658  if (dod)
1659  {
1660  int i;
1661  for (i = 0; i < len; i++)
1662  {
1663  int n = (This->queue_tail + i) % This->queue_len;
1664  memcpy((char *)dod + dodsize * i, This->data_queue + n, dodsize);
1665  }
1666  }
1667  *entries = len;
1668 
1669  if (This->overflow && This->dinput->dwVersion == 0x0800)
1671 
1672  if (!(flags & DIGDD_PEEK))
1673  {
1674  /* Advance reading position */
1675  This->queue_tail = (This->queue_tail + len) % This->queue_len;
1676  This->overflow = FALSE;
1677  }
1678 
1679  LeaveCriticalSection(&This->crit);
1680 
1681  TRACE("Returning %d events queued\n", *entries);
1682  return ret;
1683 }
#define DIERR_NOTACQUIRED
Definition: dinput.h:167
GLdouble n
Definition: glext.h:7729
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define DI_BUFFEROVERFLOW
Definition: dinput.h:130
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 DIERR_INVALIDPARAM
Definition: dinput.h:152
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
LONG HRESULT
Definition: typedefs.h:77
#define DIGDD_PEEK
Definition: dinput.h:778
#define IDirectInputDevice2_Poll(p)
Definition: dinput.h:1750
GLbitfield flags
Definition: glext.h:7161
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define DIERR_NOTBUFFERED
Definition: dinput.h:181
#define DI_OK
Definition: dinput.h:128
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define INFINITE
Definition: serial.h:102

Referenced by IDirectInputDevice2AImpl_GetDeviceData(), and SysMouseWImpl_GetDeviceData().

◆ IDirectInputDevice2WImpl_GetEffectInfo()

HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo ( LPDIRECTINPUTDEVICE8W  iface,
LPDIEFFECTINFOW  lpdei,
REFGUID  rguid 
)

Definition at line 1777 of file device.c.

1781 {
1783  FIXME("(%p)->(%p,%s): stub!\n", This, lpdei, debugstr_guid(rguid));
1784  return DI_OK;
1785 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define DI_OK
Definition: dinput.h:128

◆ IDirectInputDevice2WImpl_GetForceFeedbackState()

HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState ( LPDIRECTINPUTDEVICE8W  iface,
LPDWORD  pdwOut 
)

Definition at line 1787 of file device.c.

1788 {
1790  FIXME("(%p)->(%p): stub!\n", This, pdwOut);
1791  return DI_OK;
1792 }
#define FIXME(fmt,...)
Definition: debug.h:110
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define DI_OK
Definition: dinput.h:128
_Out_ PDWORD pdwOut
Definition: ntgdi.h:1813

Referenced by IDirectInputDevice2AImpl_GetForceFeedbackState().

◆ IDirectInputDevice2WImpl_GetObjectInfo()

HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo ( LPDIRECTINPUTDEVICE8W  iface,
LPDIDEVICEOBJECTINSTANCEW  pdidoi,
DWORD  dwObj,
DWORD  dwHow 
)

Definition at line 1576 of file device.c.

1581 {
1583  DWORD dwSize;
1585  int idx = -1;
1586 
1587  TRACE("(%p) %d(0x%08x) -> %p\n", This, dwHow, dwObj, pdidoi);
1588 
1589  if (!pdidoi ||
1590  (pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEW) &&
1591  pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3W)))
1592  return DIERR_INVALIDPARAM;
1593 
1594  switch (dwHow)
1595  {
1596  case DIPH_BYOFFSET:
1597  if (!This->data_format.offsets) break;
1598  for (idx = This->data_format.wine_df->dwNumObjs - 1; idx >= 0; idx--)
1599  if (This->data_format.offsets[idx] == dwObj) break;
1600  break;
1601  case DIPH_BYID:
1602  dwObj &= 0x00ffffff;
1603  for (idx = This->data_format.wine_df->dwNumObjs - 1; idx >= 0; idx--)
1604  if ((dataformat_to_odf(This->data_format.wine_df, idx)->dwType & 0x00ffffff) == dwObj)
1605  break;
1606  break;
1607 
1608  case DIPH_BYUSAGE:
1609  FIXME("dwHow = DIPH_BYUSAGE not implemented\n");
1610  break;
1611  default:
1612  WARN("invalid parameter: dwHow = %08x\n", dwHow);
1613  return DIERR_INVALIDPARAM;
1614  }
1615  if (idx < 0) return DIERR_OBJECTNOTFOUND;
1616 
1617  odf = dataformat_to_odf(This->data_format.wine_df, idx);
1618  dwSize = pdidoi->dwSize; /* save due to memset below */
1619  memset(pdidoi, 0, pdidoi->dwSize);
1620  pdidoi->dwSize = dwSize;
1621  if (odf->pguid) pdidoi->guidType = *odf->pguid;
1622  pdidoi->dwOfs = This->data_format.offsets ? This->data_format.offsets[idx] : odf->dwOfs;
1623  pdidoi->dwType = odf->dwType;
1624  pdidoi->dwFlags = odf->dwFlags;
1625 
1626  return DI_OK;
1627 }
#define DIPH_BYUSAGE
Definition: dinput.h:838
#define DIPH_BYID
Definition: dinput.h:837
#define WARN(fmt,...)
Definition: debug.h:111
static LPDIOBJECTDATAFORMAT dataformat_to_odf(LPCDIDATAFORMAT df, int idx)
Definition: device.c:403
#define DIPH_BYOFFSET
Definition: dinput.h:836
#define FIXME(fmt,...)
Definition: debug.h:110
unsigned int idx
Definition: utils.c:41
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
unsigned long DWORD
Definition: ntddk_ex.h:95
const GUID * pguid
Definition: dinput.h:800
#define DI_OK
Definition: dinput.h:128
#define memset(x, y, z)
Definition: compat.h:39
#define DIERR_OBJECTNOTFOUND
Definition: dinput.h:150
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by IDirectInputDevice2AImpl_GetObjectInfo(), JoystickWGenericImpl_GetObjectInfo(), SysKeyboardWImpl_GetObjectInfo(), and SysMouseWImpl_GetObjectInfo().

◆ IDirectInputDevice2WImpl_GetProperty()

HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty ( LPDIRECTINPUTDEVICE8W  iface,
REFGUID  rguid,
LPDIPROPHEADER  pdiph 
)

Definition at line 1386 of file device.c.

1387 {
1389 
1390  TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(rguid), pdiph);
1391  _dump_DIPROPHEADER(pdiph);
1392 
1393  if (!IS_DIPROP(rguid)) return DI_OK;
1394 
1395  switch (LOWORD(rguid))
1396  {
1398  {
1399  LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
1400 
1401  if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
1402 
1403  pd->dwData = This->queue_len;
1404  TRACE("buffersize = %d\n", pd->dwData);
1405  break;
1406  }
1407  case (DWORD_PTR) DIPROP_USERNAME:
1408  {
1409  LPDIPROPSTRING ps = (LPDIPROPSTRING)pdiph;
1410  struct DevicePlayer *device_player;
1411 
1412  if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
1413 
1414  LIST_FOR_EACH_ENTRY(device_player, &This->dinput->device_players,
1415  struct DevicePlayer, entry)
1416  {
1417  if (IsEqualGUID(&device_player->instance_guid, &This->guid))
1418  {
1419  if (*device_player->username)
1420  {
1421  lstrcpynW(ps->wsz, device_player->username, ARRAY_SIZE(ps->wsz));
1422  return DI_OK;
1423  }
1424  else break;
1425  }
1426  }
1427  return S_FALSE;
1428  }
1429  case (DWORD_PTR) DIPROP_VIDPID:
1430  FIXME("DIPROP_VIDPID not implemented\n");
1431  return DIERR_UNSUPPORTED;
1432  default:
1433  FIXME("Unknown property %s\n", debugstr_guid(rguid));
1434  return DIERR_INVALIDPARAM;
1435  }
1436 
1437  return DI_OK;
1438 }
struct DIPROPSTRING * LPDIPROPSTRING
DWORD dwSize
Definition: dinput.h:828
WCHAR username[MAX_PATH]
#define lstrcpynW
Definition: compat.h:397
#define DIERR_UNSUPPORTED
Definition: dinput.h:156
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357
#define debugstr_guid
Definition: kernel32.h:35
#define DIPROP_BUFFERSIZE
Definition: dinput.h:885
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
void _dump_DIPROPHEADER(LPCDIPROPHEADER diph)
Definition: device.c:176
WCHAR wsz[MAX_PATH]
Definition: dinput.h:875
uint32_t entry
Definition: isohybrid.c:63
DWORD dwData
Definition: dinput.h:844
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define DIPROP_USERNAME
Definition: dinput.h:919
#define DI_OK
Definition: dinput.h:128
#define IS_DIPROP(x)
#define DIPROP_VIDPID
Definition: dinput.h:918
struct DIPROPDWORD * LPDIPROPDWORD
#define LOWORD(l)
Definition: pedump.c:82

Referenced by IDirectInputDevice2AImpl_GetProperty(), JoystickWGenericImpl_GetProperty(), and SysMouseWImpl_GetProperty().

◆ IDirectInputDevice2WImpl_Initialize()

HRESULT WINAPI IDirectInputDevice2WImpl_Initialize ( LPDIRECTINPUTDEVICE8W  iface,
HINSTANCE  hinst,
DWORD  dwVersion,
REFGUID  rguid 
)

Definition at line 1706 of file device.c.

1708 {
1710  FIXME("(%p)->(%p,%d,%s): stub!\n", This, hinst, dwVersion, debugstr_guid(rguid));
1711  return DI_OK;
1712 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define DI_OK
Definition: dinput.h:128
static HINSTANCE hinst
Definition: edit.c:551

Referenced by IDirectInputDevice2AImpl_Initialize().

◆ IDirectInputDevice2WImpl_Poll()

HRESULT WINAPI IDirectInputDevice2WImpl_Poll ( LPDIRECTINPUTDEVICE8W  iface)

Definition at line 1841 of file device.c.

1842 {
1844 
1845  if (!This->acquired) return DIERR_NOTACQUIRED;
1846 
1848  return DI_OK;
1849 }
void check_dinput_events(void)
Definition: dinput_main.c:1900
#define DIERR_NOTACQUIRED
Definition: dinput.h:167
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define DI_OK
Definition: dinput.h:128

Referenced by IDirectInputDevice2AImpl_Poll().

◆ IDirectInputDevice2WImpl_QueryInterface()

HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface ( LPDIRECTINPUTDEVICE8W  iface,
REFIID  riid,
LPVOID ppobj 
)

Definition at line 1273 of file device.c.

1274 {
1276 
1277  TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppobj);
1278  if (IsEqualGUID(&IID_IUnknown, riid) ||
1279  IsEqualGUID(&IID_IDirectInputDeviceA, riid) ||
1280  IsEqualGUID(&IID_IDirectInputDevice2A, riid) ||
1281  IsEqualGUID(&IID_IDirectInputDevice7A, riid) ||
1282  IsEqualGUID(&IID_IDirectInputDevice8A, riid))
1283  {
1286  return DI_OK;
1287  }
1288  if (IsEqualGUID(&IID_IDirectInputDeviceW, riid) ||
1289  IsEqualGUID(&IID_IDirectInputDevice2W, riid) ||
1290  IsEqualGUID(&IID_IDirectInputDevice7W, riid) ||
1291  IsEqualGUID(&IID_IDirectInputDevice8W, riid))
1292  {
1295  return DI_OK;
1296  }
1297 
1298  WARN("Unsupported interface!\n");
1299  return E_NOINTERFACE;
1300 }
#define E_NOINTERFACE
Definition: winerror.h:2364
static IDirectInputDevice8W * IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:60
#define IDirectInputDevice2_AddRef(p)
Definition: dinput.h:1724
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
static IDirectInputDevice8A * IDirectInputDevice8A_from_impl(IDirectInputDeviceImpl *This)
Definition: device.c:56
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
const GUID IID_IUnknown
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define DI_OK
Definition: dinput.h:128

Referenced by IDirectInputDevice2AImpl_QueryInterface().

◆ IDirectInputDevice2WImpl_Release()

ULONG WINAPI IDirectInputDevice2WImpl_Release ( LPDIRECTINPUTDEVICE8W  iface)

Definition at line 1231 of file device.c.

1232 {
1234  ULONG ref = InterlockedDecrement(&(This->ref));
1235 
1236  TRACE("(%p) ref %d\n", This, ref);
1237 
1238  if (ref) return ref;
1239 
1241  /* Reset the FF state, free all effects, etc */
1243 
1244  HeapFree(GetProcessHeap(), 0, This->data_queue);
1245 
1246  /* Free data format */
1247  HeapFree(GetProcessHeap(), 0, This->data_format.wine_df->rgodf);
1248  HeapFree(GetProcessHeap(), 0, This->data_format.wine_df);
1249  release_DataFormat(&This->data_format);
1250 
1251  /* Free action mapping */
1252  HeapFree(GetProcessHeap(), 0, This->action_map);
1253 
1254  EnterCriticalSection( &This->dinput->crit );
1255  list_remove( &This->entry );
1256  LeaveCriticalSection( &This->dinput->crit );
1257 
1258  IDirectInput_Release(&This->dinput->IDirectInput7A_iface);
1259  This->crit.DebugInfo->Spare[0] = 0;
1260  DeleteCriticalSection(&This->crit);
1261 
1262  HeapFree(GetProcessHeap(), 0, This);
1263 
1264  return ref;
1265 }
#define IDirectInputDevice8_SendForceFeedbackCommand(p, a)
Definition: dinput.h:2058
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define DISFFC_RESET
Definition: dinput.h:970
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
#define IDirectInput_Release(p)
Definition: dinput.h:2294
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define GetProcessHeap()
Definition: compat.h:395
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define InterlockedDecrement
Definition: armddk.h:52
void release_DataFormat(DataFormat *format)
Definition: device.c:391
#define IDirectInputDevice_Unacquire(p)
Definition: dinput.h:1609
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by IDirectInputDevice2AImpl_Release().

◆ IDirectInputDevice2WImpl_RunControlPanel()

HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel ( LPDIRECTINPUTDEVICE8W  iface,
HWND  hwndOwner,
DWORD  dwFlags 
)

Definition at line 1692 of file device.c.

1693 {
1695  FIXME("%p)->(%p,0x%08x): stub!\n", This, hwndOwner, dwFlags);
1696 
1697  return DI_OK;
1698 }
#define FIXME(fmt,...)
Definition: debug.h:110
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI_OK
Definition: dinput.h:128

Referenced by IDirectInputDevice2AImpl_RunControlPanel().

◆ IDirectInputDevice2WImpl_SendDeviceData()

HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData ( LPDIRECTINPUTDEVICE8W  iface,
DWORD  cbObjectData,
LPCDIDEVICEOBJECTDATA  rgdod,
LPDWORD  pdwInOut,
DWORD  dwFlags 
)

Definition at line 1857 of file device.c.

1860 {
1862  FIXME("(%p)->(0x%08x,%p,%p,0x%08x): stub!\n", This, cbObjectData, rgdod, pdwInOut, dwFlags);
1863 
1864  return DI_OK;
1865 }
#define FIXME(fmt,...)
Definition: debug.h:110
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI_OK
Definition: dinput.h:128

Referenced by IDirectInputDevice2AImpl_SendDeviceData().

◆ IDirectInputDevice2WImpl_SendForceFeedbackCommand()

HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand ( LPDIRECTINPUTDEVICE8W  iface,
DWORD  dwFlags 
)

Definition at line 1800 of file device.c.

1801 {
1803  TRACE("(%p)->(0x%08x)\n", This, dwFlags);
1804  return DI_NOEFFECT;
1805 }
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI_NOEFFECT
Definition: dinput.h:132

Referenced by IDirectInputDevice2AImpl_SendForceFeedbackCommand().

◆ IDirectInputDevice2WImpl_SetCooperativeLevel()

HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel ( LPDIRECTINPUTDEVICE8W  iface,
HWND  hwnd,
DWORD  dwflags 
)

Definition at line 1167 of file device.c.

1168 {
1170 
1171  TRACE("(%p) %p,0x%08x\n", This, hwnd, dwflags);
1173 
1174  if ((dwflags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == 0 ||
1176  (dwflags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == 0 ||
1178  return DIERR_INVALIDPARAM;
1179 
1180  if (hwnd && GetWindowLongW(hwnd, GWL_STYLE) & WS_CHILD) return E_HANDLE;
1181 
1183  hwnd = GetDesktopWindow();
1184 
1185  if (!IsWindow(hwnd)) return E_HANDLE;
1186 
1187  /* For security reasons native does not allow exclusive background level
1188  for mouse and keyboard only */
1190  (IsEqualGUID(&This->guid, &GUID_SysMouse) ||
1191  IsEqualGUID(&This->guid, &GUID_SysKeyboard)))
1192  return DIERR_UNSUPPORTED;
1193 
1194  /* Store the window which asks for the mouse */
1195  EnterCriticalSection(&This->crit);
1196  This->win = hwnd;
1197  This->dwCoopLevel = dwflags;
1198  LeaveCriticalSection(&This->crit);
1199 
1200  return DI_OK;
1201 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define E_HANDLE
Definition: winerror.h:2850
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WS_CHILD
Definition: pedump.c:617
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define DIERR_UNSUPPORTED
Definition: dinput.h:156
#define DISCL_NONEXCLUSIVE
Definition: dinput.h:964
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
static void _dump_cooperativelevel_DI(DWORD dwFlags)
Definition: device.c:68
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
#define DISCL_BACKGROUND
Definition: dinput.h:966
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define DISCL_FOREGROUND
Definition: dinput.h:965
static _In_ DWORD dwflags
Definition: dispmode.c:64
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define DI_OK
Definition: dinput.h:128
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define DISCL_EXCLUSIVE
Definition: dinput.h:963

Referenced by IDirectInputDevice2AImpl_SetCooperativeLevel().

◆ IDirectInputDevice2WImpl_SetDataFormat()

HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat ( LPDIRECTINPUTDEVICE8W  iface,
LPCDIDATAFORMAT  df 
)

Definition at line 1135 of file device.c.

1136 {
1138  HRESULT res = DI_OK;
1139 
1140  if (!df) return E_POINTER;
1141  TRACE("(%p) %p\n", This, df);
1142  _dump_DIDATAFORMAT(df);
1143 
1144  if (df->dwSize != sizeof(DIDATAFORMAT)) return DIERR_INVALIDPARAM;
1145  if (This->acquired) return DIERR_ACQUIRED;
1146 
1147  EnterCriticalSection(&This->crit);
1148 
1149  release_DataFormat(&This->data_format);
1150  res = create_DataFormat(df, &This->data_format);
1151 
1152  LeaveCriticalSection(&This->crit);
1153  return res;
1154 }
DWORD dwSize
Definition: dinput.h:808
static HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *format)
Definition: device.c:432
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
void _dump_DIDATAFORMAT(const DIDATAFORMAT *df)
Definition: device.c:242
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define DIERR_ACQUIRED
Definition: dinput.h:165
LONG HRESULT
Definition: typedefs.h:77
void release_DataFormat(DataFormat *format)
Definition: device.c:391
GLuint res
Definition: glext.h:9613
#define DI_OK
Definition: dinput.h:128
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define E_POINTER
Definition: winerror.h:2365

Referenced by IDirectInputDevice2AImpl_SetDataFormat().

◆ IDirectInputDevice2WImpl_SetEventNotification()

HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification ( LPDIRECTINPUTDEVICE8W  iface,
HANDLE  event 
)

Definition at line 1212 of file device.c.

1213 {
1215 
1216  TRACE("(%p) %p\n", This, event);
1217 
1218  EnterCriticalSection(&This->crit);
1219  This->hEvent = event;
1220  LeaveCriticalSection(&This->crit);
1221  return DI_OK;
1222 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
struct _cl_event * event
Definition: glext.h:7739
#define DI_OK
Definition: dinput.h:128
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by IDirectInputDevice2AImpl_SetEventNotification().

◆ IDirectInputDevice2WImpl_SetProperty()

HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty ( LPDIRECTINPUTDEVICE8W  iface,
REFGUID  rguid,
LPCDIPROPHEADER  pdiph 
)

Definition at line 1450 of file device.c.

1452 {
1454 
1455  TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(rguid), pdiph);
1456  _dump_DIPROPHEADER(pdiph);
1457 
1458  if (!IS_DIPROP(rguid)) return DI_OK;
1459 
1460  switch (LOWORD(rguid))
1461  {
1462  case (DWORD_PTR) DIPROP_AXISMODE:
1463  {
1464  LPCDIPROPDWORD pd = (LPCDIPROPDWORD)pdiph;
1465 
1466  if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
1467  if (pdiph->dwHow == DIPH_DEVICE && pdiph->dwObj) return DIERR_INVALIDPARAM;
1468  if (This->acquired) return DIERR_ACQUIRED;
1469  if (pdiph->dwHow != DIPH_DEVICE) return DIERR_UNSUPPORTED;
1470  if (!This->data_format.user_df) return DI_OK;
1471 
1472  TRACE("Axis mode: %s\n", pd->dwData == DIPROPAXISMODE_ABS ? "absolute" :
1473  "relative");
1474 
1475  EnterCriticalSection(&This->crit);
1476  This->data_format.user_df->dwFlags &= ~DIDFT_AXIS;
1477  This->data_format.user_df->dwFlags |= pd->dwData == DIPROPAXISMODE_ABS ?
1479  LeaveCriticalSection(&This->crit);
1480  break;
1481  }
1483  {
1484  LPCDIPROPDWORD pd = (LPCDIPROPDWORD)pdiph;
1485 
1486  if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
1487  if (This->acquired) return DIERR_ACQUIRED;
1488 
1489  TRACE("buffersize = %d\n", pd->dwData);
1490 
1491  EnterCriticalSection(&This->crit);
1492  HeapFree(GetProcessHeap(), 0, This->data_queue);
1493 
1494  This->data_queue = !pd->dwData ? NULL : HeapAlloc(GetProcessHeap(), 0,
1495  pd->dwData * sizeof(DIDEVICEOBJECTDATA));
1496  This->queue_head = This->queue_tail = This->overflow = 0;
1497  This->queue_len = pd->dwData;
1498 
1499  LeaveCriticalSection(&This->crit);
1500  break;
1501  }
1502  case (DWORD_PTR) DIPROP_USERNAME:
1503  {
1504  LPCDIPROPSTRING ps = (LPCDIPROPSTRING)pdiph;
1505  struct DevicePlayer *device_player;
1506  BOOL found = FALSE;
1507 
1508  if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
1509 
1510  LIST_FOR_EACH_ENTRY(device_player, &This->dinput->device_players,
1511  struct DevicePlayer, entry)
1512  {
1513  if (IsEqualGUID(&device_player->instance_guid, &This->guid))
1514  {
1515  found = TRUE;
1516  break;
1517  }
1518  }
1519  if (!found && (device_player =
1520  HeapAlloc(GetProcessHeap(), 0, sizeof(struct DevicePlayer))))
1521  {
1522  list_add_tail(&This->dinput->device_players, &device_player->entry);
1523  device_player->instance_guid = This->guid;
1524  }
1525  if (device_player)
1526  lstrcpynW(device_player->username, ps->wsz, ARRAY_SIZE(device_player->username));
1527  break;
1528  }
1529  default:
1530  WARN("Unknown property %s\n", debugstr_guid(rguid));
1531  return DIERR_UNSUPPORTED;
1532  }
1533 
1534  return DI_OK;
1535 }
#define TRUE
Definition: types.h:120
DWORD dwSize
Definition: dinput.h:828
#define DIDF_ABSAXIS
Definition: dinput.h:775
#define DIPROPAXISMODE_ABS
Definition: dinput.h:888
#define WARN(fmt,...)
Definition: debug.h:111
WCHAR username[MAX_PATH]
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD dwHow
Definition: dinput.h:831
struct list entry
#define DIPH_DEVICE
Definition: dinput.h:835
#define lstrcpynW
Definition: compat.h:397
const DIPROPSTRING * LPCDIPROPSTRING
Definition: dinput.h:877
#define DIERR_UNSUPPORTED
Definition: dinput.h:156
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
const DIPROPDWORD * LPCDIPROPDWORD
Definition: dinput.h:846
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DIDF_RELAXIS
Definition: dinput.h:776
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define DIPROP_BUFFERSIZE
Definition: dinput.h:885
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define DIERR_ACQUIRED
Definition: dinput.h:165
void _dump_DIPROPHEADER(LPCDIPROPHEADER diph)
Definition: device.c:176
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
WCHAR wsz[MAX_PATH]
Definition: dinput.h:875
#define DIDFT_AXIS
Definition: dinput.h:753
uint32_t entry
Definition: isohybrid.c:63
DWORD dwData
Definition: dinput.h:844
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define DIPROP_AXISMODE
Definition: dinput.h:886
#define ARRAY_SIZE(a)
Definition: main.h:24
DWORD dwObj
Definition: dinput.h:830
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define DIPROP_USERNAME
Definition: dinput.h:919
#define DI_OK
Definition: dinput.h:128
#define IS_DIPROP(x)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by IDirectInputDevice2AImpl_SetProperty(), and JoystickWGenericImpl_SetProperty().

◆ IDirectInputDevice2WImpl_Unacquire()

HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire ( LPDIRECTINPUTDEVICE8W  iface)

Definition at line 1108 of file device.c.

1109 {
1111  HRESULT res;
1112 
1113  TRACE("(%p)\n", This);
1114 
1115  EnterCriticalSection(&This->crit);
1116  res = !This->acquired ? DI_NOEFFECT : DI_OK;
1117  This->acquired = 0;
1118  LeaveCriticalSection(&This->crit);
1119  if (res == DI_OK)
1120  check_dinput_hooks(iface, FALSE);
1121 
1122  return res;
1123 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
Definition: dinput_main.c:1863
#define TRACE(s)
Definition: solgame.cpp:4
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
LONG HRESULT
Definition: typedefs.h:77
#define DI_NOEFFECT
Definition: dinput.h:132
GLuint res
Definition: glext.h:9613
#define DI_OK
Definition: dinput.h:128
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by IDirectInputDevice2AImpl_Unacquire(), and SysMouseWImpl_Unacquire().

◆ IDirectInputDevice7AImpl_EnumEffectsInFile()

HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile ( LPDIRECTINPUTDEVICE8A  iface,
LPCSTR  lpszFileName,
LPDIENUMEFFECTSINFILECALLBACK  pec,
LPVOID  pvRef,
DWORD  dwFlags 
)

Definition at line 1876 of file device.c.

1881 {
1883  FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", This, lpszFileName, pec, pvRef, dwFlags);
1884 
1885  return DI_OK;
1886 }
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
#define FIXME(fmt,...)
Definition: debug.h:110
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI_OK
Definition: dinput.h:128

◆ IDirectInputDevice7AImpl_WriteEffectToFile()

HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile ( LPDIRECTINPUTDEVICE8A  iface,
LPCSTR  lpszFileName,
DWORD  dwEntries,
LPDIFILEEFFECT  rgDiFileEft,
DWORD  dwFlags 
)

Definition at line 1900 of file device.c.

1905 {
1907  FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", This, lpszFileName, dwEntries, rgDiFileEft, dwFlags);
1908 
1909  return DI_OK;
1910 }
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
#define FIXME(fmt,...)
Definition: debug.h:110
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI_OK
Definition: dinput.h:128

◆ IDirectInputDevice7WImpl_EnumEffectsInFile()

HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile ( LPDIRECTINPUTDEVICE8W  iface,
LPCWSTR  lpszFileName,
LPDIENUMEFFECTSINFILECALLBACK  pec,
LPVOID  pvRef,
DWORD  dwFlags 
)

Definition at line 1888 of file device.c.

1893 {
1895  FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", This, debugstr_w(lpszFileName), pec, pvRef, dwFlags);
1896 
1897  return DI_OK;
1898 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI_OK
Definition: dinput.h:128

◆ IDirectInputDevice7WImpl_WriteEffectToFile()

HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile ( LPDIRECTINPUTDEVICE8W  iface,
LPCWSTR  lpszFileName,
DWORD  dwEntries,
LPDIFILEEFFECT  rgDiFileEft,
DWORD  dwFlags 
)

Definition at line 1912 of file device.c.

1917 {
1919  FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", This, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags);
1920 
1921  return DI_OK;
1922 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DI_OK
Definition: dinput.h:128

◆ IDirectInputDevice8A_from_impl()

static IDirectInputDevice8A* IDirectInputDevice8A_from_impl ( IDirectInputDeviceImpl This)
inlinestatic

Definition at line 56 of file device.c.

57 {
58  return &This->IDirectInputDevice8A_iface;
59 }

Referenced by IDirectInputDevice2WImpl_QueryInterface().

◆ IDirectInputDevice8AImpl_GetImageInfo()

HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo ( LPDIRECTINPUTDEVICE8A  iface,
LPDIDEVICEIMAGEINFOHEADERA  lpdiDevImageInfoHeader 
)

Definition at line 1941 of file device.c.

1943 {
1945  FIXME("(%p)->(%p): stub !\n", This, lpdiDevImageInfoHeader);
1946 
1947  return DI_OK;
1948 }
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
Definition: device.c:47
#define FIXME(fmt,...)
Definition: debug.h:110
#define DI_OK
Definition: dinput.h:128

◆ IDirectInputDevice8W_from_impl()

◆ IDirectInputDevice8WImpl_BuildActionMap()

HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap ( LPDIRECTINPUTDEVICE8W  iface,
LPDIACTIONFORMATW  lpdiaf,
LPCWSTR  lpszUserName,
DWORD  dwFlags 
)

Definition at line 1924 of file device.c.

1928 {
1930  FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", This, lpdiaf, debugstr_w(lpszUserName), dwFlags);
1931 #define X(x) if (dwFlags & x) FIXME("\tdwFlags =|"#x"\n");
1932  X(DIDBAM_DEFAULT)
1936 #undef X
1937 
1938  return DI_OK;
1939 }
#define DIDBAM_PRESERVE
Definition: dinput.h:1353
#define DIDBAM_INITIALIZE
Definition: dinput.h:1354
#define DIDBAM_DEFAULT
Definition: dinput.h:1352
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define DIDBAM_HWDEFAULTS
Definition: dinput.h:1355
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define X(x)
#define DI_OK
Definition: dinput.h:128

Referenced by _build_action_map(), and JoystickWGenericImpl_BuildActionMap().

◆ IDirectInputDevice8WImpl_GetImageInfo()

HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo ( LPDIRECTINPUTDEVICE8W  iface,
LPDIDEVICEIMAGEINFOHEADERW  lpdiDevImageInfoHeader 
)

Definition at line 1950 of file device.c.

1952 {
1954  FIXME("(%p)->(%p): stub !\n", This, lpdiDevImageInfoHeader);
1955 
1956  return DI_OK;
1957 }
#define FIXME(fmt,...)
Definition: debug.h:110
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: device.c:51
#define DI_OK
Definition: dinput.h:128

◆ impl_from_IDirectInputDevice8A()

static IDirectInputDeviceImpl* impl_from_IDirectInputDevice8A ( IDirectInputDevice8A *  iface)
inlinestatic

Definition at line 47 of file device.c.

48 {
49  return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface);
50 }
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

Referenced by IDirectInputDevice2AImpl_Acquire(), IDirectInputDevice2AImpl_AddRef(), IDirectInputDevice2AImpl_CreateEffect(), IDirectInputDevice2AImpl_EnumCreatedEffectObjects(), IDirectInputDevice2AImpl_EnumEffects(), IDirectInputDevice2AImpl_EnumObjects(), IDirectInputDevice2AImpl_Escape(), IDirectInputDevice2AImpl_GetDeviceData(), IDirectInputDevice2AImpl_GetEffectInfo(), IDirectInputDevice2AImpl_GetForceFeedbackState(), IDirectInputDevice2AImpl_GetObjectInfo(), IDirectInputDevice2AImpl_GetProperty(), IDirectInputDevice2AImpl_Initialize(), IDirectInputDevice2AImpl_Poll(), IDirectInputDevice2AImpl_QueryInterface(), IDirectInputDevice2AImpl_Release(), IDirectInputDevice2AImpl_RunControlPanel(), IDirectInputDevice2AImpl_SendDeviceData(), IDirectInputDevice2AImpl_SendForceFeedbackCommand(), IDirectInputDevice2AImpl_SetCooperativeLevel(), IDirectInputDevice2AImpl_SetDataFormat(), IDirectInputDevice2AImpl_SetEventNotification(), IDirectInputDevice2AImpl_SetProperty(), IDirectInputDevice2AImpl_Unacquire(), IDirectInputDevice7AImpl_EnumEffectsInFile(), IDirectInputDevice7AImpl_WriteEffectToFile(), IDirectInputDevice8AImpl_GetImageInfo(), and queue_event().

◆ impl_from_IDirectInputDevice8W()

static IDirectInputDeviceImpl* impl_from_IDirectInputDevice8W ( IDirectInputDevice8W *  iface)
inlinestatic

Definition at line 51 of file device.c.

52 {
53  return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface);
54 }
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

Referenced by _build_action_map(), _set_action_map(), IDirectInputDevice2WImpl_Acquire(), IDirectInputDevice2WImpl_AddRef(), IDirectInputDevice2WImpl_CreateEffect(), IDirectInputDevice2WImpl_EnumCreatedEffectObjects(), IDirectInputDevice2WImpl_EnumEffects(), IDirectInputDevice2WImpl_EnumObjects(), IDirectInputDevice2WImpl_Escape(), IDirectInputDevice2WImpl_GetDeviceData(), IDirectInputDevice2WImpl_GetEffectInfo(), IDirectInputDevice2WImpl_GetForceFeedbackState(), IDirectInputDevice2WImpl_GetObjectInfo(), IDirectInputDevice2WImpl_GetProperty(), IDirectInputDevice2WImpl_Initialize(), IDirectInputDevice2WImpl_Poll(), IDirectInputDevice2WImpl_QueryInterface(), IDirectInputDevice2WImpl_Release(), IDirectInputDevice2WImpl_RunControlPanel(), IDirectInputDevice2WImpl_SendDeviceData(), IDirectInputDevice2WImpl_SendForceFeedbackCommand(), IDirectInputDevice2WImpl_SetCooperativeLevel(), IDirectInputDevice2WImpl_SetDataFormat(), IDirectInputDevice2WImpl_SetEventNotification(), IDirectInputDevice2WImpl_SetProperty(), IDirectInputDevice2WImpl_Unacquire(), IDirectInputDevice7WImpl_EnumEffectsInFile(), IDirectInputDevice7WImpl_WriteEffectToFile(), IDirectInputDevice8WImpl_BuildActionMap(), and IDirectInputDevice8WImpl_GetImageInfo().

◆ load_mapping_settings()

BOOL load_mapping_settings ( IDirectInputDeviceImpl This,
LPDIACTIONFORMATW  lpdiaf,
const WCHAR username 
)

Definition at line 740 of file device.c.

741 {
742  HKEY hkey;
743  WCHAR *guid_str;
744  DIDEVICEINSTANCEW didev;
745  int i;
746 
747  didev.dwSize = sizeof(didev);
748  IDirectInputDevice8_GetDeviceInfo(&This->IDirectInputDevice8W_iface, &didev);
749 
750  if (StringFromCLSID(&lpdiaf->guidActionMap, &guid_str) != S_OK)
751  return FALSE;
752 
753  hkey =