dinput: Make newly created device append itself to Direct Input's list.

This commit is contained in:
Vitaliy Margolen 2011-01-18 21:06:37 -07:00 committed by Alexandre Julliard
parent 2a219b948c
commit 9441d898f7
6 changed files with 23 additions and 14 deletions

View File

@ -506,14 +506,7 @@ static HRESULT WINAPI IDirectInput7AImpl_CreateDeviceEx(LPDIRECTINPUT7A iface, R
if (!dinput_devices[i]->create_deviceA) continue;
if ((ret = dinput_devices[i]->create_deviceA(This, rguid, riid, (LPDIRECTINPUTDEVICEA*) pvOut)) == DI_OK)
{
IDirectInputDeviceImpl *dev = impl_from_IDirectInputDevice8A(*pvOut);
EnterCriticalSection( &This->crit );
list_add_tail( &This->devices_list, &dev->entry );
LeaveCriticalSection( &This->crit );
return DI_OK;
}
if (ret == DIERR_NOINTERFACE)
ret_value = DIERR_NOINTERFACE;
@ -544,14 +537,7 @@ static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx(LPDIRECTINPUT7W iface, R
if (!dinput_devices[i]->create_deviceW) continue;
if ((ret = dinput_devices[i]->create_deviceW(This, rguid, riid, (LPDIRECTINPUTDEVICEW*) pvOut)) == DI_OK)
{
IDirectInputDeviceImpl *dev = impl_from_IDirectInputDevice8W(*pvOut);
EnterCriticalSection( &This->crit );
list_add_tail( &This->devices_list, &dev->entry );
LeaveCriticalSection( &This->crit );
return DI_OK;
}
if (ret == DIERR_NOINTERFACE)
ret_value = DIERR_NOINTERFACE;

View File

@ -390,6 +390,10 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput,
IDirectInput_AddRef(&newDevice->generic.base.dinput->IDirectInput7A_iface);
EnterCriticalSection(&dinput->crit);
list_add_tail(&dinput->devices_list, &newDevice->generic.base.entry);
LeaveCriticalSection(&dinput->crit);
newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps);
newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED;
if (newDevice->generic.base.dinput->dwVersion >= 0x0800)

View File

@ -525,6 +525,11 @@ static JoystickImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput, unsig
newDevice->generic.devcaps.dwFlags |= DIDC_FORCEFEEDBACK;
IDirectInput_AddRef(&newDevice->generic.base.dinput->IDirectInput7A_iface);
EnterCriticalSection(&dinput->crit);
list_add_tail(&dinput->devices_list, &newDevice->generic.base.entry);
LeaveCriticalSection(&dinput->crit);
return newDevice;
failed:

View File

@ -821,6 +821,10 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput,
IDirectInput_AddRef(&newDevice->generic.base.dinput->IDirectInput7A_iface);
EnterCriticalSection(&dinput->crit);
list_add_tail(&dinput->devices_list, &newDevice->generic.base.entry);
LeaveCriticalSection(&dinput->crit);
newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps);
newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED;
if (newDevice->generic.base.dinput->dwVersion >= 0x0800)

View File

@ -255,6 +255,11 @@ static SysKeyboardImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
newDevice->base.data_format.wine_df = df;
IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface);
EnterCriticalSection(&dinput->crit);
list_add_tail(&dinput->devices_list, &newDevice->base.entry);
LeaveCriticalSection(&dinput->crit);
return newDevice;
failed:

View File

@ -242,6 +242,11 @@ static SysMouseImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
newDevice->base.data_format.wine_df = df;
IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface);
EnterCriticalSection(&dinput->crit);
list_add_tail(&dinput->devices_list, &newDevice->base.entry);
LeaveCriticalSection(&dinput->crit);
return newDevice;
failed: