ReactOS 0.4.16-dev-297-gc569aee
dinput_main.c File Reference
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h"
#include "wine/asm.h"
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winerror.h"
#include "objbase.h"
#include "rpcproxy.h"
#include "initguid.h"
#include "devguid.h"
#include "dinput_private.h"
#include "device_private.h"
#include "dinputd.h"
Include dependency graph for dinput_main.c:

Go to the source code of this file.

Classes

struct  IClassFactoryImpl
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define FE(x)   { x, #x}
 
#define enum_callback_wrapper(callback, instance, ref)   (callback)((instance), (ref))
 
#define X(x)   if (dwFlags & x) FIXME("\tdwFlags |= "#x"\n");
 
#define X(x)   if (flags & x) FIXME("\tflags |= "#x"\n");
 

Enumerations

enum  directinput_versions {
  DIRECTINPUT_VERSION_300 = 0x0300 , DIRECTINPUT_VERSION_500 = 0x0500 , DIRECTINPUT_VERSION_50A = 0x050A , DIRECTINPUT_VERSION_5B2 = 0x05B2 ,
  DIRECTINPUT_VERSION_602 = 0x0602 , DIRECTINPUT_VERSION_61A = 0x061A , DIRECTINPUT_VERSION_700 = 0x0700 , DIRECTINPUT_VERSION_300 = 0x0300 ,
  DIRECTINPUT_VERSION_500 = 0x0500 , DIRECTINPUT_VERSION_50A = 0x050A , DIRECTINPUT_VERSION_5B2 = 0x05B2 , DIRECTINPUT_VERSION_602 = 0x0602 ,
  DIRECTINPUT_VERSION_61A = 0x061A , DIRECTINPUT_VERSION_700 = 0x0700
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dinput)
 
static IDirectInputImplimpl_from_IDirectInput7A (IDirectInput7A *iface)
 
static IDirectInputImplimpl_from_IDirectInput7W (IDirectInput7W *iface)
 
static IDirectInputImplimpl_from_IDirectInput8A (IDirectInput8A *iface)
 
static IDirectInputImplimpl_from_IDirectInput8W (IDirectInput8W *iface)
 
static IDirectInputDeviceImplimpl_from_IDirectInputDevice8W (IDirectInputDevice8W *iface)
 
static BOOL check_hook_thread (void)
 
static HRESULT initialize_directinput_instance (IDirectInputImpl *This, DWORD dwVersion)
 
static void uninitialize_directinput_instance (IDirectInputImpl *This)
 
static HRESULT create_directinput_instance (REFIID riid, LPVOID *ppDI, IDirectInputImpl **out)
 
HRESULT WINAPI DirectInputCreateEx (HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI, LPUNKNOWN punkOuter)
 
HRESULT WINAPI DECLSPEC_HOTPATCH DirectInput8Create (HINSTANCE hinst, DWORD version, REFIID iid, void **out, IUnknown *outer)
 
HRESULT WINAPI DECLSPEC_HOTPATCH DirectInputCreateA (HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter)
 
HRESULT WINAPI DECLSPEC_HOTPATCH DirectInputCreateW (HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter)
 
static const char_dump_DIDEVTYPE_value (DWORD dwDevType, DWORD dwVersion)
 
static void _dump_EnumDevices_dwFlags (DWORD dwFlags)
 
static const chardump_semantic (DWORD semantic)
 
static void _dump_diactionformatA (LPDIACTIONFORMATA lpdiActionFormat)
 
void _copy_diactionformatAtoW (LPDIACTIONFORMATW to, LPDIACTIONFORMATA from)
 
void _copy_diactionformatWtoA (LPDIACTIONFORMATA to, LPDIACTIONFORMATW from)
 
static DWORD diactionformat_priorityA (LPDIACTIONFORMATA lpdiaf, DWORD genre)
 
static DWORD diactionformat_priorityW (LPDIACTIONFORMATW lpdiaf, DWORD genre)
 
static HRESULT WINAPI IDirectInputAImpl_EnumDevices (LPDIRECTINPUT7A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags)
 
static HRESULT WINAPI IDirectInputWImpl_EnumDevices (LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags)
 
static ULONG WINAPI IDirectInputAImpl_AddRef (LPDIRECTINPUT7A iface)
 
static ULONG WINAPI IDirectInputWImpl_AddRef (LPDIRECTINPUT7W iface)
 
static ULONG WINAPI IDirectInputAImpl_Release (LPDIRECTINPUT7A iface)
 
static ULONG WINAPI IDirectInputWImpl_Release (LPDIRECTINPUT7W iface)
 
static HRESULT WINAPI IDirectInputAImpl_QueryInterface (LPDIRECTINPUT7A iface, REFIID riid, LPVOID *ppobj)
 
static HRESULT WINAPI IDirectInputWImpl_QueryInterface (LPDIRECTINPUT7W iface, REFIID riid, LPVOID *ppobj)
 
static HRESULT WINAPI IDirectInputAImpl_Initialize (LPDIRECTINPUT7A iface, HINSTANCE hinst, DWORD version)
 
static HRESULT WINAPI IDirectInputWImpl_Initialize (LPDIRECTINPUT7W iface, HINSTANCE hinst, DWORD x)
 
static HRESULT WINAPI IDirectInputAImpl_GetDeviceStatus (LPDIRECTINPUT7A iface, REFGUID rguid)
 
static HRESULT WINAPI IDirectInputWImpl_GetDeviceStatus (LPDIRECTINPUT7W iface, REFGUID rguid)
 
static HRESULT WINAPI IDirectInputAImpl_RunControlPanel (LPDIRECTINPUT7A iface, HWND hwndOwner, DWORD dwFlags)
 
static HRESULT WINAPI IDirectInputWImpl_RunControlPanel (LPDIRECTINPUT7W iface, HWND hwndOwner, DWORD dwFlags)
 
static HRESULT WINAPI IDirectInput2AImpl_FindDevice (LPDIRECTINPUT7A iface, REFGUID rguid, LPCSTR pszName, LPGUID pguidInstance)
 
static HRESULT WINAPI IDirectInput2WImpl_FindDevice (LPDIRECTINPUT7W iface, REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance)
 
static HRESULT create_device (IDirectInputImpl *This, REFGUID rguid, REFIID riid, LPVOID *pvOut, BOOL unicode)
 
static HRESULT WINAPI IDirectInput7AImpl_CreateDeviceEx (LPDIRECTINPUT7A iface, REFGUID rguid, REFIID riid, LPVOID *pvOut, LPUNKNOWN lpUnknownOuter)
 
static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx (LPDIRECTINPUT7W iface, REFGUID rguid, REFIID riid, LPVOID *pvOut, LPUNKNOWN lpUnknownOuter)
 
static HRESULT WINAPI IDirectInputAImpl_CreateDevice (LPDIRECTINPUT7A iface, REFGUID rguid, LPDIRECTINPUTDEVICEA *pdev, LPUNKNOWN punk)
 
static HRESULT WINAPI IDirectInputWImpl_CreateDevice (LPDIRECTINPUT7W iface, REFGUID rguid, LPDIRECTINPUTDEVICEW *pdev, LPUNKNOWN punk)
 
static ULONG WINAPI IDirectInput8AImpl_AddRef (LPDIRECTINPUT8A iface)
 
static ULONG WINAPI IDirectInput8WImpl_AddRef (LPDIRECTINPUT8W iface)
 
static HRESULT WINAPI IDirectInput8AImpl_QueryInterface (LPDIRECTINPUT8A iface, REFIID riid, LPVOID *ppobj)
 
static HRESULT WINAPI IDirectInput8WImpl_QueryInterface (LPDIRECTINPUT8W iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectInput8AImpl_Release (LPDIRECTINPUT8A iface)
 
static ULONG WINAPI IDirectInput8WImpl_Release (LPDIRECTINPUT8W iface)
 
static HRESULT WINAPI IDirectInput8AImpl_CreateDevice (LPDIRECTINPUT8A iface, REFGUID rguid, LPDIRECTINPUTDEVICE8A *pdev, LPUNKNOWN punk)
 
static HRESULT WINAPI IDirectInput8WImpl_CreateDevice (LPDIRECTINPUT8W iface, REFGUID rguid, LPDIRECTINPUTDEVICE8W *pdev, LPUNKNOWN punk)
 
static HRESULT WINAPI IDirectInput8AImpl_EnumDevices (LPDIRECTINPUT8A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags)
 
static HRESULT WINAPI IDirectInput8WImpl_EnumDevices (LPDIRECTINPUT8W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags)
 
static HRESULT WINAPI IDirectInput8AImpl_GetDeviceStatus (LPDIRECTINPUT8A iface, REFGUID rguid)
 
static HRESULT WINAPI IDirectInput8WImpl_GetDeviceStatus (LPDIRECTINPUT8W iface, REFGUID rguid)
 
static HRESULT WINAPI IDirectInput8AImpl_RunControlPanel (LPDIRECTINPUT8A iface, HWND hwndOwner, DWORD dwFlags)
 
static HRESULT WINAPI IDirectInput8WImpl_RunControlPanel (LPDIRECTINPUT8W iface, HWND hwndOwner, DWORD dwFlags)
 
static HRESULT WINAPI IDirectInput8AImpl_Initialize (LPDIRECTINPUT8A iface, HINSTANCE hinst, DWORD version)
 
static HRESULT WINAPI IDirectInput8WImpl_Initialize (LPDIRECTINPUT8W iface, HINSTANCE hinst, DWORD version)
 
static HRESULT WINAPI IDirectInput8AImpl_FindDevice (LPDIRECTINPUT8A iface, REFGUID rguid, LPCSTR pszName, LPGUID pguidInstance)
 
static HRESULT WINAPI IDirectInput8WImpl_FindDevice (LPDIRECTINPUT8W iface, REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance)
 
static BOOL should_enumerate_device (const WCHAR *username, DWORD dwFlags, struct list *device_players, REFGUID guid)
 
static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics (LPDIRECTINPUT8A iface, LPCSTR ptszUserName, LPDIACTIONFORMATA lpdiActionFormat, LPDIENUMDEVICESBYSEMANTICSCBA lpCallback, LPVOID pvRef, DWORD dwFlags)
 
static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics (LPDIRECTINPUT8W iface, LPCWSTR ptszUserName, LPDIACTIONFORMATW lpdiActionFormat, LPDIENUMDEVICESBYSEMANTICSCBW lpCallback, LPVOID pvRef, DWORD dwFlags)
 
static HRESULT WINAPI IDirectInput8WImpl_ConfigureDevices (LPDIRECTINPUT8W iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData)
 
static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices (LPDIRECTINPUT8A iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSA lpdiCDParams, DWORD dwFlags, LPVOID pvRefData)
 
static IDirectInputImplimpl_from_IDirectInputJoyConfig8 (IDirectInputJoyConfig8 *iface)
 
static HRESULT WINAPI JoyConfig8Impl_QueryInterface (IDirectInputJoyConfig8 *iface, REFIID riid, void **ppobj)
 
static ULONG WINAPI JoyConfig8Impl_AddRef (IDirectInputJoyConfig8 *iface)
 
static ULONG WINAPI JoyConfig8Impl_Release (IDirectInputJoyConfig8 *iface)
 
static HRESULT WINAPI JoyConfig8Impl_Acquire (IDirectInputJoyConfig8 *iface)
 
static HRESULT WINAPI JoyConfig8Impl_Unacquire (IDirectInputJoyConfig8 *iface)
 
static HRESULT WINAPI JoyConfig8Impl_SetCooperativeLevel (IDirectInputJoyConfig8 *iface, HWND hwnd, DWORD flags)
 
static HRESULT WINAPI JoyConfig8Impl_SendNotify (IDirectInputJoyConfig8 *iface)
 
static HRESULT WINAPI JoyConfig8Impl_EnumTypes (IDirectInputJoyConfig8 *iface, LPDIJOYTYPECALLBACK cb, void *ref)
 
static HRESULT WINAPI JoyConfig8Impl_GetTypeInfo (IDirectInputJoyConfig8 *iface, LPCWSTR name, LPDIJOYTYPEINFO info, DWORD flags)
 
static HRESULT WINAPI JoyConfig8Impl_SetTypeInfo (IDirectInputJoyConfig8 *iface, LPCWSTR name, LPCDIJOYTYPEINFO info, DWORD flags, LPWSTR new_name)
 
static HRESULT WINAPI JoyConfig8Impl_DeleteType (IDirectInputJoyConfig8 *iface, LPCWSTR name)
 
static HRESULT WINAPI JoyConfig8Impl_GetConfig (IDirectInputJoyConfig8 *iface, UINT id, LPDIJOYCONFIG info, DWORD flags)
 
static HRESULT WINAPI JoyConfig8Impl_SetConfig (IDirectInputJoyConfig8 *iface, UINT id, LPCDIJOYCONFIG info, DWORD flags)
 
static HRESULT WINAPI JoyConfig8Impl_DeleteConfig (IDirectInputJoyConfig8 *iface, UINT id)
 
static HRESULT WINAPI JoyConfig8Impl_GetUserValues (IDirectInputJoyConfig8 *iface, LPDIJOYUSERVALUES info, DWORD flags)
 
static HRESULT WINAPI JoyConfig8Impl_SetUserValues (IDirectInputJoyConfig8 *iface, LPCDIJOYUSERVALUES info, DWORD flags)
 
static HRESULT WINAPI JoyConfig8Impl_AddNewHardware (IDirectInputJoyConfig8 *iface, HWND hwnd, REFGUID guid)
 
static HRESULT WINAPI JoyConfig8Impl_OpenTypeKey (IDirectInputJoyConfig8 *iface, LPCWSTR name, DWORD security, PHKEY key)
 
static HRESULT WINAPI JoyConfig8Impl_OpenAppStatusKey (IDirectInputJoyConfig8 *iface, PHKEY key)
 
static IClassFactoryImplimpl_from_IClassFactory (IClassFactory *iface)
 
static HRESULT WINAPI DICF_QueryInterface (LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI DICF_AddRef (LPCLASSFACTORY iface)
 
static ULONG WINAPI DICF_Release (LPCLASSFACTORY iface)
 
static HRESULT WINAPI DICF_CreateInstance (LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
 
static HRESULT WINAPI DICF_LockServer (LPCLASSFACTORY iface, BOOL dolock)
 
HRESULT WINAPI DllCanUnloadNow (void)
 
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
HRESULT WINAPI DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 
static LRESULT CALLBACK LL_hook_proc (int code, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK callwndproc_proc (int code, WPARAM wparam, LPARAM lparam)
 
static DWORD WINAPI hook_thread_proc (void *param)
 
void check_dinput_hooks (LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
 
void check_dinput_events (void)
 
BOOL WINAPI DllMain (HINSTANCE inst, DWORD reason, LPVOID reserved)
 

Variables

static const IDirectInput7AVtbl ddi7avt
 
static const IDirectInput7WVtbl ddi7wvt
 
static const IDirectInput8AVtbl ddi8avt
 
static const IDirectInput8WVtbl ddi8wvt
 
static const IDirectInputJoyConfig8Vtbl JoyConfig8vt
 
static const struct dinput_devicedinput_devices []
 
HINSTANCE DINPUT_instance
 
static CRITICAL_SECTION dinput_hook_crit = { &dinput_critsect_debug, -1, 0, 0, 0, 0 }
 
static struct list direct_input_list = LIST_INIT( direct_input_list )
 
static const IClassFactoryVtbl DICF_Vtbl
 
static IClassFactoryImpl DINPUT_CF = {{&DICF_Vtbl}, 1 }
 
static DWORD hook_thread_id
 
static HANDLE hook_thread_event
 
static CRITICAL_SECTION_DEBUG dinput_critsect_debug
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 37 of file dinput_main.c.

◆ enum_callback_wrapper

#define enum_callback_wrapper (   callback,
  instance,
  ref 
)    (callback)((instance), (ref))

Definition at line 455 of file dinput_main.c.

◆ FE

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

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 38 of file dinput_main.c.

◆ X [1/2]

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

◆ X [2/2]

#define X (   x)    if (flags & x) FIXME("\tflags |= "#x"\n");

Enumeration Type Documentation

◆ directinput_versions

Enumerator
DIRECTINPUT_VERSION_300 
DIRECTINPUT_VERSION_500 
DIRECTINPUT_VERSION_50A 
DIRECTINPUT_VERSION_5B2 
DIRECTINPUT_VERSION_602 
DIRECTINPUT_VERSION_61A 
DIRECTINPUT_VERSION_700 
DIRECTINPUT_VERSION_300 
DIRECTINPUT_VERSION_500 
DIRECTINPUT_VERSION_50A 
DIRECTINPUT_VERSION_5B2 
DIRECTINPUT_VERSION_602 
DIRECTINPUT_VERSION_61A 
DIRECTINPUT_VERSION_700 

Definition at line 681 of file dinput_main.c.

682{
690};
@ DIRECTINPUT_VERSION_300
Definition: dinput_main.c:683
@ DIRECTINPUT_VERSION_500
Definition: dinput_main.c:684
@ DIRECTINPUT_VERSION_50A
Definition: dinput_main.c:685
@ DIRECTINPUT_VERSION_700
Definition: dinput_main.c:689
@ DIRECTINPUT_VERSION_602
Definition: dinput_main.c:687
@ DIRECTINPUT_VERSION_61A
Definition: dinput_main.c:688
@ DIRECTINPUT_VERSION_5B2
Definition: dinput_main.c:686

Function Documentation

◆ _copy_diactionformatAtoW()

void _copy_diactionformatAtoW ( LPDIACTIONFORMATW  to,
LPDIACTIONFORMATA  from 
)

Definition at line 339 of file dinput_main.c.

340{
341 int i;
342
343 to->dwSize = sizeof(DIACTIONFORMATW);
344 to->dwActionSize = sizeof(DIACTIONW);
345 to->dwDataSize = from->dwDataSize;
346 to->dwNumActions = from->dwNumActions;
347 to->guidActionMap = from->guidActionMap;
348 to->dwGenre = from->dwGenre;
349 to->dwBufferSize = from->dwBufferSize;
350 to->lAxisMin = from->lAxisMin;
351 to->lAxisMax = from->lAxisMax;
352 to->dwCRC = from->dwCRC;
353 to->ftTimeStamp = from->ftTimeStamp;
354
355 for (i=0; i < to->dwNumActions; i++)
356 {
357 to->rgoAction[i].uAppData = from->rgoAction[i].uAppData;
358 to->rgoAction[i].dwSemantic = from->rgoAction[i].dwSemantic;
359 to->rgoAction[i].dwFlags = from->rgoAction[i].dwFlags;
360 to->rgoAction[i].guidInstance = from->rgoAction[i].guidInstance;
361 to->rgoAction[i].dwObjID = from->rgoAction[i].dwObjID;
362 to->rgoAction[i].dwHow = from->rgoAction[i].dwHow;
363 }
364}
struct _DIACTIONW DIACTIONW
struct _DIACTIONFORMATW DIACTIONFORMATW
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
CardRegion * from
Definition: spigame.cpp:19
DWORD dwBufferSize
Definition: dinput.h:1333
LPDIACTIONW rgoAction
Definition: dinput.h:1330
FILETIME ftTimeStamp
Definition: dinput.h:1337
DWORD dwActionSize
Definition: dinput.h:1327
DWORD dwNumActions
Definition: dinput.h:1329
DWORD dwDataSize
Definition: dinput.h:1328
GUID guidActionMap
Definition: dinput.h:1331
DWORD dwFlags
Definition: dinput.h:1278
GUID guidInstance
Definition: dinput.h:1283
UINT_PTR uAppData
Definition: dinput.h:1276
DWORD dwHow
Definition: dinput.h:1285
DWORD dwSemantic
Definition: dinput.h:1277
DWORD dwObjID
Definition: dinput.h:1284

Referenced by IDirectInput8AImpl_ConfigureDevices(), JoystickAGenericImpl_BuildActionMap(), JoystickAGenericImpl_SetActionMap(), SysKeyboardAImpl_BuildActionMap(), SysKeyboardAImpl_SetActionMap(), SysMouseAImpl_BuildActionMap(), and SysMouseAImpl_SetActionMap().

◆ _copy_diactionformatWtoA()

void _copy_diactionformatWtoA ( LPDIACTIONFORMATA  to,
LPDIACTIONFORMATW  from 
)

Definition at line 366 of file dinput_main.c.

367{
368 int i;
369
370 to->dwSize = sizeof(DIACTIONFORMATA);
371 to->dwActionSize = sizeof(DIACTIONA);
372 to->dwDataSize = from->dwDataSize;
373 to->dwNumActions = from->dwNumActions;
374 to->guidActionMap = from->guidActionMap;
375 to->dwGenre = from->dwGenre;
376 to->dwBufferSize = from->dwBufferSize;
377 to->lAxisMin = from->lAxisMin;
378 to->lAxisMax = from->lAxisMax;
379 to->dwCRC = from->dwCRC;
380 to->ftTimeStamp = from->ftTimeStamp;
381
382 for (i=0; i < to->dwNumActions; i++)
383 {
384 to->rgoAction[i].uAppData = from->rgoAction[i].uAppData;
385 to->rgoAction[i].dwSemantic = from->rgoAction[i].dwSemantic;
386 to->rgoAction[i].dwFlags = from->rgoAction[i].dwFlags;
387 to->rgoAction[i].guidInstance = from->rgoAction[i].guidInstance;
388 to->rgoAction[i].dwObjID = from->rgoAction[i].dwObjID;
389 to->rgoAction[i].dwHow = from->rgoAction[i].dwHow;
390 }
391}
struct _DIACTIONFORMATA DIACTIONFORMATA
struct _DIACTIONA DIACTIONA
DWORD dwHow
Definition: dinput.h:1271
DWORD dwFlags
Definition: dinput.h:1264
DWORD dwObjID
Definition: dinput.h:1270
DWORD dwSemantic
Definition: dinput.h:1263
UINT_PTR uAppData
Definition: dinput.h:1262
GUID guidInstance
Definition: dinput.h:1269
DWORD dwDataSize
Definition: dinput.h:1310
LPDIACTIONA rgoAction
Definition: dinput.h:1312
DWORD dwBufferSize
Definition: dinput.h:1315
FILETIME ftTimeStamp
Definition: dinput.h:1319
DWORD dwNumActions
Definition: dinput.h:1311
DWORD dwActionSize
Definition: dinput.h:1309
GUID guidActionMap
Definition: dinput.h:1313

Referenced by IDirectInput8AImpl_ConfigureDevices(), JoystickAGenericImpl_BuildActionMap(), SysKeyboardAImpl_BuildActionMap(), and SysMouseAImpl_BuildActionMap().

◆ _dump_diactionformatA()

static void _dump_diactionformatA ( LPDIACTIONFORMATA  lpdiActionFormat)
static

Definition at line 308 of file dinput_main.c.

309{
310 unsigned int i;
311
312 TRACE("diaf.dwSize = %d\n", lpdiActionFormat->dwSize);
313 TRACE("diaf.dwActionSize = %d\n", lpdiActionFormat->dwActionSize);
314 TRACE("diaf.dwDataSize = %d\n", lpdiActionFormat->dwDataSize);
315 TRACE("diaf.dwNumActions = %d\n", lpdiActionFormat->dwNumActions);
316 TRACE("diaf.rgoAction = %p\n", lpdiActionFormat->rgoAction);
317 TRACE("diaf.guidActionMap = %s\n", debugstr_guid(&lpdiActionFormat->guidActionMap));
318 TRACE("diaf.dwGenre = 0x%08x\n", lpdiActionFormat->dwGenre);
319 TRACE("diaf.dwBufferSize = %d\n", lpdiActionFormat->dwBufferSize);
320 TRACE("diaf.lAxisMin = %d\n", lpdiActionFormat->lAxisMin);
321 TRACE("diaf.lAxisMax = %d\n", lpdiActionFormat->lAxisMax);
322 TRACE("diaf.hInstString = %p\n", lpdiActionFormat->hInstString);
323 TRACE("diaf.ftTimeStamp ...\n");
324 TRACE("diaf.dwCRC = 0x%x\n", lpdiActionFormat->dwCRC);
325 TRACE("diaf.tszActionMap = %s\n", debugstr_a(lpdiActionFormat->tszActionMap));
326 for (i = 0; i < lpdiActionFormat->dwNumActions; i++)
327 {
328 TRACE("diaf.rgoAction[%u]:\n", i);
329 TRACE("\tuAppData=0x%lx\n", lpdiActionFormat->rgoAction[i].uAppData);
330 TRACE("\tdwSemantic=0x%08x (%s)\n", lpdiActionFormat->rgoAction[i].dwSemantic, dump_semantic(lpdiActionFormat->rgoAction[i].dwSemantic));
331 TRACE("\tdwFlags=0x%x\n", lpdiActionFormat->rgoAction[i].dwFlags);
332 TRACE("\tszActionName=%s\n", debugstr_a(lpdiActionFormat->rgoAction[i].u.lptszActionName));
333 TRACE("\tguidInstance=%s\n", debugstr_guid(&lpdiActionFormat->rgoAction[i].guidInstance));
334 TRACE("\tdwObjID=0x%x\n", lpdiActionFormat->rgoAction[i].dwObjID);
335 TRACE("\tdwHow=0x%x\n", lpdiActionFormat->rgoAction[i].dwHow);
336 }
337}
static const char * dump_semantic(DWORD semantic)
Definition: dinput_main.c:294
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define TRACE(s)
Definition: solgame.cpp:4
LPCSTR lptszActionName
Definition: dinput.h:1266
CHAR tszActionMap[MAX_PATH]
Definition: dinput.h:1321
HINSTANCE hInstString
Definition: dinput.h:1318

Referenced by IDirectInput8AImpl_EnumDevicesBySemantics().

◆ _dump_DIDEVTYPE_value()

static const char * _dump_DIDEVTYPE_value ( DWORD  dwDevType,
DWORD  dwVersion 
)
static

Definition at line 242 of file dinput_main.c.

243{
244 if (dwVersion < 0x0800) {
245 switch (dwDevType) {
246 case 0: return "All devices";
247 case DIDEVTYPE_MOUSE: return "DIDEVTYPE_MOUSE";
248 case DIDEVTYPE_KEYBOARD: return "DIDEVTYPE_KEYBOARD";
249 case DIDEVTYPE_JOYSTICK: return "DIDEVTYPE_JOYSTICK";
250 case DIDEVTYPE_DEVICE: return "DIDEVTYPE_DEVICE";
251 default: return "Unknown";
252 }
253 } else {
254 switch (dwDevType) {
255 case DI8DEVCLASS_ALL: return "All devices";
256 case DI8DEVCLASS_POINTER: return "DI8DEVCLASS_POINTER";
257 case DI8DEVCLASS_KEYBOARD: return "DI8DEVCLASS_KEYBOARD";
258 case DI8DEVCLASS_DEVICE: return "DI8DEVCLASS_DEVICE";
259 case DI8DEVCLASS_GAMECTRL: return "DI8DEVCLASS_GAMECTRL";
260 default: return "Unknown";
261 }
262 }
263}
DWORD dwVersion
Definition: LocaleTests.cpp:63
#define DI8DEVCLASS_KEYBOARD
Definition: dinput.h:206
#define DI8DEVCLASS_ALL
Definition: dinput.h:203
#define DIDEVTYPE_JOYSTICK
Definition: dinput.h:200
#define DIDEVTYPE_KEYBOARD
Definition: dinput.h:199
#define DIDEVTYPE_MOUSE
Definition: dinput.h:198
#define DI8DEVCLASS_POINTER
Definition: dinput.h:205
#define DIDEVTYPE_DEVICE
Definition: dinput.h:197
#define DI8DEVCLASS_DEVICE
Definition: dinput.h:204
#define DI8DEVCLASS_GAMECTRL
Definition: dinput.h:207

Referenced by IDirectInputAImpl_EnumDevices(), and IDirectInputWImpl_EnumDevices().

◆ _dump_EnumDevices_dwFlags()

static void _dump_EnumDevices_dwFlags ( DWORD  dwFlags)
static

Definition at line 265 of file dinput_main.c.

266{
267 if (TRACE_ON(dinput)) {
268 unsigned int i;
269 static const struct {
270 DWORD mask;
271 const char *name;
272 } flags[] = {
273#define FE(x) { x, #x}
280#undef FE
281 };
282 TRACE(" flags: ");
283 if (dwFlags == 0) {
284 TRACE("DIEDFL_ALLDEVICES\n");
285 return;
286 }
287 for (i = 0; i < ARRAY_SIZE(flags); i++)
288 if (flags[i].mask & dwFlags)
289 TRACE("%s ",flags[i].name);
290 }
291 TRACE("\n");
292}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define DIEDFL_INCLUDEALIASES
Definition: dinput.h:193
#define DIEDFL_ALLDEVICES
Definition: dinput.h:190
#define DIEDFL_ATTACHEDONLY
Definition: dinput.h:191
#define DIEDFL_INCLUDEPHANTOMS
Definition: dinput.h:194
#define DIEDFL_INCLUDEHIDDEN
Definition: dinput.h:195
#define DIEDFL_FORCEFEEDBACK
Definition: dinput.h:192
#define FE(x)
#define TRACE_ON(x)
Definition: compat.h:75
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161
Definition: name.c:39
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by IDirectInputAImpl_EnumDevices(), and IDirectInputWImpl_EnumDevices().

◆ callwndproc_proc()

static LRESULT CALLBACK callwndproc_proc ( int  code,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1709 of file dinput_main.c.

1710{
1712 IDirectInputImpl *dinput;
1713 HWND foreground;
1714
1715 if (code != HC_ACTION || (msg->message != WM_KILLFOCUS &&
1716 msg->message != WM_ACTIVATEAPP && msg->message != WM_ACTIVATE))
1717 return CallNextHookEx( 0, code, wparam, lparam );
1718
1719 foreground = GetForegroundWindow();
1720
1722
1724 {
1726
1727 EnterCriticalSection( &dinput->crit );
1729 {
1730 if (!dev->acquired) continue;
1731
1732 if (msg->hwnd == dev->win && msg->hwnd != foreground)
1733 {
1734 TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev );
1735 IDirectInputDevice_Unacquire( &dev->IDirectInputDevice8A_iface );
1736 }
1737 }
1738 LeaveCriticalSection( &dinput->crit );
1739 }
1741
1742 return CallNextHookEx( 0, code, wparam, lparam );
1743}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define msg(x)
Definition: auth_time.c:54
#define IDirectInputDevice_Unacquire(p)
Definition: dinput.h:1609
static struct list direct_input_list
Definition: dinput_main.c:102
static CRITICAL_SECTION dinput_hook_crit
Definition: dinput_main.c:101
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
struct list devices_list
CRITICAL_SECTION crit
Definition: inflate.c:139
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
#define HC_ACTION
Definition: winuser.h:48
#define WM_ACTIVATE
Definition: winuser.h:1615
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define WM_ACTIVATEAPP
Definition: winuser.h:1635
#define WM_KILLFOCUS
Definition: winuser.h:1617

Referenced by check_dinput_hooks().

◆ check_dinput_events()

void check_dinput_events ( void  )

Definition at line 1900 of file dinput_main.c.

1901{
1902 /* Windows does not do that, but our current implementation of winex11
1903 * requires periodic event polling to forward events to the wineserver.
1904 *
1905 * We have to call this function from multiple places, because:
1906 * - some games do not explicitly poll for mouse events
1907 * (for example Culpa Innata)
1908 * - some games only poll the device, and neither keyboard nor mouse
1909 * (for example Civilization: Call to Power 2)
1910 */
1911#ifndef __REACTOS__
1913#endif
1914}
#define NULL
Definition: types.h:112
#define QS_ALLINPUT
Definition: winuser.h:906
DWORD WINAPI MsgWaitForMultipleObjectsEx(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask, _In_ DWORD dwFlags)

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

◆ check_dinput_hooks()

void check_dinput_hooks ( LPDIRECTINPUTDEVICE8W  iface,
BOOL  acquired 
)

Definition at line 1863 of file dinput_main.c.

1864{
1865 static HHOOK callwndproc_hook;
1866 static ULONG foreground_cnt;
1868
1870
1871 if (dev->dwCoopLevel & DISCL_FOREGROUND)
1872 {
1873 if (acquired)
1874 foreground_cnt++;
1875 else
1876 foreground_cnt--;
1877 }
1878
1879 if (foreground_cnt && !callwndproc_hook)
1882 else if (!foreground_cnt && callwndproc_hook)
1883 {
1884 UnhookWindowsHookEx( callwndproc_hook );
1885 callwndproc_hook = NULL;
1886 }
1887
1888 if (hook_thread_event) /* if thread is not started yet */
1889 {
1893 }
1894
1896
1898}
#define DISCL_FOREGROUND
Definition: dinput.h:965
static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
Definition: dinput_main.c:84
static LRESULT CALLBACK callwndproc_proc(int code, WPARAM wparam, LPARAM lparam)
Definition: dinput_main.c:1709
HINSTANCE DINPUT_instance
Definition: dinput_main.c:98
static HANDLE hook_thread_event
Definition: dinput_main.c:1818
static DWORD hook_thread_id
Definition: dinput_main.c:1817
#define CloseHandle
Definition: compat.h:739
#define INFINITE
Definition: serial.h:102
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
uint32_t ULONG
Definition: typedefs.h:59
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
HHOOK WINAPI SetWindowsHookExW(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_USER
Definition: winuser.h:1898
#define WH_CALLWNDPROC
Definition: winuser.h:34

Referenced by IDirectInputDevice2WImpl_Acquire(), and IDirectInputDevice2WImpl_Unacquire().

◆ check_hook_thread()

static BOOL check_hook_thread ( void  )
static

Definition at line 1828 of file dinput_main.c.

1829{
1830 static HANDLE hook_thread;
1832
1834
1835 TRACE("IDirectInputs left: %d\n", list_count(&direct_input_list));
1836 if (!list_empty(&direct_input_list) && !hook_thread)
1837 {
1838 GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (const WCHAR*)DINPUT_instance, &module);
1841 }
1842 else if (list_empty(&direct_input_list) && hook_thread)
1843 {
1845
1846 if (hook_thread_event) /* if thread is not started yet */
1847 {
1851 }
1852
1853 hook_thread_id = 0;
1854 PostThreadMessageW(tid, WM_USER+0x10, 0, 0);
1855 CloseHandle(hook_thread);
1856 hook_thread = NULL;
1857 }
1858
1860 return hook_thread_id != 0;
1861}
static int list_empty(struct list_entry *head)
Definition: list.h:58
static DWORD WINAPI hook_thread_proc(void *param)
Definition: dinput_main.c:1745
#define FALSE
Definition: types.h:117
BOOL WINAPI GetModuleHandleExW(IN DWORD dwFlags, IN LPCWSTR lpwModuleName OPTIONAL, OUT HMODULE *phModule)
Definition: loader.c:866
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
static TfClientId tid
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
Definition: list.h:155
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by initialize_directinput_instance(), and uninitialize_directinput_instance().

◆ create_device()

static HRESULT create_device ( IDirectInputImpl This,
REFGUID  rguid,
REFIID  riid,
LPVOID pvOut,
BOOL  unicode 
)
static

Definition at line 798 of file dinput_main.c.

799{
800 unsigned int i;
801
802 if (pvOut)
803 *pvOut = NULL;
804
805 if (!rguid || !pvOut)
806 return E_POINTER;
807
808 if (!This->initialized)
810
811 /* Loop on all the devices to see if anyone matches the given GUID */
812 for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
813 {
814 HRESULT ret;
815
816 if (!dinput_devices[i]->create_device) continue;
817 if ((ret = dinput_devices[i]->create_device(This, rguid, riid, pvOut, unicode)) == DI_OK)
818 return DI_OK;
819 }
820
821 WARN("invalid device GUID %s\n", debugstr_guid(rguid));
822 return DIERR_DEVICENOTREG;
823}
#define WARN(fmt,...)
Definition: precomp.h:61
#define DIERR_DEVICENOTREG
Definition: dinput.h:147
#define DI_OK
Definition: dinput.h:128
#define DIERR_NOTINITIALIZED
Definition: dinput.h:157
static const struct dinput_device * dinput_devices[]
Definition: dinput_main.c:89
static HRESULT create_device(IDirectInputImpl *This, REFGUID rguid, REFIID riid, LPVOID *pvOut, BOOL unicode)
Definition: dinput_main.c:798
REFIID riid
Definition: atlbase.h:39
int ret
#define E_POINTER
Definition: winerror.h:2365

Referenced by create_device(), IDirectInput7AImpl_CreateDeviceEx(), and IDirectInput7WImpl_CreateDeviceEx().

◆ create_directinput_instance()

static HRESULT create_directinput_instance ( REFIID  riid,
LPVOID ppDI,
IDirectInputImpl **  out 
)
static

Definition at line 107 of file dinput_main.c.

108{
110 HRESULT hr;
111
112 if (!This)
113 return E_OUTOFMEMORY;
114
115 This->IDirectInput7A_iface.lpVtbl = &ddi7avt;
116 This->IDirectInput7W_iface.lpVtbl = &ddi7wvt;
117 This->IDirectInput8A_iface.lpVtbl = &ddi8avt;
118 This->IDirectInput8W_iface.lpVtbl = &ddi8wvt;
119 This->IDirectInputJoyConfig8_iface.lpVtbl = &JoyConfig8vt;
120
121 hr = IDirectInput_QueryInterface( &This->IDirectInput7A_iface, riid, ppDI );
122 if (FAILED(hr))
123 {
125 return hr;
126 }
127
128 if (out) *out = This;
129 return DI_OK;
130}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define IDirectInput_QueryInterface(p, a, b)
Definition: dinput.h:2292
static const IDirectInput7AVtbl ddi7avt
Definition: dinput_main.c:58
static const IDirectInput7WVtbl ddi7wvt
Definition: dinput_main.c:59
static const IDirectInput8WVtbl ddi8wvt
Definition: dinput_main.c:61
static const IDirectInput8AVtbl ddi8avt
Definition: dinput_main.c:60
static const IDirectInputJoyConfig8Vtbl JoyConfig8vt
Definition: dinput_main.c:62
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define FAILED(hr)
Definition: intsafe.h:51
static FILE * out
Definition: regtests2xml.c:44
HRESULT hr
Definition: shlfolder.c:183

Referenced by DICF_CreateInstance(), DirectInput8Create(), and DirectInputCreateEx().

◆ diactionformat_priorityA()

static DWORD diactionformat_priorityA ( LPDIACTIONFORMATA  lpdiaf,
DWORD  genre 
)
static

Definition at line 399 of file dinput_main.c.

400{
401 int i;
402 DWORD priorityFlags = 0;
403
404 /* If there's at least one action for the device it's priority 1 */
405 for(i=0; i < lpdiaf->dwNumActions; i++)
406 if ((lpdiaf->rgoAction[i].dwSemantic & genre) == genre)
407 priorityFlags |= DIEDBS_MAPPEDPRI1;
408
409 return priorityFlags;
410}
#define DIEDBS_MAPPEDPRI1
Definition: dinput.h:445

Referenced by IDirectInput8AImpl_EnumDevicesBySemantics().

◆ diactionformat_priorityW()

static DWORD diactionformat_priorityW ( LPDIACTIONFORMATW  lpdiaf,
DWORD  genre 
)
static

Definition at line 412 of file dinput_main.c.

413{
414 int i;
415 DWORD priorityFlags = 0;
416
417 /* If there's at least one action for the device it's priority 1 */
418 for(i=0; i < lpdiaf->dwNumActions; i++)
419 if ((lpdiaf->rgoAction[i].dwSemantic & genre) == genre)
420 priorityFlags |= DIEDBS_MAPPEDPRI1;
421
422 return priorityFlags;
423}

Referenced by IDirectInput8WImpl_EnumDevicesBySemantics().

◆ DICF_AddRef()

static ULONG WINAPI DICF_AddRef ( LPCLASSFACTORY  iface)
static

Definition at line 1590 of file dinput_main.c.

1590 {
1592 return InterlockedIncrement(&(This->ref));
1593}
#define InterlockedIncrement
Definition: armddk.h:53
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: dinput_main.c:1578

◆ DICF_CreateInstance()

static HRESULT WINAPI DICF_CreateInstance ( LPCLASSFACTORY  iface,
LPUNKNOWN  pOuter,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 1601 of file dinput_main.c.

1603 {
1605
1606 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
1607 if ( IsEqualGUID( &IID_IUnknown, riid ) ||
1608 IsEqualGUID( &IID_IDirectInputA, riid ) ||
1609 IsEqualGUID( &IID_IDirectInputW, riid ) ||
1610 IsEqualGUID( &IID_IDirectInput2A, riid ) ||
1611 IsEqualGUID( &IID_IDirectInput2W, riid ) ||
1612 IsEqualGUID( &IID_IDirectInput7A, riid ) ||
1613 IsEqualGUID( &IID_IDirectInput7W, riid ) ||
1614 IsEqualGUID( &IID_IDirectInput8A, riid ) ||
1615 IsEqualGUID( &IID_IDirectInput8W, riid ) )
1616 {
1617 return create_directinput_instance(riid, ppobj, NULL);
1618 }
1619
1620 FIXME("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
1621 return E_NOINTERFACE;
1622}
#define FIXME(fmt,...)
Definition: precomp.h:53
const GUID IID_IUnknown
static HRESULT create_directinput_instance(REFIID riid, LPVOID *ppDI, IDirectInputImpl **out)
Definition: dinput_main.c:107
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ DICF_LockServer()

static HRESULT WINAPI DICF_LockServer ( LPCLASSFACTORY  iface,
BOOL  dolock 
)
static

Definition at line 1624 of file dinput_main.c.

1624 {
1626 FIXME("(%p)->(%d),stub!\n",This,dolock);
1627 return S_OK;
1628}
#define S_OK
Definition: intsafe.h:52

◆ DICF_QueryInterface()

static HRESULT WINAPI DICF_QueryInterface ( LPCLASSFACTORY  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 1583 of file dinput_main.c.

1583 {
1585
1586 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
1587 return E_NOINTERFACE;
1588}

◆ DICF_Release()

static ULONG WINAPI DICF_Release ( LPCLASSFACTORY  iface)
static

Definition at line 1595 of file dinput_main.c.

1595 {
1597 /* static class, won't be freed */
1598 return InterlockedDecrement(&(This->ref));
1599}
#define InterlockedDecrement
Definition: armddk.h:52

◆ DirectInput8Create()

HRESULT WINAPI DECLSPEC_HOTPATCH DirectInput8Create ( HINSTANCE  hinst,
DWORD  version,
REFIID  iid,
void **  out,
IUnknown outer 
)

Definition at line 172 of file dinput_main.c.

174{
176 HRESULT hr;
177
178 TRACE("hinst %p, version %#x, iid %s, out %p, outer %p.\n",
179 hinst, version, debugstr_guid(iid), out, outer);
180
181 if (!out)
182 return E_POINTER;
183
184 if (!IsEqualGUID(&IID_IDirectInput8A, iid) &&
185 !IsEqualGUID(&IID_IDirectInput8W, iid) &&
187 {
188 *out = NULL;
189 return DIERR_NOINTERFACE;
190 }
191
193
194 if (FAILED(hr))
195 {
196 ERR("Failed to create DirectInput, hr %#x.\n", hr);
197 return hr;
198 }
199
200 /* When aggregation is used, the application needs to manually call Initialize(). */
201 if (!outer && IsEqualGUID(&IID_IDirectInput8A, iid))
202 {
203 hr = IDirectInput8_Initialize(&This->IDirectInput8A_iface, hinst, version);
204 if (FAILED(hr))
205 {
206 IDirectInput8_Release(&This->IDirectInput8A_iface);
207 *out = NULL;
208 return hr;
209 }
210 }
211
212 if (!outer && IsEqualGUID(&IID_IDirectInput8W, iid))
213 {
214 hr = IDirectInput8_Initialize(&This->IDirectInput8W_iface, hinst, version);
215 if (FAILED(hr))
216 {
217 IDirectInput8_Release(&This->IDirectInput8W_iface);
218 *out = NULL;
219 return hr;
220 }
221 }
222
223 return S_OK;
224}
#define ERR(fmt,...)
Definition: precomp.h:57
#define DIERR_NOINTERFACE
Definition: dinput.h:153
#define IDirectInput8_Initialize(p, a, b)
Definition: dinput.h:2517
#define IDirectInput8_Release(p)
Definition: dinput.h:2511
static const WCHAR version[]
Definition: asmname.c:66
static HINSTANCE hinst
Definition: edit.c:551

Referenced by InitializeDirectInputDialog(), test_CreateDevice(), test_DirectInput8Create(), test_EnumDevices(), test_EnumDevicesBySemantics(), test_GetDeviceStatus(), test_Initialize(), test_QueryInterface(), and test_RunControlPanel().

◆ DirectInputCreateA()

HRESULT WINAPI DECLSPEC_HOTPATCH DirectInputCreateA ( HINSTANCE  hinst,
DWORD  dwVersion,
LPDIRECTINPUTA ppDI,
LPUNKNOWN  punkOuter 
)

Definition at line 229 of file dinput_main.c.

230{
231 return DirectInputCreateEx(hinst, dwVersion, &IID_IDirectInput7A, (LPVOID *)ppDI, punkOuter);
232}
HRESULT WINAPI DirectInputCreateEx(HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI, LPUNKNOWN punkOuter)
Definition: dinput_main.c:135

Referenced by joystick_tests(), mouse_tests(), test_CreateDevice(), test_DirectInputJoyConfig8(), test_enum_feedback(), test_EnumDevices(), test_GetDeviceStatus(), test_QueryInterface(), and test_RunControlPanel().

◆ DirectInputCreateEx()

HRESULT WINAPI DirectInputCreateEx ( HINSTANCE  hinst,
DWORD  dwVersion,
REFIID  riid,
LPVOID ppDI,
LPUNKNOWN  punkOuter 
)

Definition at line 135 of file dinput_main.c.

138{
140 HRESULT hr;
141
142 TRACE("(%p,%04x,%s,%p,%p)\n", hinst, dwVersion, debugstr_guid(riid), ppDI, punkOuter);
143
144 if (IsEqualGUID( &IID_IDirectInputA, riid ) ||
145 IsEqualGUID( &IID_IDirectInput2A, riid ) ||
146 IsEqualGUID( &IID_IDirectInput7A, riid ) ||
147 IsEqualGUID( &IID_IDirectInputW, riid ) ||
148 IsEqualGUID( &IID_IDirectInput2W, riid ) ||
149 IsEqualGUID( &IID_IDirectInput7W, riid ))
150 {
152 if (FAILED(hr))
153 return hr;
154 }
155 else
156 return DIERR_NOINTERFACE;
157
158 hr = IDirectInput_Initialize( &This->IDirectInput7A_iface, hinst, dwVersion );
159 if (FAILED(hr))
160 {
161 IDirectInput_Release( &This->IDirectInput7A_iface );
162 *ppDI = NULL;
163 return hr;
164 }
165
166 return DI_OK;
167}
#define IDirectInput_Release(p)
Definition: dinput.h:2294
#define IDirectInput_Initialize(p, a, b)
Definition: dinput.h:2300

Referenced by DirectInputCreateA(), and DirectInputCreateW().

◆ DirectInputCreateW()

HRESULT WINAPI DECLSPEC_HOTPATCH DirectInputCreateW ( HINSTANCE  hinst,
DWORD  dwVersion,
LPDIRECTINPUTW ppDI,
LPUNKNOWN  punkOuter 
)

Definition at line 237 of file dinput_main.c.

238{
239 return DirectInputCreateEx(hinst, dwVersion, &IID_IDirectInput7W, (LPVOID *)ppDI, punkOuter);
240}

◆ DllCanUnloadNow()

HRESULT WINAPI DllCanUnloadNow ( void  )

Definition at line 1642 of file dinput_main.c.

1643{
1644 return S_FALSE;
1645}
#define S_FALSE
Definition: winerror.h:2357

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)

Definition at line 1650 of file dinput_main.c.

1651{
1652 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
1653 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
1654 *ppv = &DINPUT_CF;
1655 IClassFactory_AddRef((IClassFactory*)*ppv);
1656 return S_OK;
1657 }
1658
1659 FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
1661}
const GUID IID_IClassFactory
static IClassFactoryImpl DINPUT_CF
Definition: dinput_main.c:1637
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  inst,
DWORD  reason,
LPVOID  reserved 
)

Definition at line 1916 of file dinput_main.c.

1917{
1918 switch(reason)
1919 {
1920 case DLL_PROCESS_ATTACH:
1922 DINPUT_instance = inst;
1923 break;
1924 case DLL_PROCESS_DETACH:
1925 if (reserved) break;
1927 break;
1928 }
1929 return TRUE;
1930}
#define TRUE
Definition: types.h:120
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
r reserved
Definition: btrfs.c:3006
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 1666 of file dinput_main.c.

1667{
1669}
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 1674 of file dinput_main.c.

1675{
1677}
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110

◆ dump_semantic()

static const char * dump_semantic ( DWORD  semantic)
static

Definition at line 294 of file dinput_main.c.

295{
296 if((semantic & 0xff000000) == 0xff000000)
297 return "Any AXIS";
298 else if((semantic & 0x82000000) == 0x82000000)
299 return "Mouse";
300 else if((semantic & 0x81000000) == 0x81000000)
301 return "Keybaord";
303 return "Helicopter";
304
305 return "Unknown";
306}
#define DIVIRTUAL_FLYING_HELICOPTER
Definition: dinput.h:2196

Referenced by _dump_diactionformatA().

◆ hook_thread_proc()

static DWORD WINAPI hook_thread_proc ( void param)
static

Definition at line 1745 of file dinput_main.c.

1746{
1747 static HHOOK kbd_hook, mouse_hook;
1748 MSG msg;
1749
1750 /* Force creation of the message queue */
1751 PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE );
1752 SetEvent(param);
1753
1754 while (GetMessageW( &msg, 0, 0, 0 ))
1755 {
1756 UINT kbd_cnt = 0, mice_cnt = 0;
1757
1758 if (msg.message == WM_USER+0x10)
1759 {
1760 IDirectInputImpl *dinput;
1761
1762 TRACE( "Processing hook change notification lp:%ld\n", msg.lParam );
1763
1764 if (!msg.wParam && !msg.lParam)
1765 {
1767 if (mouse_hook) UnhookWindowsHookEx( mouse_hook );
1768 kbd_hook = mouse_hook = NULL;
1769 break;
1770 }
1771
1773
1774 /* Count acquired keyboards and mice*/
1776 {
1778
1779 EnterCriticalSection( &dinput->crit );
1781 {
1782 if (!dev->acquired || !dev->event_proc) continue;
1783
1784 if (IsEqualGUID( &dev->guid, &GUID_SysKeyboard ))
1785 kbd_cnt++;
1786 else
1787 if (IsEqualGUID( &dev->guid, &GUID_SysMouse ))
1788 mice_cnt++;
1789 }
1790 LeaveCriticalSection( &dinput->crit );
1791 }
1793
1794 if (kbd_cnt && !kbd_hook)
1796 else if (!kbd_cnt && kbd_hook)
1797 {
1799 kbd_hook = NULL;
1800 }
1801
1802 if (mice_cnt && !mouse_hook)
1804 else if (!mice_cnt && mouse_hook)
1805 {
1806 UnhookWindowsHookEx( mouse_hook );
1807 mouse_hook = NULL;
1808 }
1809 }
1812 }
1813
1815}
@ kbd_hook
Definition: SystemMenu.c:37
static LRESULT CALLBACK LL_hook_proc(int code, WPARAM wparam, LPARAM lparam)
Definition: dinput_main.c:1683
VOID WINAPI FreeLibraryAndExitThread(HMODULE hLibModule, DWORD dwExitCode)
Definition: loader.c:507
GLfloat param
Definition: glext.h:5796
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define WH_MOUSE_LL
Definition: winuser.h:44
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define WH_KEYBOARD_LL
Definition: winuser.h:43
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define PM_NOREMOVE
Definition: winuser.h:1198

Referenced by check_hook_thread().

◆ IDirectInput2AImpl_FindDevice()

static HRESULT WINAPI IDirectInput2AImpl_FindDevice ( LPDIRECTINPUT7A  iface,
REFGUID  rguid,
LPCSTR  pszName,
LPGUID  pguidInstance 
)
static

Definition at line 778 of file dinput_main.c.

780{
782
783 FIXME( "(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), pszName, pguidInstance );
784
785 return DI_OK;
786}
static IDirectInputImpl * impl_from_IDirectInput7A(IDirectInput7A *iface)
Definition: dinput_main.c:64

Referenced by IDirectInput8AImpl_FindDevice().

◆ IDirectInput2WImpl_FindDevice()

static HRESULT WINAPI IDirectInput2WImpl_FindDevice ( LPDIRECTINPUT7W  iface,
REFGUID  rguid,
LPCWSTR  pszName,
LPGUID  pguidInstance 
)
static

Definition at line 788 of file dinput_main.c.

790{
792
793 FIXME( "(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), debugstr_w(pszName), pguidInstance );
794
795 return DI_OK;
796}
static IDirectInputImpl * impl_from_IDirectInput7W(IDirectInput7W *iface)
Definition: dinput_main.c:69
#define debugstr_w
Definition: kernel32.h:32

Referenced by IDirectInput8WImpl_FindDevice().

◆ IDirectInput7AImpl_CreateDeviceEx()

static HRESULT WINAPI IDirectInput7AImpl_CreateDeviceEx ( LPDIRECTINPUT7A  iface,
REFGUID  rguid,
REFIID  riid,
LPVOID pvOut,
LPUNKNOWN  lpUnknownOuter 
)
static

Definition at line 825 of file dinput_main.c.

827{
829
830 TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter);
831
832 return create_device(This, rguid, riid, pvOut, FALSE);
833}

Referenced by IDirectInput8AImpl_CreateDevice(), and IDirectInputAImpl_CreateDevice().

◆ IDirectInput7WImpl_CreateDeviceEx()

static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx ( LPDIRECTINPUT7W  iface,
REFGUID  rguid,
REFIID  riid,
LPVOID pvOut,
LPUNKNOWN  lpUnknownOuter 
)
static

Definition at line 835 of file dinput_main.c.

837{
839
840 TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter);
841
842 return create_device(This, rguid, riid, pvOut, TRUE);
843}

Referenced by IDirectInput8WImpl_CreateDevice(), and IDirectInputWImpl_CreateDevice().

◆ IDirectInput8AImpl_AddRef()

static ULONG WINAPI IDirectInput8AImpl_AddRef ( LPDIRECTINPUT8A  iface)
static

Definition at line 861 of file dinput_main.c.

862{
864 return IDirectInputAImpl_AddRef( &This->IDirectInput7A_iface );
865}
static IDirectInputImpl * impl_from_IDirectInput8A(IDirectInput8A *iface)
Definition: dinput_main.c:74
static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface)
Definition: dinput_main.c:540

◆ IDirectInput8AImpl_ConfigureDevices()

static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices ( LPDIRECTINPUT8A  iface,
LPDICONFIGUREDEVICESCALLBACK  lpdiCallback,
LPDICONFIGUREDEVICESPARAMSA  lpdiCDParams,
DWORD  dwFlags,
LPVOID  pvRefData 
)
static

Definition at line 1255 of file dinput_main.c.

1259{
1261 DIACTIONFORMATW diafW;
1262 DICONFIGUREDEVICESPARAMSW diCDParamsW;
1263 HRESULT hr;
1264 int i;
1265
1266 FIXME("(this=%p,%p,%p,%04x,%p): stub\n", This, lpdiCallback, lpdiCDParams, dwFlags, pvRefData);
1267
1268 /* Copy parameters */
1269 diCDParamsW.dwSize = sizeof(DICONFIGUREDEVICESPARAMSW);
1270 diCDParamsW.dwcUsers = lpdiCDParams->dwcUsers;
1271 diCDParamsW.dwcFormats = lpdiCDParams->dwcFormats;
1272 diCDParamsW.lprgFormats = &diafW;
1273 diCDParamsW.hwnd = lpdiCDParams->hwnd;
1274 diCDParamsW.lptszUserNames = NULL;
1275
1276 if (lpdiCDParams->lptszUserNames) {
1277 char *start = lpdiCDParams->lptszUserNames;
1278 WCHAR *to = NULL;
1279 int total_len = 0;
1280 for (i = 0; i < lpdiCDParams->dwcUsers; i++)
1281 {
1282 char *end = start + 1;
1283 int len;
1284 while (*(end++));
1286 total_len += len + 2; /* length of string and two null char */
1287 if (to)
1288 to = HeapReAlloc(GetProcessHeap(), 0, to, sizeof(WCHAR) * total_len);
1289 else
1290 to = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * total_len);
1291
1292 MultiByteToWideChar(CP_ACP, 0, start, end - start, to + (total_len - len - 2), len);
1293 to[total_len] = 0;
1294 to[total_len - 1] = 0;
1295 }
1296 diCDParamsW.lptszUserNames = to;
1297 }
1298
1299 diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiCDParams->lprgFormats->dwNumActions);
1300 _copy_diactionformatAtoW(&diafW, lpdiCDParams->lprgFormats);
1301
1302 /* Copy action names */
1303 for (i=0; i < diafW.dwNumActions; i++)
1304 {
1305 const char* from = lpdiCDParams->lprgFormats->rgoAction[i].u.lptszActionName;
1306 int len = MultiByteToWideChar(CP_ACP, 0, from , -1, NULL , 0);
1307 WCHAR *to = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len);
1308
1309 MultiByteToWideChar(CP_ACP, 0, from , -1, to , len);
1310 diafW.rgoAction[i].u.lptszActionName = to;
1311 }
1312
1313 hr = IDirectInput8WImpl_ConfigureDevices(&This->IDirectInput8W_iface, lpdiCallback, &diCDParamsW, dwFlags, pvRefData);
1314
1315 /* Copy back configuration */
1316 if (SUCCEEDED(hr))
1317 _copy_diactionformatWtoA(lpdiCDParams->lprgFormats, &diafW);
1318
1319 /* Free memory */
1320 for (i=0; i < diafW.dwNumActions; i++)
1321 HeapFree(GetProcessHeap(), 0, (void*) diafW.rgoAction[i].u.lptszActionName);
1322
1323 HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
1324
1325 heap_free((void*) diCDParamsW.lptszUserNames);
1326
1327 return hr;
1328}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
struct _DICONFIGUREDEVICESPARAMSW DICONFIGUREDEVICESPARAMSW
static HRESULT WINAPI IDirectInput8WImpl_ConfigureDevices(LPDIRECTINPUT8W iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData)
Definition: dinput_main.c:1242
void _copy_diactionformatWtoA(LPDIACTIONFORMATA to, LPDIACTIONFORMATW from)
Definition: dinput_main.c:366
void _copy_diactionformatAtoW(LPDIACTIONFORMATW to, LPDIACTIONFORMATA from)
Definition: dinput_main.c:339
#define CP_ACP
Definition: compat.h:109
#define HeapReAlloc
Definition: compat.h:734
#define MultiByteToWideChar
Definition: compat.h:110
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLenum GLsizei len
Definition: glext.h:6722
#define SUCCEEDED(hr)
Definition: intsafe.h:50
LPCWSTR lptszActionName
Definition: dinput.h:1280
LPDIACTIONFORMATA lprgFormats
Definition: dinput.h:1387
LPDIACTIONFORMATW lprgFormats
Definition: dinput.h:1399

◆ IDirectInput8AImpl_CreateDevice()

static HRESULT WINAPI IDirectInput8AImpl_CreateDevice ( LPDIRECTINPUT8A  iface,
REFGUID  rguid,
LPDIRECTINPUTDEVICE8A pdev,
LPUNKNOWN  punk 
)
static

Definition at line 897 of file dinput_main.c.

899{
901 return IDirectInput7AImpl_CreateDeviceEx( &This->IDirectInput7A_iface, rguid, NULL, (LPVOID*)pdev, punk );
902}
static HRESULT WINAPI IDirectInput7AImpl_CreateDeviceEx(LPDIRECTINPUT7A iface, REFGUID rguid, REFIID riid, LPVOID *pvOut, LPUNKNOWN lpUnknownOuter)
Definition: dinput_main.c:825

◆ IDirectInput8AImpl_EnumDevices()

static HRESULT WINAPI IDirectInput8AImpl_EnumDevices ( LPDIRECTINPUT8A  iface,
DWORD  dwDevType,
LPDIENUMDEVICESCALLBACKA  lpCallback,
LPVOID  pvRef,
DWORD  dwFlags 
)
static

Definition at line 911 of file dinput_main.c.

913{
915 return IDirectInputAImpl_EnumDevices( &This->IDirectInput7A_iface, dwDevType, lpCallback, pvRef, dwFlags );
916}
static HRESULT WINAPI IDirectInputAImpl_EnumDevices(LPDIRECTINPUT7A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:461

◆ IDirectInput8AImpl_EnumDevicesBySemantics()

static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics ( LPDIRECTINPUT8A  iface,
LPCSTR  ptszUserName,
LPDIACTIONFORMATA  lpdiActionFormat,
LPDIENUMDEVICESBYSEMANTICSCBA  lpCallback,
LPVOID  pvRef,
DWORD  dwFlags 
)
static

Definition at line 1026 of file dinput_main.c.

1031{
1032 static REFGUID guids[2] = { &GUID_SysKeyboard, &GUID_SysMouse };
1033 static const DWORD actionMasks[] = { DIKEYBOARD_MASK, DIMOUSE_MASK };
1035 DIDEVICEINSTANCEA didevi;
1037 DWORD callbackFlags;
1038 int i, j;
1039 int device_count = 0;
1040 int remain;
1041 DIDEVICEINSTANCEA *didevis = 0;
1042 WCHAR *username_w = 0;
1043
1044 FIXME("(this=%p,%s,%p,%p,%p,%04x): semi-stub\n", This, debugstr_a(ptszUserName), lpdiActionFormat,
1045 lpCallback, pvRef, dwFlags);
1046#define X(x) if (dwFlags & x) FIXME("\tdwFlags |= "#x"\n");
1053#undef X
1054
1055 _dump_diactionformatA(lpdiActionFormat);
1056
1057 didevi.dwSize = sizeof(didevi);
1058
1059 if (ptszUserName)
1060 {
1061 int len = MultiByteToWideChar(CP_ACP, 0, ptszUserName, -1, 0, 0);
1062
1063 username_w = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len);
1064 MultiByteToWideChar(CP_ACP, 0, ptszUserName, -1, username_w, len);
1065 }
1066
1067 /* Enumerate all the joysticks */
1068 for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
1069 {
1070 HRESULT enumSuccess;
1071
1072 if (!dinput_devices[i]->enum_deviceA) continue;
1073
1074 for (j = 0, enumSuccess = S_OK; SUCCEEDED(enumSuccess); j++)
1075 {
1076 TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
1077
1078 /* Default behavior is to enumerate attached game controllers */
1079 enumSuccess = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
1080 if (enumSuccess == S_OK &&
1081 should_enumerate_device(username_w, dwFlags, &This->device_players, &didevi.guidInstance))
1082 {
1083 if (device_count++)
1084 didevis = HeapReAlloc(GetProcessHeap(), 0, didevis, sizeof(DIDEVICEINSTANCEA)*device_count);
1085 else
1086 didevis = HeapAlloc(GetProcessHeap(), 0, sizeof(DIDEVICEINSTANCEA)*device_count);
1087 didevis[device_count-1] = didevi;
1088 }
1089 }
1090 }
1091
1092 remain = device_count;
1093 /* Add keyboard and mouse to remaining device count */
1095 {
1096 for (i = 0; i < ARRAY_SIZE(guids); i++)
1097 {
1098 if (should_enumerate_device(username_w, dwFlags, &This->device_players, guids[i]))
1099 remain++;
1100 }
1101 }
1102
1103 for (i = 0; i < device_count; i++)
1104 {
1105 callbackFlags = diactionformat_priorityA(lpdiActionFormat, lpdiActionFormat->dwGenre);
1106 IDirectInput_CreateDevice(iface, &didevis[i].guidInstance, &lpdid, NULL);
1107
1108 if (lpCallback(&didevis[i], lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP)
1109 {
1111 HeapFree(GetProcessHeap(), 0, didevis);
1112 HeapFree(GetProcessHeap(), 0, username_w);
1113 return DI_OK;
1114 }
1116 }
1117
1118 HeapFree(GetProcessHeap(), 0, didevis);
1119
1121 {
1122 HeapFree(GetProcessHeap(), 0, username_w);
1123 return DI_OK;
1124 }
1125
1126 /* Enumerate keyboard and mouse */
1127 for (i = 0; i < ARRAY_SIZE(guids); i++)
1128 {
1129 if (should_enumerate_device(username_w, dwFlags, &This->device_players, guids[i]))
1130 {
1131 callbackFlags = diactionformat_priorityA(lpdiActionFormat, actionMasks[i]);
1132
1133 IDirectInput_CreateDevice(iface, guids[i], &lpdid, NULL);
1134 IDirectInputDevice_GetDeviceInfo(lpdid, &didevi);
1135
1136 if (lpCallback(&didevi, lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP)
1137 {
1139 HeapFree(GetProcessHeap(), 0, username_w);
1140 return DI_OK;
1141 }
1143 }
1144 }
1145
1146 HeapFree(GetProcessHeap(), 0, username_w);
1147 return DI_OK;
1148}
#define DIEDBSFL_MULTIMICEKEYBOARDS
Definition: dinput.h:454
#define DIENUM_STOP
Definition: dinput.h:187
struct IDirectInputDevice8A * LPDIRECTINPUTDEVICE8A
Definition: dinput.h:105
#define DIEDBSFL_AVAILABLEDEVICES
Definition: dinput.h:453
#define DIEDBSFL_ATTACHEDONLY
Definition: dinput.h:450
#define IDirectInputDevice_GetDeviceInfo(p, a)
Definition: dinput.h:1616
#define IDirectInput_CreateDevice(p, a, b, c)
Definition: dinput.h:2296
#define DIEDBSFL_THISUSER
Definition: dinput.h:451
#define DIEDBSFL_FORCEFEEDBACK
Definition: dinput.h:452
#define IDirectInputDevice_Release(p)
Definition: dinput.h:1602
#define DIEDBSFL_NONGAMINGDEVICES
Definition: dinput.h:455
static DWORD diactionformat_priorityA(LPDIACTIONFORMATA lpdiaf, DWORD genre)
Definition: dinput_main.c:399
static void _dump_diactionformatA(LPDIACTIONFORMATA lpdiActionFormat)
Definition: dinput_main.c:308
#define X(x)
static BOOL should_enumerate_device(const WCHAR *username, DWORD dwFlags, struct list *device_players, REFGUID guid)
Definition: dinput_main.c:985
#define DIMOUSE_MASK
#define DIKEYBOARD_MASK
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
GUID guidInstance
Definition: dinput.h:413
Definition: scsiwmi.h:51

◆ IDirectInput8AImpl_FindDevice()

static HRESULT WINAPI IDirectInput8AImpl_FindDevice ( LPDIRECTINPUT8A  iface,
REFGUID  rguid,
LPCSTR  pszName,
LPGUID  pguidInstance 
)
static

Definition at line 973 of file dinput_main.c.

974{
976 return IDirectInput2AImpl_FindDevice( &This->IDirectInput7A_iface, rguid, pszName, pguidInstance );
977}
static HRESULT WINAPI IDirectInput2AImpl_FindDevice(LPDIRECTINPUT7A iface, REFGUID rguid, LPCSTR pszName, LPGUID pguidInstance)
Definition: dinput_main.c:778

◆ IDirectInput8AImpl_GetDeviceStatus()

static HRESULT WINAPI IDirectInput8AImpl_GetDeviceStatus ( LPDIRECTINPUT8A  iface,
REFGUID  rguid 
)
static

Definition at line 925 of file dinput_main.c.

926{
928 return IDirectInputAImpl_GetDeviceStatus( &This->IDirectInput7A_iface, rguid );
929}
static HRESULT WINAPI IDirectInputAImpl_GetDeviceStatus(LPDIRECTINPUT7A iface, REFGUID rguid)
Definition: dinput_main.c:719

◆ IDirectInput8AImpl_Initialize()

static HRESULT WINAPI IDirectInput8AImpl_Initialize ( LPDIRECTINPUT8A  iface,
HINSTANCE  hinst,
DWORD  version 
)
static

Definition at line 949 of file dinput_main.c.

950{
952
953 TRACE("(%p)->(%p, 0x%04x)\n", This, hinst, version);
954
955 if (!hinst)
956 return DIERR_INVALIDPARAM;
957 else if (version == 0)
959 else if (version < DIRECTINPUT_VERSION)
961 else if (version > DIRECTINPUT_VERSION)
963
965}
#define DIRECTINPUT_VERSION
Definition: precomp.h:4
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
#define DIERR_OLDDIRECTINPUTVERSION
Definition: dinput.h:141
#define DIERR_BETADIRECTINPUTVERSION
Definition: dinput.h:143
static HRESULT initialize_directinput_instance(IDirectInputImpl *This, DWORD dwVersion)
Definition: dinput_main.c:628

Referenced by IDirectInput8WImpl_Initialize().

◆ IDirectInput8AImpl_QueryInterface()

static HRESULT WINAPI IDirectInput8AImpl_QueryInterface ( LPDIRECTINPUT8A  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 873 of file dinput_main.c.

874{
876 return IDirectInputAImpl_QueryInterface( &This->IDirectInput7A_iface, riid, ppobj );
877}
static HRESULT WINAPI IDirectInputAImpl_QueryInterface(LPDIRECTINPUT7A iface, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:577

◆ IDirectInput8AImpl_Release()

static ULONG WINAPI IDirectInput8AImpl_Release ( LPDIRECTINPUT8A  iface)
static

Definition at line 885 of file dinput_main.c.

886{
888 return IDirectInputAImpl_Release( &This->IDirectInput7A_iface );
889}
static ULONG WINAPI IDirectInputAImpl_Release(LPDIRECTINPUT7A iface)
Definition: dinput_main.c:555

◆ IDirectInput8AImpl_RunControlPanel()

static HRESULT WINAPI IDirectInput8AImpl_RunControlPanel ( LPDIRECTINPUT8A  iface,
HWND  hwndOwner,
DWORD  dwFlags 
)
static

Definition at line 937 of file dinput_main.c.

938{
940 return IDirectInputAImpl_RunControlPanel( &This->IDirectInput7A_iface, hwndOwner, dwFlags );
941}
static HRESULT WINAPI IDirectInputAImpl_RunControlPanel(LPDIRECTINPUT7A iface, HWND hwndOwner, DWORD dwFlags)
Definition: dinput_main.c:745

◆ IDirectInput8WImpl_AddRef()

static ULONG WINAPI IDirectInput8WImpl_AddRef ( LPDIRECTINPUT8W  iface)
static

Definition at line 867 of file dinput_main.c.

868{
870 return IDirectInputAImpl_AddRef( &This->IDirectInput7A_iface );
871}
static IDirectInputImpl * impl_from_IDirectInput8W(IDirectInput8W *iface)
Definition: dinput_main.c:79

◆ IDirectInput8WImpl_ConfigureDevices()

static HRESULT WINAPI IDirectInput8WImpl_ConfigureDevices ( LPDIRECTINPUT8W  iface,
LPDICONFIGUREDEVICESCALLBACK  lpdiCallback,
LPDICONFIGUREDEVICESPARAMSW  lpdiCDParams,
DWORD  dwFlags,
LPVOID  pvRefData 
)
static

Definition at line 1242 of file dinput_main.c.

1246{
1248
1249 FIXME("(this=%p,%p,%p,%04x,%p): stub\n", This, lpdiCallback, lpdiCDParams, dwFlags, pvRefData);
1250
1251 /* Call helper function in config.c to do the real work */
1252 return _configure_devices(iface, lpdiCallback, lpdiCDParams, dwFlags, pvRefData);
1253}
HRESULT _configure_devices(IDirectInput8W *iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData)
Definition: config.c:493

Referenced by IDirectInput8AImpl_ConfigureDevices().

◆ IDirectInput8WImpl_CreateDevice()

static HRESULT WINAPI IDirectInput8WImpl_CreateDevice ( LPDIRECTINPUT8W  iface,
REFGUID  rguid,
LPDIRECTINPUTDEVICE8W pdev,
LPUNKNOWN  punk 
)
static

Definition at line 904 of file dinput_main.c.

906{
908 return IDirectInput7WImpl_CreateDeviceEx( &This->IDirectInput7W_iface, rguid, NULL, (LPVOID*)pdev, punk );
909}
static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx(LPDIRECTINPUT7W iface, REFGUID rguid, REFIID riid, LPVOID *pvOut, LPUNKNOWN lpUnknownOuter)
Definition: dinput_main.c:835

◆ IDirectInput8WImpl_EnumDevices()

static HRESULT WINAPI IDirectInput8WImpl_EnumDevices ( LPDIRECTINPUT8W  iface,
DWORD  dwDevType,
LPDIENUMDEVICESCALLBACKW  lpCallback,
LPVOID  pvRef,
DWORD  dwFlags 
)
static

Definition at line 918 of file dinput_main.c.

920{
922 return IDirectInputWImpl_EnumDevices( &This->IDirectInput7W_iface, dwDevType, lpCallback, pvRef, dwFlags );
923}
static HRESULT WINAPI IDirectInputWImpl_EnumDevices(LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:502

◆ IDirectInput8WImpl_EnumDevicesBySemantics()

static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics ( LPDIRECTINPUT8W  iface,
LPCWSTR  ptszUserName,
LPDIACTIONFORMATW  lpdiActionFormat,
LPDIENUMDEVICESBYSEMANTICSCBW  lpCallback,
LPVOID  pvRef,
DWORD  dwFlags 
)
static

Definition at line 1150 of file dinput_main.c.

1155{
1156 static REFGUID guids[2] = { &GUID_SysKeyboard, &GUID_SysMouse };
1157 static const DWORD actionMasks[] = { DIKEYBOARD_MASK, DIMOUSE_MASK };
1159 DIDEVICEINSTANCEW didevi;
1161 DWORD callbackFlags;
1162 int i, j;
1163 int device_count = 0;
1164 int remain;
1165 DIDEVICEINSTANCEW *didevis = 0;
1166
1167 FIXME("(this=%p,%s,%p,%p,%p,%04x): semi-stub\n", This, debugstr_w(ptszUserName), lpdiActionFormat,
1168 lpCallback, pvRef, dwFlags);
1169
1170 didevi.dwSize = sizeof(didevi);
1171
1172 /* Enumerate all the joysticks */
1173 for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
1174 {
1175 HRESULT enumSuccess;
1176
1177 if (!dinput_devices[i]->enum_deviceW) continue;
1178
1179 for (j = 0, enumSuccess = S_OK; SUCCEEDED(enumSuccess); j++)
1180 {
1181 TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
1182
1183 /* Default behavior is to enumerate attached game controllers */
1184 enumSuccess = dinput_devices[i]->enum_deviceW(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
1185 if (enumSuccess == S_OK &&
1186 should_enumerate_device(ptszUserName, dwFlags, &This->device_players, &didevi.guidInstance))
1187 {
1188 if (device_count++)
1189 didevis = HeapReAlloc(GetProcessHeap(), 0, didevis, sizeof(DIDEVICEINSTANCEW)*device_count);
1190 else
1191 didevis = HeapAlloc(GetProcessHeap(), 0, sizeof(DIDEVICEINSTANCEW)*device_count);
1192 didevis[device_count-1] = didevi;
1193 }
1194 }
1195 }
1196
1197 remain = device_count;
1198 /* Add keyboard and mouse to remaining device count */
1200 {
1201 for (i = 0; i < ARRAY_SIZE(guids); i++)
1202 {
1203 if (should_enumerate_device(ptszUserName, dwFlags, &This->device_players, guids[i]))
1204 remain++;
1205 }
1206 }
1207
1208 for (i = 0; i < device_count; i++)
1209 {
1210 callbackFlags = diactionformat_priorityW(lpdiActionFormat, lpdiActionFormat->dwGenre);
1211 IDirectInput_CreateDevice(iface, &didevis[i].guidInstance, &lpdid, NULL);
1212
1213 if (lpCallback(&didevis[i], lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP)
1214 {
1215 HeapFree(GetProcessHeap(), 0, didevis);
1216 return DI_OK;
1217 }
1218 }
1219
1220 HeapFree(GetProcessHeap(), 0, didevis);
1221
1222 if (dwFlags & DIEDBSFL_FORCEFEEDBACK) return DI_OK;
1223
1224 /* Enumerate keyboard and mouse */
1225 for (i = 0; i < ARRAY_SIZE(guids); i++)
1226 {
1227 if (should_enumerate_device(ptszUserName, dwFlags, &This->device_players, guids[i]))
1228 {
1229 callbackFlags = diactionformat_priorityW(lpdiActionFormat, actionMasks[i]);
1230
1231 IDirectInput_CreateDevice(iface, guids[i], &lpdid, NULL);
1232 IDirectInputDevice_GetDeviceInfo(lpdid, &didevi);
1233
1234 if (lpCallback(&didevi, lpdid, callbackFlags, --remain, pvRef) == DIENUM_STOP)
1235 return DI_OK;
1236 }
1237 }
1238
1239 return DI_OK;
1240}
struct IDirectInputDevice8W * LPDIRECTINPUTDEVICE8W
Definition: dinput.h:106
static DWORD diactionformat_priorityW(LPDIACTIONFORMATW lpdiaf, DWORD genre)
Definition: dinput_main.c:412
GUID guidInstance
Definition: dinput.h:426

◆ IDirectInput8WImpl_FindDevice()

static HRESULT WINAPI IDirectInput8WImpl_FindDevice ( LPDIRECTINPUT8W  iface,
REFGUID  rguid,
LPCWSTR  pszName,
LPGUID  pguidInstance 
)
static

Definition at line 979 of file dinput_main.c.

980{
982 return IDirectInput2WImpl_FindDevice( &This->IDirectInput7W_iface, rguid, pszName, pguidInstance );
983}
static HRESULT WINAPI IDirectInput2WImpl_FindDevice(LPDIRECTINPUT7W iface, REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance)
Definition: dinput_main.c:788

◆ IDirectInput8WImpl_GetDeviceStatus()

static HRESULT WINAPI IDirectInput8WImpl_GetDeviceStatus ( LPDIRECTINPUT8W  iface,
REFGUID  rguid 
)
static

Definition at line 931 of file dinput_main.c.

932{
934 return IDirectInputAImpl_GetDeviceStatus( &This->IDirectInput7A_iface, rguid );
935}

◆ IDirectInput8WImpl_Initialize()

static HRESULT WINAPI IDirectInput8WImpl_Initialize ( LPDIRECTINPUT8W  iface,
HINSTANCE  hinst,
DWORD  version 
)
static

Definition at line 967 of file dinput_main.c.

968{
970 return IDirectInput8AImpl_Initialize( &This->IDirectInput8A_iface, hinst, version );
971}
static HRESULT WINAPI IDirectInput8AImpl_Initialize(LPDIRECTINPUT8A iface, HINSTANCE hinst, DWORD version)
Definition: dinput_main.c:949

◆ IDirectInput8WImpl_QueryInterface()

static HRESULT WINAPI IDirectInput8WImpl_QueryInterface ( LPDIRECTINPUT8W  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 879 of file dinput_main.c.

880{
882 return IDirectInputAImpl_QueryInterface( &This->IDirectInput7A_iface, riid, ppobj );
883}

◆ IDirectInput8WImpl_Release()

static ULONG WINAPI IDirectInput8WImpl_Release ( LPDIRECTINPUT8W  iface)
static

Definition at line 891 of file dinput_main.c.

892{
894 return IDirectInputAImpl_Release( &This->IDirectInput7A_iface );
895}

◆ IDirectInput8WImpl_RunControlPanel()

static HRESULT WINAPI IDirectInput8WImpl_RunControlPanel ( LPDIRECTINPUT8W  iface,
HWND  hwndOwner,
DWORD  dwFlags 
)
static

Definition at line 943 of file dinput_main.c.

944{
946 return IDirectInputAImpl_RunControlPanel( &This->IDirectInput7A_iface, hwndOwner, dwFlags );
947}

◆ IDirectInputAImpl_AddRef()

static ULONG WINAPI IDirectInputAImpl_AddRef ( LPDIRECTINPUT7A  iface)
static

Definition at line 540 of file dinput_main.c.

541{
544
545 TRACE( "(%p) ref %d\n", This, ref );
546 return ref;
547}
Definition: send.c:48

Referenced by IDirectInput8AImpl_AddRef(), IDirectInput8WImpl_AddRef(), IDirectInputWImpl_AddRef(), and JoyConfig8Impl_AddRef().

◆ IDirectInputAImpl_CreateDevice()

static HRESULT WINAPI IDirectInputAImpl_CreateDevice ( LPDIRECTINPUT7A  iface,
REFGUID  rguid,
LPDIRECTINPUTDEVICEA pdev,
LPUNKNOWN  punk 
)
static

Definition at line 845 of file dinput_main.c.

847{
848 return IDirectInput7AImpl_CreateDeviceEx(iface, rguid, NULL, (LPVOID*)pdev, punk);
849}

◆ IDirectInputAImpl_EnumDevices()

static HRESULT WINAPI IDirectInputAImpl_EnumDevices ( LPDIRECTINPUT7A  iface,
DWORD  dwDevType,
LPDIENUMDEVICESCALLBACKA  lpCallback,
LPVOID  pvRef,
DWORD  dwFlags 
)
static

Definition at line 461 of file dinput_main.c.

464{
466 DIDEVICEINSTANCEA devInstance;
467 unsigned int i;
468 int j;
469 HRESULT r;
470
471 TRACE("(this=%p,0x%04x '%s',%p,%p,0x%04x)\n",
472 This, dwDevType, _dump_DIDEVTYPE_value(dwDevType, This->dwVersion),
473 lpCallback, pvRef, dwFlags);
475
476 if (!lpCallback ||
478 (dwDevType > DI8DEVCLASS_GAMECTRL && dwDevType < DI8DEVTYPE_DEVICE) || dwDevType > DI8DEVTYPE_SUPPLEMENTAL)
479 return DIERR_INVALIDPARAM;
480
481 if (!This->initialized)
483
484 for (i = 0; i < ARRAY_SIZE(dinput_devices); i++) {
485 if (!dinput_devices[i]->enum_deviceA) continue;
486
487 TRACE(" Checking device %u ('%s')\n", i, dinput_devices[i]->name);
488 for (j = 0, r = S_OK; SUCCEEDED(r); j++) {
489 devInstance.dwSize = sizeof(devInstance);
490 r = dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->dwVersion, j);
491 if (r == S_OK)
492 if (enum_callback_wrapper(lpCallback, &devInstance, pvRef) == DIENUM_STOP)
493 return S_OK;
494 }
495 }
496
497 return S_OK;
498}
#define DI8DEVTYPE_DEVICE
Definition: dinput.h:209
#define DI8DEVTYPE_SUPPLEMENTAL
Definition: dinput.h:220
static void _dump_EnumDevices_dwFlags(DWORD dwFlags)
Definition: dinput_main.c:265
#define enum_callback_wrapper(callback, instance, ref)
Definition: dinput_main.c:455
static const char * _dump_DIDEVTYPE_value(DWORD dwDevType, DWORD dwVersion)
Definition: dinput_main.c:242
GLdouble GLdouble GLdouble r
Definition: gl.h:2055

Referenced by IDirectInput8AImpl_EnumDevices().

◆ IDirectInputAImpl_GetDeviceStatus()

static HRESULT WINAPI IDirectInputAImpl_GetDeviceStatus ( LPDIRECTINPUT7A  iface,
REFGUID  rguid 
)
static

Definition at line 719 of file dinput_main.c.

720{
722 HRESULT hr;
724
725 TRACE( "(%p)->(%s)\n", This, debugstr_guid(rguid) );
726
727 if (!rguid) return E_POINTER;
728 if (!This->initialized)
730
731 hr = IDirectInput_CreateDevice( iface, rguid, &device, NULL );
732 if (hr != DI_OK) return DI_NOTATTACHED;
733
734 IUnknown_Release( device );
735
736 return DI_OK;
737}
struct IDirectInputDeviceA * LPDIRECTINPUTDEVICEA
Definition: dinput.h:99
#define DI_NOTATTACHED
Definition: dinput.h:129
Definition: devices.h:37

Referenced by IDirectInput8AImpl_GetDeviceStatus(), IDirectInput8WImpl_GetDeviceStatus(), and IDirectInputWImpl_GetDeviceStatus().

◆ IDirectInputAImpl_Initialize()

static HRESULT WINAPI IDirectInputAImpl_Initialize ( LPDIRECTINPUT7A  iface,
HINSTANCE  hinst,
DWORD  version 
)
static

◆ IDirectInputAImpl_QueryInterface()

static HRESULT WINAPI IDirectInputAImpl_QueryInterface ( LPDIRECTINPUT7A  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 577 of file dinput_main.c.

578{
580
581 TRACE( "(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppobj );
582
583 if (!riid || !ppobj)
584 return E_POINTER;
585
586 *ppobj = NULL;
587
588#if DIRECTINPUT_VERSION == 0x0700
589 if (IsEqualGUID( &IID_IUnknown, riid ) ||
590 IsEqualGUID( &IID_IDirectInputA, riid ) ||
591 IsEqualGUID( &IID_IDirectInput2A, riid ) ||
592 IsEqualGUID( &IID_IDirectInput7A, riid ))
593 *ppobj = &This->IDirectInput7A_iface;
594 else if (IsEqualGUID( &IID_IDirectInputW, riid ) ||
595 IsEqualGUID( &IID_IDirectInput2W, riid ) ||
596 IsEqualGUID( &IID_IDirectInput7W, riid ))
597 *ppobj = &This->IDirectInput7W_iface;
598
599#else
600 if (IsEqualGUID( &IID_IUnknown, riid ) ||
601 IsEqualGUID( &IID_IDirectInput8A, riid ))
602 *ppobj = &This->IDirectInput8A_iface;
603
604 else if (IsEqualGUID( &IID_IDirectInput8W, riid ))
605 *ppobj = &This->IDirectInput8W_iface;
606
607#endif
608
609 if (IsEqualGUID( &IID_IDirectInputJoyConfig8, riid ))
610 *ppobj = &This->IDirectInputJoyConfig8_iface;
611
612 if(*ppobj)
613 {
614 IUnknown_AddRef( (IUnknown*)*ppobj );
615 return DI_OK;
616 }
617
618 WARN( "Unsupported interface: %s\n", debugstr_guid(riid));
619 return E_NOINTERFACE;
620}

Referenced by IDirectInput8AImpl_QueryInterface(), IDirectInput8WImpl_QueryInterface(), IDirectInputWImpl_QueryInterface(), and JoyConfig8Impl_QueryInterface().

◆ IDirectInputAImpl_Release()

static ULONG WINAPI IDirectInputAImpl_Release ( LPDIRECTINPUT7A  iface)
static

Definition at line 555 of file dinput_main.c.

556{
559
560 TRACE( "(%p) ref %d\n", This, ref );
561
562 if (ref == 0)
563 {
566 }
567
568 return ref;
569}
static void uninitialize_directinput_instance(IDirectInputImpl *This)
Definition: dinput_main.c:658

Referenced by IDirectInput8AImpl_Release(), IDirectInput8WImpl_Release(), IDirectInputWImpl_Release(), and JoyConfig8Impl_Release().

◆ IDirectInputAImpl_RunControlPanel()

static HRESULT WINAPI IDirectInputAImpl_RunControlPanel ( LPDIRECTINPUT7A  iface,
HWND  hwndOwner,
DWORD  dwFlags 
)
static

Definition at line 745 of file dinput_main.c.

748{
749 WCHAR control_exeW[] = {'c','o','n','t','r','o','l','.','e','x','e',0};
750 STARTUPINFOW si = {0};
752
754
755 TRACE( "(%p)->(%p, %08x)\n", This, hwndOwner, dwFlags );
756
757 if (hwndOwner && !IsWindow(hwndOwner))
758 return E_HANDLE;
759
760 if (dwFlags)
761 return DIERR_INVALIDPARAM;
762
763 if (!This->initialized)
765
766 if (!CreateProcessW(NULL, control_exeW, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &si, &pi))
768
769 return DI_OK;
770}
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4598
static refpint_t pi[]
Definition: server.c:96
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define DETACHED_PROCESS
Definition: winbase.h:182
#define E_HANDLE
Definition: winerror.h:2850
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
BOOL WINAPI IsWindow(_In_opt_ HWND)

Referenced by IDirectInput8AImpl_RunControlPanel(), IDirectInput8WImpl_RunControlPanel(), and IDirectInputWImpl_RunControlPanel().

◆ IDirectInputWImpl_AddRef()

static ULONG WINAPI IDirectInputWImpl_AddRef ( LPDIRECTINPUT7W  iface)
static

Definition at line 549 of file dinput_main.c.

550{
552 return IDirectInputAImpl_AddRef( &This->IDirectInput7A_iface );
553}

◆ IDirectInputWImpl_CreateDevice()

static HRESULT WINAPI IDirectInputWImpl_CreateDevice ( LPDIRECTINPUT7W  iface,
REFGUID  rguid,
LPDIRECTINPUTDEVICEW pdev,
LPUNKNOWN  punk 
)
static

Definition at line 851 of file dinput_main.c.

853{
854 return IDirectInput7WImpl_CreateDeviceEx(iface, rguid, NULL, (LPVOID*)pdev, punk);
855}

◆ IDirectInputWImpl_EnumDevices()

static HRESULT WINAPI IDirectInputWImpl_EnumDevices ( LPDIRECTINPUT7W  iface,
DWORD  dwDevType,
LPDIENUMDEVICESCALLBACKW  lpCallback,
LPVOID  pvRef,
DWORD  dwFlags 
)
static

Definition at line 502 of file dinput_main.c.

505{
507 DIDEVICEINSTANCEW devInstance;
508 unsigned int i;
509 int j;
510 HRESULT r;
511
512 TRACE("(this=%p,0x%04x '%s',%p,%p,0x%04x)\n",
513 This, dwDevType, _dump_DIDEVTYPE_value(dwDevType, This->dwVersion),
514 lpCallback, pvRef, dwFlags);
516
517 if (!lpCallback ||
519 (dwDevType > DI8DEVCLASS_GAMECTRL && dwDevType < DI8DEVTYPE_DEVICE) || dwDevType > DI8DEVTYPE_SUPPLEMENTAL)
520 return DIERR_INVALIDPARAM;
521
522 if (!This->initialized)
524
525 for (i = 0; i < ARRAY_SIZE(dinput_devices); i++) {
526 if (!dinput_devices[i]->enum_deviceW) continue;
527 for (j = 0, r = S_OK; SUCCEEDED(r); j++) {
528 devInstance.dwSize = sizeof(devInstance);
529 TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
530 r = dinput_devices[i]->enum_deviceW(dwDevType, dwFlags, &devInstance, This->dwVersion, j);
531 if (r == S_OK)
532 if (enum_callback_wrapper(lpCallback, &devInstance, pvRef) == DIENUM_STOP)
533 return S_OK;
534 }
535 }
536
537 return S_OK;
538}

Referenced by IDirectInput8WImpl_EnumDevices().

◆ IDirectInputWImpl_GetDeviceStatus()

static HRESULT WINAPI IDirectInputWImpl_GetDeviceStatus ( LPDIRECTINPUT7W  iface,
REFGUID  rguid 
)
static

Definition at line 739 of file dinput_main.c.

740{
742 return IDirectInputAImpl_GetDeviceStatus( &This->IDirectInput7A_iface, rguid );
743}

◆ IDirectInputWImpl_Initialize()

static HRESULT WINAPI IDirectInputWImpl_Initialize ( LPDIRECTINPUT7W  iface,
HINSTANCE  hinst,
DWORD  x 
)
static

Definition at line 713 of file dinput_main.c.

714{
716 return IDirectInputAImpl_Initialize( &This->IDirectInput7A_iface, hinst, x );
717}
static HRESULT WINAPI IDirectInputAImpl_Initialize(LPDIRECTINPUT7A iface, HINSTANCE hinst, DWORD version)
Definition: dinput_main.c:692
GLint GLint GLint GLint GLint x
Definition: gl.h:1548

◆ IDirectInputWImpl_QueryInterface()

static HRESULT WINAPI IDirectInputWImpl_QueryInterface ( LPDIRECTINPUT7W  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 622 of file dinput_main.c.

623{
625 return IDirectInputAImpl_QueryInterface( &This->IDirectInput7A_iface, riid, ppobj );
626}

◆ IDirectInputWImpl_Release()

static ULONG WINAPI IDirectInputWImpl_Release ( LPDIRECTINPUT7W  iface)
static

Definition at line 571 of file dinput_main.c.

572{
574 return IDirectInputAImpl_Release( &This->IDirectInput7A_iface );
575}

◆ IDirectInputWImpl_RunControlPanel()

static HRESULT WINAPI IDirectInputWImpl_RunControlPanel ( LPDIRECTINPUT7W  iface,
HWND  hwndOwner,
DWORD  dwFlags 
)
static

Definition at line 772 of file dinput_main.c.

773{
775 return IDirectInputAImpl_RunControlPanel( &This->IDirectInput7A_iface, hwndOwner, dwFlags );
776}

◆ impl_from_IClassFactory()

static IClassFactoryImpl * impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 1578 of file dinput_main.c.

1579{
1580 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
1581}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by DICF_AddRef(), DICF_CreateInstance(), DICF_LockServer(), DICF_QueryInterface(), and DICF_Release().

◆ impl_from_IDirectInput7A()

◆ impl_from_IDirectInput7W()

◆ impl_from_IDirectInput8A()

◆ impl_from_IDirectInput8W()

◆ impl_from_IDirectInputDevice8W()

static IDirectInputDeviceImpl * impl_from_IDirectInputDevice8W ( IDirectInputDevice8W *  iface)
inlinestatic

Definition at line 84 of file dinput_main.c.

85{
86 return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface);
87}

Referenced by check_dinput_hooks().

◆ impl_from_IDirectInputJoyConfig8()

static IDirectInputImpl * impl_from_IDirectInputJoyConfig8 ( IDirectInputJoyConfig8 *  iface)
inlinestatic

Definition at line 1334 of file dinput_main.c.

1335{
1336 return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInputJoyConfig8_iface );
1337}

Referenced by JoyConfig8Impl_AddRef(), JoyConfig8Impl_GetConfig(), JoyConfig8Impl_QueryInterface(), and JoyConfig8Impl_Release().

◆ initialize_directinput_instance()

static HRESULT initialize_directinput_instance ( IDirectInputImpl This,
DWORD  dwVersion 
)
static

Definition at line 628 of file dinput_main.c.

629{
630 if (!This->initialized)
631 {
632 This->dwVersion = dwVersion;
633 This->evsequence = 1;
634
636 This->crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDirectInputImpl*->crit");
637
638 list_init( &This->devices_list );
639 list_init( &This->device_players );
640
641 /* Add self to the list of the IDirectInputs */
645
646 This->initialized = TRUE;
647
648 if (!check_hook_thread())
649 {
651 return DIERR_GENERIC;
652 }
653 }
654
655 return DI_OK;
656}
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
static void list_init(struct list_entry *head)
Definition: list.h:51
#define DIERR_GENERIC
Definition: dinput.h:154
static BOOL check_hook_thread(void)
Definition: dinput_main.c:1828
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DWORD_PTR
Definition: treelist.c:76

Referenced by IDirectInput8AImpl_Initialize(), and IDirectInputAImpl_Initialize().

◆ JoyConfig8Impl_Acquire()

static HRESULT WINAPI JoyConfig8Impl_Acquire ( IDirectInputJoyConfig8 *  iface)
static

Definition at line 1357 of file dinput_main.c.

1358{
1359 FIXME( "(%p): stub!\n", iface );
1360 return E_NOTIMPL;
1361}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ JoyConfig8Impl_AddNewHardware()

static HRESULT WINAPI JoyConfig8Impl_AddNewHardware ( IDirectInputJoyConfig8 *  iface,
HWND  hwnd,
REFGUID  guid 
)
static

Definition at line 1473 of file dinput_main.c.

1474{
1475 FIXME( "(%p)->(%p, %s): stub!\n", iface, hwnd, debugstr_guid(guid) );
1476 return E_NOTIMPL;
1477}
const GUID * guid
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

◆ JoyConfig8Impl_AddRef()

static ULONG WINAPI JoyConfig8Impl_AddRef ( IDirectInputJoyConfig8 *  iface)
static

Definition at line 1345 of file dinput_main.c.

1346{
1348 return IDirectInputAImpl_AddRef( &This->IDirectInput7A_iface );
1349}
static IDirectInputImpl * impl_from_IDirectInputJoyConfig8(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1334

◆ JoyConfig8Impl_DeleteConfig()

static HRESULT WINAPI JoyConfig8Impl_DeleteConfig ( IDirectInputJoyConfig8 *  iface,
UINT  id 
)
static

Definition at line 1455 of file dinput_main.c.

1456{
1457 FIXME( "(%p)->(%d): stub!\n", iface, id );
1458 return E_NOTIMPL;
1459}

◆ JoyConfig8Impl_DeleteType()

static HRESULT WINAPI JoyConfig8Impl_DeleteType ( IDirectInputJoyConfig8 *  iface,
LPCWSTR  name 
)
static

Definition at line 1400 of file dinput_main.c.

1401{
1402 FIXME( "(%p)->(%s): stub!\n", iface, debugstr_w(name) );
1403 return E_NOTIMPL;
1404}

◆ JoyConfig8Impl_EnumTypes()

static HRESULT WINAPI JoyConfig8Impl_EnumTypes ( IDirectInputJoyConfig8 *  iface,
LPDIJOYTYPECALLBACK  cb,
void ref 
)
static

Definition at line 1381 of file dinput_main.c.

1382{
1383 FIXME( "(%p)->(%p, %p): stub!\n", iface, cb, ref );
1384 return E_NOTIMPL;
1385}
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33

◆ JoyConfig8Impl_GetConfig()

static HRESULT WINAPI JoyConfig8Impl_GetConfig ( IDirectInputJoyConfig8 *  iface,
UINT  id,
LPDIJOYCONFIG  info,
DWORD  flags 
)
static

Definition at line 1406 of file dinput_main.c.

1407{
1409 UINT found = 0;
1410 int i, j;
1411 HRESULT r;
1412
1413 FIXME("(%p)->(%d, %p, 0x%08x): semi-stub!\n", iface, id, info, flags);
1414
1415#define X(x) if (flags & x) FIXME("\tflags |= "#x"\n");
1418 X(DIJC_GAIN)
1420#undef X
1421
1422 /* Enumerate all joysticks in order */
1423 for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
1424 {
1425 if (!dinput_devices[i]->enum_deviceA) continue;
1426
1427 for (j = 0, r = S_OK; SUCCEEDED(r); j++)
1428 {
1430 dev.dwSize = sizeof(dev);
1431 if ((r = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL, 0, &dev, di->dwVersion, j)) == S_OK)
1432 {
1433 /* Only take into account the chosen id */
1434 if (found == id)
1435 {
1437 info->guidInstance = dev.guidInstance;
1438
1439 return DI_OK;
1440 }
1441 found += 1;
1442 }
1443 }
1444 }
1445
1446 return DIERR_NOMOREITEMS;
1447}
#define DIJC_GAIN
Definition: dinputd.h:132
#define DIJC_GUIDINSTANCE
Definition: dinputd.h:130
#define DIERR_NOMOREITEMS
Definition: dinputd.h:47
#define DIJC_REGHWCONFIGTYPE
Definition: dinputd.h:131
#define DIJC_CALLOUT
Definition: dinputd.h:133

◆ JoyConfig8Impl_GetTypeInfo()

static HRESULT WINAPI JoyConfig8Impl_GetTypeInfo ( IDirectInputJoyConfig8 *  iface,
LPCWSTR  name,
LPDIJOYTYPEINFO  info,
DWORD  flags 
)
static

Definition at line 1387 of file dinput_main.c.

1388{
1389 FIXME( "(%p)->(%s, %p, 0x%08x): stub!\n", iface, debugstr_w(name), info, flags );
1390 return E_NOTIMPL;
1391}

◆ JoyConfig8Impl_GetUserValues()

static HRESULT WINAPI JoyConfig8Impl_GetUserValues ( IDirectInputJoyConfig8 *  iface,
LPDIJOYUSERVALUES  info,
DWORD  flags 
)
static

Definition at line 1461 of file dinput_main.c.

1462{
1463 FIXME( "(%p)->(%p, 0x%08x): stub!\n", iface, info, flags );
1464 return E_NOTIMPL;
1465}

◆ JoyConfig8Impl_OpenAppStatusKey()

static HRESULT WINAPI JoyConfig8Impl_OpenAppStatusKey ( IDirectInputJoyConfig8 *  iface,
PHKEY  key 
)
static

Definition at line 1485 of file dinput_main.c.

1486{
1487 FIXME( "(%p)->(%p): stub!\n", iface, key );
1488 return E_NOTIMPL;
1489}
Definition: copy.c:22

◆ JoyConfig8Impl_OpenTypeKey()

static HRESULT WINAPI JoyConfig8Impl_OpenTypeKey ( IDirectInputJoyConfig8 *  iface,
LPCWSTR  name,
DWORD  security,
PHKEY  key 
)
static

Definition at line 1479 of file dinput_main.c.

1480{
1481 FIXME( "(%p)->(%s, 0x%08x, %p): stub!\n", iface, debugstr_w(name), security, key );
1482 return E_NOTIMPL;
1483}

◆ JoyConfig8Impl_QueryInterface()

static HRESULT WINAPI JoyConfig8Impl_QueryInterface ( IDirectInputJoyConfig8 *  iface,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 1339 of file dinput_main.c.

1340{
1342 return IDirectInputAImpl_QueryInterface( &This->IDirectInput7A_iface, riid, ppobj );
1343}

◆ JoyConfig8Impl_Release()

static ULONG WINAPI JoyConfig8Impl_Release ( IDirectInputJoyConfig8 *  iface)
static

Definition at line 1351 of file dinput_main.c.

1352{
1354 return IDirectInputAImpl_Release( &This->IDirectInput7A_iface );
1355}

◆ JoyConfig8Impl_SendNotify()

static HRESULT WINAPI JoyConfig8Impl_SendNotify ( IDirectInputJoyConfig8 *  iface)
static

Definition at line 1375 of file dinput_main.c.

1376{
1377 FIXME( "(%p): stub!\n", iface );
1378 return E_NOTIMPL;
1379}

◆ JoyConfig8Impl_SetConfig()

static HRESULT WINAPI JoyConfig8Impl_SetConfig ( IDirectInputJoyConfig8 *  iface,
UINT  id,
LPCDIJOYCONFIG  info,
DWORD  flags 
)
static

Definition at line 1449 of file dinput_main.c.

1450{
1451 FIXME( "(%p)->(%d, %p, 0x%08x): stub!\n", iface, id, info, flags );
1452 return E_NOTIMPL;
1453}

◆ JoyConfig8Impl_SetCooperativeLevel()

static HRESULT WINAPI JoyConfig8Impl_SetCooperativeLevel ( IDirectInputJoyConfig8 *  iface,
HWND  hwnd,
DWORD  flags 
)
static

Definition at line 1369 of file dinput_main.c.

1370{
1371 FIXME( "(%p)->(%p, 0x%08x): stub!\n", iface, hwnd, flags );
1372 return E_NOTIMPL;
1373}

◆ JoyConfig8Impl_SetTypeInfo()

static HRESULT WINAPI JoyConfig8Impl_SetTypeInfo ( IDirectInputJoyConfig8 *  iface,
LPCWSTR  name,
LPCDIJOYTYPEINFO  info,
DWORD  flags,
LPWSTR  new_name 
)
static

Definition at line 1393 of file dinput_main.c.

1395{
1396 FIXME( "(%p)->(%s, %p, 0x%08x, %s): stub!\n", iface, debugstr_w(name), info, flags, debugstr_w(new_name) );
1397 return E_NOTIMPL;
1398}

◆ JoyConfig8Impl_SetUserValues()

static HRESULT WINAPI JoyConfig8Impl_SetUserValues ( IDirectInputJoyConfig8 *  iface,
LPCDIJOYUSERVALUES  info,
DWORD  flags 
)
static

Definition at line 1467 of file dinput_main.c.

1468{
1469 FIXME( "(%p)->(%p, 0x%08x): stub!\n", iface, info, flags );
1470 return E_NOTIMPL;
1471}

◆ JoyConfig8Impl_Unacquire()

static HRESULT WINAPI JoyConfig8Impl_Unacquire ( IDirectInputJoyConfig8 *  iface)
static

Definition at line 1363 of file dinput_main.c.

1364{
1365 FIXME( "(%p): stub!\n", iface );
1366 return E_NOTIMPL;
1367}

◆ LL_hook_proc()

static LRESULT CALLBACK LL_hook_proc ( int  code,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1683 of file dinput_main.c.

1684{
1685 IDirectInputImpl *dinput;
1686 int skip = 0;
1687
1688 if (code != HC_ACTION) return CallNextHookEx( 0, code, wparam, lparam );
1689
1692 {
1694
1695 EnterCriticalSection( &dinput->crit );
1697 if (dev->acquired && dev->event_proc)
1698 {
1699 TRACE("calling %p->%p (%lx %lx)\n", dev, dev->event_proc, wparam, lparam);
1700 skip |= dev->event_proc( &dev->IDirectInputDevice8A_iface, wparam, lparam );
1701 }
1702 LeaveCriticalSection( &dinput->crit );
1703 }
1705
1706 return skip ? 1 : CallNextHookEx( 0, code, wparam, lparam );
1707}
#define skip(...)
Definition: atltest.h:64

Referenced by hook_thread_proc().

◆ should_enumerate_device()

static BOOL should_enumerate_device ( const WCHAR username,
DWORD  dwFlags,
struct list device_players,
REFGUID  guid 
)
static

Definition at line 985 of file dinput_main.c.

987{
988 BOOL should_enumerate = TRUE;
989 struct DevicePlayer *device_player;
990
991 /* Check if user owns this device */
993 {
994 should_enumerate = FALSE;
995 LIST_FOR_EACH_ENTRY(device_player, device_players, struct DevicePlayer, entry)
996 {
997 if (IsEqualGUID(&device_player->instance_guid, guid))
998 {
999 if (*device_player->username && !lstrcmpW(username, device_player->username))
1000 return TRUE; /* Device username matches */
1001 break;
1002 }
1003 }
1004 }
1005
1006 /* Check if this device is not owned by anyone */
1008 BOOL found = FALSE;
1009 should_enumerate = FALSE;
1010 LIST_FOR_EACH_ENTRY(device_player, device_players, struct DevicePlayer, entry)
1011 {
1012 if (IsEqualGUID(&device_player->instance_guid, guid))
1013 {
1014 if (*device_player->username)
1015 found = TRUE;
1016 break;
1017 }
1018 }
1019 if (!found)
1020 return TRUE; /* Device does not have a username */
1021 }
1022
1023 return should_enumerate;
1024}
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
unsigned int BOOL
Definition: ntddk_ex.h:94
static WCHAR username[]
Definition: url.c:32
WCHAR username[MAX_PATH]

Referenced by IDirectInput8AImpl_EnumDevicesBySemantics(), and IDirectInput8WImpl_EnumDevicesBySemantics().

◆ uninitialize_directinput_instance()

static void uninitialize_directinput_instance ( IDirectInputImpl This)
static

Definition at line 658 of file dinput_main.c.

659{
660 if (This->initialized)
661 {
662 struct DevicePlayer *device_player, *device_player2;
663 /* Remove self from the list of the IDirectInputs */
665 list_remove( &This->entry );
667
668 LIST_FOR_EACH_ENTRY_SAFE( device_player, device_player2,
669 &This->device_players, struct DevicePlayer, entry )
670 HeapFree(GetProcessHeap(), 0, device_player);
671
673
674 This->crit.DebugInfo->Spare[0] = 0;
675 DeleteCriticalSection( &This->crit );
676
677 This->initialized = FALSE;
678 }
679}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204

Referenced by IDirectInputAImpl_Release(), and initialize_directinput_instance().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( dinput  )

Variable Documentation

◆ ddi7avt

static const IDirectInput7AVtbl ddi7avt
static

◆ ddi7wvt

static const IDirectInput7WVtbl ddi7wvt
static
Initial value:
= {
}
static HRESULT WINAPI IDirectInputWImpl_GetDeviceStatus(LPDIRECTINPUT7W iface, REFGUID rguid)
Definition: dinput_main.c:739
static ULONG WINAPI IDirectInputWImpl_Release(LPDIRECTINPUT7W iface)
Definition: dinput_main.c:571
static HRESULT WINAPI IDirectInputWImpl_RunControlPanel(LPDIRECTINPUT7W iface, HWND hwndOwner, DWORD dwFlags)
Definition: dinput_main.c:772
static HRESULT WINAPI IDirectInputWImpl_Initialize(LPDIRECTINPUT7W iface, HINSTANCE hinst, DWORD x)
Definition: dinput_main.c:713
static ULONG WINAPI IDirectInputWImpl_AddRef(LPDIRECTINPUT7W iface)
Definition: dinput_main.c:549
static HRESULT WINAPI IDirectInputWImpl_CreateDevice(LPDIRECTINPUT7W iface, REFGUID rguid, LPDIRECTINPUTDEVICEW *pdev, LPUNKNOWN punk)
Definition: dinput_main.c:851
static HRESULT WINAPI IDirectInputWImpl_QueryInterface(LPDIRECTINPUT7W iface, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:622

Definition at line 59 of file dinput_main.c.

Referenced by create_directinput_instance().

◆ ddi8avt

static const IDirectInput8AVtbl ddi8avt
static
Initial value:
= {
}
static HRESULT WINAPI IDirectInput8AImpl_QueryInterface(LPDIRECTINPUT8A iface, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:873
static HRESULT WINAPI IDirectInput8AImpl_EnumDevices(LPDIRECTINPUT8A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:911
static ULONG WINAPI IDirectInput8AImpl_AddRef(LPDIRECTINPUT8A iface)
Definition: dinput_main.c:861
static HRESULT WINAPI IDirectInput8AImpl_CreateDevice(LPDIRECTINPUT8A iface, REFGUID rguid, LPDIRECTINPUTDEVICE8A *pdev, LPUNKNOWN punk)
Definition: dinput_main.c:897
static HRESULT WINAPI IDirectInput8AImpl_GetDeviceStatus(LPDIRECTINPUT8A iface, REFGUID rguid)
Definition: dinput_main.c:925
static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(LPDIRECTINPUT8A iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSA lpdiCDParams, DWORD dwFlags, LPVOID pvRefData)
Definition: dinput_main.c:1255
static ULONG WINAPI IDirectInput8AImpl_Release(LPDIRECTINPUT8A iface)
Definition: dinput_main.c:885
static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(LPDIRECTINPUT8A iface, LPCSTR ptszUserName, LPDIACTIONFORMATA lpdiActionFormat, LPDIENUMDEVICESBYSEMANTICSCBA lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:1026
static HRESULT WINAPI IDirectInput8AImpl_RunControlPanel(LPDIRECTINPUT8A iface, HWND hwndOwner, DWORD dwFlags)
Definition: dinput_main.c:937
static HRESULT WINAPI IDirectInput8AImpl_FindDevice(LPDIRECTINPUT8A iface, REFGUID rguid, LPCSTR pszName, LPGUID pguidInstance)
Definition: dinput_main.c:973

Definition at line 60 of file dinput_main.c.

Referenced by create_directinput_instance().

◆ ddi8wvt

static const IDirectInput8WVtbl ddi8wvt
static
Initial value:
= {
}
static HRESULT WINAPI IDirectInput8WImpl_FindDevice(LPDIRECTINPUT8W iface, REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance)
Definition: dinput_main.c:979
static HRESULT WINAPI IDirectInput8WImpl_EnumDevices(LPDIRECTINPUT8W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:918
static HRESULT WINAPI IDirectInput8WImpl_QueryInterface(LPDIRECTINPUT8W iface, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:879
static HRESULT WINAPI IDirectInput8WImpl_Initialize(LPDIRECTINPUT8W iface, HINSTANCE hinst, DWORD version)
Definition: dinput_main.c:967
static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(LPDIRECTINPUT8W iface, LPCWSTR ptszUserName, LPDIACTIONFORMATW lpdiActionFormat, LPDIENUMDEVICESBYSEMANTICSCBW lpCallback, LPVOID pvRef, DWORD dwFlags)
Definition: dinput_main.c:1150
static ULONG WINAPI IDirectInput8WImpl_Release(LPDIRECTINPUT8W iface)
Definition: dinput_main.c:891
static ULONG WINAPI IDirectInput8WImpl_AddRef(LPDIRECTINPUT8W iface)
Definition: dinput_main.c:867
static HRESULT WINAPI IDirectInput8WImpl_RunControlPanel(LPDIRECTINPUT8W iface, HWND hwndOwner, DWORD dwFlags)
Definition: dinput_main.c:943
static HRESULT WINAPI IDirectInput8WImpl_GetDeviceStatus(LPDIRECTINPUT8W iface, REFGUID rguid)
Definition: dinput_main.c:931
static HRESULT WINAPI IDirectInput8WImpl_CreateDevice(LPDIRECTINPUT8W iface, REFGUID rguid, LPDIRECTINPUTDEVICE8W *pdev, LPUNKNOWN punk)
Definition: dinput_main.c:904

Definition at line 61 of file dinput_main.c.

Referenced by create_directinput_instance().

◆ DICF_Vtbl

const IClassFactoryVtbl DICF_Vtbl
static
Initial value:
= {
}
static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface)
Definition: dinput_main.c:1595
static HRESULT WINAPI DICF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
Definition: dinput_main.c:1624
static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface)
Definition: dinput_main.c:1590
static HRESULT WINAPI DICF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:1601
static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj)
Definition: dinput_main.c:1583

Definition at line 1630 of file dinput_main.c.

◆ DINPUT_CF

IClassFactoryImpl DINPUT_CF = {{&DICF_Vtbl}, 1 }
static

Definition at line 1637 of file dinput_main.c.

Referenced by DllGetClassObject().

◆ dinput_critsect_debug

CRITICAL_SECTION_DEBUG dinput_critsect_debug
static
Initial value:
=
{
0, 0, { (DWORD_PTR)(__FILE__ ": dinput_hook_crit") }
}
static CRITICAL_SECTION_DEBUG dinput_critsect_debug
Definition: dinput_main.c:1820
LIST_ENTRY ProcessLocksList
Definition: winbase.h:908

Definition at line 1820 of file dinput_main.c.

◆ dinput_devices

const struct dinput_device* dinput_devices[]
static
Initial value:
=
{
}
const struct dinput_device keyboard_device
Definition: keyboard.c:355
const struct dinput_device mouse_device
Definition: mouse.c:305
const struct dinput_device joystick_linux_device
const struct dinput_device joystick_linuxinput_device
const struct dinput_device joystick_osx_device

Definition at line 89 of file dinput_main.c.

Referenced by create_device(), IDirectInput8AImpl_EnumDevicesBySemantics(), IDirectInput8WImpl_EnumDevicesBySemantics(), IDirectInputAImpl_EnumDevices(), IDirectInputWImpl_EnumDevices(), and JoyConfig8Impl_GetConfig().

◆ dinput_hook_crit

◆ DINPUT_instance

◆ direct_input_list

struct list direct_input_list = LIST_INIT( direct_input_list )
static

◆ hook_thread_event

HANDLE hook_thread_event
static

Definition at line 1818 of file dinput_main.c.

Referenced by check_dinput_hooks(), and check_hook_thread().

◆ hook_thread_id

DWORD hook_thread_id
static

Definition at line 1817 of file dinput_main.c.

Referenced by check_dinput_hooks(), and check_hook_thread().

◆ JoyConfig8vt

static const IDirectInputJoyConfig8Vtbl JoyConfig8vt
static
Initial value:
=
{
}
static ULONG WINAPI JoyConfig8Impl_Release(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1351
static HRESULT WINAPI JoyConfig8Impl_GetTypeInfo(IDirectInputJoyConfig8 *iface, LPCWSTR name, LPDIJOYTYPEINFO info, DWORD flags)
Definition: dinput_main.c:1387
static HRESULT WINAPI JoyConfig8Impl_QueryInterface(IDirectInputJoyConfig8 *iface, REFIID riid, void **ppobj)
Definition: dinput_main.c:1339
static HRESULT WINAPI JoyConfig8Impl_SendNotify(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1375
static ULONG WINAPI JoyConfig8Impl_AddRef(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1345
static HRESULT WINAPI JoyConfig8Impl_OpenAppStatusKey(IDirectInputJoyConfig8 *iface, PHKEY key)
Definition: dinput_main.c:1485
static HRESULT WINAPI JoyConfig8Impl_DeleteType(IDirectInputJoyConfig8 *iface, LPCWSTR name)
Definition: dinput_main.c:1400
static HRESULT WINAPI JoyConfig8Impl_OpenTypeKey(IDirectInputJoyConfig8 *iface, LPCWSTR name, DWORD security, PHKEY key)
Definition: dinput_main.c:1479
static HRESULT WINAPI JoyConfig8Impl_SetConfig(IDirectInputJoyConfig8 *iface, UINT id, LPCDIJOYCONFIG info, DWORD flags)
Definition: dinput_main.c:1449
static HRESULT WINAPI JoyConfig8Impl_SetCooperativeLevel(IDirectInputJoyConfig8 *iface, HWND hwnd, DWORD flags)
Definition: dinput_main.c:1369
static HRESULT WINAPI JoyConfig8Impl_GetConfig(IDirectInputJoyConfig8 *iface, UINT id, LPDIJOYCONFIG info, DWORD flags)
Definition: dinput_main.c:1406
static HRESULT WINAPI JoyConfig8Impl_GetUserValues(IDirectInputJoyConfig8 *iface, LPDIJOYUSERVALUES info, DWORD flags)
Definition: dinput_main.c:1461
static HRESULT WINAPI JoyConfig8Impl_AddNewHardware(IDirectInputJoyConfig8 *iface, HWND hwnd, REFGUID guid)
Definition: dinput_main.c:1473
static HRESULT WINAPI JoyConfig8Impl_SetTypeInfo(IDirectInputJoyConfig8 *iface, LPCWSTR name, LPCDIJOYTYPEINFO info, DWORD flags, LPWSTR new_name)
Definition: dinput_main.c:1393
static HRESULT WINAPI JoyConfig8Impl_SetUserValues(IDirectInputJoyConfig8 *iface, LPCDIJOYUSERVALUES info, DWORD flags)
Definition: dinput_main.c:1467
static HRESULT WINAPI JoyConfig8Impl_Acquire(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1357
static HRESULT WINAPI JoyConfig8Impl_EnumTypes(IDirectInputJoyConfig8 *iface, LPDIJOYTYPECALLBACK cb, void *ref)
Definition: dinput_main.c:1381
static HRESULT WINAPI JoyConfig8Impl_Unacquire(IDirectInputJoyConfig8 *iface)
Definition: dinput_main.c:1363
static HRESULT WINAPI JoyConfig8Impl_DeleteConfig(IDirectInputJoyConfig8 *iface, UINT id)
Definition: dinput_main.c:1455

Definition at line 62 of file dinput_main.c.

Referenced by create_directinput_instance().