[PATCH] Don't show setup version warning message box in unattended mode

Jon TURNEY jon.turney@dronecode.org.uk
Mon Nov 18 16:49:00 GMT 2013


As was pointed out on IRC a week or two ago, setup can show a "The current ini
file is from a newer version of setup..." message box even in unattended mode.

Attached is a patch to fix.

There are other uses of MessageBox() which probably present a similar problem
and still need fixing.

2013-11-18  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* msg.cc (mbox): Generalize to a MessgeBox() wrapper which knows
	what to do in unattended mode.
	* msg.h: Add prototype.
	* ini.cc (IniParseFeedback): Use here rather than MessageBox().

-------------- next part --------------
Index: ini.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/ini.cc,v
retrieving revision 2.59
diff -u -u -p -r2.59 ini.cc
--- ini.cc	14 Nov 2013 21:36:14 -0000	2.59
+++ ini.cc	18 Nov 2013 16:18:01 -0000
@@ -106,11 +106,11 @@ public:
     }
   virtual void warning (const std::string& message)const
     {
-      MessageBox (0, message.c_str(), "Warning", 0);
+      mbox (0, message.c_str(), "Warning", 0);
     }
   virtual void error(const std::string& message)const
     {
-      MessageBox (0, message.c_str(), "Parse Errors", 0);
+      mbox (0, message.c_str(), "Parse Errors", 0);
     }
   virtual ~ GuiParseFeedback ()
     {
Index: msg.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/msg.cc,v
retrieving revision 2.9
diff -u -u -p -r2.9 msg.cc
--- msg.cc	7 Aug 2008 22:59:17 -0000	2.9
+++ msg.cc	18 Nov 2013 16:18:01 -0000
@@ -41,15 +41,9 @@ msg (const char *fmt, ...)
   OutputDebugString (buf);
 }
 
-static int
-mbox (HWND owner, const char *name, int type, int id, va_list args)
+int
+mbox (HWND owner, const char *buf, const char *name, int type)
 {
-  char buf[1000], fmt[1000];
-
-  if (LoadString (hinstance, id, fmt, sizeof (fmt)) <= 0)
-    ExitProcess (0);
-
-  vsnprintf (buf, 1000, fmt, args);
   log (LOG_PLAIN) << "mbox " << name << ": " << buf << endLog;
   if (unattended_mode)
     {
@@ -79,6 +73,18 @@ mbox (HWND owner, const char *name, int 
   return MessageBox (owner, buf, "Cygwin Setup", type);
 }
 
+static int
+mbox (HWND owner, const char *name, int type, int id, va_list args)
+{
+  char buf[1000], fmt[1000];
+
+  if (LoadString (hinstance, id, fmt, sizeof (fmt)) <= 0)
+    ExitProcess (0);
+
+  vsnprintf (buf, 1000, fmt, args);
+  return mbox(owner, buf, name, type);
+}
+
 void
 note (HWND owner, int id, ...)
 {
Index: msg.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/msg.h,v
retrieving revision 2.4
diff -u -u -p -r2.4 msg.h
--- msg.h	29 Aug 2004 16:59:40 -0000	2.4
+++ msg.h	18 Nov 2013 16:18:01 -0000
@@ -37,4 +37,7 @@ void note (HWND owner, int id, ...);
 /* returns IDYES or IDNO, otherwise same as note() */
 int yesno (HWND owner, int id, ...);
 
+/* general MessageBox() wrapper which understands unattended mode */
+int mbox (HWND owner, const char *buf, const char *name, int type);
+
 #endif /* SETUP_MSG_H */


More information about the Cygwin-apps mailing list