On Wed Jun 15 23:43:22 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list:
On 6/14/22 00:02, Rémi Bernon (@rbernon) wrote: > On Tue Jun 14 04:05:11 2022 +0000, **** wrote: >> Zebediah Figura replied on the mailing list: >> \`\`\` >> On 6/13/22 03:27, Rémi Bernon (@rbernon) wrote: >>> Rémi Bernon (@rbernon) commented about dlls/user32/tests/input.c: >>>> + ok(count == ~0u, "GetRawInputData returned %d\n", count); >>>> + ok(GetLastError() == ERROR_INVALID_PARAMETER, >> "GetRawInputData returned %08lx\n", GetLastError()); >>>> + } >>>> + else if (is_wow64) >>>> + { >>>> + count = GetRawInputData((HRAWINPUT)lparam, >> RID_INPUT, &ri, &size, sizeof(RAWINPUTHEADER64)); >>>> + todo_wine ok(count == sizeof(ri), "GetRawInputData >> returned %d\n", count); >>>> + ok(ri.data.mouse.lLastX == 6, "Unexpected rawinput >> data: %ld\n", ri.data.mouse.lLastX); >>>> + todo_wine ok(GetLastError() == 0xdeadbeef, >> "GetRawInputData returned %08lx\n", GetLastError()); >>>> + } >>>> + else >>>> + { >>>> + count = GetRawInputData((HRAWINPUT)lparam, >> RID_INPUT, &ri, &size, sizeof(RAWINPUTHEADER64)); >>>> + ok(count == ~0u, "GetRawInputData returned %d\n", count); >>>> + ok(GetLastError() == ERROR_INVALID_PARAMETER, >> "GetRawInputData returned %08lx\n", GetLastError()); >>>> + } >>> It feels a bit unbalanced to test invalid cases at the same time as a >> valid case depending on the arch. Could we have instead a test for the >> invalid sizes, and the another one with valid size? >> I don't understand what you mean by this. Only one of these three tests >> makes sense, and on mutually exclusive architectures. >> I could separate the if/elif/else into three separate if blocks, but I >> doubt that's what you mean. >> \`\`\` > I mean that, like the `GetRawInputBuffer` tests below you check an invalid size and ERROR_INVALID_PARAMETER error case, but on wow64, you don't and instead you check a valid size and the returned data. > > I think you should check the same cases on all arch if possible, so invalid size and error on all arch (similarly to `GetRawInputBuffer`), then the valid case and data on all arch as well. > The point is to check the "wrong" architecture's size in all three cases. In the wow64 case, this succeeds; otherwise, it fails. This quirk is specific to GetRawInputData(); GetRawInputBuffer() always rejects the "wrong" architecture's size. Perhaps this structure would make it clearer: if (sizeof(void *) == 8) { count = GetRawInputData(..., sizeof(RAWINPUTHEADER32)); ok(count == ~0u, ...); } else { count = GetRawInputData(..., sizeof(RAWINPUTHEADER64)); if (is_wow64) { ok(count == sizeof(ri), ...); } else { ok(count == ~0u, ...); } }
Yeah looks clearer.