Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/ansi.c | 54 ++++++++--------- dlls/dinput/device.c | 4 +- dlls/dinput/device_private.h | 4 +- dlls/dinput/dinput_main.c | 111 +++++++++++++++++------------------ dlls/dinput/dinput_private.h | 29 +++++---- dlls/dinput/joystick_hid.c | 2 +- dlls/dinput/keyboard.c | 2 +- dlls/dinput/mouse.c | 2 +- 8 files changed, 103 insertions(+), 105 deletions(-)
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c index b7ec426b2e0..99ec3c73327 100644 --- a/dlls/dinput/ansi.c +++ b/dlls/dinput/ansi.c @@ -54,22 +54,22 @@ static inline IDirectInputDeviceA *IDirectInputDeviceA_from_IDirectInputDeviceW( return (IDirectInputDeviceA *)IDirectInputDevice8A_from_IDirectInputDevice8W( (IDirectInputDevice8W *)iface ); }
-static IDirectInputImpl *impl_from_IDirectInput7A( IDirectInput7A *iface ) +static struct dinput *impl_from_IDirectInput7A( IDirectInput7A *iface ) { - return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInput7A_iface ); + return CONTAINING_RECORD( iface, struct dinput, IDirectInput7A_iface ); }
-static IDirectInput7W *IDirectInput7W_from_impl( IDirectInputImpl *impl ) +static IDirectInput7W *IDirectInput7W_from_impl( struct dinput *impl ) { return &impl->IDirectInput7W_iface; }
-static IDirectInputImpl *impl_from_IDirectInput8A( IDirectInput8A *iface ) +static struct dinput *impl_from_IDirectInput8A( IDirectInput8A *iface ) { - return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInput8A_iface ); + return CONTAINING_RECORD( iface, struct dinput, IDirectInput8A_iface ); }
-static IDirectInput8W *IDirectInput8W_from_impl( IDirectInputImpl *impl ) +static IDirectInput8W *IDirectInput8W_from_impl( struct dinput *impl ) { return &impl->IDirectInput8W_iface; } @@ -678,28 +678,28 @@ const IDirectInputDevice8AVtbl dinput_device_a_vtbl =
static HRESULT WINAPI dinput8_a_QueryInterface( IDirectInput8A *iface_a, REFIID iid, void **out ) { - IDirectInputImpl *impl = impl_from_IDirectInput8A( iface_a ); + struct dinput *impl = impl_from_IDirectInput8A( iface_a ); IDirectInput8W *iface_w = IDirectInput8W_from_impl( impl ); return IDirectInput8_QueryInterface( iface_w, iid, out ); }
static ULONG WINAPI dinput8_a_AddRef( IDirectInput8A *iface_a ) { - IDirectInputImpl *impl = impl_from_IDirectInput8A( iface_a ); + struct dinput *impl = impl_from_IDirectInput8A( iface_a ); IDirectInput8W *iface_w = IDirectInput8W_from_impl( impl ); return IDirectInput8_AddRef( iface_w ); }
static ULONG WINAPI dinput8_a_Release( IDirectInput8A *iface_a ) { - IDirectInputImpl *impl = impl_from_IDirectInput8A( iface_a ); + struct dinput *impl = impl_from_IDirectInput8A( iface_a ); IDirectInput8W *iface_w = IDirectInput8W_from_impl( impl ); return IDirectInput8_Release( iface_w ); }
static HRESULT WINAPI dinput8_a_CreateDevice( IDirectInput8A *iface_a, REFGUID guid, IDirectInputDevice8A **out, IUnknown *outer ) { - IDirectInputImpl *impl = impl_from_IDirectInput8A( iface_a ); + struct dinput *impl = impl_from_IDirectInput8A( iface_a ); IDirectInput8W *iface_w = IDirectInput8W_from_impl( impl ); IDirectInputDevice8W *outw; HRESULT hr; @@ -730,7 +730,7 @@ static HRESULT WINAPI dinput8_a_EnumDevices( IDirectInput8A *iface_a, DWORD type void *ref, DWORD flags ) { struct enum_devices_wtoa_params params = {callback, ref}; - IDirectInputImpl *impl = impl_from_IDirectInput8A( iface_a ); + struct dinput *impl = impl_from_IDirectInput8A( iface_a ); IDirectInput8W *iface_w = IDirectInput8W_from_impl( impl );
if (!callback) return DIERR_INVALIDPARAM; @@ -740,28 +740,28 @@ static HRESULT WINAPI dinput8_a_EnumDevices( IDirectInput8A *iface_a, DWORD type
static HRESULT WINAPI dinput8_a_GetDeviceStatus( IDirectInput8A *iface_a, REFGUID instance_guid ) { - IDirectInputImpl *impl = impl_from_IDirectInput8A( iface_a ); + struct dinput *impl = impl_from_IDirectInput8A( iface_a ); IDirectInput8W *iface_w = IDirectInput8W_from_impl( impl ); return IDirectInput8_GetDeviceStatus( iface_w, instance_guid ); }
static HRESULT WINAPI dinput8_a_RunControlPanel( IDirectInput8A *iface_a, HWND owner, DWORD flags ) { - IDirectInputImpl *impl = impl_from_IDirectInput8A( iface_a ); + struct dinput *impl = impl_from_IDirectInput8A( iface_a ); IDirectInput8W *iface_w = IDirectInput8W_from_impl( impl ); return IDirectInput8_RunControlPanel( iface_w, owner, flags ); }
static HRESULT WINAPI dinput8_a_Initialize( IDirectInput8A *iface_a, HINSTANCE instance, DWORD version ) { - IDirectInputImpl *impl = impl_from_IDirectInput8A( iface_a ); + struct dinput *impl = impl_from_IDirectInput8A( iface_a ); IDirectInput8W *iface_w = IDirectInput8W_from_impl( impl ); return IDirectInput8_Initialize( iface_w, instance, version ); }
static HRESULT WINAPI dinput8_a_FindDevice( IDirectInput8A *iface_a, REFGUID guid, const char *name_a, GUID *instance_guid ) { - IDirectInputImpl *impl = impl_from_IDirectInput8A( iface_a ); + struct dinput *impl = impl_from_IDirectInput8A( iface_a ); IDirectInput8W *iface_w = IDirectInput8W_from_impl( impl ); HRESULT hr; WCHAR *name_w; @@ -794,7 +794,7 @@ static HRESULT WINAPI dinput8_a_EnumDevicesBySemantics( IDirectInput8A *iface_a, LPDIENUMDEVICESBYSEMANTICSCBA callback, void *ref, DWORD flags ) { struct enum_devices_by_semantics_wtoa_params params = {callback, ref}; - IDirectInputImpl *impl = impl_from_IDirectInput8A( iface_a ); + struct dinput *impl = impl_from_IDirectInput8A( iface_a ); DIACTIONFORMATW format_w = {sizeof(format_w), sizeof(DIACTIONW)}; IDirectInput8W *iface_w = IDirectInput8W_from_impl( impl ); HRESULT hr; @@ -821,7 +821,7 @@ static HRESULT WINAPI dinput8_a_EnumDevicesBySemantics( IDirectInput8A *iface_a, static HRESULT WINAPI dinput8_a_ConfigureDevices( IDirectInput8A *iface_a, LPDICONFIGUREDEVICESCALLBACK callback, DICONFIGUREDEVICESPARAMSA *params_a, DWORD flags, void *ref ) { - IDirectInputImpl *impl = impl_from_IDirectInput8A( iface_a ); + struct dinput *impl = impl_from_IDirectInput8A( iface_a ); IDirectInput8W *iface_w = IDirectInput8W_from_impl( impl ); DICONFIGUREDEVICESPARAMSW params_w = {sizeof(params_w)}; DIACTIONFORMATA *format_a = params_a->lprgFormats; @@ -873,28 +873,28 @@ const IDirectInput8AVtbl dinput8_a_vtbl =
static HRESULT WINAPI dinput7_a_QueryInterface( IDirectInput7A *iface_a, REFIID iid, void **out ) { - IDirectInputImpl *impl = impl_from_IDirectInput7A( iface_a ); + struct dinput *impl = impl_from_IDirectInput7A( iface_a ); IDirectInput7W *iface_w = IDirectInput7W_from_impl( impl ); return IDirectInput7_QueryInterface( iface_w, iid, out ); }
static ULONG WINAPI dinput7_a_AddRef( IDirectInput7A *iface_a ) { - IDirectInputImpl *impl = impl_from_IDirectInput7A( iface_a ); + struct dinput *impl = impl_from_IDirectInput7A( iface_a ); IDirectInput7W *iface_w = IDirectInput7W_from_impl( impl ); return IDirectInput7_AddRef( iface_w ); }
static ULONG WINAPI dinput7_a_Release( IDirectInput7A *iface_a ) { - IDirectInputImpl *impl = impl_from_IDirectInput7A( iface_a ); + struct dinput *impl = impl_from_IDirectInput7A( iface_a ); IDirectInput7W *iface_w = IDirectInput7W_from_impl( impl ); return IDirectInput7_Release( iface_w ); }
static HRESULT WINAPI dinput7_a_CreateDevice( IDirectInput7A *iface_a, REFGUID guid, IDirectInputDeviceA **out_a, IUnknown *outer ) { - IDirectInputImpl *impl = impl_from_IDirectInput7A( iface_a ); + struct dinput *impl = impl_from_IDirectInput7A( iface_a ); IDirectInput7W *iface_w = IDirectInput7W_from_impl( impl ); IDirectInputDeviceW *out_w; HRESULT hr; @@ -910,7 +910,7 @@ static HRESULT WINAPI dinput7_a_EnumDevices( IDirectInput7A *iface_a, DWORD type void *ref, DWORD flags ) { struct enum_devices_wtoa_params params = {callback, ref}; - IDirectInputImpl *impl = impl_from_IDirectInput7A( iface_a ); + struct dinput *impl = impl_from_IDirectInput7A( iface_a ); IDirectInput7W *iface_w = IDirectInput7W_from_impl( impl );
if (!callback) return DIERR_INVALIDPARAM; @@ -920,28 +920,28 @@ static HRESULT WINAPI dinput7_a_EnumDevices( IDirectInput7A *iface_a, DWORD type
static HRESULT WINAPI dinput7_a_GetDeviceStatus( IDirectInput7A *iface_a, REFGUID instance_guid ) { - IDirectInputImpl *impl = impl_from_IDirectInput7A( iface_a ); + struct dinput *impl = impl_from_IDirectInput7A( iface_a ); IDirectInput7W *iface_w = IDirectInput7W_from_impl( impl ); return IDirectInput7_GetDeviceStatus( iface_w, instance_guid ); }
static HRESULT WINAPI dinput7_a_RunControlPanel( IDirectInput7A *iface_a, HWND owner, DWORD flags ) { - IDirectInputImpl *impl = impl_from_IDirectInput7A( iface_a ); + struct dinput *impl = impl_from_IDirectInput7A( iface_a ); IDirectInput7W *iface_w = IDirectInput7W_from_impl( impl ); return IDirectInput7_RunControlPanel( iface_w, owner, flags ); }
static HRESULT WINAPI dinput7_a_Initialize( IDirectInput7A *iface_a, HINSTANCE instance, DWORD version ) { - IDirectInputImpl *impl = impl_from_IDirectInput7A( iface_a ); + struct dinput *impl = impl_from_IDirectInput7A( iface_a ); IDirectInput7W *iface_w = IDirectInput7W_from_impl( impl ); return IDirectInput7_Initialize( iface_w, instance, version ); }
static HRESULT WINAPI dinput7_a_FindDevice( IDirectInput7A *iface_a, REFGUID guid, const char *name_a, GUID *instance_guid ) { - IDirectInputImpl *impl = impl_from_IDirectInput7A( iface_a ); + struct dinput *impl = impl_from_IDirectInput7A( iface_a ); IDirectInput7W *iface_w = IDirectInput7W_from_impl( impl ); HRESULT hr; WCHAR *name_w; @@ -955,7 +955,7 @@ static HRESULT WINAPI dinput7_a_FindDevice( IDirectInput7A *iface_a, REFGUID gui
static HRESULT WINAPI dinput7_a_CreateDeviceEx( IDirectInput7A *iface_a, REFGUID guid, REFIID iid, void **out, IUnknown *outer ) { - IDirectInputImpl *impl = impl_from_IDirectInput7A( iface_a ); + struct dinput *impl = impl_from_IDirectInput7A( iface_a ); IDirectInput7W *iface_w = IDirectInput7W_from_impl( impl ); return IDirectInput7_CreateDeviceEx( iface_w, guid, iid, out, outer ); } diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index ff8e2252a40..8c48fa7b53b 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -2153,8 +2153,8 @@ static const IDirectInputDevice8WVtbl dinput_device_w_vtbl = dinput_device_GetImageInfo, };
-HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, - const GUID *guid, IDirectInputImpl *dinput, void **out ) +HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, const GUID *guid, + struct dinput *dinput, void **out ) { struct dinput_device *This; DIDATAFORMAT *format; diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 15a8a6f83b5..4e76d1ba738 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -84,7 +84,7 @@ struct dinput_device LONG ref; GUID guid; CRITICAL_SECTION crit; - IDirectInputImpl *dinput; + struct dinput *dinput; struct list entry; /* entry into acquired device list */ HANDLE hEvent; DIDEVICEINSTANCEW instance; @@ -124,7 +124,7 @@ struct dinput_device };
extern HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, const GUID *guid, - IDirectInputImpl *dinput, void **out ) DECLSPEC_HIDDEN; + struct dinput *dinput, void **out ) DECLSPEC_HIDDEN; extern HRESULT dinput_device_init( IDirectInputDevice8W *iface ); extern void dinput_device_destroy( IDirectInputDevice8W *iface );
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index d3d5206a1e4..b9d44f140c8 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -59,14 +59,14 @@ static const IDirectInput7WVtbl dinput7_vtbl; static const IDirectInput8WVtbl dinput8_vtbl; static const IDirectInputJoyConfig8Vtbl joy_config_vtbl;
-static inline IDirectInputImpl *impl_from_IDirectInput7W( IDirectInput7W *iface ) +static inline struct dinput *impl_from_IDirectInput7W( IDirectInput7W *iface ) { - return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInput7W_iface ); + return CONTAINING_RECORD( iface, struct dinput, IDirectInput7W_iface ); }
-static inline IDirectInputImpl *impl_from_IDirectInput8W( IDirectInput8W *iface ) +static inline struct dinput *impl_from_IDirectInput8W( IDirectInput8W *iface ) { - return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInput8W_iface ); + return CONTAINING_RECORD( iface, struct dinput, IDirectInput8W_iface ); }
static inline struct dinput_device *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) @@ -95,8 +95,8 @@ static struct list acquired_rawmouse_list = LIST_INIT( acquired_rawmouse_list ); static struct list acquired_keyboard_list = LIST_INIT( acquired_keyboard_list ); static struct list acquired_device_list = LIST_INIT( acquired_device_list );
-static HRESULT initialize_directinput_instance(IDirectInputImpl *This, DWORD dwVersion); -static void uninitialize_directinput_instance(IDirectInputImpl *This); +static HRESULT initialize_directinput_instance( struct dinput *impl, DWORD version ); +static void uninitialize_directinput_instance( struct dinput *impl );
void dinput_hooks_acquire_device( IDirectInputDevice8W *iface ) { @@ -137,28 +137,27 @@ static void dinput_device_internal_unacquire( IDirectInputDevice8W *iface ) LeaveCriticalSection( &impl->crit ); }
-static HRESULT create_directinput_instance(REFIID riid, LPVOID *ppDI, IDirectInputImpl **out) +static HRESULT dinput_create( REFIID riid, LPVOID *ppDI, struct dinput **out ) { - IDirectInputImpl *This = calloc( 1, sizeof(IDirectInputImpl) ); + struct dinput *impl = calloc( 1, sizeof(struct dinput) ); HRESULT hr;
- if (!This) - return E_OUTOFMEMORY; + if (!impl) return E_OUTOFMEMORY;
- This->IDirectInput7A_iface.lpVtbl = &dinput7_a_vtbl; - This->IDirectInput7W_iface.lpVtbl = &dinput7_vtbl; - This->IDirectInput8A_iface.lpVtbl = &dinput8_a_vtbl; - This->IDirectInput8W_iface.lpVtbl = &dinput8_vtbl; - This->IDirectInputJoyConfig8_iface.lpVtbl = &joy_config_vtbl; + impl->IDirectInput7A_iface.lpVtbl = &dinput7_a_vtbl; + impl->IDirectInput7W_iface.lpVtbl = &dinput7_vtbl; + impl->IDirectInput8A_iface.lpVtbl = &dinput8_a_vtbl; + impl->IDirectInput8W_iface.lpVtbl = &dinput8_vtbl; + impl->IDirectInputJoyConfig8_iface.lpVtbl = &joy_config_vtbl;
- hr = IDirectInput_QueryInterface( &This->IDirectInput7A_iface, riid, ppDI ); + hr = IDirectInput_QueryInterface( &impl->IDirectInput7A_iface, riid, ppDI ); if (FAILED(hr)) { - free( This ); + free( impl ); return hr; }
- if (out) *out = This; + if (out) *out = impl; return DI_OK; }
@@ -169,7 +168,7 @@ HRESULT WINAPI DirectInputCreateEx( HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI, LPUNKNOWN punkOuter) { - IDirectInputImpl *This; + struct dinput *impl; HRESULT hr;
TRACE("(%p,%04x,%s,%p,%p)\n", hinst, dwVersion, debugstr_guid(riid), ppDI, punkOuter); @@ -181,17 +180,17 @@ HRESULT WINAPI DirectInputCreateEx( IsEqualGUID( &IID_IDirectInput2W, riid ) || IsEqualGUID( &IID_IDirectInput7W, riid )) { - hr = create_directinput_instance(riid, ppDI, &This); + hr = dinput_create( riid, ppDI, &impl ); if (FAILED(hr)) return hr; } else return DIERR_NOINTERFACE;
- hr = IDirectInput_Initialize( &This->IDirectInput7A_iface, hinst, dwVersion ); + hr = IDirectInput_Initialize( &impl->IDirectInput7A_iface, hinst, dwVersion ); if (FAILED(hr)) { - IDirectInput_Release( &This->IDirectInput7A_iface ); + IDirectInput_Release( &impl->IDirectInput7A_iface ); *ppDI = NULL; return hr; } @@ -205,7 +204,7 @@ HRESULT WINAPI DirectInputCreateEx( HRESULT WINAPI DECLSPEC_HOTPATCH DirectInput8Create(HINSTANCE hinst, DWORD version, REFIID iid, void **out, IUnknown *outer) { - IDirectInputImpl *This; + struct dinput *impl; HRESULT hr;
TRACE("hinst %p, version %#x, iid %s, out %p, outer %p.\n", @@ -222,7 +221,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH DirectInput8Create(HINSTANCE hinst, return DIERR_NOINTERFACE; }
- hr = create_directinput_instance(iid, out, &This); + hr = dinput_create( iid, out, &impl );
if (FAILED(hr)) { @@ -233,10 +232,10 @@ HRESULT WINAPI DECLSPEC_HOTPATCH DirectInput8Create(HINSTANCE hinst, /* When aggregation is used, the application needs to manually call Initialize(). */ if (!outer && IsEqualGUID(&IID_IDirectInput8A, iid)) { - hr = IDirectInput8_Initialize(&This->IDirectInput8A_iface, hinst, version); + hr = IDirectInput8_Initialize( &impl->IDirectInput8A_iface, hinst, version ); if (FAILED(hr)) { - IDirectInput8_Release(&This->IDirectInput8A_iface); + IDirectInput8_Release( &impl->IDirectInput8A_iface ); *out = NULL; return hr; } @@ -244,10 +243,10 @@ HRESULT WINAPI DECLSPEC_HOTPATCH DirectInput8Create(HINSTANCE hinst,
if (!outer && IsEqualGUID(&IID_IDirectInput8W, iid)) { - hr = IDirectInput8_Initialize(&This->IDirectInput8W_iface, hinst, version); + hr = IDirectInput8_Initialize( &impl->IDirectInput8W_iface, hinst, version ); if (FAILED(hr)) { - IDirectInput8_Release(&This->IDirectInput8W_iface); + IDirectInput8_Release( &impl->IDirectInput8W_iface ); *out = NULL; return hr; } @@ -324,7 +323,7 @@ __ASM_GLOBAL_FUNC( enum_callback_wrapper, static HRESULT WINAPI dinput7_EnumDevices( IDirectInput7W *iface, DWORD type, LPDIENUMDEVICESCALLBACKW callback, void *context, DWORD flags ) { - IDirectInputImpl *impl = impl_from_IDirectInput7W( iface ); + struct dinput *impl = impl_from_IDirectInput7W( iface );
TRACE( "iface %p, type %#x, callback %p, context %p, flags %#x.\n", iface, type, callback, context, flags );
@@ -339,7 +338,7 @@ static HRESULT WINAPI dinput7_EnumDevices( IDirectInput7W *iface, DWORD type, LP
static ULONG WINAPI dinput7_AddRef( IDirectInput7W *iface ) { - IDirectInputImpl *impl = impl_from_IDirectInput7W( iface ); + struct dinput *impl = impl_from_IDirectInput7W( iface ); ULONG ref = InterlockedIncrement( &impl->ref ); TRACE( "iface %p increasing refcount to %u.\n", iface, ref ); return ref; @@ -347,7 +346,7 @@ static ULONG WINAPI dinput7_AddRef( IDirectInput7W *iface )
static ULONG WINAPI dinput7_Release( IDirectInput7W *iface ) { - IDirectInputImpl *impl = impl_from_IDirectInput7W( iface ); + struct dinput *impl = impl_from_IDirectInput7W( iface ); ULONG ref = InterlockedDecrement( &impl->ref );
TRACE( "iface %p decreasing refcount to %u.\n", iface, ref ); @@ -363,7 +362,7 @@ static ULONG WINAPI dinput7_Release( IDirectInput7W *iface )
static HRESULT WINAPI dinput7_QueryInterface( IDirectInput7W *iface, REFIID iid, void **out ) { - IDirectInputImpl *impl = impl_from_IDirectInput7W( iface ); + struct dinput *impl = impl_from_IDirectInput7W( iface );
TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out );
@@ -450,7 +449,7 @@ static void unregister_di_em_win_class(void) WARN( "Unable to unregister message window class\n" ); }
-static HRESULT initialize_directinput_instance( IDirectInputImpl *impl, DWORD version ) +static HRESULT initialize_directinput_instance( struct dinput *impl, DWORD version ) { if (!impl->initialized) { @@ -465,7 +464,7 @@ static HRESULT initialize_directinput_instance( IDirectInputImpl *impl, DWORD ve return DI_OK; }
-static void uninitialize_directinput_instance( IDirectInputImpl *impl ) +static void uninitialize_directinput_instance( struct dinput *impl ) { if (impl->initialized) { @@ -491,7 +490,7 @@ enum directinput_versions
static HRESULT WINAPI dinput7_Initialize( IDirectInput7W *iface, HINSTANCE hinst, DWORD version ) { - IDirectInputImpl *impl = impl_from_IDirectInput7W( iface ); + struct dinput *impl = impl_from_IDirectInput7W( iface );
TRACE( "iface %p, hinst %p, version %#x.\n", iface, hinst, version );
@@ -512,7 +511,7 @@ static HRESULT WINAPI dinput7_Initialize( IDirectInput7W *iface, HINSTANCE hinst
static HRESULT WINAPI dinput7_GetDeviceStatus( IDirectInput7W *iface, const GUID *guid ) { - IDirectInputImpl *impl = impl_from_IDirectInput7W( iface ); + struct dinput *impl = impl_from_IDirectInput7W( iface ); HRESULT hr; IDirectInputDeviceW *device;
@@ -531,7 +530,7 @@ static HRESULT WINAPI dinput7_GetDeviceStatus( IDirectInput7W *iface, const GUID
static HRESULT WINAPI dinput7_RunControlPanel( IDirectInput7W *iface, HWND owner, DWORD flags ) { - IDirectInputImpl *impl = impl_from_IDirectInput7W( iface ); + struct dinput *impl = impl_from_IDirectInput7W( iface ); WCHAR control_exe[] = {L"control.exe"}; STARTUPINFOW si = {0}; PROCESS_INFORMATION pi; @@ -558,7 +557,7 @@ static HRESULT WINAPI dinput7_FindDevice( IDirectInput7W *iface, const GUID *gui static HRESULT WINAPI dinput7_CreateDeviceEx( IDirectInput7W *iface, const GUID *guid, REFIID iid, void **out, IUnknown *outer ) { - IDirectInputImpl *impl = impl_from_IDirectInput7W( iface ); + struct dinput *impl = impl_from_IDirectInput7W( iface ); IDirectInputDevice8W *device; HRESULT hr;
@@ -593,26 +592,26 @@ static HRESULT WINAPI dinput7_CreateDevice( IDirectInput7W *iface, const GUID *g
static ULONG WINAPI dinput8_AddRef( IDirectInput8W *iface ) { - IDirectInputImpl *impl = impl_from_IDirectInput8W( iface ); + struct dinput *impl = impl_from_IDirectInput8W( iface ); return IDirectInput7_AddRef( &impl->IDirectInput7W_iface ); }
static HRESULT WINAPI dinput8_QueryInterface( IDirectInput8W *iface, REFIID iid, void **out ) { - IDirectInputImpl *impl = impl_from_IDirectInput8W( iface ); + struct dinput *impl = impl_from_IDirectInput8W( iface ); return IDirectInput7_QueryInterface( &impl->IDirectInput7W_iface, iid, out ); }
static ULONG WINAPI dinput8_Release( IDirectInput8W *iface ) { - IDirectInputImpl *impl = impl_from_IDirectInput8W( iface ); + struct dinput *impl = impl_from_IDirectInput8W( iface ); return IDirectInput7_Release( &impl->IDirectInput7W_iface ); }
static HRESULT WINAPI dinput8_CreateDevice( IDirectInput8W *iface, const GUID *guid, IDirectInputDevice8W **out, IUnknown *outer ) { - IDirectInputImpl *impl = impl_from_IDirectInput8W( iface ); + struct dinput *impl = impl_from_IDirectInput8W( iface ); return IDirectInput7_CreateDeviceEx( &impl->IDirectInput7W_iface, guid, &IID_IDirectInputDevice8W, (void **)out, outer ); } @@ -630,7 +629,7 @@ static HRESULT WINAPI dinput8_EnumDevices( IDirectInput8W *iface, DWORD type, LP DWORD flags ) { DIDEVICEINSTANCEW instance = {.dwSize = sizeof(DIDEVICEINSTANCEW)}; - IDirectInputImpl *impl = impl_from_IDirectInput8W( iface ); + struct dinput *impl = impl_from_IDirectInput8W( iface ); DWORD device_class = 0, device_type = 0; unsigned int i = 0; HRESULT hr; @@ -679,19 +678,19 @@ static HRESULT WINAPI dinput8_EnumDevices( IDirectInput8W *iface, DWORD type, LP
static HRESULT WINAPI dinput8_GetDeviceStatus( IDirectInput8W *iface, const GUID *guid ) { - IDirectInputImpl *impl = impl_from_IDirectInput8W( iface ); + struct dinput *impl = impl_from_IDirectInput8W( iface ); return IDirectInput7_GetDeviceStatus( &impl->IDirectInput7W_iface, guid ); }
static HRESULT WINAPI dinput8_RunControlPanel( IDirectInput8W *iface, HWND owner, DWORD flags ) { - IDirectInputImpl *impl = impl_from_IDirectInput8W( iface ); + struct dinput *impl = impl_from_IDirectInput8W( iface ); return IDirectInput7_RunControlPanel( &impl->IDirectInput7W_iface, owner, flags ); }
static HRESULT WINAPI dinput8_Initialize( IDirectInput8W *iface, HINSTANCE hinst, DWORD version ) { - IDirectInputImpl *impl = impl_from_IDirectInput8W( iface ); + struct dinput *impl = impl_from_IDirectInput8W( iface );
TRACE( "iface %p, hinst %p, version %#x.\n", iface, hinst, version );
@@ -709,7 +708,7 @@ static HRESULT WINAPI dinput8_Initialize( IDirectInput8W *iface, HINSTANCE hinst
static HRESULT WINAPI dinput8_FindDevice( IDirectInput8W *iface, const GUID *guid, const WCHAR *name, GUID *instance_guid ) { - IDirectInputImpl *impl = impl_from_IDirectInput8W( iface ); + struct dinput *impl = impl_from_IDirectInput8W( iface ); return IDirectInput7_FindDevice( &impl->IDirectInput7W_iface, guid, name, instance_guid ); }
@@ -767,7 +766,7 @@ struct enum_device_by_semantics_params static BOOL CALLBACK enum_device_by_semantics( const DIDEVICEINSTANCEW *instance, void *context ) { struct enum_device_by_semantics_params *params = context; - IDirectInputImpl *impl = impl_from_IDirectInput8W( params->iface ); + struct dinput *impl = impl_from_IDirectInput8W( params->iface );
if (should_enumerate_device( params->username, params->flags, &impl->device_players, &instance->guidInstance )) { @@ -786,7 +785,7 @@ static HRESULT WINAPI dinput8_EnumDevicesBySemantics( IDirectInput8W *iface, con DWORD callbackFlags, enum_flags = DIEDFL_ATTACHEDONLY | (flags & DIEDFL_FORCEFEEDBACK); static const GUID *guids[2] = {&GUID_SysKeyboard, &GUID_SysMouse}; static const DWORD actionMasks[] = { DIKEYBOARD_MASK, DIMOUSE_MASK }; - IDirectInputImpl *impl = impl_from_IDirectInput8W( iface ); + struct dinput *impl = impl_from_IDirectInput8W( iface ); DIDEVICEINSTANCEW didevi; IDirectInputDevice8W *lpdid; unsigned int i = 0; @@ -870,26 +869,26 @@ static HRESULT WINAPI dinput8_ConfigureDevices( IDirectInput8W *iface, LPDICONFI * IDirectInputJoyConfig8 interface */
-static inline IDirectInputImpl *impl_from_IDirectInputJoyConfig8(IDirectInputJoyConfig8 *iface) +static inline struct dinput *impl_from_IDirectInputJoyConfig8( IDirectInputJoyConfig8 *iface ) { - return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInputJoyConfig8_iface ); + return CONTAINING_RECORD( iface, struct dinput, IDirectInputJoyConfig8_iface ); }
static HRESULT WINAPI joy_config_QueryInterface( IDirectInputJoyConfig8 *iface, REFIID iid, void **out ) { - IDirectInputImpl *impl = impl_from_IDirectInputJoyConfig8( iface ); + struct dinput *impl = impl_from_IDirectInputJoyConfig8( iface ); return IDirectInput7_QueryInterface( &impl->IDirectInput7W_iface, iid, out ); }
static ULONG WINAPI joy_config_AddRef( IDirectInputJoyConfig8 *iface ) { - IDirectInputImpl *impl = impl_from_IDirectInputJoyConfig8( iface ); + struct dinput *impl = impl_from_IDirectInputJoyConfig8( iface ); return IDirectInput7_AddRef( &impl->IDirectInput7W_iface ); }
static ULONG WINAPI joy_config_Release( IDirectInputJoyConfig8 *iface ) { - IDirectInputImpl *impl = impl_from_IDirectInputJoyConfig8( iface ); + struct dinput *impl = impl_from_IDirectInputJoyConfig8( iface ); return IDirectInput7_Release( &impl->IDirectInput7W_iface ); }
@@ -960,7 +959,7 @@ static BOOL CALLBACK find_device_from_index( const DIDEVICEINSTANCEW *instance,
static HRESULT WINAPI joy_config_GetConfig( IDirectInputJoyConfig8 *iface, UINT id, DIJOYCONFIG *info, DWORD flags ) { - IDirectInputImpl *impl = impl_from_IDirectInputJoyConfig8( iface ); + struct dinput *impl = impl_from_IDirectInputJoyConfig8( iface ); struct find_device_from_index_params params = {.index = id}; HRESULT hr;
@@ -1124,7 +1123,7 @@ static HRESULT WINAPI class_factory_CreateInstance( IClassFactory *iface, IUnkno
if (outer) return CLASS_E_NOAGGREGATION;
- if (FAILED(hr = create_directinput_instance( &IID_IUnknown, (void **)&unknown, NULL ))) return hr; + if (FAILED(hr = dinput_create( &IID_IUnknown, (void **)&unknown, NULL ))) return hr; hr = IUnknown_QueryInterface( unknown, iid, out ); IUnknown_Release( unknown );
diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index 4b36a69c0e1..de48c4c5298 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -30,31 +30,30 @@ extern HINSTANCE DINPUT_instance;
/* Implementation specification */ -typedef struct IDirectInputImpl IDirectInputImpl; -struct IDirectInputImpl +struct dinput { - IDirectInput7A IDirectInput7A_iface; - IDirectInput7W IDirectInput7W_iface; - IDirectInput8A IDirectInput8A_iface; - IDirectInput8W IDirectInput8W_iface; - IDirectInputJoyConfig8 IDirectInputJoyConfig8_iface; + IDirectInput7A IDirectInput7A_iface; + IDirectInput7W IDirectInput7W_iface; + IDirectInput8A IDirectInput8A_iface; + IDirectInput8W IDirectInput8W_iface; + IDirectInputJoyConfig8 IDirectInputJoyConfig8_iface; + LONG ref;
- LONG ref; - BOOL initialized; - DWORD evsequence; /* unique sequence number for events */ - DWORD dwVersion; /* direct input version number */ - struct list device_players; /* device instance guid to player name */ + BOOL initialized; + DWORD dwVersion; /* direct input version number */ + DWORD evsequence; /* unique sequence number for events */ + struct list device_players; /* device instance guid to player name */ };
extern const IDirectInput7AVtbl dinput7_a_vtbl DECLSPEC_HIDDEN; extern const IDirectInput8AVtbl dinput8_a_vtbl DECLSPEC_HIDDEN;
extern HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version ); -extern HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out ); +extern HRESULT mouse_create_device( struct dinput *dinput, const GUID *guid, IDirectInputDevice8W **out ); extern HRESULT keyboard_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version ); -extern HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out ); +extern HRESULT keyboard_create_device( struct dinput *dinput, const GUID *guid, IDirectInputDevice8W **out ); extern HRESULT hid_joystick_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index ); -extern HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out ); +extern HRESULT hid_joystick_create_device( struct dinput *dinput, const GUID *guid, IDirectInputDevice8W **out );
struct DevicePlayer { GUID instance_guid; diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 597a3da4ef8..067ffabaaa9 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -1964,7 +1964,7 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap return DIENUM_CONTINUE; }
-HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out ) +HRESULT hid_joystick_create_device( struct dinput *dinput, const GUID *guid, IDirectInputDevice8W **out ) { static const DIPROPHEADER filter = { diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index 1421e56ac3a..c483fb6e66a 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -164,7 +164,7 @@ HRESULT keyboard_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instan return DI_OK; }
-HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out ) +HRESULT keyboard_create_device( struct dinput *dinput, const GUID *guid, IDirectInputDevice8W **out ) { struct keyboard *impl; HRESULT hr; diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 64b2c30008d..43f3a6ad334 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -91,7 +91,7 @@ HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, return DI_OK; }
-HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out ) +HRESULT mouse_create_device( struct dinput *dinput, const GUID *guid, IDirectInputDevice8W **out ) { struct mouse *impl; HKEY hkey, appkey;