Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
v2: Fix an incorrect use of sizeof in the WCHAR / char conversion, in GetFullPathNameW and SetupCopyOEMInfW calls.
I also initially overlooked the small differences variations between driver_pnp and driver_hid start/stop sequences, it doesn't seem to make any difference but I used the driver_pnp version which does a few more things.
Also edited the subjects.
dlls/ntoskrnl.exe/tests/ntoskrnl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index dc10497caee..e3afd46181c 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -946,7 +946,7 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params) static void test_return_status(void) { struct return_status_params params; - unsigned int i, j, k; + unsigned int i, j, k, old_threshold;
static const ULONG method_tests[] = { @@ -979,12 +979,15 @@ static void test_return_status(void) params.ret_status = status_tests[i]; params.iosb_status = status_tests[j];
- winetest_push_context("return 0x%08x, iosb 0x%08x, pending %d, method %u", - params.ret_status, params.iosb_status, params.pending, method_tests[k] & 3); + trace("testing return 0x%08x, iosb 0x%08x, pending %d, method %u\n", + params.ret_status, params.iosb_status, params.pending, method_tests[k] & 3); + old_threshold = winetest_mute_threshold; + winetest_mute_threshold = 1;
do_return_status(method_tests[k], ¶ms);
- winetest_pop_context(); + winetest_mute_threshold = old_threshold; + trace("done\n"); } } }
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 343 ++++++++++++----------------- 1 file changed, 135 insertions(+), 208 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index e3afd46181c..1239a3dae9a 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -1345,6 +1345,137 @@ static void add_file_to_catalog(HANDLE catalog, const WCHAR *file) } }
+static void driver_stop(void) +{ + SP_DEVINFO_DATA device = {sizeof(SP_DEVINFO_DATA)}; + WCHAR path[MAX_PATH], dest[MAX_PATH], *filepart; + SC_HANDLE manager, service; + HDEVINFO set; + HANDLE file; + BOOL ret; + DWORD i; + + set = SetupDiCreateDeviceInfoList(NULL, NULL); + ok(set != INVALID_HANDLE_VALUE, "failed to create device list, error %u\n", GetLastError()); + + ret = SetupDiOpenDeviceInfoW(set, L"root\winetest\0", NULL, 0, &device); + ok(ret, "failed to open device, error %u\n", GetLastError()); + + ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device); + ok(ret, "failed to remove device, error %#x\n", GetLastError()); + + file = CreateFileW(L"\\?\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}", 0, 0, NULL, OPEN_EXISTING, 0, NULL); + ok(file == INVALID_HANDLE_VALUE, "expected failure\n"); + ok(GetLastError() == ERROR_FILE_NOT_FOUND, "got error %u\n", GetLastError()); + + ret = SetupDiDestroyDeviceInfoList(set); + ok(ret, "failed to destroy set, error %#x\n", GetLastError()); + + set = SetupDiGetClassDevsA(NULL, "wine", NULL, DIGCF_ALLCLASSES); + ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError()); + + for (i = 0; SetupDiEnumDeviceInfo(set, i, &device); ++i) + { + ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device); + ok(ret, "failed to remove device, error %#x\n", GetLastError()); + } + + /* Windows stops the service but does not delete it. */ + manager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT); + ok(!!manager, "failed to open service manager, error %u\n", GetLastError()); + service = OpenServiceW(manager, L"winetest", SERVICE_STOP | DELETE); + ok(!!service, "failed to open service, error %u\n", GetLastError()); + unload_driver(service); + CloseServiceHandle(manager); + + cat_okfile(); + + GetFullPathNameW(L"winetest.inf", ARRAY_SIZE(path), path, NULL); + ret = SetupCopyOEMInfW(path, NULL, 0, 0, dest, ARRAY_SIZE(dest), NULL, &filepart); + ok(ret, "Failed to copy INF, error %#x\n", GetLastError()); + ret = SetupUninstallOEMInfW(filepart, 0, NULL); + ok(ret, "Failed to uninstall INF, error %u\n", GetLastError()); + + ret = DeleteFileW(L"winetest.cat"); + ok(ret, "Failed to delete file, error %u\n", GetLastError()); + ret = DeleteFileW(L"winetest.inf"); + ok(ret, "Failed to delete file, error %u\n", GetLastError()); + ret = DeleteFileW(L"winetest.sys"); + ok(ret, "Failed to delete file, error %u\n", GetLastError()); + /* Windows 10 apparently deletes the image in SetupUninstallOEMInf(). */ + ret = DeleteFileW(L"C:/windows/system32/drivers/winetest.sys"); + ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND, "Failed to delete file, error %u\n", GetLastError()); +} + +static void driver_start(struct testsign_context *ctx, const WCHAR *resource) +{ + static const WCHAR hardware_id[] = L"test_hardware_id\0"; + SP_DEVINFO_DATA device = {sizeof(SP_DEVINFO_DATA)}; + WCHAR path[MAX_PATH], filename[MAX_PATH]; + BOOL ret, need_reboot; + HANDLE catalog; + HDEVINFO set; + FILE *f; + + load_resource(resource, filename); + ret = MoveFileExW(filename, L"winetest.sys", MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); + ok(ret, "failed to move file, error %u\n", GetLastError()); + + f = fopen("winetest.inf", "w"); + ok(!!f, "failed to open winetest.inf: %s\n", strerror(errno)); + fputs(inf_text, f); + fclose(f); + + /* Create the catalog file. */ + + catalog = CryptCATOpen((WCHAR *)L"winetest.cat", CRYPTCAT_OPEN_CREATENEW, 0, CRYPTCAT_VERSION_1, 0); + ok(catalog != INVALID_HANDLE_VALUE, "Failed to create catalog, error %#x\n", GetLastError()); + + ret = !!CryptCATPutCatAttrInfo(catalog, (WCHAR *)L"HWID1", + CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED, + sizeof(L"test_hardware_id"), (BYTE *)L"test_hardware_id"); + todo_wine ok(ret, "failed to add attribute, error %#x\n", GetLastError()); + + ret = !!CryptCATPutCatAttrInfo(catalog, (WCHAR *)L"OS", + CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED, + sizeof(L"VistaX64"), (BYTE *)L"VistaX64"); + todo_wine ok(ret, "failed to add attribute, error %#x\n", GetLastError()); + + add_file_to_catalog(catalog, L"winetest.sys"); + add_file_to_catalog(catalog, L"winetest.inf"); + + ret = CryptCATPersistStore(catalog); + todo_wine ok(ret, "Failed to write catalog, error %u\n", GetLastError()); + + ret = CryptCATClose(catalog); + ok(ret, "Failed to close catalog, error %u\n", GetLastError()); + + testsign_sign(ctx, L"winetest.cat"); + + /* Install the driver. */ + + set = SetupDiCreateDeviceInfoList(NULL, NULL); + ok(set != INVALID_HANDLE_VALUE, "failed to create device list, error %#x\n", GetLastError()); + + ret = SetupDiCreateDeviceInfoW(set, L"root\winetest\0", &GUID_NULL, NULL, NULL, 0, &device); + ok(ret, "failed to create device, error %#x\n", GetLastError()); + + ret = SetupDiSetDeviceRegistryPropertyW( set, &device, SPDRP_HARDWAREID, + (const BYTE *)hardware_id, sizeof(hardware_id) ); + ok(ret, "failed to create set hardware ID, error %#x\n", GetLastError()); + + ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device); + ok(ret, "failed to register device, error %#x\n", GetLastError()); + + ret = SetupDiDestroyDeviceInfoList(set); + ok(ret, "failed to destroy set, error %u\n", GetLastError()); + + GetFullPathNameW(L"winetest.inf", ARRAY_SIZE(path), path, NULL); + ret = UpdateDriverForPlugAndPlayDevicesW(NULL, hardware_id, path, INSTALLFLAG_FORCE, &need_reboot); + ok(ret, "failed to install device, error %#x\n", GetLastError()); + ok(!need_reboot, "expected no reboot necessary\n"); +} + static const GUID bus_class = {0xdeadbeef, 0x29ef, 0x4538, {0xa5, 0xfd, 0xb6, 0x95, 0x73, 0xa3, 0x62, 0xc1}}; static const GUID child_class = {0xdeadbeef, 0x29ef, 0x4538, {0xa5, 0xfd, 0xb6, 0x95, 0x73, 0xa3, 0x62, 0xc2}};
@@ -1703,127 +1834,15 @@ static void test_pnp_devices(void)
static void test_pnp_driver(struct testsign_context *ctx) { - static const char hardware_id[] = "test_hardware_id\0"; - char path[MAX_PATH], dest[MAX_PATH], *filepart; - SP_DEVINFO_DATA device = {sizeof(device)}; char cwd[MAX_PATH], tempdir[MAX_PATH]; - WCHAR driver_filename[MAX_PATH]; - SC_HANDLE manager, service; - BOOL ret, need_reboot; - HANDLE catalog, file; - unsigned int i; - HDEVINFO set; - FILE *f;
GetCurrentDirectoryA(ARRAY_SIZE(cwd), cwd); GetTempPathA(ARRAY_SIZE(tempdir), tempdir); SetCurrentDirectoryA(tempdir);
- load_resource(L"driver_pnp.dll", driver_filename); - ret = MoveFileExW(driver_filename, L"winetest.sys", MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); - ok(ret, "failed to move file, error %u\n", GetLastError()); - - f = fopen("winetest.inf", "w"); - ok(!!f, "failed to open winetest.inf: %s\n", strerror(errno)); - fputs(inf_text, f); - fclose(f); - - /* Create the catalog file. */ - - catalog = CryptCATOpen((WCHAR *)L"winetest.cat", CRYPTCAT_OPEN_CREATENEW, 0, CRYPTCAT_VERSION_1, 0); - ok(catalog != INVALID_HANDLE_VALUE, "Failed to create catalog, error %#x\n", GetLastError()); - - ret = !!CryptCATPutCatAttrInfo(catalog, (WCHAR *)L"HWID1", - CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED, - sizeof(L"test_hardware_id"), (BYTE *)L"test_hardware_id"); - todo_wine ok(ret, "failed to add attribute, error %#x\n", GetLastError()); - - ret = !!CryptCATPutCatAttrInfo(catalog, (WCHAR *)L"OS", - CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED, - sizeof(L"VistaX64"), (BYTE *)L"VistaX64"); - todo_wine ok(ret, "failed to add attribute, error %#x\n", GetLastError()); - - add_file_to_catalog(catalog, L"winetest.sys"); - add_file_to_catalog(catalog, L"winetest.inf"); - - ret = CryptCATPersistStore(catalog); - todo_wine ok(ret, "Failed to write catalog, error %u\n", GetLastError()); - - ret = CryptCATClose(catalog); - ok(ret, "Failed to close catalog, error %u\n", GetLastError()); - - testsign_sign(ctx, L"winetest.cat"); - - /* Install the driver. */ - - set = SetupDiCreateDeviceInfoList(NULL, NULL); - ok(set != INVALID_HANDLE_VALUE, "failed to create device list, error %#x\n", GetLastError()); - - ret = SetupDiCreateDeviceInfoA(set, "root\winetest\0", &GUID_NULL, NULL, NULL, 0, &device); - ok(ret, "failed to create device, error %#x\n", GetLastError()); - - ret = SetupDiSetDeviceRegistryPropertyA( set, &device, SPDRP_HARDWAREID, - (const BYTE *)hardware_id, sizeof(hardware_id) ); - ok(ret, "failed to create set hardware ID, error %#x\n", GetLastError()); - - ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device); - ok(ret, "failed to register device, error %#x\n", GetLastError()); - - GetFullPathNameA("winetest.inf", sizeof(path), path, NULL); - ret = UpdateDriverForPlugAndPlayDevicesA(NULL, hardware_id, path, INSTALLFLAG_FORCE, &need_reboot); - ok(ret, "failed to install device, error %#x\n", GetLastError()); - ok(!need_reboot, "expected no reboot necessary\n"); - - /* Tests. */ - + driver_start(ctx, L"driver_pnp.dll"); test_pnp_devices(); - - /* Clean up. */ - - ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device); - ok(ret, "failed to remove device, error %#x\n", GetLastError()); - - file = CreateFileA("\\?\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}", 0, 0, NULL, OPEN_EXISTING, 0, NULL); - ok(file == INVALID_HANDLE_VALUE, "expected failure\n"); - ok(GetLastError() == ERROR_FILE_NOT_FOUND, "got error %u\n", GetLastError()); - - ret = SetupDiDestroyDeviceInfoList(set); - ok(ret, "failed to destroy set, error %#x\n", GetLastError()); - - set = SetupDiGetClassDevsA(NULL, "wine", NULL, DIGCF_ALLCLASSES); - ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError()); - - for (i = 0; SetupDiEnumDeviceInfo(set, i, &device); ++i) - { - ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device); - ok(ret, "failed to remove device, error %#x\n", GetLastError()); - } - - /* Windows stops the service but does not delete it. */ - manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT); - ok(!!manager, "failed to open service manager, error %u\n", GetLastError()); - service = OpenServiceA(manager, "winetest", SERVICE_STOP | DELETE); - ok(!!service, "failed to open service, error %u\n", GetLastError()); - unload_driver(service); - CloseServiceHandle(manager); - - cat_okfile(); - - GetFullPathNameA("winetest.inf", sizeof(path), path, NULL); - ret = SetupCopyOEMInfA(path, NULL, 0, 0, dest, sizeof(dest), NULL, &filepart); - ok(ret, "Failed to copy INF, error %#x\n", GetLastError()); - ret = SetupUninstallOEMInfA(filepart, 0, NULL); - ok(ret, "Failed to uninstall INF, error %u\n", GetLastError()); - - ret = DeleteFileA("winetest.cat"); - ok(ret, "Failed to delete file, error %u\n", GetLastError()); - ret = DeleteFileA("winetest.inf"); - ok(ret, "Failed to delete file, error %u\n", GetLastError()); - ret = DeleteFileA("winetest.sys"); - ok(ret, "Failed to delete file, error %u\n", GetLastError()); - /* Windows 10 apparently deletes the image in SetupUninstallOEMInf(). */ - ret = DeleteFileA("C:/windows/system32/drivers/winetest.sys"); - ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND, "Failed to delete file, error %u\n", GetLastError()); + driver_stop();
SetCurrentDirectoryA(cwd); } @@ -3300,18 +3319,9 @@ static void test_hid_device(DWORD report_id, DWORD polled)
static void test_hid_driver(struct testsign_context *ctx, DWORD report_id, DWORD polled) { - static const char hardware_id[] = "test_hardware_id\0"; - char path[MAX_PATH], dest[MAX_PATH], *filepart; - SP_DEVINFO_DATA device = {sizeof(device)}; char cwd[MAX_PATH], tempdir[MAX_PATH]; - WCHAR driver_filename[MAX_PATH]; - SC_HANDLE manager, service; - BOOL ret, need_reboot; - HANDLE catalog, file; LSTATUS status; - HDEVINFO set; HKEY hkey; - FILE *f;
GetCurrentDirectoryA(ARRAY_SIZE(cwd), cwd); GetTempPathA(ARRAY_SIZE(tempdir), tempdir); @@ -3326,92 +3336,9 @@ static void test_hid_driver(struct testsign_context *ctx, DWORD report_id, DWORD status = RegSetValueExW(hkey, L"PolledMode", 0, REG_DWORD, (void *)&polled, sizeof(polled)); ok(!status, "RegSetValueExW returned %#x\n", status);
- load_resource(L"driver_hid.dll", driver_filename); - ret = MoveFileExW(driver_filename, L"winetest.sys", MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); - ok(ret, "failed to move file, error %u\n", GetLastError()); - - f = fopen("winetest.inf", "w"); - ok(!!f, "failed to open winetest.inf: %s\n", strerror(errno)); - fputs(inf_text, f); - fclose(f); - - /* Create the catalog file. */ - - catalog = CryptCATOpen((WCHAR *)L"winetest.cat", CRYPTCAT_OPEN_CREATENEW, 0, CRYPTCAT_VERSION_1, 0); - ok(catalog != INVALID_HANDLE_VALUE, "Failed to create catalog, error %#x\n", GetLastError()); - - add_file_to_catalog(catalog, L"winetest.sys"); - add_file_to_catalog(catalog, L"winetest.inf"); - - ret = CryptCATPersistStore(catalog); - todo_wine ok(ret, "Failed to write catalog, error %u\n", GetLastError()); - - ret = CryptCATClose(catalog); - ok(ret, "Failed to close catalog, error %u\n", GetLastError()); - - testsign_sign(ctx, L"winetest.cat"); - - /* Install the driver. */ - - set = SetupDiCreateDeviceInfoList(NULL, NULL); - ok(set != INVALID_HANDLE_VALUE, "failed to create device list, error %#x\n", GetLastError()); - - ret = SetupDiCreateDeviceInfoA(set, "root\winetest\0", &GUID_NULL, NULL, NULL, 0, &device); - ok(ret, "failed to create device, error %#x\n", GetLastError()); - - ret = SetupDiSetDeviceRegistryPropertyA( set, &device, SPDRP_HARDWAREID, - (const BYTE *)hardware_id, sizeof(hardware_id) ); - ok(ret, "failed to create set hardware ID, error %#x\n", GetLastError()); - - ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device); - ok(ret, "failed to register device, error %#x\n", GetLastError()); - - GetFullPathNameA("winetest.inf", sizeof(path), path, NULL); - ret = UpdateDriverForPlugAndPlayDevicesA(NULL, hardware_id, path, INSTALLFLAG_FORCE, &need_reboot); - ok(ret, "failed to install device, error %#x\n", GetLastError()); - ok(!need_reboot, "expected no reboot necessary\n"); - - /* Tests. */ - + driver_start(ctx, L"driver_hid.dll"); test_hid_device(report_id, polled); - - /* Clean up. */ - - ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device); - ok(ret, "failed to remove device, error %#x\n", GetLastError()); - - file = CreateFileA("\\?\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}", 0, 0, NULL, OPEN_EXISTING, 0, NULL); - ok(file == INVALID_HANDLE_VALUE, "expected failure\n"); - ok(GetLastError() == ERROR_FILE_NOT_FOUND, "got error %u\n", GetLastError()); - - ret = SetupDiDestroyDeviceInfoList(set); - ok(ret, "failed to destroy set, error %#x\n", GetLastError()); - - /* Windows stops the service but does not delete it. */ - manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT); - ok(!!manager, "failed to open service manager, error %u\n", GetLastError()); - service = OpenServiceA(manager, "winetest", SERVICE_STOP | DELETE); - ok(!!service, "failed to open service, error %u\n", GetLastError()); - unload_driver(service); - CloseServiceHandle(manager); - - cat_okfile(); - - GetFullPathNameA("winetest.inf", sizeof(path), path, NULL); - ret = SetupCopyOEMInfA(path, NULL, 0, 0, dest, sizeof(dest), NULL, &filepart); - ok(ret, "Failed to copy INF, error %#x\n", GetLastError()); - ret = SetupUninstallOEMInfA(filepart, 0, NULL); - ok(ret, "Failed to uninstall INF, error %u\n", GetLastError()); - - ret = DeleteFileA("winetest.cat"); - ok(ret, "Failed to delete file, error %u\n", GetLastError()); - ret = DeleteFileA("winetest.inf"); - ok(ret, "Failed to delete file, error %u\n", GetLastError()); - ret = DeleteFileA("winetest.sys"); - ok(ret, "Failed to delete file, error %u\n", GetLastError()); - /* Windows 10 apparently deletes the image in SetupUninstallOEMInf(). */ - ret = DeleteFileA("C:/windows/system32/drivers/winetest.sys"); - ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND, "Failed to delete file, error %u\n", GetLastError()); + driver_stop();
SetCurrentDirectoryA(cwd); }
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 1239a3dae9a..c788e2c2671 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -92,10 +92,11 @@ struct testsign_context HCERTSTORE root_store, publisher_store; };
+static const WCHAR container_name[] = L"wine_testsign"; + static BOOL testsign_create_cert(struct testsign_context *ctx) { BYTE encoded_name[100], encoded_key_id[200], public_key_info_buffer[1000]; - WCHAR container_name[26]; BYTE hash_buffer[16], cert_buffer[1000], provider_nameA[100], serial[16]; CERT_PUBLIC_KEY_INFO *public_key_info = (CERT_PUBLIC_KEY_INFO *)public_key_info_buffer; CRYPT_KEY_PROV_INFO provider_info = {0}; @@ -110,10 +111,13 @@ static BOOL testsign_create_cert(struct testsign_context *ctx)
memset(ctx, 0, sizeof(*ctx));
- srand(time(NULL)); - swprintf(container_name, ARRAY_SIZE(container_name), L"wine_testsign%u", rand()); - ret = CryptAcquireContextW(&ctx->provider, container_name, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET); + if (!ret && GetLastError() == NTE_EXISTS) + { + ret = CryptAcquireContextW(&ctx->provider, container_name, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET); + ok(ret, "Failed to delete container, error %#x\n", GetLastError()); + ret = CryptAcquireContextW(&ctx->provider, container_name, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET); + } ok(ret, "Failed to create container, error %#x\n", GetLastError());
ret = CryptGenKey(ctx->provider, AT_SIGNATURE, CRYPT_EXPORTABLE, &key); @@ -245,6 +249,9 @@ static void testsign_cleanup(struct testsign_context *ctx)
ret = CryptReleaseContext(ctx->provider, 0); ok(ret, "failed to release context, error %u\n", GetLastError()); + + ret = CryptAcquireContextW(&ctx->provider, container_name, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET); + ok(ret, "Failed to delete container, error %#x\n", GetLastError()); }
static void testsign_sign(struct testsign_context *ctx, const WCHAR *filename)
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 33 ++++++++++++++---------------- 1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index c788e2c2671..fc213948f35 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -87,7 +87,6 @@ static void load_resource(const WCHAR *name, WCHAR *filename)
struct testsign_context { - HCRYPTPROV provider; const CERT_CONTEXT *cert, *root_cert, *publisher_cert; HCERTSTORE root_store, publisher_store; }; @@ -105,26 +104,27 @@ static BOOL testsign_create_cert(struct testsign_context *ctx) CERT_INFO cert_info = {0}; WCHAR provider_nameW[100]; CERT_EXTENSION extension; + HCRYPTPROV provider; HCRYPTKEY key; DWORD size; BOOL ret;
memset(ctx, 0, sizeof(*ctx));
- ret = CryptAcquireContextW(&ctx->provider, container_name, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET); + ret = CryptAcquireContextW(&provider, container_name, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET); if (!ret && GetLastError() == NTE_EXISTS) { - ret = CryptAcquireContextW(&ctx->provider, container_name, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET); + ret = CryptAcquireContextW(&provider, container_name, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET); ok(ret, "Failed to delete container, error %#x\n", GetLastError()); - ret = CryptAcquireContextW(&ctx->provider, container_name, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET); + ret = CryptAcquireContextW(&provider, container_name, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET); } ok(ret, "Failed to create container, error %#x\n", GetLastError());
- ret = CryptGenKey(ctx->provider, AT_SIGNATURE, CRYPT_EXPORTABLE, &key); + ret = CryptGenKey(provider, AT_SIGNATURE, CRYPT_EXPORTABLE, &key); ok(ret, "Failed to create key, error %#x\n", GetLastError()); ret = CryptDestroyKey(key); ok(ret, "Failed to destroy key, error %#x\n", GetLastError()); - ret = CryptGetUserKey(ctx->provider, AT_SIGNATURE, &key); + ret = CryptGetUserKey(provider, AT_SIGNATURE, &key); ok(ret, "Failed to get user key, error %#x\n", GetLastError()); ret = CryptDestroyKey(key); ok(ret, "Failed to destroy key, error %#x\n", GetLastError()); @@ -136,12 +136,12 @@ static BOOL testsign_create_cert(struct testsign_context *ctx) key_info.CertIssuer.pbData = encoded_name;
size = sizeof(public_key_info_buffer); - ret = CryptExportPublicKeyInfo(ctx->provider, AT_SIGNATURE, X509_ASN_ENCODING, public_key_info, &size); + ret = CryptExportPublicKeyInfo(provider, AT_SIGNATURE, X509_ASN_ENCODING, public_key_info, &size); ok(ret, "Failed to export public key, error %#x\n", GetLastError()); cert_info.SubjectPublicKeyInfo = *public_key_info;
size = sizeof(hash_buffer); - ret = CryptHashPublicKeyInfo(ctx->provider, CALG_MD5, 0, X509_ASN_ENCODING, public_key_info, hash_buffer, &size); + ret = CryptHashPublicKeyInfo(provider, CALG_MD5, 0, X509_ASN_ENCODING, public_key_info, hash_buffer, &size); ok(ret, "Failed to hash public key, error %#x\n", GetLastError());
key_info.KeyId.cbData = size; @@ -172,7 +172,7 @@ static BOOL testsign_create_cert(struct testsign_context *ctx) cert_info.rgExtension = &extension; algid.pszObjId = (char *)szOID_RSA_SHA1RSA; size = sizeof(cert_buffer); - ret = CryptSignAndEncodeCertificate(ctx->provider, AT_SIGNATURE, X509_ASN_ENCODING, + ret = CryptSignAndEncodeCertificate(provider, AT_SIGNATURE, X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED, &cert_info, &algid, NULL, cert_buffer, &size); ok(ret, "Failed to create certificate, error %#x\n", GetLastError());
@@ -180,7 +180,7 @@ static BOOL testsign_create_cert(struct testsign_context *ctx) ok(!!ctx->cert, "Failed to create context, error %#x\n", GetLastError());
size = sizeof(provider_nameA); - ret = CryptGetProvParam(ctx->provider, PP_NAME, provider_nameA, &size, 0); + ret = CryptGetProvParam(provider, PP_NAME, provider_nameA, &size, 0); ok(ret, "Failed to get prov param, error %#x\n", GetLastError()); MultiByteToWideChar(CP_ACP, 0, (char *)provider_nameA, -1, provider_nameW, ARRAY_SIZE(provider_nameW));
@@ -191,6 +191,9 @@ static BOOL testsign_create_cert(struct testsign_context *ctx) ret = CertSetCertificateContextProperty(ctx->cert, CERT_KEY_PROV_INFO_PROP_ID, 0, &provider_info); ok(ret, "Failed to set provider info, error %#x\n", GetLastError());
+ ret = CryptReleaseContext(provider, 0); + ok(ret, "failed to release context, error %u\n", GetLastError()); + ctx->root_store = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY_A, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, "root"); if (!ctx->root_store && GetLastError() == ERROR_ACCESS_DENIED) { @@ -198,8 +201,6 @@ static BOOL testsign_create_cert(struct testsign_context *ctx)
ret = CertFreeCertificateContext(ctx->cert); ok(ret, "Failed to free certificate, error %u\n", GetLastError()); - ret = CryptReleaseContext(ctx->provider, 0); - ok(ret, "failed to release context, error %u\n", GetLastError());
return FALSE; } @@ -213,8 +214,6 @@ static BOOL testsign_create_cert(struct testsign_context *ctx) ok(ret, "Failed to free certificate, error %u\n", GetLastError()); ret = CertCloseStore(ctx->root_store, CERT_CLOSE_STORE_CHECK_FLAG); ok(ret, "Failed to close store, error %u\n", GetLastError()); - ret = CryptReleaseContext(ctx->provider, 0); - ok(ret, "failed to release context, error %u\n", GetLastError());
return FALSE; } @@ -232,6 +231,7 @@ static BOOL testsign_create_cert(struct testsign_context *ctx)
static void testsign_cleanup(struct testsign_context *ctx) { + HCRYPTPROV provider; BOOL ret;
ret = CertFreeCertificateContext(ctx->cert); @@ -247,10 +247,7 @@ static void testsign_cleanup(struct testsign_context *ctx) ret = CertCloseStore(ctx->publisher_store, CERT_CLOSE_STORE_CHECK_FLAG); ok(ret, "Failed to close store, error %u\n", GetLastError());
- ret = CryptReleaseContext(ctx->provider, 0); - ok(ret, "failed to release context, error %u\n", GetLastError()); - - ret = CryptAcquireContextW(&ctx->provider, container_name, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET); + ret = CryptAcquireContextW(&provider, container_name, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET); ok(ret, "Failed to delete container, error %#x\n", GetLastError()); }
This should help with stale devices when some test crashed.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index fc213948f35..cf4b9d811cb 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -1416,6 +1416,7 @@ static void driver_start(struct testsign_context *ctx, const WCHAR *resource) static const WCHAR hardware_id[] = L"test_hardware_id\0"; SP_DEVINFO_DATA device = {sizeof(SP_DEVINFO_DATA)}; WCHAR path[MAX_PATH], filename[MAX_PATH]; + SC_HANDLE manager, service; BOOL ret, need_reboot; HANDLE catalog; HDEVINFO set; @@ -1462,6 +1463,29 @@ static void driver_start(struct testsign_context *ctx, const WCHAR *resource) ok(set != INVALID_HANDLE_VALUE, "failed to create device list, error %#x\n", GetLastError());
ret = SetupDiCreateDeviceInfoW(set, L"root\winetest\0", &GUID_NULL, NULL, NULL, 0, &device); + if (!ret && GetLastError() == ERROR_DEVINST_ALREADY_EXISTS) + { + ret = SetupDiOpenDeviceInfoW(set, L"root\winetest\0", NULL, 0, &device); + ok(ret, "failed to open device, error %#x\n", GetLastError()); + + ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device); + ok(ret, "failed to remove device, error %u\n", GetLastError()); + + ret = SetupDiDeleteDeviceInfo(set, &device); + ok(ret, "failed to delete device info, error %u\n", GetLastError()); + + /* Windows stops the service but does not delete it. */ + manager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT); + ok(!!manager, "failed to open service manager, error %u\n", GetLastError()); + + service = OpenServiceW(manager, L"winetest", SERVICE_STOP | DELETE); + if (service) unload_driver(service); + else ok(GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST, "got error %u\n", GetLastError()); + + CloseServiceHandle(manager); + + ret = SetupDiCreateDeviceInfoW(set, L"root\winetest\0", &GUID_NULL, NULL, NULL, 0, &device); + } ok(ret, "failed to create device, error %#x\n", GetLastError());
ret = SetupDiSetDeviceRegistryPropertyW( set, &device, SPDRP_HARDWAREID,
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=97160
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
ntoskrnl.exe: ntoskrnl.c:1496: Test failed: failed to register device, error 0xe000020b ntoskrnl.c:1542: Test failed: got name "\\?\Root#WINETEST#0#{deadbeef-29ef-4538-a5fd-b69573a362c1}" ntoskrnl.c:1570: Test failed: got name "\\?\Root#WINETEST#0#{deadbeef-29ef-4538-a5fd-b69573a362c1}" driver_pnp.c:538: Test failed: got id 'Root\WINETEST'
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/driver_hid.c | 268 ++------------------------- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 250 +++++++++++++++++++++++++ 2 files changed, 265 insertions(+), 253 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver_hid.c b/dlls/ntoskrnl.exe/tests/driver_hid.c index ed0767877ac..590483f528f 100644 --- a/dlls/ntoskrnl.exe/tests/driver_hid.c +++ b/dlls/ntoskrnl.exe/tests/driver_hid.c @@ -40,6 +40,8 @@ static UNICODE_STRING control_symlink;
static unsigned int got_start_device; +static char report_descriptor_buf[4096]; +static DWORD report_descriptor_len; static DWORD report_id; static DWORD polled;
@@ -161,253 +163,6 @@ static NTSTATUS WINAPI driver_power(DEVICE_OBJECT *device, IRP *irp)
static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) { -#include "psh_hid_macros.h" -/* Replace REPORT_ID with USAGE_PAGE when id is 0 */ -#define REPORT_ID_OR_USAGE_PAGE(size, id, off) SHORT_ITEM_1((id ? 8 : 0), 1, (id + off)) - const unsigned char report_descriptor[] = - { - USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), - USAGE(1, HID_USAGE_GENERIC_JOYSTICK), - COLLECTION(1, Application), - USAGE(1, HID_USAGE_GENERIC_JOYSTICK), - COLLECTION(1, Logical), - REPORT_ID_OR_USAGE_PAGE(1, report_id, 0), - USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), - USAGE(1, HID_USAGE_GENERIC_X), - USAGE(1, HID_USAGE_GENERIC_Y), - LOGICAL_MINIMUM(1, -128), - LOGICAL_MAXIMUM(1, 127), - REPORT_SIZE(1, 8), - REPORT_COUNT(1, 2), - INPUT(1, Data|Var|Abs), - - USAGE_PAGE(1, HID_USAGE_PAGE_BUTTON), - USAGE_MINIMUM(1, 1), - USAGE_MAXIMUM(1, 8), - LOGICAL_MINIMUM(1, 0), - LOGICAL_MAXIMUM(1, 1), - REPORT_COUNT(1, 8), - REPORT_SIZE(1, 1), - INPUT(1, Data|Var|Abs), - - USAGE_MINIMUM(1, 0x18), - USAGE_MAXIMUM(1, 0x1f), - LOGICAL_MINIMUM(1, 0), - LOGICAL_MAXIMUM(1, 1), - REPORT_COUNT(1, 8), - REPORT_SIZE(1, 1), - INPUT(1, Cnst|Var|Abs), - REPORT_COUNT(1, 8), - REPORT_SIZE(1, 1), - INPUT(1, Cnst|Var|Abs), - /* needs to be 8 bit aligned as next has Buff */ - - USAGE_MINIMUM(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8), - USAGE_MAXIMUM(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0xf), - LOGICAL_MINIMUM(1, 0), - LOGICAL_MAXIMUM(1, 8), - REPORT_COUNT(1, 2), - REPORT_SIZE(1, 8), - INPUT(2, Data|Ary|Rel|Wrap|Lin|Pref|Null|Vol|Buff), - - /* needs to be 8 bit aligned as previous has Buff */ - USAGE(1, 0x20), - LOGICAL_MINIMUM(1, 0), - LOGICAL_MAXIMUM(1, 1), - REPORT_COUNT(1, 8), - REPORT_SIZE(1, 1), - INPUT(1, Data|Var|Abs), - USAGE_MINIMUM(1, 0x21), - USAGE_MAXIMUM(1, 0x22), - REPORT_COUNT(1, 2), - REPORT_SIZE(1, 0), - INPUT(1, Data|Var|Abs), - USAGE(1, 0x23), - REPORT_COUNT(1, 0), - REPORT_SIZE(1, 1), - INPUT(1, Data|Var|Abs), - - USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), - USAGE(1, HID_USAGE_GENERIC_HATSWITCH), - LOGICAL_MINIMUM(1, 1), - LOGICAL_MAXIMUM(1, 8), - REPORT_SIZE(1, 4), - REPORT_COUNT(1, 2), - INPUT(1, Data|Var|Abs), - - USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), - USAGE(1, HID_USAGE_GENERIC_Z), - LOGICAL_MINIMUM(4, 0x00000000), - LOGICAL_MAXIMUM(4, 0x3fffffff), - PHYSICAL_MINIMUM(4, 0x80000000), - PHYSICAL_MAXIMUM(4, 0x7fffffff), - REPORT_SIZE(1, 32), - REPORT_COUNT(1, 1), - INPUT(1, Data|Var|Abs), - - /* reset physical range to its default interpretation */ - USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), - USAGE(1, HID_USAGE_GENERIC_RX), - PHYSICAL_MINIMUM(4, 0), - PHYSICAL_MAXIMUM(4, 0), - REPORT_SIZE(1, 32), - REPORT_COUNT(1, 1), - INPUT(1, Data|Var|Abs), - - USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), - USAGE(1, HID_USAGE_GENERIC_RY), - LOGICAL_MINIMUM(4, 0x7fff), - LOGICAL_MAXIMUM(4, 0x0000), - PHYSICAL_MINIMUM(4, 0x0000), - PHYSICAL_MAXIMUM(4, 0x7fff), - REPORT_SIZE(1, 32), - REPORT_COUNT(1, 1), - INPUT(1, Data|Var|Abs), - END_COLLECTION, - - USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), - USAGE(1, HID_USAGE_GENERIC_JOYSTICK), - COLLECTION(1, Report), - REPORT_ID_OR_USAGE_PAGE(1, report_id, 1), - USAGE_PAGE(1, HID_USAGE_PAGE_BUTTON), - USAGE_MINIMUM(1, 9), - USAGE_MAXIMUM(1, 10), - LOGICAL_MINIMUM(1, 0), - LOGICAL_MAXIMUM(1, 1), - REPORT_COUNT(1, 8), - REPORT_SIZE(1, 1), - INPUT(1, Data|Var|Abs), - END_COLLECTION, - - USAGE_PAGE(1, HID_USAGE_PAGE_LED), - USAGE(1, HID_USAGE_LED_GREEN), - COLLECTION(1, Report), - REPORT_ID_OR_USAGE_PAGE(1, report_id, 0), - USAGE_PAGE(1, HID_USAGE_PAGE_LED), - USAGE(1, 1), - USAGE(1, 2), - USAGE(1, 3), - USAGE(1, 4), - USAGE(1, 5), - USAGE(1, 6), - USAGE(1, 7), - USAGE(1, 8), - LOGICAL_MINIMUM(1, 0), - LOGICAL_MAXIMUM(1, 1), - PHYSICAL_MINIMUM(1, 0), - PHYSICAL_MAXIMUM(1, 1), - REPORT_COUNT(1, 8), - REPORT_SIZE(1, 1), - INPUT(1, Data|Var|Abs), - - USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8c), - USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8d), - USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8e), - USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8f), - LOGICAL_MINIMUM(1, 1), - LOGICAL_MAXIMUM(1, 16), - REPORT_COUNT(1, 2), - REPORT_SIZE(1, 8), - INPUT(1, Data|Ary|Abs), - END_COLLECTION, - - USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS), - USAGE(1, HID_USAGE_HAPTICS_SIMPLE_CONTROLLER), - COLLECTION(1, Logical), - REPORT_ID_OR_USAGE_PAGE(1, report_id, 0), - USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS), - - USAGE(1, HID_USAGE_HAPTICS_WAVEFORM_LIST), - COLLECTION(1, NamedArray), - USAGE_PAGE(1, HID_USAGE_PAGE_ORDINAL), - USAGE(1, 3), /* HID_USAGE_HAPTICS_WAVEFORM_RUMBLE */ - USAGE(1, 4), /* HID_USAGE_HAPTICS_WAVEFORM_BUZZ */ - LOGICAL_MINIMUM(2, 0x0000), - LOGICAL_MAXIMUM(2, 0xffff), - REPORT_COUNT(1, 2), - REPORT_SIZE(1, 16), - FEATURE(1, Data|Var|Abs|Null), - END_COLLECTION, - - USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS), - USAGE(1, HID_USAGE_HAPTICS_DURATION_LIST), - COLLECTION(1, NamedArray), - USAGE_PAGE(1, HID_USAGE_PAGE_ORDINAL), - USAGE(1, 3), /* 0 (HID_USAGE_HAPTICS_WAVEFORM_RUMBLE) */ - USAGE(1, 4), /* 0 (HID_USAGE_HAPTICS_WAVEFORM_BUZZ) */ - LOGICAL_MINIMUM(2, 0x0000), - LOGICAL_MAXIMUM(2, 0xffff), - REPORT_COUNT(1, 2), - REPORT_SIZE(1, 16), - FEATURE(1, Data|Var|Abs|Null), - END_COLLECTION, - - USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS), - USAGE(1, HID_USAGE_HAPTICS_WAVEFORM_CUTOFF_TIME), - UNIT(2, 0x1001), /* seconds */ - UNIT_EXPONENT(1, -3), /* 10^-3 */ - LOGICAL_MINIMUM(2, 0x8000), - LOGICAL_MAXIMUM(2, 0x7fff), - PHYSICAL_MINIMUM(4, 0x00000000), - PHYSICAL_MAXIMUM(4, 0xffffffff), - REPORT_SIZE(1, 32), - REPORT_COUNT(1, 2), - FEATURE(1, Data|Var|Abs), - /* reset global items */ - UNIT(1, 0), /* None */ - UNIT_EXPONENT(1, 0), - - USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), - USAGE(1, HID_USAGE_GENERIC_Z), - LOGICAL_MINIMUM(4, 0x0000), - LOGICAL_MAXIMUM(4, 0x7fff), - PHYSICAL_MINIMUM(4, 0xfff90000), - PHYSICAL_MAXIMUM(4, 0x0003ffff), - REPORT_SIZE(1, 32), - REPORT_COUNT(1, 1), - FEATURE(1, Data|Var|Abs), - END_COLLECTION, - - USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), - USAGE(1, HID_USAGE_GENERIC_JOYSTICK), - COLLECTION(1, Report), - REPORT_ID_OR_USAGE_PAGE(1, report_id, 1), - USAGE_PAGE(1, HID_USAGE_PAGE_BUTTON), - USAGE_MINIMUM(1, 9), - USAGE_MAXIMUM(1, 10), - LOGICAL_MINIMUM(1, 0), - LOGICAL_MAXIMUM(1, 1), - PHYSICAL_MINIMUM(1, 0), - PHYSICAL_MAXIMUM(1, 1), - REPORT_COUNT(1, 8), - REPORT_SIZE(1, 1), - FEATURE(1, Data|Var|Abs), - END_COLLECTION, - - USAGE_PAGE(1, HID_USAGE_PAGE_LED), - USAGE(1, HID_USAGE_LED_GREEN), - COLLECTION(1, Report), - REPORT_ID_OR_USAGE_PAGE(1, report_id, 0), - USAGE_PAGE(1, HID_USAGE_PAGE_LED), - REPORT_COUNT(1, 8), - REPORT_SIZE(1, 1), - OUTPUT(1, Cnst|Var|Abs), - END_COLLECTION, - - USAGE_PAGE(1, HID_USAGE_PAGE_LED), - USAGE(1, HID_USAGE_LED_RED), - COLLECTION(1, Report), - REPORT_ID_OR_USAGE_PAGE(1, report_id, 1), - USAGE_PAGE(1, HID_USAGE_PAGE_LED), - REPORT_COUNT(1, 8), - REPORT_SIZE(1, 1), - OUTPUT(1, Cnst|Var|Abs), - END_COLLECTION, - END_COLLECTION, - }; -#undef REPORT_ID_OR_USAGE_PAGE -#include "pop_hid_macros.h" - IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation(irp); HID_DEVICE_EXTENSION *ext = device->DeviceExtension; struct hid_device *impl = ext->MiniDeviceExtension; @@ -455,7 +210,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) desc->bCountry = 0; desc->bNumDescriptors = 1; desc->DescriptorList[0].bReportType = HID_REPORT_DESCRIPTOR_TYPE; - desc->DescriptorList[0].wReportLength = sizeof(report_descriptor); + desc->DescriptorList[0].wReportLength = report_descriptor_len; irp->IoStatus.Information = sizeof(*desc); } ret = STATUS_SUCCESS; @@ -464,12 +219,12 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp)
case IOCTL_HID_GET_REPORT_DESCRIPTOR: ok(!in_size, "got input size %u\n", in_size); - ok(out_size == sizeof(report_descriptor), "got output size %u\n", out_size); + ok(out_size == report_descriptor_len, "got output size %u\n", out_size);
- if (out_size == sizeof(report_descriptor)) + if (out_size == report_descriptor_len) { - memcpy(irp->UserBuffer, report_descriptor, sizeof(report_descriptor)); - irp->IoStatus.Information = sizeof(report_descriptor); + memcpy(irp->UserBuffer, report_descriptor_buf, report_descriptor_len); + irp->IoStatus.Information = report_descriptor_len; } ret = STATUS_SUCCESS; break; @@ -679,7 +434,7 @@ static void WINAPI driver_unload(DRIVER_OBJECT *driver) NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *registry) { static const int info_size = offsetof( KEY_VALUE_PARTIAL_INFORMATION, Data ); - char buffer[offsetof( KEY_VALUE_PARTIAL_INFORMATION, Data ) + sizeof(DWORD)]; + char buffer[offsetof( KEY_VALUE_PARTIAL_INFORMATION, Data ) + sizeof(report_descriptor_buf)]; HID_MINIDRIVER_REGISTRATION params = { .Revision = HID_REVISION, @@ -713,6 +468,13 @@ NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *registry) memcpy(&polled, buffer + info_size, size - info_size); params.DevicesArePolled = polled;
+ RtlInitUnicodeString(&name_str, L"Descriptor"); + size = info_size + sizeof(report_descriptor_buf); + ret = ZwQueryValueKey(hkey, &name_str, KeyValuePartialInformation, buffer, size, &size); + ok(!ret, "ZwQueryValueKey returned %#x\n", ret); + memcpy(report_descriptor_buf, buffer + info_size, size - info_size); + report_descriptor_len = size - info_size; + driver->DriverExtension->AddDevice = driver_add_device; driver->DriverUnload = driver_unload; driver->MajorFunction[IRP_MJ_PNP] = driver_pnp; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index cf4b9d811cb..adb5b05aa90 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -3347,6 +3347,253 @@ static void test_hid_device(DWORD report_id, DWORD polled)
static void test_hid_driver(struct testsign_context *ctx, DWORD report_id, DWORD polled) { +#include "psh_hid_macros.h" +/* Replace REPORT_ID with USAGE_PAGE when id is 0 */ +#define REPORT_ID_OR_USAGE_PAGE(size, id, off) SHORT_ITEM_1((id ? 8 : 0), 1, (id + off)) + const unsigned char report_descriptor[] = + { + USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), + USAGE(1, HID_USAGE_GENERIC_JOYSTICK), + COLLECTION(1, Application), + USAGE(1, HID_USAGE_GENERIC_JOYSTICK), + COLLECTION(1, Logical), + REPORT_ID_OR_USAGE_PAGE(1, report_id, 0), + USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), + USAGE(1, HID_USAGE_GENERIC_X), + USAGE(1, HID_USAGE_GENERIC_Y), + LOGICAL_MINIMUM(1, -128), + LOGICAL_MAXIMUM(1, 127), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 2), + INPUT(1, Data|Var|Abs), + + USAGE_PAGE(1, HID_USAGE_PAGE_BUTTON), + USAGE_MINIMUM(1, 1), + USAGE_MAXIMUM(1, 8), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 1), + REPORT_COUNT(1, 8), + REPORT_SIZE(1, 1), + INPUT(1, Data|Var|Abs), + + USAGE_MINIMUM(1, 0x18), + USAGE_MAXIMUM(1, 0x1f), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 1), + REPORT_COUNT(1, 8), + REPORT_SIZE(1, 1), + INPUT(1, Cnst|Var|Abs), + REPORT_COUNT(1, 8), + REPORT_SIZE(1, 1), + INPUT(1, Cnst|Var|Abs), + /* needs to be 8 bit aligned as next has Buff */ + + USAGE_MINIMUM(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8), + USAGE_MAXIMUM(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0xf), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 8), + REPORT_COUNT(1, 2), + REPORT_SIZE(1, 8), + INPUT(2, Data|Ary|Rel|Wrap|Lin|Pref|Null|Vol|Buff), + + /* needs to be 8 bit aligned as previous has Buff */ + USAGE(1, 0x20), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 1), + REPORT_COUNT(1, 8), + REPORT_SIZE(1, 1), + INPUT(1, Data|Var|Abs), + USAGE_MINIMUM(1, 0x21), + USAGE_MAXIMUM(1, 0x22), + REPORT_COUNT(1, 2), + REPORT_SIZE(1, 0), + INPUT(1, Data|Var|Abs), + USAGE(1, 0x23), + REPORT_COUNT(1, 0), + REPORT_SIZE(1, 1), + INPUT(1, Data|Var|Abs), + + USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), + USAGE(1, HID_USAGE_GENERIC_HATSWITCH), + LOGICAL_MINIMUM(1, 1), + LOGICAL_MAXIMUM(1, 8), + REPORT_SIZE(1, 4), + REPORT_COUNT(1, 2), + INPUT(1, Data|Var|Abs), + + USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), + USAGE(1, HID_USAGE_GENERIC_Z), + LOGICAL_MINIMUM(4, 0x00000000), + LOGICAL_MAXIMUM(4, 0x3fffffff), + PHYSICAL_MINIMUM(4, 0x80000000), + PHYSICAL_MAXIMUM(4, 0x7fffffff), + REPORT_SIZE(1, 32), + REPORT_COUNT(1, 1), + INPUT(1, Data|Var|Abs), + + /* reset physical range to its default interpretation */ + USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), + USAGE(1, HID_USAGE_GENERIC_RX), + PHYSICAL_MINIMUM(4, 0), + PHYSICAL_MAXIMUM(4, 0), + REPORT_SIZE(1, 32), + REPORT_COUNT(1, 1), + INPUT(1, Data|Var|Abs), + + USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), + USAGE(1, HID_USAGE_GENERIC_RY), + LOGICAL_MINIMUM(4, 0x7fff), + LOGICAL_MAXIMUM(4, 0x0000), + PHYSICAL_MINIMUM(4, 0x0000), + PHYSICAL_MAXIMUM(4, 0x7fff), + REPORT_SIZE(1, 32), + REPORT_COUNT(1, 1), + INPUT(1, Data|Var|Abs), + END_COLLECTION, + + USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), + USAGE(1, HID_USAGE_GENERIC_JOYSTICK), + COLLECTION(1, Report), + REPORT_ID_OR_USAGE_PAGE(1, report_id, 1), + USAGE_PAGE(1, HID_USAGE_PAGE_BUTTON), + USAGE_MINIMUM(1, 9), + USAGE_MAXIMUM(1, 10), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 1), + REPORT_COUNT(1, 8), + REPORT_SIZE(1, 1), + INPUT(1, Data|Var|Abs), + END_COLLECTION, + + USAGE_PAGE(1, HID_USAGE_PAGE_LED), + USAGE(1, HID_USAGE_LED_GREEN), + COLLECTION(1, Report), + REPORT_ID_OR_USAGE_PAGE(1, report_id, 0), + USAGE_PAGE(1, HID_USAGE_PAGE_LED), + USAGE(1, 1), + USAGE(1, 2), + USAGE(1, 3), + USAGE(1, 4), + USAGE(1, 5), + USAGE(1, 6), + USAGE(1, 7), + USAGE(1, 8), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 1), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(1, 1), + REPORT_COUNT(1, 8), + REPORT_SIZE(1, 1), + INPUT(1, Data|Var|Abs), + + USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8c), + USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8d), + USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8e), + USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8f), + LOGICAL_MINIMUM(1, 1), + LOGICAL_MAXIMUM(1, 16), + REPORT_COUNT(1, 2), + REPORT_SIZE(1, 8), + INPUT(1, Data|Ary|Abs), + END_COLLECTION, + + USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS), + USAGE(1, HID_USAGE_HAPTICS_SIMPLE_CONTROLLER), + COLLECTION(1, Logical), + REPORT_ID_OR_USAGE_PAGE(1, report_id, 0), + USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS), + + USAGE(1, HID_USAGE_HAPTICS_WAVEFORM_LIST), + COLLECTION(1, NamedArray), + USAGE_PAGE(1, HID_USAGE_PAGE_ORDINAL), + USAGE(1, 3), /* HID_USAGE_HAPTICS_WAVEFORM_RUMBLE */ + USAGE(1, 4), /* HID_USAGE_HAPTICS_WAVEFORM_BUZZ */ + LOGICAL_MINIMUM(2, 0x0000), + LOGICAL_MAXIMUM(2, 0xffff), + REPORT_COUNT(1, 2), + REPORT_SIZE(1, 16), + FEATURE(1, Data|Var|Abs|Null), + END_COLLECTION, + + USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS), + USAGE(1, HID_USAGE_HAPTICS_DURATION_LIST), + COLLECTION(1, NamedArray), + USAGE_PAGE(1, HID_USAGE_PAGE_ORDINAL), + USAGE(1, 3), /* 0 (HID_USAGE_HAPTICS_WAVEFORM_RUMBLE) */ + USAGE(1, 4), /* 0 (HID_USAGE_HAPTICS_WAVEFORM_BUZZ) */ + LOGICAL_MINIMUM(2, 0x0000), + LOGICAL_MAXIMUM(2, 0xffff), + REPORT_COUNT(1, 2), + REPORT_SIZE(1, 16), + FEATURE(1, Data|Var|Abs|Null), + END_COLLECTION, + + USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS), + USAGE(1, HID_USAGE_HAPTICS_WAVEFORM_CUTOFF_TIME), + UNIT(2, 0x1001), /* seconds */ + UNIT_EXPONENT(1, -3), /* 10^-3 */ + LOGICAL_MINIMUM(2, 0x8000), + LOGICAL_MAXIMUM(2, 0x7fff), + PHYSICAL_MINIMUM(4, 0x00000000), + PHYSICAL_MAXIMUM(4, 0xffffffff), + REPORT_SIZE(1, 32), + REPORT_COUNT(1, 2), + FEATURE(1, Data|Var|Abs), + /* reset global items */ + UNIT(1, 0), /* None */ + UNIT_EXPONENT(1, 0), + + USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), + USAGE(1, HID_USAGE_GENERIC_Z), + LOGICAL_MINIMUM(4, 0x0000), + LOGICAL_MAXIMUM(4, 0x7fff), + PHYSICAL_MINIMUM(4, 0xfff90000), + PHYSICAL_MAXIMUM(4, 0x0003ffff), + REPORT_SIZE(1, 32), + REPORT_COUNT(1, 1), + FEATURE(1, Data|Var|Abs), + END_COLLECTION, + + USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), + USAGE(1, HID_USAGE_GENERIC_JOYSTICK), + COLLECTION(1, Report), + REPORT_ID_OR_USAGE_PAGE(1, report_id, 1), + USAGE_PAGE(1, HID_USAGE_PAGE_BUTTON), + USAGE_MINIMUM(1, 9), + USAGE_MAXIMUM(1, 10), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 1), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(1, 1), + REPORT_COUNT(1, 8), + REPORT_SIZE(1, 1), + FEATURE(1, Data|Var|Abs), + END_COLLECTION, + + USAGE_PAGE(1, HID_USAGE_PAGE_LED), + USAGE(1, HID_USAGE_LED_GREEN), + COLLECTION(1, Report), + REPORT_ID_OR_USAGE_PAGE(1, report_id, 0), + USAGE_PAGE(1, HID_USAGE_PAGE_LED), + REPORT_COUNT(1, 8), + REPORT_SIZE(1, 1), + OUTPUT(1, Cnst|Var|Abs), + END_COLLECTION, + + USAGE_PAGE(1, HID_USAGE_PAGE_LED), + USAGE(1, HID_USAGE_LED_RED), + COLLECTION(1, Report), + REPORT_ID_OR_USAGE_PAGE(1, report_id, 1), + USAGE_PAGE(1, HID_USAGE_PAGE_LED), + REPORT_COUNT(1, 8), + REPORT_SIZE(1, 1), + OUTPUT(1, Cnst|Var|Abs), + END_COLLECTION, + END_COLLECTION, + }; +#undef REPORT_ID_OR_USAGE_PAGE +#include "pop_hid_macros.h" + char cwd[MAX_PATH], tempdir[MAX_PATH]; LSTATUS status; HKEY hkey; @@ -3364,6 +3611,9 @@ static void test_hid_driver(struct testsign_context *ctx, DWORD report_id, DWORD status = RegSetValueExW(hkey, L"PolledMode", 0, REG_DWORD, (void *)&polled, sizeof(polled)); ok(!status, "RegSetValueExW returned %#x\n", status);
+ status = RegSetValueExW(hkey, L"Descriptor", 0, REG_BINARY, (void *)report_descriptor, sizeof(report_descriptor)); + ok(!status, "RegSetValueExW returned %#x\n", status); + driver_start(ctx, L"driver_hid.dll"); test_hid_device(report_id, polled); driver_stop();
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=97161
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
ntoskrnl.exe: ntoskrnl.c:1496: Test failed: failed to register device, error 0xe000020b ntoskrnl.c:3226: Test failed: id 0 poll: didn't find device ntoskrnl.c:3230: Test failed: id 0 poll: got error 5 ntoskrnl.c:3235: Test failed: id 0 poll: HidD_GetNumInputBuffers failed last error 6 ntoskrnl.c:3236: Test failed: id 0 poll: HidD_GetNumInputBuffers returned 3735928559 ntoskrnl.c:3241: Test failed: id 0 poll: HidD_SetNumInputBuffers returned error 6 ntoskrnl.c:3245: Test failed: id 0 poll: HidD_SetNumInputBuffers returned error 6 ntoskrnl.c:3249: Test failed: id 0 poll: HidD_SetNumInputBuffers failed last error 6 ntoskrnl.c:3254: Test failed: id 0 poll: HidD_GetNumInputBuffers failed last error 6 ntoskrnl.c:3255: Test failed: id 0 poll: HidD_GetNumInputBuffers returned 3735928559 ntoskrnl.c:3260: Test failed: id 0 poll: got error 5 ntoskrnl.c:3265: Test failed: id 0 poll: HidD_GetNumInputBuffers failed last error 6 ntoskrnl.c:3266: Test failed: id 0 poll: HidD_GetNumInputBuffers returned 3735928559 ntoskrnl.c:3270: Test failed: id 0 poll: HidD_SetNumInputBuffers failed last error 6 ntoskrnl.c:3275: Test failed: id 0 poll: HidD_GetNumInputBuffers failed last error 6 ntoskrnl.c:3276: Test failed: id 0 poll: HidD_GetNumInputBuffers returned 3735928559 ntoskrnl.c:3280: Test failed: id 0 poll: HidD_GetNumInputBuffers failed last error 6 ntoskrnl.c:3281: Test failed: id 0 poll: HidD_GetNumInputBuffers returned 3735928559 ntoskrnl.c:3288: Test failed: id 0 poll: IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error 6 ntoskrnl.c:3290: Test failed: id 0 poll: got poll_freq 0, expected 5 ntoskrnl.c:3296: Test failed: id 0 poll: IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error 6 ntoskrnl.c:3303: Test failed: id 0 poll: IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error 6 ntoskrnl.c:3310: Test failed: id 0 poll: IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error 6 ntoskrnl.c:3316: Test failed: id 0 poll: IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error 6 ntoskrnl.c:3318: Test failed: id 0 poll: got poll_freq 0, expected 10000 ntoskrnl.c:3324: Test failed: id 0 poll: IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error 6 ntoskrnl.c:3330: Test failed: id 0 poll: IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error 6 ntoskrnl.c:2244: Test failed: id 0 poll: HidD_GetPreparsedData failed with error 6 ntoskrnl.c:2250: Test failed: id 0 poll: HidP_GetCaps returned 0xc0110001 ntoskrnl.c:2251: Test failed: id 0 poll: got InputReportByteLength 25, expected 26 ntoskrnl.c:2251: Test failed: id 0 poll: got OutputReportByteLength 2, expected 3 ntoskrnl.c:2251: Test failed: id 0 poll: got FeatureReportByteLength 21, expected 22 ntoskrnl.c:2255: Test failed: id 0 poll: HidP_GetLinkCollectionNodes returned 0xc0110001 ntoskrnl.c:2256: Test failed: id 0 poll: got 0 collection nodes, expected 10 ntoskrnl.c:2262: Test failed: id 0 poll: HidP_GetLinkCollectionNodes returned 0xc0110001 ntoskrnl.c:2263: Test failed: id 0 poll: got 16 collection nodes, expected 10 ntoskrnl.c:2275: Test failed: id 0 poll: HidP_GetButtonCaps returned 0xc0110001 ntoskrnl.c:2277: Test failed: id 0 poll: HidP_GetButtonCaps returned 0xc0110001 ntoskrnl.c:2280: Test failed: id 0 poll: HidP_GetButtonCaps returned 0xc0110001 ntoskrnl.c:2281: Test failed: id 0 poll: HidP_GetButtonCaps returned count 0, expected 17 ntoskrnl.c:2288: Test failed: id 0 poll: HidP_GetButtonCaps returned 0xc0110001 ntoskrnl.c:2289: Test failed: id 0 poll: HidP_GetButtonCaps returned count 32, expected 17 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[0]: got UsagePage 0000, expected 0009 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[0]: got BitField 0, expected 2 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[0]: got LinkCollection 0, expected 1 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[0]: got LinkUsage 0000, expected 0004 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[0]: got LinkUsagePage 0000, expected 0001 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[0]: got IsRange 0, expected 1 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[0]: got IsAbsolute 0, expected 1 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[1]: got UsagePage 0000, expected 0009 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[1]: got BitField 0, expected 3 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[1]: got LinkCollection 0, expected 1 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[1]: got LinkUsage 0000, expected 0004 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[1]: got LinkUsagePage 0000, expected 0001 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[1]: got IsRange 0, expected 1 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[1]: got IsAbsolute 0, expected 1 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[2]: got UsagePage 0000, expected 0007 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[2]: got BitField 0, expected 508 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[2]: got LinkCollection 0, expected 1 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[2]: got LinkUsage 0000, expected 0004 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[2]: got LinkUsagePage 0000, expected 0001 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[2]: got IsRange 0, expected 1 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[3]: got UsagePage 0000, expected 0009 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[3]: got BitField 0, expected 2 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[3]: got LinkCollection 0, expected 1 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[3]: got LinkUsage 0000, expected 0004 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[3]: got LinkUsagePage 0000, expected 0001 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[3]: got IsAbsolute 0, expected 1 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[3]: got NotRange.Usage 0000, expected 0020 ntoskrnl.c:2295: Test failed: id 0 poll: button_caps[3]: got NotRange.DataIndex 0, expected 26 ntoskrnl.c:2301: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned 0xc0110001 ntoskrnl.c:2303: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned 0xc0110001 ntoskrnl.c:2306: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned 0xc0110001 ntoskrnl.c:2307: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned count 0, expected 17 ntoskrnl.c:2314: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned 0xc0110001 ntoskrnl.c:2315: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned count 31, expected 17 ntoskrnl.c:2321: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned 0xc0110001 ntoskrnl.c:2322: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned count 31, expected 1 ntoskrnl.c:2327: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned 0xc0110001 ntoskrnl.c:2328: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned count 48879, expected 0 ntoskrnl.c:2331: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned 0xc0110001 ntoskrnl.c:2332: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned count 48879, expected 0 ntoskrnl.c:2335: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned 0xc0110001 ntoskrnl.c:2336: Test failed: id 0 poll: HidP_GetSpecificButtonCaps returned count 48879, expected 0 ntoskrnl.c:2340: Test failed: id 0 poll: HidP_GetValueCaps returned 0xc0110001 ntoskrnl.c:2342: Test failed: id 0 poll: HidP_GetValueCaps returned 0xc0110001 ntoskrnl.c:2345: Test failed: id 0 poll: HidP_GetValueCaps returned 0xc0110001 ntoskrnl.c:2346: Test failed: id 0 poll: HidP_GetValueCaps returned count 0, expected 7 ntoskrnl.c:2352: Test failed: id 0 poll: HidP_GetValueCaps returned 0xc0110001 ntoskrnl.c:2353: Test failed: id 0 poll: HidP_GetValueCaps returned count 16, expected 7 ntoskrnl.c:2359: Test failed: id 0 poll: value_caps[0]: got ReportID 1, expected 0 ntoskrnl.c:2359: Test failed: id 0 poll: value_caps[1]: got ReportID 1, expected 0 ntoskrnl.c:2359: Test failed: id 0 poll: value_caps[2]: got ReportID 1, expected 0 ntoskrnl.c:2359: Test failed: id 0 poll: value_caps[3]: got ReportID 1, expected 0 ntoskrnl.c:2365: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned 0xc0110001 ntoskrnl.c:2367: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned 0xc0110001 ntoskrnl.c:2370: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned 0xc0110001 ntoskrnl.c:2371: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned count 0, expected 7 ntoskrnl.c:2378: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned 0xc0110001 ntoskrnl.c:2379: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned count 12, expected 7 ntoskrnl.c:2381: Test failed: id 0 poll: got BitSize 4, expected 8 ntoskrnl.c:2381: Test failed: id 0 poll: got ReportCount 2, expected 1 ntoskrnl.c:2381: Test failed: id 0 poll: got LogicalMin 1, expected -128 ntoskrnl.c:2381: Test failed: id 0 poll: got LogicalMax 8, expected 127 ntoskrnl.c:2381: Test failed: id 0 poll: got NotRange.Usage 0039, expected 0031 ntoskrnl.c:2381: Test failed: id 0 poll: got NotRange.DataIndex 29, expected 0 ntoskrnl.c:2389: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned 0xc0110001 ntoskrnl.c:2395: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned 0xc0110001 ntoskrnl.c:2396: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned count 57005, expected 0 ntoskrnl.c:2399: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned 0xc0110001 ntoskrnl.c:2400: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned count 57005, expected 0 ntoskrnl.c:2403: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned 0xc0110001 ntoskrnl.c:2404: Test failed: id 0 poll: HidP_GetSpecificValueCaps returned count 57005, expected 0 ntoskrnl.c:2409: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:2411: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:2413: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:2415: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:2419: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:2424: Test failed: id 0 poll: unexpected report data ntoskrnl.c:2428: Test failed: id 0 poll: HidP_SetUsageValueArray returned 0xc0110001 ntoskrnl.c:2432: Test failed: id 0 poll: HidP_SetUsageValueArray returned 0xc0110001 ntoskrnl.c:2436: Test failed: id 0 poll: HidP_SetUsageValueArray returned 0xc0110001 ntoskrnl.c:2440: Test failed: id 0 poll: HidP_GetUsageValueArray returned 0xc0110001 ntoskrnl.c:2444: Test failed: id 0 poll: HidP_GetUsageValueArray returned 0xc0110001 ntoskrnl.c:2448: Test failed: id 0 poll: HidP_GetUsageValueArray returned 0xc0110001 ntoskrnl.c:2453: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2457: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2458: Test failed: id 0 poll: got value deadbeef, expected 0x80 ntoskrnl.c:2462: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2463: Test failed: id 0 poll: got value deadbeef, expected 0xffffff80 ntoskrnl.c:2468: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2472: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2473: Test failed: id 0 poll: got value deadbeef, expected 0x7f ntoskrnl.c:2478: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2482: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2483: Test failed: id 0 poll: got value deadbeef, expected 0 ntoskrnl.c:2488: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2492: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2493: Test failed: id 0 poll: got value deadbeef, expected 0 ntoskrnl.c:2497: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2498: Test failed: id 0 poll: got value deadbeef, expected 0x7fffffff ntoskrnl.c:2503: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2507: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2508: Test failed: id 0 poll: got value deadbeef, expected 0x7fffffff ntoskrnl.c:2513: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2517: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2518: Test failed: id 0 poll: got value deadbeef, expected 0x80000000 ntoskrnl.c:2523: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2527: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2528: Test failed: id 0 poll: got value deadbeef, expected 0 ntoskrnl.c:2533: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2537: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2538: Test failed: id 0 poll: got value deadbeef, expected 0 ntoskrnl.c:2541: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2542: Test failed: id 0 poll: got value deadbeef, expected 0 ntoskrnl.c:2547: Test failed: id 0 poll: HidP_MaxUsageListLength(HidP_Input, 0) returned 0, expected 50 ntoskrnl.c:2549: Test failed: id 0 poll: HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_BUTTON) returned 0, expected 32 ntoskrnl.c:2551: Test failed: id 0 poll: HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_LED) returned 0, expected 8 ntoskrnl.c:2553: Test failed: id 0 poll: HidP_MaxUsageListLength(HidP_Feature, HID_USAGE_PAGE_BUTTON) returned 0, expected 8 ntoskrnl.c:2561: Test failed: id 0 poll: HidP_SetUsages returned 0xc0110001 ntoskrnl.c:2567: Test failed: id 0 poll: HidP_SetUsages returned 0xc0110001 ntoskrnl.c:2573: Test failed: id 0 poll: HidP_SetUsages returned 0xc0110001 ntoskrnl.c:2579: Test failed: id 0 poll: HidP_SetUsages returned 0xc0110001 ntoskrnl.c:2584: Test failed: id 0 poll: HidP_GetUsages returned 0xc0110001 ntoskrnl.c:2585: Test failed: id 0 poll: got usage count 16, expected 2 ntoskrnl.c:2591: Test failed: id 0 poll: got report[6] ffffffcd expected 0 ntoskrnl.c:2592: Test failed: id 0 poll: got report[7] ffffffcd expected 0 ntoskrnl.c:2596: Test failed: id 0 poll: HidP_SetUsages returned 0xc0110001 ntoskrnl.c:2599: Test failed: id 0 poll: unexpected report data ntoskrnl.c:2603: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2608: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2614: Test failed: id 0 poll: HidP_GetUsages returned 0xc0110001 ntoskrnl.c:2615: Test failed: id 0 poll: got usage count 1, expected 2 ntoskrnl.c:2620: Test failed: id 0 poll: HidP_GetUsages returned 0xc0110001 ntoskrnl.c:2621: Test failed: id 0 poll: got usage count 16, expected 2 ntoskrnl.c:2622: Test failed: id 0 poll: got usages[0] cdcd, expected 4 ntoskrnl.c:2623: Test failed: id 0 poll: got usages[1] cdcd, expected 6 ntoskrnl.c:2629: Test failed: id 0 poll: HidP_GetUsages returned 0xc0110001 ntoskrnl.c:2630: Test failed: id 0 poll: got usage count 16, expected 2 ntoskrnl.c:2631: Test failed: id 0 poll: got usages[0] cdcd, expected 6 ntoskrnl.c:2632: Test failed: id 0 poll: got usages[1] cdcd, expected 4 ntoskrnl.c:2638: Test failed: id 0 poll: HidP_GetUsagesEx returned 0xc0110001 ntoskrnl.c:2639: Test failed: id 0 poll: got usage count 16, expected 4 ntoskrnl.c:2640: Test failed: id 0 poll: got usage_and_pages[0] UsagePage cdcd, expected 9 ntoskrnl.c:2642: Test failed: id 0 poll: got usage_and_pages[1] UsagePage cdcd, expected 9 ntoskrnl.c:2644: Test failed: id 0 poll: got usage_and_pages[2] UsagePage cdcd, expected 7 ntoskrnl.c:2646: Test failed: id 0 poll: got usage_and_pages[3] UsagePage cdcd, expected 7 ntoskrnl.c:2648: Test failed: id 0 poll: got usage_and_pages[4] UsagePage cdcd, expected 8 ntoskrnl.c:2650: Test failed: id 0 poll: got usage_and_pages[5] UsagePage cdcd, expected 8 ntoskrnl.c:2652: Test failed: id 0 poll: got usage_and_pages[0] Usage cdcd, expected 4 ntoskrnl.c:2654: Test failed: id 0 poll: got usage_and_pages[1] Usage cdcd, expected 6 ntoskrnl.c:2656: Test failed: id 0 poll: got usage_and_pages[2] Usage cdcd, expected 9 ntoskrnl.c:2658: Test failed: id 0 poll: got usage_and_pages[3] Usage cdcd, expected b ntoskrnl.c:2660: Test failed: id 0 poll: got usage_and_pages[4] Usage cdcd, expected 6 ntoskrnl.c:2662: Test failed: id 0 poll: got usage_and_pages[5] Usage cdcd, expected 4 ntoskrnl.c:2668: Test failed: id 0 poll: HidP_MaxDataListLength(HidP_Input) returned 0, expected 58 ntoskrnl.c:2672: Test failed: id 0 poll: HidP_MaxDataListLength(HidP_Feature) returned 0, expected 14 ntoskrnl.c:2676: Test failed: id 0 poll: HidP_GetData returned 0xc0110001 ntoskrnl.c:2677: Test failed: id 0 poll: got data count 1, expected 11 ntoskrnl.c:2680: Test failed: id 0 poll: HidP_GetData returned 0xc0110001 ntoskrnl.c:2684: Test failed: id 0 poll: data[1]: got DataIndex 0, expected 1 ntoskrnl.c:2684: Test failed: id 0 poll: data[2]: got DataIndex 0, expected 5 ntoskrnl.c:2685: Test failed: id 0 poll: data[2]: got RawValue 0, expected 1 ntoskrnl.c:2684: Test failed: id 0 poll: data[3]: got DataIndex 0, expected 7 ntoskrnl.c:2685: Test failed: id 0 poll: data[3]: got RawValue 0, expected 1 ntoskrnl.c:2684: Test failed: id 0 poll: data[4]: got DataIndex 0, expected 19 ntoskrnl.c:2685: Test failed: id 0 poll: data[4]: got RawValue 0, expected 1 ntoskrnl.c:2684: Test failed: id 0 poll: data[5]: got DataIndex 0, expected 21 ntoskrnl.c:2685: Test failed: id 0 poll: data[5]: got RawValue 0, expected 1 ntoskrnl.c:2684: Test failed: id 0 poll: data[6]: got DataIndex 0, expected 30 ntoskrnl.c:2684: Test failed: id 0 poll: data[7]: got DataIndex 0, expected 31 ntoskrnl.c:2684: Test failed: id 0 poll: data[8]: got DataIndex 0, expected 32 ntoskrnl.c:2685: Test failed: id 0 poll: data[8]: got RawValue 0, expected -17970434 ntoskrnl.c:2684: Test failed: id 0 poll: data[9]: got DataIndex 0, expected 37 ntoskrnl.c:2685: Test failed: id 0 poll: data[9]: got RawValue 0, expected 1 ntoskrnl.c:2684: Test failed: id 0 poll: data[10]: got DataIndex 0, expected 39 ntoskrnl.c:2685: Test failed: id 0 poll: data[10]: got RawValue 0, expected 1 ntoskrnl.c:2694: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:2700: Test failed: id 0 poll: HidP_SetUsages returned 0xc0110001 ntoskrnl.c:2701: Test failed: id 0 poll: unexpected usage index 0, expected 3 ntoskrnl.c:2703: Test failed: id 0 poll: unexpected usage index 0, expected 4 ntoskrnl.c:2707: Test failed: id 0 poll: HidP_UnsetUsages returned 0xc0110001 ntoskrnl.c:2714: Test failed: id 0 poll: HidP_UnsetUsages returned 0xc0110001 ntoskrnl.c:2719: Test failed: id 0 poll: HidP_SetUsages returned 0xc0110001 ntoskrnl.c:2720: Test failed: id 0 poll: unexpected usage index 0, expected 1 ntoskrnl.c:2725: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:2729: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:2734: Test failed: id 0 poll: unexpected report data ntoskrnl.c:2752: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2756: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2761: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2767: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2771: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2776: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2783: Test failed: id 0 poll: unexpected report data ntoskrnl.c:2790: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2793: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2797: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2802: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2806: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2811: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2812: Test failed: id 0 poll: got value deadbeef, expected 0x1005 ntoskrnl.c:2818: Test failed: id 0 poll: HidP_SetUsageValueArray returned 0xc0110001 ntoskrnl.c:2821: Test failed: id 0 poll: HidP_SetUsageValueArray returned 0xc0110001 ntoskrnl.c:2822: Test failed: id 0 poll: unexpected report data ntoskrnl.c:2827: Test failed: id 0 poll: HidP_GetUsageValueArray returned 0xc0110001 ntoskrnl.c:2830: Test failed: id 0 poll: HidP_GetUsageValueArray returned 0xc0110001 ntoskrnl.c:2832: Test failed: id 0 poll: unexpected report value ntoskrnl.c:2838: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2842: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2843: Test failed: id 0 poll: got value deadbeef, expected 0 ntoskrnl.c:2847: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2848: Test failed: id 0 poll: got value deadbeef, expected 0x7fffffff ntoskrnl.c:2853: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2857: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2858: Test failed: id 0 poll: got value deadbeef, expected 0x3ffff ntoskrnl.c:2863: Test failed: id 0 poll: HidP_SetUsageValue returned 0xc0110001 ntoskrnl.c:2867: Test failed: id 0 poll: HidP_GetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2868: Test failed: id 0 poll: got value deadbeef, expected 0xfff90000 ntoskrnl.c:2871: Test failed: id 0 poll: HidP_SetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2875: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2876: Test failed: id 0 poll: got value 0, expected 0xfffff518 ntoskrnl.c:2879: Test failed: id 0 poll: HidP_SetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2883: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2884: Test failed: id 0 poll: got value 0, expected 0xfffff45e ntoskrnl.c:2887: Test failed: id 0 poll: HidP_SetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2891: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2892: Test failed: id 0 poll: got value 0, expected 0xfffffe7d ntoskrnl.c:2895: Test failed: id 0 poll: HidP_SetScaledUsageValue returned 0xc0110001 ntoskrnl.c:2899: Test failed: id 0 poll: HidP_GetUsageValue returned 0xc0110001 ntoskrnl.c:2900: Test failed: id 0 poll: got value 0, expected 0xfffffd0b ntoskrnl.c:2905: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:2910: Test failed: id 0 poll: HidD_GetInputReport returned error 6 ntoskrnl.c:2915: Test failed: id 0 poll: HidD_GetInputReport returned error 6 ntoskrnl.c:2924: Test failed: id 0 poll: HidD_GetInputReport returned error 6 ntoskrnl.c:2935: Test failed: id 0 poll: HidD_GetInputReport failed, last error 6 ntoskrnl.c:2936: Test failed: id 0 poll: got report[0] ffffffcd, expected 00 ntoskrnl.c:2941: Test failed: id 0 poll: IOCTL_HID_GET_INPUT_REPORT failed, last error 6 ntoskrnl.c:2942: Test failed: id 0 poll: got length 50, expected 3 ntoskrnl.c:2943: Test failed: id 0 poll: got report[0] ffffffcd, expected 00 ntoskrnl.c:2948: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:2953: Test failed: id 0 poll: HidD_GetFeature returned error 6 ntoskrnl.c:2958: Test failed: id 0 poll: HidD_GetFeature returned error 6 ntoskrnl.c:2967: Test failed: id 0 poll: HidD_GetFeature returned error 6 ntoskrnl.c:2978: Test failed: id 0 poll: HidD_GetFeature failed, last error 6 ntoskrnl.c:2979: Test failed: id 0 poll: got report[0] ffffffcd, expected 00 ntoskrnl.c:2984: Test failed: id 0 poll: IOCTL_HID_GET_FEATURE failed, last error 6 ntoskrnl.c:2985: Test failed: id 0 poll: got length 42, expected 3 ntoskrnl.c:2986: Test failed: id 0 poll: got report[0] ffffffcd, expected 00 ntoskrnl.c:2991: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:2996: Test failed: id 0 poll: HidD_SetFeature returned error 6 ntoskrnl.c:3001: Test failed: id 0 poll: HidD_SetFeature returned error 6 ntoskrnl.c:3010: Test failed: id 0 poll: HidD_SetFeature returned error 6 ntoskrnl.c:3020: Test failed: id 0 poll: HidD_SetFeature failed, last error 6 ntoskrnl.c:3026: Test failed: id 0 poll: IOCTL_HID_SET_FEATURE returned error 6 ntoskrnl.c:3030: Test failed: id 0 poll: IOCTL_HID_SET_FEATURE failed, last error 6 ntoskrnl.c:3031: Test failed: id 0 poll: got length 0, expected 3 ntoskrnl.c:3036: Test failed: id 0 poll: HidP_InitializeReportForID returned 0xc0110001 ntoskrnl.c:3043: Test failed: id 0 poll: HidD_SetOutputReport returned error 6 ntoskrnl.c:3048: Test failed: id 0 poll: HidD_SetOutputReport returned error 6 ntoskrnl.c:3057: Test failed: id 0 poll: HidD_SetOutputReport returned error 6 ntoskrnl.c:3067: Test failed: id 0 poll: HidD_SetOutputReport failed, last error 6 ntoskrnl.c:3073: Test failed: id 0 poll: IOCTL_HID_SET_OUTPUT_REPORT returned error 6 ntoskrnl.c:3077: Test failed: id 0 poll: IOCTL_HID_SET_OUTPUT_REPORT failed, last error 6 ntoskrnl.c:3078: Test failed: id 0 poll: got length 0, expected 3 ntoskrnl.c:3084: Test failed: id 0 poll: WriteFile returned error 6 ntoskrnl.c:3089: Test failed: id 0 poll: WriteFile returned error 6 ntoskrnl.c:3100: Test failed: id 0 poll: WriteFile returned error 6 ntoskrnl.c:3114: Test failed: id 0 poll: WriteFile failed, last error 6 ntoskrnl.c:3115: Test failed: id 0 poll: WriteFile wrote 0 ntoskrnl.c:3122: Test failed: id 0 poll: ReadFile failed, last error 6 ntoskrnl.c:3126: Test failed: id 0 poll: ReadFile failed, last error 6 ntoskrnl.c:3134: Test failed: id 0 poll: ReadFile failed, last error 6 ntoskrnl.c:3135: Test failed: id 0 poll: ReadFile returned 0 ntoskrnl.c:3136: Test failed: id 0 poll: unexpected report data ntoskrnl.c:3145: Test failed: id 0 poll: ReadFile returned error 6 ntoskrnl: Timeout
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/driver_hid.c | 24 +++++++++++------------- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 13 +++++++++++++ 2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver_hid.c b/dlls/ntoskrnl.exe/tests/driver_hid.c index 590483f528f..7819c5556bb 100644 --- a/dlls/ntoskrnl.exe/tests/driver_hid.c +++ b/dlls/ntoskrnl.exe/tests/driver_hid.c @@ -40,6 +40,7 @@ static UNICODE_STRING control_symlink;
static unsigned int got_start_device; +static HID_DEVICE_ATTRIBUTES attributes; static char report_descriptor_buf[4096]; static DWORD report_descriptor_len; static DWORD report_id; @@ -230,25 +231,16 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) break;
case IOCTL_HID_GET_DEVICE_ATTRIBUTES: - { - HID_DEVICE_ATTRIBUTES *attr = irp->UserBuffer; - ok(!in_size, "got input size %u\n", in_size); - ok(out_size == sizeof(*attr), "got output size %u\n", out_size); + ok(out_size == sizeof(attributes), "got output size %u\n", out_size);
- if (out_size == sizeof(*attr)) + if (out_size == sizeof(attributes)) { - ok(!attr->Size, "got size %u\n", attr->Size); - - attr->Size = sizeof(*attr); - attr->VendorID = 0x1209; - attr->ProductID = 0x0001; - attr->VersionNumber = 0xface; - irp->IoStatus.Information = sizeof(*attr); + memcpy(irp->UserBuffer, &attributes, sizeof(attributes)); + irp->IoStatus.Information = sizeof(attributes); } ret = STATUS_SUCCESS; break; - }
case IOCTL_HID_READ_REPORT: { @@ -475,6 +467,12 @@ NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *registry) memcpy(report_descriptor_buf, buffer + info_size, size - info_size); report_descriptor_len = size - info_size;
+ RtlInitUnicodeString(&name_str, L"Attributes"); + size = info_size + sizeof(attributes); + ret = ZwQueryValueKey(hkey, &name_str, KeyValuePartialInformation, buffer, size, &size); + ok(!ret, "ZwQueryValueKey returned %#x\n", ret); + memcpy(&attributes, buffer + info_size, size - info_size); + driver->DriverExtension->AddDevice = driver_add_device; driver->DriverUnload = driver_unload; driver->MajorFunction[IRP_MJ_PNP] = driver_pnp; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index adb5b05aa90..293422777c5 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -39,9 +39,11 @@ #include "dbt.h" #include "initguid.h" #include "devguid.h" +#include "ddk/wdm.h" #include "ddk/hidclass.h" #include "ddk/hidsdi.h" #include "ddk/hidpi.h" +#include "ddk/hidport.h" #include "wine/test.h" #include "wine/heap.h" #include "wine/mssign.h" @@ -3594,6 +3596,14 @@ static void test_hid_driver(struct testsign_context *ctx, DWORD report_id, DWORD #undef REPORT_ID_OR_USAGE_PAGE #include "pop_hid_macros.h"
+ static HID_DEVICE_ATTRIBUTES attributes = + { + .Size = sizeof(HID_DEVICE_ATTRIBUTES), + .VendorID = 0x1209, + .ProductID = 0x0001, + .VersionNumber = 0x0100, + }; + char cwd[MAX_PATH], tempdir[MAX_PATH]; LSTATUS status; HKEY hkey; @@ -3614,6 +3624,9 @@ static void test_hid_driver(struct testsign_context *ctx, DWORD report_id, DWORD status = RegSetValueExW(hkey, L"Descriptor", 0, REG_BINARY, (void *)report_descriptor, sizeof(report_descriptor)); ok(!status, "RegSetValueExW returned %#x\n", status);
+ status = RegSetValueExW(hkey, L"Attributes", 0, REG_BINARY, (void *)&attributes, sizeof(attributes)); + ok(!status, "RegSetValueExW returned %#x\n", status); + driver_start(ctx, L"driver_hid.dll"); test_hid_device(report_id, polled); driver_stop();
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/driver_hid.c | 19 +++++--- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 70 +++++++++++++++------------- 2 files changed, 50 insertions(+), 39 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver_hid.c b/dlls/ntoskrnl.exe/tests/driver_hid.c index 7819c5556bb..a525d845569 100644 --- a/dlls/ntoskrnl.exe/tests/driver_hid.c +++ b/dlls/ntoskrnl.exe/tests/driver_hid.c @@ -43,6 +43,7 @@ static unsigned int got_start_device; static HID_DEVICE_ATTRIBUTES attributes; static char report_descriptor_buf[4096]; static DWORD report_descriptor_len; +static HIDP_CAPS caps; static DWORD report_id; static DWORD polled;
@@ -244,7 +245,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp)
case IOCTL_HID_READ_REPORT: { - ULONG expected_size = 25; + ULONG expected_size = caps.InputReportByteLength - (report_id ? 0 : 1); ok(!in_size, "got input size %u\n", in_size); ok(out_size == expected_size, "got output size %u\n", out_size);
@@ -268,7 +269,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) case IOCTL_HID_WRITE_REPORT: { HID_XFER_PACKET *packet = irp->UserBuffer; - ULONG expected_size = 2; + ULONG expected_size = caps.OutputReportByteLength - (report_id ? 0 : 1);
ok(in_size == sizeof(*packet), "got input size %u\n", in_size); ok(!out_size, "got output size %u\n", out_size); @@ -287,7 +288,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) case IOCTL_HID_GET_INPUT_REPORT: { HID_XFER_PACKET *packet = irp->UserBuffer; - ULONG expected_size = 23; + ULONG expected_size = caps.InputReportByteLength - (report_id ? 0 : 1); ok(!in_size, "got input size %u\n", in_size); ok(out_size == sizeof(*packet), "got output size %u\n", out_size);
@@ -306,7 +307,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) case IOCTL_HID_SET_OUTPUT_REPORT: { HID_XFER_PACKET *packet = irp->UserBuffer; - ULONG expected_size = 2; + ULONG expected_size = caps.OutputReportByteLength - (report_id ? 0 : 1); ok(in_size == sizeof(*packet), "got input size %u\n", in_size); ok(!out_size, "got output size %u\n", out_size);
@@ -322,7 +323,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) case IOCTL_HID_GET_FEATURE: { HID_XFER_PACKET *packet = irp->UserBuffer; - ULONG expected_size = 17; + ULONG expected_size = caps.FeatureReportByteLength - (report_id ? 0 : 1); ok(!in_size, "got input size %u\n", in_size); ok(out_size == sizeof(*packet), "got output size %u\n", out_size);
@@ -340,7 +341,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) case IOCTL_HID_SET_FEATURE: { HID_XFER_PACKET *packet = irp->UserBuffer; - ULONG expected_size = 17; + ULONG expected_size = caps.FeatureReportByteLength - (report_id ? 0 : 1); ok(in_size == sizeof(*packet), "got input size %u\n", in_size); ok(!out_size, "got output size %u\n", out_size);
@@ -473,6 +474,12 @@ NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *registry) ok(!ret, "ZwQueryValueKey returned %#x\n", ret); memcpy(&attributes, buffer + info_size, size - info_size);
+ RtlInitUnicodeString(&name_str, L"Caps"); + size = info_size + sizeof(caps); + ret = ZwQueryValueKey(hkey, &name_str, KeyValuePartialInformation, buffer, size, &size); + ok(!ret, "ZwQueryValueKey returned %#x\n", ret); + memcpy(&caps, buffer + info_size, size - info_size); + driver->DriverExtension->AddDevice = driver_add_device; driver->DriverUnload = driver_unload; driver->MajorFunction[IRP_MJ_PNP] = driver_pnp; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 293422777c5..b8a9c09326a 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -2032,41 +2032,42 @@ static BOOL sync_ioctl(HANDLE file, DWORD code, void *in_buf, DWORD in_len, void return ret; }
+static const HIDP_CAPS expect_hidp_caps[] = +{ + /* without report id */ + { + .Usage = HID_USAGE_GENERIC_JOYSTICK, + .UsagePage = HID_USAGE_PAGE_GENERIC, + .InputReportByteLength = 26, + .OutputReportByteLength = 3, + .FeatureReportByteLength = 22, + .NumberLinkCollectionNodes = 10, + .NumberInputButtonCaps = 17, + .NumberInputValueCaps = 7, + .NumberInputDataIndices = 47, + .NumberFeatureButtonCaps = 1, + .NumberFeatureValueCaps = 6, + .NumberFeatureDataIndices = 8, + }, + /* with report id */ + { + .Usage = HID_USAGE_GENERIC_JOYSTICK, + .UsagePage = HID_USAGE_PAGE_GENERIC, + .InputReportByteLength = 25, + .OutputReportByteLength = 2, + .FeatureReportByteLength = 21, + .NumberLinkCollectionNodes = 10, + .NumberInputButtonCaps = 17, + .NumberInputValueCaps = 7, + .NumberInputDataIndices = 47, + .NumberFeatureButtonCaps = 1, + .NumberFeatureValueCaps = 6, + .NumberFeatureDataIndices = 8, + }, +}; + static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled) { - const HIDP_CAPS expect_hidp_caps[] = - { - /* without report id */ - { - .Usage = HID_USAGE_GENERIC_JOYSTICK, - .UsagePage = HID_USAGE_PAGE_GENERIC, - .InputReportByteLength = 26, - .OutputReportByteLength = 3, - .FeatureReportByteLength = 22, - .NumberLinkCollectionNodes = 10, - .NumberInputButtonCaps = 17, - .NumberInputValueCaps = 7, - .NumberInputDataIndices = 47, - .NumberFeatureButtonCaps = 1, - .NumberFeatureValueCaps = 6, - .NumberFeatureDataIndices = 8, - }, - /* with report id */ - { - .Usage = HID_USAGE_GENERIC_JOYSTICK, - .UsagePage = HID_USAGE_PAGE_GENERIC, - .InputReportByteLength = 25, - .OutputReportByteLength = 2, - .FeatureReportByteLength = 21, - .NumberLinkCollectionNodes = 10, - .NumberInputButtonCaps = 17, - .NumberInputValueCaps = 7, - .NumberInputDataIndices = 47, - .NumberFeatureButtonCaps = 1, - .NumberFeatureValueCaps = 6, - .NumberFeatureDataIndices = 8, - }, - }; const HIDP_BUTTON_CAPS expect_button_caps[] = { { @@ -3627,6 +3628,9 @@ static void test_hid_driver(struct testsign_context *ctx, DWORD report_id, DWORD status = RegSetValueExW(hkey, L"Attributes", 0, REG_BINARY, (void *)&attributes, sizeof(attributes)); ok(!status, "RegSetValueExW returned %#x\n", status);
+ status = RegSetValueExW(hkey, L"Caps", 0, REG_BINARY, (void *)&expect_hidp_caps[report_id], sizeof(*expect_hidp_caps)); + ok(!status, "RegSetValueExW returned %#x\n", status); + driver_start(ctx, L"driver_hid.dll"); test_hid_device(report_id, polled); driver_stop();
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/driver_hid.c | 1 - dlls/ntoskrnl.exe/tests/ntoskrnl.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver_hid.c b/dlls/ntoskrnl.exe/tests/driver_hid.c index a525d845569..9c878bec1ec 100644 --- a/dlls/ntoskrnl.exe/tests/driver_hid.c +++ b/dlls/ntoskrnl.exe/tests/driver_hid.c @@ -298,7 +298,6 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp)
memset(packet->reportBuffer, 0xa5, 3); if (report_id) ((char *)packet->reportBuffer)[0] = report_id; - ((char *)packet->reportBuffer)[1] = seq++; irp->IoStatus.Information = 3; ret = STATUS_SUCCESS; break; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index b8a9c09326a..19c4ac117d8 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -3172,6 +3172,7 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled ret = GetOverlappedResult(async_file, &overlapped, &value, FALSE); ok(ret, "GetOverlappedResult failed, last error %u\n", GetLastError()); ok(value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected 3\n", value); + todo_wine ok(memcmp(report, buffer + caps.InputReportByteLength, caps.InputReportByteLength), "expected different report\n"); ok(!memcmp(report, buffer, caps.InputReportByteLength), "expected identical reports\n");