Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
Testing shows that GetMany always crashes when the vector is empty, as well as passing NULL pointers to GetAt/get_Size/IndexOf.
dlls/windows.gaming.input/main.c | 14 +++++++++----- dlls/windows.gaming.input/tests/input.c | 20 ++++++++++++++++++-- 2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c index 5e349d98fab..d7a2f138a14 100644 --- a/dlls/windows.gaming.input/main.c +++ b/dlls/windows.gaming.input/main.c @@ -120,21 +120,25 @@ static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetAt( IVectorView_Gamepad *iface, ULONG index, IGamepad **value) { FIXME("iface %p, index %#x, value %p stub!\n", iface, index, value); - return E_NOTIMPL; + *value = NULL; + return E_BOUNDS; }
static HRESULT STDMETHODCALLTYPE vector_view_gamepad_get_Size( IVectorView_Gamepad *iface, ULONG *value) { FIXME("iface %p, value %p stub!\n", iface, value); - return E_NOTIMPL; + *value = 0; + return S_OK; }
static HRESULT STDMETHODCALLTYPE vector_view_gamepad_IndexOf( - IVectorView_Gamepad *iface, IGamepad *element, ULONG *index, BOOLEAN *value) + IVectorView_Gamepad *iface, IGamepad *element, ULONG *index, BOOLEAN *found) { - FIXME("iface %p, element %p, index %p, value %p stub!\n", iface, element, index, value); - return E_NOTIMPL; + FIXME("iface %p, element %p, index %p, found %p stub!\n", iface, element, index, found); + *index = 0; + *found = FALSE; + return S_OK; }
static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetMany( diff --git a/dlls/windows.gaming.input/tests/input.c b/dlls/windows.gaming.input/tests/input.c index cfd814d5631..622da229e70 100644 --- a/dlls/windows.gaming.input/tests/input.c +++ b/dlls/windows.gaming.input/tests/input.c @@ -111,6 +111,8 @@ static void test_Gamepad(void) IGamepadStatics *gamepad_statics = NULL; IInspectable *inspectable = NULL, *tmp_inspectable = NULL; IAgileObject *agile_object = NULL, *tmp_agile_object = NULL; + IGamepad *gamepad; + BOOLEAN found; HSTRING str; HRESULT hr; ULONG size; @@ -165,8 +167,22 @@ static void test_Gamepad(void)
size = 0xdeadbeef; hr = IVectorView_Gamepad_get_Size(gamepads, &size); - todo_wine ok(hr == S_OK, "IVectorView_Gamepad_get_Size failed, hr %#x\n", hr); - todo_wine ok(size != 0xdeadbeef, "IVectorView_Gamepad_get_Size returned %u\n", size); + ok(hr == S_OK, "IVectorView_Gamepad_get_Size failed, hr %#x\n", hr); + ok(size != 0xdeadbeef, "IVectorView_Gamepad_get_Size returned %u\n", size); + + if (size == 0) + { + gamepad = (IGamepad *)0xdeadbeef; + hr = IVectorView_Gamepad_GetAt(gamepads, 0, &gamepad); + ok(hr == E_BOUNDS, "IVectorView_Gamepad_GetAt failed, hr %#x\n", hr); + ok(gamepad == NULL, "IVectorView_Gamepad_GetAt returned %p\n", gamepad); + + size = 0xdeadbeef; + found = TRUE; + hr = IVectorView_Gamepad_IndexOf(gamepads, gamepad, &size, &found); + ok(hr == S_OK, "IVectorView_Gamepad_IndexOf failed, hr %#x\n", hr); + ok(size == 0 && found == FALSE, "IVectorView_Gamepad_IndexOf returned size %d, found %d\n", size, found); + }
IVectorView_Gamepad_Release(gamepads);
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windows.gaming.input/main.c | 14 ++++++++++---- dlls/windows.gaming.input/tests/input.c | 17 +++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c index d7a2f138a14..d3533b91266 100644 --- a/dlls/windows.gaming.input/main.c +++ b/dlls/windows.gaming.input/main.c @@ -321,28 +321,34 @@ static HRESULT STDMETHODCALLTYPE gamepad_statics_add_GamepadAdded( IGamepadStatics *iface, IEventHandler_Gamepad *value, EventRegistrationToken* token) { FIXME("iface %p, value %p, token %p stub!\n", iface, value, token); - return E_NOTIMPL; + if (!value) return E_INVALIDARG; + if (!token) return E_POINTER; + token->value = 0; + return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_remove_GamepadAdded( IGamepadStatics *iface, EventRegistrationToken token) { FIXME("iface %p, token %#I64x stub!\n", iface, token.value); - return E_NOTIMPL; + return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_add_GamepadRemoved( IGamepadStatics *iface, IEventHandler_Gamepad *value, EventRegistrationToken* token) { FIXME("iface %p, value %p, token %p stub!\n", iface, value, token); - return E_NOTIMPL; + if (!value) return E_INVALIDARG; + if (!token) return E_POINTER; + token->value = 0; + return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_remove_GamepadRemoved( IGamepadStatics *iface, EventRegistrationToken token) { FIXME("iface %p, token %#I64x stub!\n", iface, token.value); - return E_NOTIMPL; + return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_get_Gamepads( diff --git a/dlls/windows.gaming.input/tests/input.c b/dlls/windows.gaming.input/tests/input.c index 622da229e70..b164ed5bd51 100644 --- a/dlls/windows.gaming.input/tests/input.c +++ b/dlls/windows.gaming.input/tests/input.c @@ -188,19 +188,24 @@ static void test_Gamepad(void)
token.value = 0xdeadbeef; hr = IGamepadStatics_add_GamepadAdded(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, &token); - todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); - todo_wine ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadAdded returned token %#I64x\n", token.value); + ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); + ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadAdded returned token %#I64x\n", token.value);
hr = IGamepadStatics_remove_GamepadAdded(gamepad_statics, token); - todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); + ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
token.value = 0xdeadbeef; IGamepadStatics_add_GamepadRemoved(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, &token); - todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadRemoved failed, hr %#x\n", hr); - todo_wine ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadRemoved returned token %#I64x\n", token.value); + ok(hr == S_OK, "IGamepadStatics_add_GamepadRemoved failed, hr %#x\n", hr); + ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadRemoved returned token %#I64x\n", token.value);
hr = IGamepadStatics_remove_GamepadRemoved(gamepad_statics, token); - todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); + ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); + + hr = IGamepadStatics_add_GamepadAdded(gamepad_statics, NULL, &token); + ok(hr == E_INVALIDARG, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); + hr = IGamepadStatics_add_GamepadAdded(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, NULL); + ok(hr == E_POINTER, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
IGamepadStatics_Release(gamepad_statics);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=87294
Your paranoid android.
=== w1064v1809 (32 bit report) ===
windows.gaming.input: 12e0:input: unhandled exception c0000005 at 7370C22E
=== w1064 (32 bit report) ===
windows.gaming.input: 1c34:input: unhandled exception c0000005 at 7480C523
=== w10pro64 (32 bit report) ===
windows.gaming.input: 0608:input: unhandled exception c0000005 at 7521C523
=== w1064v1809 (64 bit report) ===
windows.gaming.input: 1608:input: unhandled exception c0000005 at 00007FFFAF26653F
=== w1064 (64 bit report) ===
windows.gaming.input: 1ae8:input: unhandled exception c0000005 at 00007FFDDCCC6A7B
=== w1064_2qxl (64 bit report) ===
windows.gaming.input: 1aa0:input: unhandled exception c0000005 at 00007FFACDCE6A7B
=== w10pro64 (64 bit report) ===
windows.gaming.input: 09c4:input: unhandled exception c0000005 at 00007FFEE8BC6A7B
=== w10pro64_ar (64 bit report) ===
windows.gaming.input: 14fc:input: unhandled exception c0000005 at 00007FFB7E706A7B
=== w10pro64_he (64 bit report) ===
windows.gaming.input: 1c9c:input: unhandled exception c0000005 at 00007FFACE396A7B
=== w10pro64_ja (64 bit report) ===
windows.gaming.input: 1e20:input: unhandled exception c0000005 at 00007FFC0F6D6A7B
=== w10pro64_zh_CN (64 bit report) ===
windows.gaming.input: 1ef8:input: unhandled exception c0000005 at 00007FFA36846A7B
On 3/19/21 9:55 AM, Rémi Bernon wrote:
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
dlls/windows.gaming.input/main.c | 14 ++++++++++---- dlls/windows.gaming.input/tests/input.c | 17 +++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c index d7a2f138a14..d3533b91266 100644 --- a/dlls/windows.gaming.input/main.c +++ b/dlls/windows.gaming.input/main.c @@ -321,28 +321,34 @@ static HRESULT STDMETHODCALLTYPE gamepad_statics_add_GamepadAdded( IGamepadStatics *iface, IEventHandler_Gamepad *value, EventRegistrationToken* token) { FIXME("iface %p, value %p, token %p stub!\n", iface, value, token);
- return E_NOTIMPL;
if (!value) return E_INVALIDARG;
if (!token) return E_POINTER;
token->value = 0;
return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_remove_GamepadAdded( IGamepadStatics *iface, EventRegistrationToken token) { FIXME("iface %p, token %#I64x stub!\n", iface, token.value);
- return E_NOTIMPL;
return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_add_GamepadRemoved( IGamepadStatics *iface, IEventHandler_Gamepad *value, EventRegistrationToken* token) { FIXME("iface %p, value %p, token %p stub!\n", iface, value, token);
- return E_NOTIMPL;
if (!value) return E_INVALIDARG;
if (!token) return E_POINTER;
token->value = 0;
return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_remove_GamepadRemoved( IGamepadStatics *iface, EventRegistrationToken token) { FIXME("iface %p, token %#I64x stub!\n", iface, token.value);
- return E_NOTIMPL;
return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_get_Gamepads(
diff --git a/dlls/windows.gaming.input/tests/input.c b/dlls/windows.gaming.input/tests/input.c index 622da229e70..b164ed5bd51 100644 --- a/dlls/windows.gaming.input/tests/input.c +++ b/dlls/windows.gaming.input/tests/input.c @@ -188,19 +188,24 @@ static void test_Gamepad(void)
token.value = 0xdeadbeef; hr = IGamepadStatics_add_GamepadAdded(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, &token);
- todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
- todo_wine ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadAdded returned token %#I64x\n", token.value);
ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadAdded returned token %#I64x\n", token.value);
hr = IGamepadStatics_remove_GamepadAdded(gamepad_statics, token);
- todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
token.value = 0xdeadbeef; IGamepadStatics_add_GamepadRemoved(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, &token);
- todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadRemoved failed, hr %#x\n", hr);
- todo_wine ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadRemoved returned token %#I64x\n", token.value);
ok(hr == S_OK, "IGamepadStatics_add_GamepadRemoved failed, hr %#x\n", hr);
ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadRemoved returned token %#I64x\n", token.value);
hr = IGamepadStatics_remove_GamepadRemoved(gamepad_statics, token);
- todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
hr = IGamepadStatics_add_GamepadAdded(gamepad_statics, NULL, &token);
ok(hr == E_INVALIDARG, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
hr = IGamepadStatics_add_GamepadAdded(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, NULL);
ok(hr == E_POINTER, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
IGamepadStatics_Release(gamepad_statics);
Crap, I tested this before but maybe not on all windows versions and the hr == E_POINTER case actually crashes too on most recent windows... I'll remove the test.