dinput: Trace device entry points calls consistently.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-10-27 09:40:58 +02:00 committed by Alexandre Julliard
parent e043d1d3af
commit 69c9631081
1 changed files with 69 additions and 81 deletions

View File

@ -929,17 +929,18 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire( IDirectInputDevice8W *
* IDirectInputDeviceA * IDirectInputDeviceA
*/ */
static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice8W *iface, LPCDIDATAFORMAT df ) static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice8W *iface, const DIDATAFORMAT *format )
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
HRESULT res = DI_OK; HRESULT res = DI_OK;
if (!df) return E_POINTER; TRACE( "iface %p, format %p.\n", iface, format );
TRACE("(%p) %p\n", This, df);
_dump_DIDATAFORMAT(df);
if (df->dwSize != sizeof(DIDATAFORMAT)) return DIERR_INVALIDPARAM; if (!format) return E_POINTER;
if (df->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) return DIERR_INVALIDPARAM; _dump_DIDATAFORMAT( format );
if (format->dwSize != sizeof(DIDATAFORMAT)) return DIERR_INVALIDPARAM;
if (format->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) return DIERR_INVALIDPARAM;
if (This->acquired) return DIERR_ACQUIRED; if (This->acquired) return DIERR_ACQUIRED;
EnterCriticalSection(&This->crit); EnterCriticalSection(&This->crit);
@ -949,7 +950,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice
This->num_actions = 0; This->num_actions = 0;
release_DataFormat(&This->data_format); release_DataFormat(&This->data_format);
res = create_DataFormat(df, &This->data_format); res = create_DataFormat( format, &This->data_format );
LeaveCriticalSection(&This->crit); LeaveCriticalSection(&This->crit);
return res; return res;
@ -961,32 +962,31 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice
* Set cooperative level and the source window for the events. * Set cooperative level and the source window for the events.
*/ */
static HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel( IDirectInputDevice8W *iface, static HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel( IDirectInputDevice8W *iface,
HWND hwnd, DWORD dwflags ) HWND hwnd, DWORD flags )
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
HRESULT hr; HRESULT hr;
TRACE("(%p) %p,0x%08x\n", This, hwnd, dwflags); TRACE( "iface %p, hwnd %p, flags %#x.\n", iface, hwnd, flags );
_dump_cooperativelevel_DI(dwflags);
if ((dwflags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == 0 || _dump_cooperativelevel_DI( flags );
(dwflags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE) ||
(dwflags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == 0 || if ((flags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == 0 ||
(dwflags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == (DISCL_FOREGROUND | DISCL_BACKGROUND)) (flags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE) ||
(flags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == 0 ||
(flags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == (DISCL_FOREGROUND | DISCL_BACKGROUND))
return DIERR_INVALIDPARAM; return DIERR_INVALIDPARAM;
if (hwnd && GetWindowLongW(hwnd, GWL_STYLE) & WS_CHILD) return E_HANDLE; if (hwnd && GetWindowLongW(hwnd, GWL_STYLE) & WS_CHILD) return E_HANDLE;
if (!hwnd && dwflags == (DISCL_NONEXCLUSIVE | DISCL_BACKGROUND)) if (!hwnd && flags == (DISCL_NONEXCLUSIVE | DISCL_BACKGROUND)) hwnd = GetDesktopWindow();
hwnd = GetDesktopWindow();
if (!IsWindow(hwnd)) return E_HANDLE; if (!IsWindow(hwnd)) return E_HANDLE;
/* For security reasons native does not allow exclusive background level /* For security reasons native does not allow exclusive background level
for mouse and keyboard only */ for mouse and keyboard only */
if (dwflags & DISCL_EXCLUSIVE && dwflags & DISCL_BACKGROUND && if (flags & DISCL_EXCLUSIVE && flags & DISCL_BACKGROUND &&
(IsEqualGUID(&This->guid, &GUID_SysMouse) || (IsEqualGUID( &This->guid, &GUID_SysMouse ) || IsEqualGUID( &This->guid, &GUID_SysKeyboard )))
IsEqualGUID(&This->guid, &GUID_SysKeyboard)))
return DIERR_UNSUPPORTED; return DIERR_UNSUPPORTED;
/* Store the window which asks for the mouse */ /* Store the window which asks for the mouse */
@ -995,7 +995,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel( IDirectInput
else else
{ {
This->win = hwnd; This->win = hwnd;
This->dwCoopLevel = dwflags; This->dwCoopLevel = flags;
hr = DI_OK; hr = DI_OK;
} }
LeaveCriticalSection(&This->crit); LeaveCriticalSection(&This->crit);
@ -1029,7 +1029,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification( IDirectInpu
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
TRACE("(%p) %p\n", This, event); TRACE( "iface %p, event %p.\n", iface, event );
EnterCriticalSection(&This->crit); EnterCriticalSection(&This->crit);
This->hEvent = event; This->hEvent = event;
@ -1100,34 +1100,34 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetCapabilities( IDirectInputDevi
} }
static HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface( IDirectInputDevice8W *iface, static HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface( IDirectInputDevice8W *iface,
REFIID riid, LPVOID *ppobj ) const GUID *iid, void **out )
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppobj); TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out );
if (IsEqualGUID(&IID_IDirectInputDeviceA, riid) || if (IsEqualGUID( &IID_IDirectInputDeviceA, iid ) ||
IsEqualGUID(&IID_IDirectInputDevice2A, riid) || IsEqualGUID( &IID_IDirectInputDevice2A, iid ) ||
IsEqualGUID(&IID_IDirectInputDevice7A, riid) || IsEqualGUID( &IID_IDirectInputDevice7A, iid ) ||
IsEqualGUID(&IID_IDirectInputDevice8A, riid)) IsEqualGUID( &IID_IDirectInputDevice8A, iid ))
{ {
IDirectInputDevice2_AddRef(iface); IDirectInputDevice2_AddRef(iface);
*ppobj = IDirectInputDevice8A_from_impl(This); *out = IDirectInputDevice8A_from_impl( This );
return DI_OK; return DI_OK;
} }
if (IsEqualGUID(&IID_IUnknown, riid) || if (IsEqualGUID( &IID_IUnknown, iid ) ||
IsEqualGUID(&IID_IDirectInputDeviceW, riid) || IsEqualGUID( &IID_IDirectInputDeviceW, iid ) ||
IsEqualGUID(&IID_IDirectInputDevice2W, riid) || IsEqualGUID( &IID_IDirectInputDevice2W, iid ) ||
IsEqualGUID(&IID_IDirectInputDevice7W, riid) || IsEqualGUID( &IID_IDirectInputDevice7W, iid ) ||
IsEqualGUID(&IID_IDirectInputDevice8W, riid)) IsEqualGUID( &IID_IDirectInputDevice8W, iid ))
{ {
IDirectInputDevice2_AddRef(iface); IDirectInputDevice2_AddRef(iface);
*ppobj = IDirectInputDevice8W_from_impl(This); *out = IDirectInputDevice8W_from_impl( This );
return DI_OK; return DI_OK;
} }
WARN("Unsupported interface!\n"); WARN( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) );
return E_NOINTERFACE; return E_NOINTERFACE;
} }
@ -1564,18 +1564,16 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceState( IDirectInputDevic
return hr; return hr;
} }
static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice8W *iface, static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice8W *iface, DWORD size,
DWORD dodsize, LPDIDEVICEOBJECTDATA dod, DIDEVICEOBJECTDATA *data, DWORD *count, DWORD flags )
LPDWORD entries, DWORD flags )
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
HRESULT ret = DI_OK; HRESULT ret = DI_OK;
int len; int len;
TRACE("(%p) %p -> %p(%d) x%d, 0x%08x\n", TRACE( "iface %p, size %u, data %p, count %p, flags %#x.\n", iface, size, data, count, flags );
This, dod, entries, entries ? *entries : 0, dodsize, flags);
if (This->dinput->dwVersion == 0x0800 || dodsize == sizeof(DIDEVICEOBJECTDATA_DX3)) if (This->dinput->dwVersion == 0x0800 || size == sizeof(DIDEVICEOBJECTDATA_DX3))
{ {
if (!This->queue_len) return DIERR_NOTBUFFERED; if (!This->queue_len) return DIERR_NOTBUFFERED;
if (!This->acquired) return DIERR_NOTACQUIRED; if (!This->acquired) return DIERR_NOTACQUIRED;
@ -1583,8 +1581,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice
if (!This->queue_len) if (!This->queue_len)
return DI_OK; return DI_OK;
if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3)) if (size < sizeof(DIDEVICEOBJECTDATA_DX3)) return DIERR_INVALIDPARAM;
return DIERR_INVALIDPARAM;
IDirectInputDevice2_Poll(iface); IDirectInputDevice2_Poll(iface);
EnterCriticalSection(&This->crit); EnterCriticalSection(&This->crit);
@ -1592,18 +1589,18 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice
len = This->queue_head - This->queue_tail; len = This->queue_head - This->queue_tail;
if (len < 0) len += This->queue_len; if (len < 0) len += This->queue_len;
if ((*entries != INFINITE) && (len > *entries)) len = *entries; if ((*count != INFINITE) && (len > *count)) len = *count;
if (dod) if (data)
{ {
int i; int i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
int n = (This->queue_tail + i) % This->queue_len; int n = (This->queue_tail + i) % This->queue_len;
memcpy((char *)dod + dodsize * i, This->data_queue + n, dodsize); memcpy( (char *)data + size * i, This->data_queue + n, size );
} }
} }
*entries = len; *count = len;
if (This->overflow && This->dinput->dwVersion == 0x0800) if (This->overflow && This->dinput->dwVersion == 0x0800)
ret = DI_BUFFEROVERFLOW; ret = DI_BUFFEROVERFLOW;
@ -1617,24 +1614,21 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice
LeaveCriticalSection(&This->crit); LeaveCriticalSection(&This->crit);
TRACE("Returning %d events queued\n", *entries); TRACE( "Returning %d events queued\n", *count );
return ret; return ret;
} }
static HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel( IDirectInputDevice8W *iface, static HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel( IDirectInputDevice8W *iface, HWND hwnd, DWORD flags )
HWND hwndOwner, DWORD dwFlags )
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME( "iface %p, hwnd %p, flags %#x stub!\n", iface, hwnd, flags );
FIXME("%p)->(%p,0x%08x): stub!\n", This, hwndOwner, dwFlags);
return DI_OK; return DI_OK;
} }
static HRESULT WINAPI IDirectInputDevice2WImpl_Initialize( IDirectInputDevice8W *iface, HINSTANCE hinst, static HRESULT WINAPI IDirectInputDevice2WImpl_Initialize( IDirectInputDevice8W *iface, HINSTANCE instance,
DWORD dwVersion, REFGUID rguid ) DWORD version, const GUID *guid )
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME( "iface %p, instance %p, version %#x, guid %s stub!\n", iface, instance, version,
FIXME("(%p)->(%p,%d,%s): stub!\n", This, hinst, dwVersion, debugstr_guid(rguid)); debugstr_guid( guid ) );
return DI_OK; return DI_OK;
} }
@ -1809,10 +1803,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects( IDirect
return impl->vtbl->enum_created_effect_objects( iface, callback, context, flags ); return impl->vtbl->enum_created_effect_objects( iface, callback, context, flags );
} }
static HRESULT WINAPI IDirectInputDevice2WImpl_Escape( IDirectInputDevice8W *iface, LPDIEFFESCAPE lpDIEEsc ) static HRESULT WINAPI IDirectInputDevice2WImpl_Escape( IDirectInputDevice8W *iface, DIEFFESCAPE *escape )
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME( "iface %p, escape %p stub!\n", iface, escape );
FIXME("(%p)->(%p): stub!\n", This, lpDIEEsc);
return DI_OK; return DI_OK;
} }
@ -1830,33 +1823,30 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_Poll( IDirectInputDevice8W *iface
return DI_OK; return DI_OK;
} }
static HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData( IDirectInputDevice8W *iface, DWORD cbObjectData, static HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData( IDirectInputDevice8W *iface, DWORD size,
LPCDIDEVICEOBJECTDATA rgdod, const DIDEVICEOBJECTDATA *data,
LPDWORD pdwInOut, DWORD dwFlags ) DWORD *count, DWORD flags )
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME( "iface %p, size %u, data %p, count %p, flags %#x stub!\n", iface, size, data, count, flags );
FIXME("(%p)->(0x%08x,%p,%p,0x%08x): stub!\n", This, cbObjectData, rgdod, pdwInOut, dwFlags);
return DI_OK; return DI_OK;
} }
static HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile( IDirectInputDevice8W *iface, LPCWSTR lpszFileName, static HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile( IDirectInputDevice8W *iface,
LPDIENUMEFFECTSINFILECALLBACK pec, const WCHAR *filename,
LPVOID pvRef, DWORD dwFlags ) LPDIENUMEFFECTSINFILECALLBACK callback,
void *context, DWORD flags )
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME( "iface %p, filename %s, callback %p, context %p, flags %#x stub!\n", iface,
FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", This, debugstr_w(lpszFileName), pec, pvRef, dwFlags); debugstr_w(filename), callback, context, flags );
return DI_OK; return DI_OK;
} }
static HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile( IDirectInputDevice8W *iface, static HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile( IDirectInputDevice8W *iface,
LPCWSTR lpszFileName, DWORD dwEntries, const WCHAR *filename, DWORD count,
LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags ) DIFILEEFFECT *effects, DWORD flags )
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME( "iface %p, filename %s, count %u, effects %p, flags %#x stub!\n", iface,
FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", This, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags); debugstr_w(filename), count, effects, flags );
return DI_OK; return DI_OK;
} }
@ -2072,11 +2062,9 @@ static HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap( IDirectInputDevice8
} }
static HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo( IDirectInputDevice8W *iface, static HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo( IDirectInputDevice8W *iface,
LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader ) DIDEVICEIMAGEINFOHEADERW *header )
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME( "iface %p, header %p stub!\n", iface, header );
FIXME("(%p)->(%p): stub !\n", This, lpdiDevImageInfoHeader);
return DI_OK; return DI_OK;
} }