Alexandre Julliard : shell32: Use RtlRandom instead of the non-portable rand_r.

Alexandre Julliard julliard at winehq.org
Tue Dec 23 13:40:39 CST 2008


Module: wine
Branch: master
Commit: 03fe2d0d51d5c10a38787b65c09cbbb4fb411c31
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=03fe2d0d51d5c10a38787b65c09cbbb4fb411c31

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Dec 22 20:14:59 2008 +0100

shell32: Use RtlRandom instead of the non-portable rand_r.

---

 dlls/shell32/trash.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/trash.c b/dlls/shell32/trash.c
index 568c557..d692046 100644
--- a/dlls/shell32/trash.c
+++ b/dlls/shell32/trash.c
@@ -215,7 +215,7 @@ static char *create_trashinfo(const char *info_dir, const char *file_path)
 {
     const char *base_name;
     char *filename_buffer;
-    unsigned int seed = (unsigned int)time(NULL);
+    ULONG seed = GetTickCount();
     int i;
 
     errno = ENOMEM;       /* out-of-memory is the only case when errno isn't set */
@@ -240,7 +240,7 @@ static char *create_trashinfo(const char *info_dir, const char *file_path)
     
     for (i=0; i<1000; i++)
     {
-        sprintf(filename_buffer, "%s-%08x", base_name, rand_r(&seed));
+        sprintf(filename_buffer, "%s-%08x", base_name, RtlRandom(&seed));
         if (try_create_trashinfo_file(info_dir, filename_buffer, file_path))
             return filename_buffer;
     }




More information about the wine-cvs mailing list