mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Added patch to translate all invalid console handles into usable DOS handles.
This commit is contained in:
parent
2228abee0a
commit
e22062154b
@ -0,0 +1,70 @@
|
||||
From 190e36c5ea8047e42b10d8c626bb221b4f3d5b02 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 26 Feb 2016 21:35:52 +0100
|
||||
Subject: krnl386.exe16: Really translate all invalid console handles into
|
||||
usable DOS handles.
|
||||
|
||||
---
|
||||
dlls/krnl386.exe16/file.c | 33 ++++++++++++++++++++-------------
|
||||
1 file changed, 20 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/dlls/krnl386.exe16/file.c b/dlls/krnl386.exe16/file.c
|
||||
index b66b753..e6b1233 100644
|
||||
--- a/dlls/krnl386.exe16/file.c
|
||||
+++ b/dlls/krnl386.exe16/file.c
|
||||
@@ -45,6 +45,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(file);
|
||||
|
||||
static HANDLE dos_handles[DOS_TABLE_SIZE];
|
||||
|
||||
+static void set_standard_handle(HANDLE *out, HANDLE null, HANDLE in)
|
||||
+{
|
||||
+ if (!in || in == INVALID_HANDLE_VALUE ||
|
||||
+ !DuplicateHandle(GetCurrentProcess(), in, GetCurrentProcess(),
|
||||
+ out, 0, TRUE, DUPLICATE_SAME_ACCESS))
|
||||
+ {
|
||||
+ DuplicateHandle(GetCurrentProcess(), null, GetCurrentProcess(),
|
||||
+ out, 0, TRUE, DUPLICATE_SAME_ACCESS);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/***********************************************************************
|
||||
* FILE_InitProcessDosHandles
|
||||
*
|
||||
@@ -53,25 +64,21 @@ static HANDLE dos_handles[DOS_TABLE_SIZE];
|
||||
*/
|
||||
static void FILE_InitProcessDosHandles( void )
|
||||
{
|
||||
- HANDLE hStdInput, hStdOutput, hStdError, hNull;
|
||||
+ HANDLE hNull;
|
||||
static BOOL init_done /* = FALSE */;
|
||||
- HANDLE cp = GetCurrentProcess();
|
||||
|
||||
if (init_done) return;
|
||||
init_done = TRUE;
|
||||
- hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
- hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
- hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
||||
+
|
||||
hNull = CreateFileA("NUL", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
|
||||
+
|
||||
/* Invalid console handles need to translate to real DOS handles in a new process */
|
||||
- if (!hStdInput) hStdInput = hNull;
|
||||
- if (!hStdOutput) hStdOutput = hNull;
|
||||
- if (!hStdError) hStdError = hNull;
|
||||
- DuplicateHandle(cp, hStdInput, cp, &dos_handles[0], 0, TRUE, DUPLICATE_SAME_ACCESS);
|
||||
- DuplicateHandle(cp, hStdOutput, cp, &dos_handles[1], 0, TRUE, DUPLICATE_SAME_ACCESS);
|
||||
- DuplicateHandle(cp, hStdError, cp, &dos_handles[2], 0, TRUE, DUPLICATE_SAME_ACCESS);
|
||||
- DuplicateHandle(cp, hStdError, cp, &dos_handles[3], 0, TRUE, DUPLICATE_SAME_ACCESS);
|
||||
- DuplicateHandle(cp, hStdError, cp, &dos_handles[4], 0, TRUE, DUPLICATE_SAME_ACCESS);
|
||||
+ set_standard_handle(&dos_handles[0], hNull, GetStdHandle(STD_INPUT_HANDLE));
|
||||
+ set_standard_handle(&dos_handles[1], hNull, GetStdHandle(STD_OUTPUT_HANDLE));
|
||||
+ set_standard_handle(&dos_handles[2], hNull, GetStdHandle(STD_ERROR_HANDLE));
|
||||
+ set_standard_handle(&dos_handles[3], hNull, GetStdHandle(STD_ERROR_HANDLE));
|
||||
+ set_standard_handle(&dos_handles[4], hNull, GetStdHandle(STD_ERROR_HANDLE));
|
||||
+
|
||||
CloseHandle(hNull);
|
||||
}
|
||||
|
||||
--
|
||||
2.7.1
|
||||
|
1
patches/krnl386.exe16-Invalid_Console_Handles/definition
Normal file
1
patches/krnl386.exe16-Invalid_Console_Handles/definition
Normal file
@ -0,0 +1 @@
|
||||
Fixes: [7106] Translate all invalid console handles into usable DOS handles
|
@ -174,6 +174,7 @@ patch_enable_all ()
|
||||
enable_kernel32_SetFileInformationByHandle="$1"
|
||||
enable_kernel32_TimezoneInformation_Registry="$1"
|
||||
enable_kernel32_VerifyVersionInfo="$1"
|
||||
enable_krnl386_exe16_Invalid_Console_Handles="$1"
|
||||
enable_libs_Debug_Channel="$1"
|
||||
enable_libs_Unicode_Collation="$1"
|
||||
enable_makedep_PARENTSPEC="$1"
|
||||
@ -666,6 +667,9 @@ patch_enable ()
|
||||
kernel32-VerifyVersionInfo)
|
||||
enable_kernel32_VerifyVersionInfo="$2"
|
||||
;;
|
||||
krnl386.exe16-Invalid_Console_Handles)
|
||||
enable_krnl386_exe16_Invalid_Console_Handles="$2"
|
||||
;;
|
||||
libs-Debug_Channel)
|
||||
enable_libs_Debug_Channel="$2"
|
||||
;;
|
||||
@ -4159,6 +4163,21 @@ if test "$enable_kernel32_VerifyVersionInfo" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset krnl386.exe16-Invalid_Console_Handles
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#7106] Translate all invalid console handles into usable DOS handles
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/krnl386.exe16/file.c
|
||||
# |
|
||||
if test "$enable_krnl386_exe16_Invalid_Console_Handles" -eq 1; then
|
||||
patch_apply krnl386.exe16-Invalid_Console_Handles/0001-krnl386.exe16-Really-translate-all-invalid-console-h.patch
|
||||
(
|
||||
echo '+ { "Michael Müller", "krnl386.exe16: Really translate all invalid console handles into usable DOS handles.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset libs-Debug_Channel
|
||||
# |
|
||||
# | Modified files:
|
||||
|
Loading…
Reference in New Issue
Block a user