[PATCH v2 2/3] programs: don't recreate a console when redirecting a program to wow64

Eric Pouech eric.pouech at gmail.com
Tue Feb 15 10:43:34 CST 2022


Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 programs/uninstaller/main.c |    6 ++++--
 programs/winedbg/winedbg.c  |    3 ++-
 programs/wusa/main.c        |    3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/programs/uninstaller/main.c b/programs/uninstaller/main.c
index 68d0dfe49f9..fa88c92078f 100644
--- a/programs/uninstaller/main.c
+++ b/programs/uninstaller/main.c
@@ -166,7 +166,8 @@ int __cdecl wmain(int argc, WCHAR *argv[])
         wcscat( filename, L"\\uninstaller.exe" );
 
         Wow64DisableWow64FsRedirection( &redir );
-        if (CreateProcessW( filename, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ))
+        if (CreateProcessW( filename, GetCommandLineW(), NULL, NULL, FALSE,
+                            GetConsoleCP() == 0 ? DETACHED_PROCESS : 0, NULL, NULL, &si, &pi ))
         {
             WINE_TRACE( "restarting %s\n", wine_dbgstr_w(filename) );
             WaitForSingleObject( pi.hProcess, INFINITE );
@@ -342,7 +343,8 @@ static void UninstallProgram(void)
         memset(&si, 0, sizeof(STARTUPINFOW));
         si.cb = sizeof(STARTUPINFOW);
         si.wShowWindow = SW_NORMAL;
-        res = CreateProcessW(NULL, entries[i].command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &info);
+        res = CreateProcessW(NULL, entries[i].command, NULL, NULL, FALSE,
+                             GetConsoleCP() == 0 ? DETACHED_PROCESS : 0, NULL, NULL, &si, &info);
         if (res)
         {   /* wait for the process to exit */
             WaitForSingleObject(info.hProcess, INFINITE);
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c
index 95318eeb2f1..6462b8e8b50 100644
--- a/programs/winedbg/winedbg.c
+++ b/programs/winedbg/winedbg.c
@@ -606,7 +606,8 @@ static void restart_if_wow64(void)
         lstrcatW( filename, L"\\winedbg.exe" );
 
         Wow64DisableWow64FsRedirection( &redir );
-        if (CreateProcessW( filename, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ))
+        if (CreateProcessW( filename, GetCommandLineW(), NULL, NULL, FALSE,
+                            GetConsoleCP() == 0 ? DETACHED_PROCESS : 0, NULL, NULL, &si, &pi ))
         {
             WINE_TRACE( "restarting %s\n", wine_dbgstr_w(filename) );
             SetConsoleCtrlHandler( NULL, TRUE ); /* Ignore ^C */
diff --git a/programs/wusa/main.c b/programs/wusa/main.c
index d1bb385cd06..390ac85b12b 100644
--- a/programs/wusa/main.c
+++ b/programs/wusa/main.c
@@ -1027,7 +1027,8 @@ static void restart_as_x86_64(void)
     wcscat( filename, L"\\wusa.exe" );
 
     Wow64DisableWow64FsRedirection(&redir);
-    if (CreateProcessW(filename, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
+    if (CreateProcessW(filename, GetCommandLineW(), NULL, NULL, FALSE,
+                       GetConsoleCP() == 0 ? DETACHED_PROCESS : 0, NULL, NULL, &si, &pi))
     {
         TRACE("Restarting %s\n", wine_dbgstr_w(filename));
         WaitForSingleObject(pi.hProcess, INFINITE);




More information about the wine-devel mailing list