From 1481df94abad5cc75a7f5bdcd57273700b7c7dd2 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sat, 27 Jun 2020 09:27:33 +0200 Subject: [PATCH] [KMTESTS:EX] Use stricter checks for the UUID returned from ExUuidCreate. * Check the entire version field * Check the variant field * Accept RPC_NT_UUID_LOCAL_ONLY, which is sometimes returned by Windows * Repeat the test to show that these things happen every time Based on a patch by Serge Gautherie. --- modules/rostests/kmtests/ntos_ex/ExUuid.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/rostests/kmtests/ntos_ex/ExUuid.c b/modules/rostests/kmtests/ntos_ex/ExUuid.c index 2fb0bba8dc8..82bb27b6089 100644 --- a/modules/rostests/kmtests/ntos_ex/ExUuid.c +++ b/modules/rostests/kmtests/ntos_ex/ExUuid.c @@ -14,8 +14,14 @@ START_TEST(ExUuid) { UUID Uuid; NTSTATUS Status; + ULONG i; - Status = ExUuidCreate(&Uuid); - ok(Status == STATUS_SUCCESS, "ExUuidCreate returned unexpected status: %lx\n", Status); - ok((Uuid.Data3 & 0x1000) == 0x1000, "Invalid UUID version: %x\n", (Uuid.Data3 & 0xF000)); + for (i = 0; i < 1000; i++) + { + Status = ExUuidCreate(&Uuid); + ok(Status == STATUS_SUCCESS || Status == RPC_NT_UUID_LOCAL_ONLY, + "ExUuidCreate returned unexpected status: 0x%lx\n", Status); + ok((Uuid.Data3 & 0xF000) == 0x1000, "Invalid UUID version: 0x%x\n", (Uuid.Data3 & 0xF000)); + ok((Uuid.Data4[0] & 0xC0) == 0x80, "Invalid UUID variant: 0x%x\n", (Uuid.Data4[0] & 0xF0)); + } }