[setup - the official Cygwin setup program] branch master, updated. release_2.917

Jon TURNEY via Cygwin-apps-cvs <[email protected]>
Newsgroups gmane.os.cygwin.cvs.apps
Message-ID <[email protected]>


https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=6c940f562bece60e42aebe652d49c4023dfbd3cf

commit 6c940f562bece60e42aebe652d49c4023dfbd3cf
Author: Jon Turney <[email protected]>
Date:   Mon Jan 24 17:07:15 2022 +0000

    Don't create install package if there's no install: line
    
    Don't erroneously create an install package if there's no install: line
    for that version.
    
    If it's for the latest version and something depends on this package,
    the solver will produce a solution containing that package & version,
    so we'll try to download it without having a path to fetch it from,
    leading to download errors which are impossible to resolve.

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=71046cdd73cbcce2e2713d188c10d4b573c5dddf

commit 71046cdd73cbcce2e2713d188c10d4b573c5dddf
Author: Jon Turney <[email protected]>
Date:   Mon Jan 24 16:28:29 2022 +0000

    Use SHMessageBoxCheck() for MessageBox with "don't show again" checkbox


Diff:
---
 IniDBBuilderPackage.cc |  4 ++++
 main.cc                |  4 ++--
 msg.cc                 | 20 +++++++++++++++++---
 msg.h                  |  1 +
 4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc
index 96517e9b..3a8f10f8 100644
--- a/IniDBBuilderPackage.cc
+++ b/IniDBBuilderPackage.cc
@@ -376,6 +376,10 @@ IniDBBuilderPackage::process ()
   if (cbpv.version.empty())
     return;
 
+  // no install: line, no package
+  if (!cbpv.archive.Canonical())
+    return;
+
 #if DEBUG
   Log (LOG_BABBLE) << "Finished with package " << name << endLog;
   Log (LOG_BABBLE) << "Version " << cbpv.version << endLog;
diff --git a/main.cc b/main.cc
index ea4152f5..a48ee423 100644
--- a/main.cc
+++ b/main.cc
@@ -348,10 +348,10 @@ WinMain (HINSTANCE h,
           (!is_64bit)
 #endif
           mbox (NULL, IDS_DEPRECATED_WINDOWS_ARCH,
-                MB_ICONEXCLAMATION | MB_OK);
+                MB_ICONEXCLAMATION | MB_OK | MB_DSA_CHECKBOX);
         else if ((OSMajorVersion () == 6) && (OSMinorVersion() < 1))
           mbox (NULL, IDS_DEPRECATED_WINDOWS_VERSION,
-                MB_ICONEXCLAMATION | MB_OK);
+                MB_ICONEXCLAMATION | MB_OK | MB_DSA_CHECKBOX);
       }
 
     /* Set default DACL and Group. */
diff --git a/msg.cc b/msg.cc
index 00eaf5aa..39d87ebe 100644
--- a/msg.cc
+++ b/msg.cc
@@ -20,6 +20,7 @@
 
 #include "LogFile.h"
 #include "win32.h"
+#include <shlwapi.h>
 
 #include <stdio.h>
 #include <stdarg.h>
@@ -32,8 +33,6 @@ static int
 unattended_result(int mb_type)
 {
   // Return some default values.
-  Log (LOG_PLAIN) << "unattended_mode is set at mbox: returning default value" << endLog;
-
   switch (mb_type & MB_TYPEMASK)
     {
     case MB_OK:
@@ -62,7 +61,10 @@ mbox (HWND owner, const char *buf, const char *name, int type)
   // 'name' is not the mbox caption, just some text written to the log
   Log (LOG_PLAIN) << "mbox " << name << ": " << buf << endLog;
   if (unattended_mode)
+    {
+      Log (LOG_PLAIN) << "unattended_mode is set at mbox: returning default value" << endLog;
       return unattended_result(type);
+    }
 
   char caption[32];
   LoadString (hinstance, IDS_MBOX_CAPTION, caption, sizeof (caption));
@@ -126,6 +128,9 @@ LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam) {
   return CallNextHookEx(hMsgBoxHook, nCode, wParam, lParam);
 }
 
+// registry key to store "don't show this again" state, made unique by including a GUID
+static const char *regkey = "Cygwin-Setup-d975d7b8-8c44-44a1-915a-7cf44b79cd88";
+
 int
 mbox(HWND owner, unsigned int format_id, int mb_type, ...)
 {
@@ -163,7 +168,16 @@ mbox(HWND owner, unsigned int format_id, int mb_type, ...)
   }
 
   std::wstring caption = LoadStringW(IDS_MBOX_CAPTION);
-  int retval = MessageBoxW(owner, buf.c_str(), caption.c_str(), mb_type);
+  int retval;
+  if (mb_type & MB_DSA_CHECKBOX)
+    {
+      mb_type &= ~MB_DSA_CHECKBOX;
+      std::wstring regkey_msg = format(L"%s-%d", regkey, format_id);
+      retval = SHMessageBoxCheckW(owner, buf.c_str(), caption.c_str(), mb_type,
+                                  unattended_result(mb_type), regkey_msg.c_str());
+    }
+  else
+    retval = MessageBoxW(owner, buf.c_str(), caption.c_str(), mb_type);
 
   // When the the retry_continue customization is active, adjust the return
   // value for less confusing results
diff --git a/msg.h b/msg.h
index 98dff693..5f5d6578 100644
--- a/msg.h
+++ b/msg.h
@@ -38,5 +38,6 @@ int mbox (HWND owner, const char *buf, const char *name, int type);
 int mbox(HWND owner, unsigned int format_id, int mb_type, ...);
 
 #define MB_RETRYCONTINUE 7
+#define MB_DSA_CHECKBOX 0x80000000 // with a "Dont Show Me This Dialog Again" checkbox
 
 #endif /* SETUP_MSG_H */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.