Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- 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 4b62660750..1d36620fc4 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -3983,3 +3983,36 @@ void WINAPI KeLeaveGuardedRegion(void) { FIXME("\n"); } + +/************************************************************************* + * 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 */ + SystemFunction036(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 d087422605..73ebbd91ef 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);
On 2/20/19 8:53 AM, Zhiyi Zhang wrote:
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
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(-)
Perhaps we could just borrow UuidCreate() from rpcrt4 instead? Though maybe that's not worthwhile.
On 2019/2/20 23:40, Zebediah Figura wrote:
On 2/20/19 8:53 AM, Zhiyi Zhang wrote:
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
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(-)
Perhaps we could just borrow UuidCreate() from rpcrt4 instead? Though maybe that's not worthwhile.
Yes. This is mostly just a copy of UuidCreate() from rpcrt4. rpcrt4 doesn't import ExUuidCreate, hence the copying.