Author: tfaber
Date: Mon Oct 10 00:17:02 2011
New Revision: 54069

URL: http://svn.reactos.org/svn/reactos?rev=54069&view=rev
Log:
[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.

Modified:
    trunk/reactos/dll/win32/advapi32/misc/sysfunc.c

Modified: trunk/reactos/dll/win32/advapi32/misc/sysfunc.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/misc/sysfunc.c?rev=54069&r1=54068&r2=54069&view=diff
==============================================================================
--- trunk/reactos/dll/win32/advapi32/misc/sysfunc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/misc/sysfunc.c [iso-8859-1] Mon Oct 10 
00:17:02 2011
@@ -576,6 +576,8 @@
     DWORD dwSeed;
     PBYTE pBuffer;
     ULONG uPseudoRandom;
+    LARGE_INTEGER time;
+    static ULONG uCounter = 17;
 
     if(!pbBuffer || !dwLen)
     {
@@ -583,8 +585,9 @@
         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;


Reply via email to