From: Thomas Faber Date: Mon, 10 Oct 2011 00:17:02 +0000 (+0000) Subject: [ADVAPI32] X-Git-Tag: backups/iut-netsh@54410~318 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=24e4f7e73de9be8004620603e9bd97b4b2ffc0e2;hp=d38c1a938af37fc7d99dc5a4f2b32e94a04cec9a [ADVAPI32] - Hackfix RtlGenRandom to be slightly less dependent on the current time, while staying very un-random. - Should fix services problems (no joke) due to non-unique RPC UUIDs See issue #6542 for more details. svn path=/trunk/; revision=54069 --- diff --git a/reactos/dll/win32/advapi32/misc/sysfunc.c b/reactos/dll/win32/advapi32/misc/sysfunc.c index 1512d38dc29..97d4ad24403 100644 --- a/reactos/dll/win32/advapi32/misc/sysfunc.c +++ b/reactos/dll/win32/advapi32/misc/sysfunc.c @@ -576,6 +576,8 @@ SystemFunction036(PVOID pbBuffer, ULONG dwLen) DWORD dwSeed; PBYTE pBuffer; ULONG uPseudoRandom; + LARGE_INTEGER time; + static ULONG uCounter = 17; if(!pbBuffer || !dwLen) { @@ -583,8 +585,9 @@ SystemFunction036(PVOID pbBuffer, ULONG dwLen) return TRUE; } - /* Get the first seed from the tick count */ - dwSeed = GetTickCount(); + /* Get the first seed from the performance counter */ + QueryPerformanceCounter(&time); + dwSeed = time.LowPart ^ time.HighPart ^ RtlUlongByteSwap(uCounter++); /* We will access the buffer bytewise */ pBuffer = (PBYTE)pbBuffer;