shell32: Use CREATE_NEW_CONSOLE when SEE_MASK_NOCONSOLE is omitted.

Vincent Povirk madewokherd at gmail.com
Wed Apr 16 16:11:36 CDT 2014


MSDN specifically mentions that this flag is the opposite of
CREATE_NEW_CONSOLE:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb759784%28v=vs.85%29.aspx

I also wrote a test program (built with -mconsole), which uses
ShellExecuteEx to run cmd.exe. When running it from a command line on
windows, it creates a new console window for cmd.exe only when
SEE_MASK_NOCONSOLE is not in fMask. (If I compile with -mwindows, it
seems to create a new console window regardless of the value of the
flag or how I start it, which looks like another wine bug to me.)

This fixes a bug where BG2 Fixpack
(http://forums.gibberlings3.net/index.php?s=8df10219790134601c21bd4ea810e0e5&app=downloads&showfile=696)
doesn't get a console window for its main executable after the
installer extracts and runs it.
-------------- next part --------------
From 6104a4773fe99b0b8dfe5c74cfcbad7e36391cab Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Wed, 16 Apr 2014 15:50:37 -0500
Subject: [PATCH] shell32: Use CREATE_NEW_CONSOLE when SEE_MASK_NOCONSOLE is
 omitted.

---
 dlls/shell32/shlexec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index 39d640a..bccf7a0 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -338,7 +338,7 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
     startup.dwFlags = STARTF_USESHOWWINDOW;
     startup.wShowWindow = psei->nShow;
     dwCreationFlags = CREATE_UNICODE_ENVIRONMENT;
-    if (psei->fMask & SEE_MASK_NO_CONSOLE)
+    if (!(psei->fMask & SEE_MASK_NO_CONSOLE))
         dwCreationFlags |= CREATE_NEW_CONSOLE;
     if (CreateProcessW(NULL, (LPWSTR)lpCmd, NULL, NULL, FALSE, dwCreationFlags, env,
                        lpDirectory, &startup, &info))
-- 
1.8.3.2



More information about the wine-patches mailing list