Commit 0686815f authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Check acquired state in IDirectInputDevice2WImpl_SetCooperativeLevel.

parent 0e757229
......@@ -1118,6 +1118,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W ifac
HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags)
{
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
HRESULT hr;
TRACE("(%p) %p,0x%08x\n", This, hwnd, dwflags);
_dump_cooperativelevel_DI(dwflags);
......@@ -1144,11 +1145,16 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8
/* Store the window which asks for the mouse */
EnterCriticalSection(&This->crit);
This->win = hwnd;
This->dwCoopLevel = dwflags;
if (This->acquired) hr = DIERR_ACQUIRED;
else
{
This->win = hwnd;
This->dwCoopLevel = dwflags;
hr = DI_OK;
}
LeaveCriticalSection(&This->crit);
return DI_OK;
return hr;
}
/******************************************************************************
......
......@@ -4082,7 +4082,6 @@ static void test_simple_joystick(void)
hr = IDirectInputDevice8_Acquire( device );
ok( hr == DI_OK, "IDirectInputDevice8_Acquire returned: %#x\n", hr );
hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE );
todo_wine
ok( hr == DIERR_ACQUIRED, "IDirectInputDevice8_SetCooperativeLevel returned: %#x\n", hr );
hr = IDirectInputDevice8_Unacquire( device );
ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
......
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