From 18983c5387b211ff86a7e7ec0f4f0b24ecbf9fc8 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 20 Aug 2011 22:55:42 +0200 Subject: [PATCH] Avoid "no disk in drive" popups on Win7 systems Stray accesses to exchangeable drives cause pop-up error boxes on Win7 systems, blocking the entire process. --- src/Main/bootstrap.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx index c29440dba..2208ceb15 100644 --- a/src/Main/bootstrap.cxx +++ b/src/Main/bootstrap.cxx @@ -25,6 +25,10 @@ # include #endif +#ifdef HAVE_WINDOWS_H +#include +#endif + #if defined(HAVE_FEENABLEEXCEPT) #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -167,6 +171,11 @@ int _bootstrap_OSInit; // Main entry point; catch any exceptions that have made it this far. int main ( int argc, char **argv ) { #if _MSC_VER + // Don't show blocking "no disk in drive" error messages on Windows 7, + // silently return errors to application instead. + // See Microsoft MSDN #ms680621: "GUI apps should specify SEM_NOOPENFILEERRORBOX" + SetErrorMode(SEM_NOOPENFILEERRORBOX); + // Windows has no $HOME aka %HOME%, so we have to construct the full path. // make sure it fits into the buffer. Max. path length is 255, but who knows // what's in these environment variables?