[PATCH] ntdll: Return buffer filled with random values from SystemInterruptInformation.

Zebediah Figura z.figura12 at gmail.com
Fri Sep 27 19:14:04 CDT 2019


From: Sebastian Lackner <sebastian at fds-team.de>

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=39123
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/ntdll/nt.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 5afdf77986a..7b618269703 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -2799,10 +2799,21 @@ NTSTATUS WINAPI NtQuerySystemInformation(
     case SystemInterruptInformation:
         {
             SYSTEM_INTERRUPT_INFORMATION sii;
+            int dev_random;
 
             memset(&sii, 0, sizeof(sii));
             len = sizeof(sii);
 
+            /* Some applications use the returned buffer for random number
+             * generation. Its unlikely that an app depends on the exact
+             * layout, so just fill with values from /dev/urandom. */
+            dev_random = open( "/dev/urandom", O_RDONLY );
+            if (dev_random != -1)
+            {
+                read( dev_random, &sii, sizeof(sii) );
+                close( dev_random );
+            }
+
             if ( Length >= len)
             {
                 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
-- 
2.23.0




More information about the wine-devel mailing list