mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
NtAllocateUuids(): Improve randomness of initial sequence count.
svn path=/trunk/; revision=12251
This commit is contained in:
parent
e49daf9671
commit
c443a93492
1 changed files with 16 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: uuid.c,v 1.3 2004/12/19 12:52:42 ekohl Exp $
|
/* $Id: uuid.c,v 1.4 2004/12/20 14:07:34 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -152,8 +152,16 @@ ExpSaveUuidSequence(PULONG Sequence)
|
||||||
static VOID
|
static VOID
|
||||||
ExpGetRandomUuidSequence(PULONG Sequence)
|
ExpGetRandomUuidSequence(PULONG Sequence)
|
||||||
{
|
{
|
||||||
/* FIXME */
|
LARGE_INTEGER Counter;
|
||||||
*Sequence = 0x70615243;
|
LARGE_INTEGER Frequency;
|
||||||
|
ULONG Value;
|
||||||
|
|
||||||
|
Counter = KeQueryPerformanceCounter(&Frequency);
|
||||||
|
Value = Counter.u.LowPart ^ Counter.u.HighPart;
|
||||||
|
|
||||||
|
*Sequence = *Sequence ^ Value;
|
||||||
|
|
||||||
|
DPRINT("Sequence %lx\n", *Sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,7 +227,11 @@ NtAllocateUuids(OUT PULARGE_INTEGER Time,
|
||||||
if (!UuidSequenceInitialized)
|
if (!UuidSequenceInitialized)
|
||||||
{
|
{
|
||||||
Status = ExpLoadUuidSequence(&UuidSequence);
|
Status = ExpLoadUuidSequence(&UuidSequence);
|
||||||
if (!NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
UuidSequence++;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ExpGetRandomUuidSequence(&UuidSequence);
|
ExpGetRandomUuidSequence(&UuidSequence);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue