Rémi Bernon (@rbernon) commented about dlls/user32/tests/input.c:
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputBuffer returned %08lx\n", GetLastError());
- SetLastError(0xdeadbeef);
- size = sizeof(buffer);
- count = GetRawInputBuffer((RAWINPUT*)buffer, &size, sizeof(RAWINPUTHEADER) + 1);
- ok(count == ~0U, "GetRawInputBuffer succeeded\n");
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputBuffer returned %08lx\n", GetLastError());
- /* the function returns 64-bit RAWINPUT structures on WoW64, but still
* forbids sizeof(RAWINPUTHEADER) from the wrong architecture */
- SetLastError(0xdeadbeef);
- size = sizeof(buffer);
- if (sizeof(void *) == 8)
count = GetRawInputBuffer((RAWINPUT*)buffer, &size, sizeof(RAWINPUTHEADER32));
- else
count = GetRawInputBuffer((RAWINPUT*)buffer, &size, sizeof(RAWINPUTHEADER64));
Same here, I think adding a conditionally initialized `header_size` variable would make it simpler to read.