Commit 7c552a4a authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

Report an error if GetDeviceData is called on an Unacquired device.

parent 816c86c4
...@@ -299,8 +299,10 @@ HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel( ...@@ -299,8 +299,10 @@ HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
) { ) {
ICOM_THIS(IDirectInputDevice2AImpl,iface); ICOM_THIS(IDirectInputDevice2AImpl,iface);
TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags); TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags);
if (TRACE_ON(dinput)) if (TRACE_ON(dinput)) {
_dump_cooperativelevel_DI(dwflags); TRACE(" cooperative level : ");
_dump_cooperativelevel_DI(dwflags);
}
return 0; return 0;
} }
......
...@@ -270,8 +270,10 @@ static HRESULT WINAPI SysMouseAImpl_SetCooperativeLevel( ...@@ -270,8 +270,10 @@ static HRESULT WINAPI SysMouseAImpl_SetCooperativeLevel(
TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags); TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags);
if (TRACE_ON(dinput)) if (TRACE_ON(dinput)) {
_dump_cooperativelevel_DI(dwflags); TRACE(" cooperative level : ");
_dump_cooperativelevel_DI(dwflags);
}
/* Store the window which asks for the mouse */ /* Store the window which asks for the mouse */
if (!hwnd) if (!hwnd)
...@@ -640,9 +642,15 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, ...@@ -640,9 +642,15 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
ICOM_THIS(SysMouseAImpl,iface); ICOM_THIS(SysMouseAImpl,iface);
DWORD len, nqtail; DWORD len, nqtail;
EnterCriticalSection(&(This->crit));
TRACE("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx)\n",This,dodsize,*entries,flags); TRACE("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx)\n",This,dodsize,*entries,flags);
if (This->acquired == 0) {
WARN(" application tries to get data from an unacquired device !\n");
return DIERR_NOTACQUIRED;
}
EnterCriticalSection(&(This->crit));
len = ((This->queue_head < This->queue_tail) ? This->queue_len : 0) len = ((This->queue_head < This->queue_tail) ? This->queue_len : 0)
+ (This->queue_head - This->queue_tail); + (This->queue_head - This->queue_tail);
if (len > *entries) len = *entries; if (len > *entries) len = *entries;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment