aboutsummaryrefslogtreecommitdiffstats
path: root/ui/win32/console_win32.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-04-26 04:42:20 +0000
committerGuy Harris <guy@alum.mit.edu>2013-04-26 04:42:20 +0000
commitedfe2fc28c736df464e727c4b6191621a45d593e (patch)
treecc3e3524a342f884ca459e03c285c691cb055c92 /ui/win32/console_win32.c
parent889e2d6e5e24cd6197bc97bffd2b470922483013 (diff)
Work around a bug in a Microsoft security fix.
svn path=/trunk/; revision=49046
Diffstat (limited to 'ui/win32/console_win32.c')
-rw-r--r--ui/win32/console_win32.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/ui/win32/console_win32.c b/ui/win32/console_win32.c
index 3c50980c6d..7f93a1a742 100644
--- a/ui/win32/console_win32.c
+++ b/ui/win32/console_win32.c
@@ -160,7 +160,25 @@ create_console(void)
*/
if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
/* Probably not, as we couldn't attach to the parent process's console.
- Try to create a console. */
+ Try to create a console.
+
+ According to a comment on
+
+ http://msdn.microsoft.com/en-us/library/windows/desktop/ms681952(v=vs.85).aspx
+
+ and according to
+
+ http://connect.microsoft.com/VisualStudio/feedback/details/689696/installing-security-update-kb2507938-prevents-console-allocation
+
+ and
+
+ http://answers.microsoft.com/en-us/windows/forum/windows_xp-windows_update/kb2567680-andor-kb2507938-breaks-attachconsole-api/e8191280-2d49-4be4-9918-18486fba0afa
+
+ even a failed attempt to attach to another process's console
+ will cause subsequent AllocConsole() calls to fail, possibly due
+ to bugs introduced by a security patch. To work around this, we
+ do a FreeConsole() first. */
+ FreeConsole();
if (AllocConsole()) {
/* That succeeded. */
console_wait = TRUE;