This is mostly a copy of UuidCreate() in rpcrt4 with NTSTATUS return code.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- v2: Include ntsecapi.h to avoid a compiler warning. Supersede 158874
dlls/ntoskrnl.exe/ntoskrnl.c | 33 +++++++++++++++++++++++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- include/ddk/ntddk.h | 2 ++ 3 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 010f9f735f..1e8aeb1d53 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -41,6 +41,7 @@ #include "dbt.h" #include "winreg.h" #include "setupapi.h" +#include "ntsecapi.h" #include "ddk/csq.h" #include "ddk/ntddk.h" #include "ddk/ntifs.h" @@ -4149,3 +4150,35 @@ static struct _OBJECT_TYPE token_type = };
POBJECT_TYPE SeTokenObjectType = &token_type; + +/************************************************************************* + * ExUuidCreate (NTOSKRNL.@) + * + * Creates a 128bit UUID. + * + * RETURNS + * + * STATUS_SUCCESS if successful. + * RPC_NT_UUID_LOCAL_ONLY if UUID is only locally unique. + * + * NOTES + * + * Follows RFC 4122, section 4.4 (Algorithms for Creating a UUID from + * Truly Random or Pseudo-Random Numbers) + */ +NTSTATUS WINAPI ExUuidCreate(UUID *uuid) +{ + RtlGenRandom(uuid, sizeof(*uuid)); + /* Clear the version bits and set the version (4) */ + uuid->Data3 &= 0x0fff; + uuid->Data3 |= (4 << 12); + /* Set the topmost bits of Data4 (clock_seq_hi_and_reserved) as + * specified in RFC 4122, section 4.4. + */ + uuid->Data4[0] &= 0x3f; + uuid->Data4[0] |= 0x80; + + TRACE("%s\n", debugstr_guid(uuid)); + + return STATUS_SUCCESS; +} diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 4dcd553049..6ee6bc905e 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -185,7 +185,7 @@ @ stub ExSystemExceptionFilter @ stdcall ExSystemTimeToLocalTime(ptr ptr) RtlSystemTimeToLocalTime @ stub ExUnregisterCallback -@ stub ExUuidCreate +@ stdcall ExUuidCreate(ptr) @ stub ExVerifySuite @ stub ExWindowStationObjectType @ stub Exi386InterlockedDecrementLong diff --git a/include/ddk/ntddk.h b/include/ddk/ntddk.h index 452e510fdc..fb8cacc188 100644 --- a/include/ddk/ntddk.h +++ b/include/ddk/ntddk.h @@ -202,7 +202,9 @@ typedef NTSTATUS (WINAPI *PIO_QUERY_DEVICE_ROUTINE)(PVOID,PUNICODE_STRING,INTERF PKEY_VALUE_FULL_INFORMATION*,CONFIGURATION_TYPE,ULONG,PKEY_VALUE_FULL_INFORMATION*); typedef void (NTAPI EXPAND_STACK_CALLOUT)(void*); typedef EXPAND_STACK_CALLOUT *PEXPAND_STACK_CALLOUT; +typedef GUID UUID;
+NTSTATUS WINAPI ExUuidCreate(UUID*); NTSTATUS WINAPI IoQueryDeviceDescription(PINTERFACE_TYPE,PULONG,PCONFIGURATION_TYPE,PULONG, PCONFIGURATION_TYPE,PULONG,PIO_QUERY_DEVICE_ROUTINE,PVOID); void WINAPI IoRegisterDriverReinitialization(PDRIVER_OBJECT,PDRIVER_REINITIALIZE,PVOID);
Hi,
While running your changed tests on Windows, 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=48307
Your paranoid android.
=== debian9 (64 bit WoW report) ===
ntoskrnl.exe: driver.c:565: Test failed: got 0 driver.c:568: Test failed: got 0x102