From c891e585610d64cd1b5072d636b53c9ea05ef3f9 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Thu, 7 Jan 2016 06:02:35 +0100 Subject: [PATCH] Added patch to return buffer filled with random values from SystemInterruptInformation. --- ...fer-filled-with-random-values-from-S.patch | 39 +++++++++++++++++++ .../definition | 1 + patches/patchinstall.sh | 19 +++++++++ 3 files changed, 59 insertions(+) create mode 100644 patches/ntdll-SystemInterruptInformation/0001-ntdll-Return-buffer-filled-with-random-values-from-S.patch create mode 100644 patches/ntdll-SystemInterruptInformation/definition diff --git a/patches/ntdll-SystemInterruptInformation/0001-ntdll-Return-buffer-filled-with-random-values-from-S.patch b/patches/ntdll-SystemInterruptInformation/0001-ntdll-Return-buffer-filled-with-random-values-from-S.patch new file mode 100644 index 00000000..e49935a6 --- /dev/null +++ b/patches/ntdll-SystemInterruptInformation/0001-ntdll-Return-buffer-filled-with-random-values-from-S.patch @@ -0,0 +1,39 @@ +From e42cdb8305dcebca77afba4a56e59391f2cb4a38 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Thu, 7 Jan 2016 06:01:01 +0100 +Subject: ntdll: Return buffer filled with random values from + SystemInterruptInformation. + +--- + dlls/ntdll/nt.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c +index 9ee1923..fe3e8e8 100644 +--- a/dlls/ntdll/nt.c ++++ b/dlls/ntdll/nt.c +@@ -2070,10 +2070,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.6.4 + diff --git a/patches/ntdll-SystemInterruptInformation/definition b/patches/ntdll-SystemInterruptInformation/definition new file mode 100644 index 00000000..cc876097 --- /dev/null +++ b/patches/ntdll-SystemInterruptInformation/definition @@ -0,0 +1 @@ +Fixes: [39123] Return buffer filled with random values from SystemInterruptInformation diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 4e68281b..f5905e8a 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -211,6 +211,7 @@ patch_enable_all () enable_ntdll_Serial_Port_Detection="$1" enable_ntdll_Status_Mapping="$1" enable_ntdll_Syscall_Wrappers="$1" + enable_ntdll_SystemInterruptInformation="$1" enable_ntdll_SystemRoot_Symlink="$1" enable_ntdll_ThreadTime="$1" enable_ntdll_Threading="$1" @@ -749,6 +750,9 @@ patch_enable () ntdll-Syscall_Wrappers) enable_ntdll_Syscall_Wrappers="$2" ;; + ntdll-SystemInterruptInformation) + enable_ntdll_SystemInterruptInformation="$2" + ;; ntdll-SystemRoot_Symlink) enable_ntdll_SystemRoot_Symlink="$2" ;; @@ -4447,6 +4451,21 @@ if test "$enable_ntdll_Status_Mapping" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-SystemInterruptInformation +# | +# | This patchset fixes the following Wine bugs: +# | * [#39123] Return buffer filled with random values from SystemInterruptInformation +# | +# | Modified files: +# | * dlls/ntdll/nt.c +# | +if test "$enable_ntdll_SystemInterruptInformation" -eq 1; then + patch_apply ntdll-SystemInterruptInformation/0001-ntdll-Return-buffer-filled-with-random-values-from-S.patch + ( + echo '+ { "Sebastian Lackner", "ntdll: Return buffer filled with random values from SystemInterruptInformation.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntdll-SystemRoot_Symlink # | # | This patchset has the following (direct or indirect) dependencies: