From d9f0d99e31569835e295b990029c6dd19554299c Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Tue, 9 Feb 2021 16:00:21 +0900 Subject: Imported Upstream version 2.1.21 --- build-aux/speedo/w32/g4wihelp.c | 64 ++++++++++++---- build-aux/speedo/w32/inst.nsi | 158 +++++++++++++++++++++++++--------------- build-aux/texinfo.tex | 10 +-- 3 files changed, 156 insertions(+), 76 deletions(-) (limited to 'build-aux') diff --git a/build-aux/speedo/w32/g4wihelp.c b/build-aux/speedo/w32/g4wihelp.c index 012e4af..d62d036 100644 --- a/build-aux/speedo/w32/g4wihelp.c +++ b/build-aux/speedo/w32/g4wihelp.c @@ -964,10 +964,8 @@ read_w32_registry_string (HKEY root, const char *dir, const char *name) #define ENV_REG "SYSTEM\\CurrentControlSet\\Control\\" \ "Session Manager\\Environment" /* The following setting can be used for a per-user setting. */ -#if 0 -#define ENV_HK HKEY_CURRENT_USER -#define ENV_REG "Environment" -#endif +#define ENV_HK_USER HKEY_CURRENT_USER +#define ENV_REG_USER "Environment" /* Due to a bug in Windows7 (kb 2685893) we better put a lower limit than 8191 on the maximum length of the PATH variable. Note, that depending on the used toolchain we used to had a 259 byte limit in @@ -979,12 +977,16 @@ path_add (HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters_t *extra) { char dir[PATH_LENGTH_LIMIT]; + char is_user_install[2]; char *path; char *path_new; int path_new_size; char *comp; const char delims[] = ";"; + int is_user; HKEY key_handle = 0; + HKEY root_key; + const char *env_reg; g_hwndParent = hwndParent; EXDLL_INIT(); @@ -997,13 +999,26 @@ path_add (HWND hwndParent, int string_size, char *variables, if (popstring (dir, sizeof (dir))) return; -/* MessageBox (g_hwndParent, "XXX 2", 0, MB_OK); */ + /* The expected stack layout: HKEY component. */ + if (popstring (is_user_install, sizeof (is_user_install))) + return; + + if (!strcmp(is_user_install, "1")) + { + root_key = ENV_HK_USER; + env_reg = ENV_REG_USER; + } + else + { + root_key = ENV_HK; + env_reg = ENV_REG; + } + + path = read_w32_registry_string (root_key, env_reg, "Path"); - path = read_w32_registry_string (ENV_HK, ENV_REG, "Path"); if (! path) { - MessageBox (g_hwndParent, "No PATH variable found", 0, MB_OK); - return; + path = strdup (""); } /* MessageBox (g_hwndParent, "XXX 3", 0, MB_OK); */ @@ -1041,6 +1056,8 @@ path_add (HWND hwndParent, int string_size, char *variables, do { /* MessageBox (g_hwndParent, comp, 0, MB_OK); */ + if (!comp) + break; if (!strcmp (comp, dir)) { @@ -1053,10 +1070,8 @@ path_add (HWND hwndParent, int string_size, char *variables, while (comp); free (path); -/* MessageBox (g_hwndParent, "XXX 8", 0, MB_OK); */ - - /* Set a key for our CLSID. */ - RegCreateKey (ENV_HK, ENV_REG, &key_handle); + /* Update the path key. */ + RegCreateKey (root_key, env_reg, &key_handle); RegSetValueEx (key_handle, "Path", 0, REG_EXPAND_SZ, path_new, path_new_size); RegCloseKey (key_handle); @@ -1074,6 +1089,7 @@ path_remove (HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters_t *extra) { char dir[PATH_LENGTH_LIMIT]; + char is_user_install[2]; char *path; char *path_new; int path_new_size; @@ -1082,6 +1098,8 @@ path_remove (HWND hwndParent, int string_size, char *variables, HKEY key_handle = 0; int changed = 0; int count = 0; + HKEY root_key; + const char *env_reg; g_hwndParent = hwndParent; EXDLL_INIT(); @@ -1092,7 +1110,25 @@ path_remove (HWND hwndParent, int string_size, char *variables, if (popstring (dir, sizeof (dir))) return; - path = read_w32_registry_string (ENV_HK, ENV_REG, "Path"); + /* The expected stack layout: HKEY component. */ + if (popstring (is_user_install, sizeof (is_user_install))) + return; + + if (!strcmp(is_user_install, "1")) + { + root_key = ENV_HK_USER; + env_reg = ENV_REG_USER; + } + else + { + root_key = ENV_HK; + env_reg = ENV_REG; + } + + path = read_w32_registry_string (root_key, env_reg, "Path"); + + if (!path) + return; /* Old path plus semicolon plus dir plus terminating nul. */ path_new_size = strlen (path) + 1; path_new = malloc (path_new_size); @@ -1126,7 +1162,7 @@ path_remove (HWND hwndParent, int string_size, char *variables, return; /* Set a key for our CLSID. */ - RegCreateKey (ENV_HK, ENV_REG, &key_handle); + RegCreateKey (root_key, env_reg, &key_handle); RegSetValueEx (key_handle, "Path", 0, REG_EXPAND_SZ, path_new, path_new_size); RegCloseKey (key_handle); diff --git a/build-aux/speedo/w32/inst.nsi b/build-aux/speedo/w32/inst.nsi index b4d6994..b89876e 100644 --- a/build-aux/speedo/w32/inst.nsi +++ b/build-aux/speedo/w32/inst.nsi @@ -1,5 +1,6 @@ # inst.nsi - Installer for GnuPG on Windows. -*- coding: latin-1; -*- # Copyright (C) 2005, 2014 g10 Code GmbH +# 2017 Intevation GmbH # # This file is part of GnuPG. # @@ -42,7 +43,7 @@ !define PRETTY_PACKAGE "GNU Privacy Guard" !define PRETTY_PACKAGE_SHORT "GnuPG" !define COMPANY "The GnuPG Project" -!define COPYRIGHT "Copyright (C) 2015 The GnuPG Project" +!define COPYRIGHT "Copyright (C) 2017 The GnuPG Project" !define DESCRIPTION "GnuPG: The GNU Privacy Guard for Windows" !define INSTALL_DIR "GnuPG" @@ -80,9 +81,6 @@ SetCompressor lzma # SetCompressorDictSize 8 !endif -# Include the generic parts. -!define HAVE_STARTMENU - # We use the modern UI. !include "MUI.nsh" @@ -90,6 +88,17 @@ SetCompressor lzma !include "LogicLib.nsh" !include "x64.nsh" +# We support user mode installation but prefer system wide +!define MULTIUSER_EXECUTIONLEVEL Highest +!define MULTIUSER_MUI +!define MULTIUSER_INSTALLMODE_COMMANDLINE +!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "Software\${PACKAGE_SHORT}" +!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "" +!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\${PACKAGE_SHORT}" +!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "Install Directory" +!define MULTIUSER_INSTALLMODE_INSTDIR "${PACKAGE_SHORT}" +!include "MultiUser.nsh" + # Set the package name. Note that this name should not be suffixed # with the version because this would get displayed in the start menu. # Given that a slash in the name troubles Windows startmenu creation @@ -109,9 +118,6 @@ OutFile "${NAME}-${VERSION}_${BUILD_DATESTR}.exe" !endif InstallDir "$PROGRAMFILES\${INSTALL_DIR}" -InstallDirRegKey HKLM "Software\${PACKAGE_SHORT}" "Install Directory" - - # Add version information to the file properties. VIProductVersion "${PROD_VERSION}" VIAddVersionKey "ProductName" "${PRETTY_PACKAGE_SHORT} (${VERSION})" @@ -161,7 +167,7 @@ VIAddVersionKey "FileVersion" "${PROD_VERSION}" # We don't have MUI_PAGE_DIRECTORY -!ifdef HAVE_STARTMENU +!ifdef WITH_GUI Page custom CustomPageOptions @@ -169,7 +175,7 @@ Var STARTMENU_FOLDER !define MUI_PAGE_CUSTOMFUNCTION_PRE CheckIfStartMenuWanted !define MUI_STARTMENUPAGE_NODISABLE -!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" +!define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\GnuPG" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" # We need to set the Startmenu name explicitly because a slash in the @@ -361,9 +367,10 @@ Function PrintNonAdminWarning UserInfo::GetAccountType Pop $1 StrCmp $1 "Admin" leave +1 - MessageBox MB_OK "$(T_AdminNeeded)" - Quit - + MessageBox MB_YESNO "$(T_AdminWanted)" IDNO exit + goto leave + exit: + Quit leave: FunctionEnd @@ -446,24 +453,30 @@ LangString T_FoundExistingVersion ${LANG_GERMAN} \ eine neuere oder dieselbe Version handelt.)" LangString T_FoundExistingVersionB ${LANG_ENGLISH} \ "A version of GnuPG has already been installed on the system. \ - There will be no problem installing and thus overwriting this \ - Version. $\r$\n\ + $\r$\n\ $\r$\n\ Do you want to continue installing GnuPG?" LangString T_FoundExistingVersionB ${LANG_GERMAN} \ "Eine Version von GnuPG ist hier bereits installiert. \ - Es ist problemlos möglich, die Installation fortzuführen. $\r$\n\ + $\r$\n\ $\r$\n\ Möchten die die Installation von GnuPG fortführen?" # From Function PrintNonAdminWarning -LangString T_AdminNeeded ${LANG_ENGLISH} \ - "Warning: Administrator permissions required for a successful installation" -LangString T_AdminNeeded ${LANG_GERMAN} \ - "Achtung: Für eine erfolgreiche Installation werden \ - Administratorrechte benötigt." +LangString T_AdminWanted ${LANG_ENGLISH} \ + "Warning: It is recommended to install GnuPG system-wide with \ + administrator rights. \ + $\r$\n\ + $\r$\n\ + Do you want to continue installing GnuPG without administrator rights?" +LangString T_AdminWanted ${LANG_GERMAN} \ + "Achtung: Es wird empfohlen GnuPG systemweit mit \ + Administratorrechten zu installieren. \ + $\r$\n\ + $\r$\n\ + Möchten die die Installation von GnuPG ohne Administratorrechte fortführen?" # From Function PrintCloseOtherApps LangString T_CloseOtherApps ${LANG_ENGLISH} \ @@ -504,8 +517,24 @@ FunctionEnd # AddToPath - Adds the given dir to the search path. # Input - head of the stack Function AddToPath + ClearErrors + UserInfo::GetName + IfErrors add_admin + Pop $0 + UserInfo::GetAccountType + Pop $1 + StrCmp $1 "Admin" add_admin add_user + +add_admin: Exch $0 - g4wihelp::path_add "$0" + g4wihelp::path_add "$0" "0" + goto add_done +add_user: + Exch $0 + g4wihelp::path_add "$0" "1" + goto add_done + +add_done: StrCmp $R5 "0" add_to_path_done SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 add_to_path_done: @@ -516,8 +545,24 @@ FunctionEnd # RemoveFromPath - Remove a given dir from the path # Input: head of the stack Function un.RemoveFromPath + ClearErrors + UserInfo::GetName + IfErrors remove_admin + Pop $0 + UserInfo::GetAccountType + Pop $1 + StrCmp $1 "Admin" remove_admin remove_user + +remove_admin: Exch $0 - g4wihelp::path_remove "$0" + g4wihelp::path_remove "$0" "0" + goto remove_done +remove_user: + Exch $0 + g4wihelp::path_remove "$0" "1" + goto remove_done + +remove_done: StrCmp $R5 "0" remove_from_path_done SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 remove_from_path_done: @@ -540,7 +585,7 @@ Section "-gnupginst" FileWrite $0 "${VERSION}$\r$\n" FileClose $0 - WriteRegStr HKLM "Software\GnuPG" "Install Directory" $INSTDIR + WriteRegStr SHCTX "Software\GnuPG" "Install Directory" $INSTDIR # If we are reinstalling, try to kill a possible running gpa using # an already installed gpa. @@ -608,8 +653,6 @@ Section "GnuPG" SEC_gnupg Rename /REBOOTOK scdaemon.exe.tmp scdaemon.exe SetOutPath "$INSTDIR\share\gnupg" - File "share/gnupg/gpg-conf.skel" - File "share/gnupg/dirmngr-conf.skel" File "share/gnupg/distsigkey.gpg" File "share/gnupg/sks-keyservers.netCA.pem" @@ -1383,7 +1426,7 @@ Section "-un.gnupginst" RMDir "$INSTDIR" # Clean the registry. - DeleteRegValue HKLM "Software\GNU\GnuPG" "Install Directory" + DeleteRegValue SHCTX "Software\GNU\GnuPG" "Install Directory" SectionEnd @@ -1411,8 +1454,25 @@ Function .onInit !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${W32_SRCDIR}/inst-options.ini" #Call CalcDepends + + Var /GLOBAL changed_dir + # Check if the install directory was modified on the command line + StrCmp "$INSTDIR" "$PROGRAMFILES\${INSTALL_DIR}" unmodified 0 + # It is modified. Save that value. + StrCpy $changed_dir "$INSTDIR" + + # MULITUSER_INIT overwrites directory setting from command line + !insertmacro MULTIUSER_INIT + StrCpy $INSTDIR "$changed_dir" + goto initDone +unmodified: + !insertmacro MULTIUSER_INIT +initDone: FunctionEnd +Function "un.onInit" + !insertmacro MULTIUSER_UNINIT +FunctionEnd #Function .onInstFailed # Delete $TEMP\gpgspltmp.wav @@ -1441,13 +1501,6 @@ FunctionEnd !ifdef WITH_GUI Section "-startmenu" -!ifdef HAVE_STARTMENU - # Make sure that the context of the automatic variables has been set to - # the "all users" shell folder. This guarantees that the menu gets written - # for all users. We have already checked that we are running as Admin; or - # we printed a warning that installation will not succeed. - SetShellVarContext all - # Check if the start menu entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "${W32_SRCDIR}/inst-options.ini" \ "Field 2" "State" @@ -1519,7 +1572,6 @@ no_gpa_quicklaunch: no_quick_launch: -!endif SectionEnd !endif @@ -1535,30 +1587,23 @@ Section # Windows Add/Remove Programs support StrCpy $MYTMP "Software\Microsoft\Windows\CurrentVersion\Uninstall\GnuPG" - WriteRegExpandStr HKLM $MYTMP "UninstallString" '"$INSTDIR\gnupg-uninstall.exe"' - WriteRegExpandStr HKLM $MYTMP "InstallLocation" "$INSTDIR" - WriteRegStr HKLM $MYTMP "DisplayName" "${PRETTY_PACKAGE}" + WriteRegExpandStr SHCTX $MYTMP "UninstallString" '"$INSTDIR\gnupg-uninstall.exe"' + WriteRegExpandStr SHCTX $MYTMP "InstallLocation" "$INSTDIR" + WriteRegStr SHCTX $MYTMP "DisplayName" "${PRETTY_PACKAGE}" !ifdef WITH_GUI - WriteRegStr HKLM $MYTMP "DisplayIcon" "$INSTDIR\bin\gpa.exe,0" + WriteRegStr SHCTX $MYTMP "DisplayIcon" "$INSTDIR\bin\gpa.exe,0" +!else + WriteRegStr SHCTX $MYTMP "DisplayIcon" "$INSTDIR\bin\gpg.exe,0" !endif - WriteRegStr HKLM $MYTMP "DisplayVersion" "${VERSION}" - WriteRegStr HKLM $MYTMP "Publisher" "The GnuPG Project" - WriteRegStr HKLM $MYTMP "URLInfoAbout" "https://gnupg.org" - WriteRegDWORD HKLM $MYTMP "NoModify" "1" - WriteRegDWORD HKLM $MYTMP "NoRepair" "1" + WriteRegStr SHCTX $MYTMP "DisplayVersion" "${VERSION}" + WriteRegStr SHCTX $MYTMP "Publisher" "The GnuPG Project" + WriteRegStr SHCTX $MYTMP "URLInfoAbout" "https://gnupg.org" + WriteRegDWORD SHCTX $MYTMP "NoModify" "1" + WriteRegDWORD SHCTX $MYTMP "NoRepair" "1" SectionEnd - Section Uninstall - !ifdef WITH_GUI -!ifdef HAVE_STARTMENU - # Make sure that the context of the automatic variables has been set to - # the "all users" shell folder. This guarantees that the menu gets written - # for all users. We have already checked that we are running as Admin; or - # we printed a warning that installation will not succeed. - SetShellVarContext all - #--------------------------------------------------- # Delete the menu entries and any empty parent menus #--------------------------------------------------- @@ -1576,7 +1621,7 @@ Section Uninstall StrCmp $MYTMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop startMenuDeleteLoopDone: - DeleteRegValue HKLM "Software\GNU\GnuPG" "Start Menu Folder" + DeleteRegValue SHCTX "Software\GNU\GnuPG" "Start Menu Folder" # Delete Desktop links. Delete "$DESKTOP\GPA.lnk" @@ -1588,15 +1633,14 @@ Section Uninstall Delete "$QUICKLAUNCH\GPA.lnk" no_quick_launch_uninstall: -!endif !endif Delete "$INSTDIR\gnupg-uninstall.exe" RMDir "$INSTDIR" # Clean the registry. - DeleteRegValue HKLM "Software\GnuPG" "Install Directory" - DeleteRegKey /ifempty HKLM "Software\GnuPG" + DeleteRegValue SHCTX "Software\GnuPG" "Install Directory" + DeleteRegKey /ifempty SHCTX "Software\GnuPG" # Remove Windows Add/Remove Programs support. - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GnuPG" + DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\GnuPG" SectionEnd diff --git a/build-aux/texinfo.tex b/build-aux/texinfo.tex index a181898..5a17f97 100644 --- a/build-aux/texinfo.tex +++ b/build-aux/texinfo.tex @@ -415,7 +415,7 @@ \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} -% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% Each occurrence of `\^^M' or `\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo @@ -440,7 +440,7 @@ % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, % just before passing the control to \argtorun. -% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% (Similarly, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % @@ -497,7 +497,7 @@ % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they -% are not treated as enviroments; they don't open a group. (The +% are not treated as environments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) @@ -520,7 +520,7 @@ \fi } -% Evironment mismatch, #1 expected: +% Environment mismatch, #1 expected: \def\badenverr{% \errhelp = \EMsimple \errmessage{This command can appear only \inenvironment\temp, @@ -7034,7 +7034,7 @@ end % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. -% Similarily, if a @footnote appears inside an alignment, save the footnote +% Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. -- cgit v1.2.3