MSDN states that the function can only return one of DIERR_INVALIDPARAM, DIERR_NOTINITIALIZED, DIERR_OTHERAPPHASPRIO, on error, and DI_OK, or DI_NOEFFECT, on success.
Some games will try to call Acquire again in a tight loop and block the main thread if DIERR_INPUTLOST is returned. There's a small chance for this to happen with Resident Evil 2, whenever a joystick is plugged, then quickly unplugged.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/joystick_hid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 3b02600ce4e..4ba127b1fd2 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -866,7 +866,7 @@ static HRESULT hid_joystick_acquire( IDirectInputDevice8W *iface ) { impl->device = CreateFileW( impl->device_path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, 0 ); - if (impl->device == INVALID_HANDLE_VALUE) return DIERR_INPUTLOST; + if (impl->device == INVALID_HANDLE_VALUE) return DIERR_INVALIDPARAM; }
memset( &impl->read_ovl, 0, sizeof(impl->read_ovl) ); @@ -876,7 +876,7 @@ static HRESULT hid_joystick_acquire( IDirectInputDevice8W *iface ) { CloseHandle( impl->device ); impl->device = INVALID_HANDLE_VALUE; - return DIERR_INPUTLOST; + return DIERR_INVALIDPARAM; }
IDirectInputDevice8_SendForceFeedbackCommand( iface, DISFFC_RESET );