diff options
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/speedo.mk | 68 | ||||
-rw-r--r-- | build-aux/speedo/w32/exdll.c | 286 | ||||
-rw-r--r-- | build-aux/speedo/w32/exdll.h | 259 | ||||
-rw-r--r-- | build-aux/speedo/w32/g4wihelp.c | 426 | ||||
-rw-r--r-- | build-aux/speedo/w32/inst.nsi | 49 | ||||
-rw-r--r-- | build-aux/speedo/w32/wixlib.wxs | 3 |
6 files changed, 784 insertions, 307 deletions
diff --git a/build-aux/speedo.mk b/build-aux/speedo.mk index 646a4fe..e47dfe3 100644 --- a/build-aux/speedo.mk +++ b/build-aux/speedo.mk @@ -80,6 +80,9 @@ # AUTHENTICODE_KEY=/home/foo/.gnupg/my-authenticode-key.p12 # AUTHENTICODE_CERTS=/home/foo/.gnupg/my-authenticode-certs.pem # +# If a tarball has not been published while building a release it +# may be stored in a directory specified by: +# OVERRIDE_TARBALLS=/home/foo/override-tarballs #--8<---------------cut here---------------end--------------->8--- @@ -132,7 +135,10 @@ help-wixlib: @echo '' @echo 'Afterwards w32-release will build also a wixlib.' - +# NB: we can't use +$(MAKE) here because we would need to define the +# dependencies of our packages. This does not make much sense given that +# we have a clear order in how they are build and concurrent builds +# would anyway clutter up the logs. SPEEDOMAKE := $(MAKE) -f $(SPEEDO_MK) UPD_SWDB=1 native: check-tools @@ -223,7 +229,7 @@ STATIC=0 # external packages. TARBALLS=$(shell pwd)/../tarballs -# Number of parallel make jobs +# Number of parallel make jobs in each package MAKE_J=3 # Name to use for the w32 installer and sources @@ -246,6 +252,7 @@ $(eval $(call READ_AUTOGEN_template,AUTHENTICODE_CERTS)) $(eval $(call READ_AUTOGEN_template,OSSLSIGNCODE)) $(eval $(call READ_AUTOGEN_template,OSSLPKCS11ENGINE)) $(eval $(call READ_AUTOGEN_template,SCUTEMODULE)) +$(eval $(call READ_AUTOGEN_template,OVERRIDE_TARBALLS)) # All files given in AUTHENTICODE_FILES are signed before # they are put into the installer. @@ -489,7 +496,7 @@ gtk__ver = 2.24.17 gitrep = ${HOME}/s # The tarball directories -pkgrep = ftp://ftp.gnupg.org/gcrypt +pkgrep = https://gnupg.org/ftp/gcrypt pkg10rep = ftp://ftp.g10code.com/g10code pkg2rep = $(TARBALLS) @@ -681,9 +688,13 @@ speedo_pkg_w64_gpgex_configure = \ # External packages # +# gcc 10.2 takes __udivdi3 from the exception handler DLL and thus +# requires it. This is a regression from gcc 8.3 and earlier. To fix +# this we need to pass -static-libgcc. ifeq ($(TARGETOS),w32) speedo_pkg_zlib_make_args = \ - -fwin32/Makefile.gcc PREFIX=$(host)- IMPLIB=libz.dll.a + -fwin32/Makefile.gcc PREFIX=$(host)- IMPLIB=libz.dll.a \ + LDFLAGS=-static-libgcc speedo_pkg_zlib_make_args_inst = \ -fwin32/Makefile.gcc \ @@ -873,17 +884,18 @@ endif # The playground area is our scratch area, where we unpack, build and # install the packages. $(stampdir)/stamp-directories: - $(MKDIR) $(root) || true - $(MKDIR) $(stampdir) || true - $(MKDIR) $(sdir) || true - $(MKDIR) $(bdir) || true - $(MKDIR) $(idir) || true + $(MKDIR) -p $(root) + $(MKDIR) -p $(stampdir) + $(MKDIR) -p $(sdir) + $(MKDIR) -p $(bdir) + $(MKDIR) -p $(idir) ifeq ($(TARGETOS),w32) - $(MKDIR) $(bdir6) || true - $(MKDIR) $(idir6) || true + $(MKDIR) -p $(bdir6) + $(MKDIR) -p $(idir6) endif touch $(stampdir)/stamp-directories + # Frob the name $1 by converting all '-' and '+' characters to '_'. define FROB_macro $(subst +,_,$(subst -,_,$(1))) @@ -977,7 +989,7 @@ endef # define SPKG_template -$(stampdir)/stamp-$(1)-00-unpack: $(stampdir)/stamp-directories +$(stampdir)/stamp-$(1)-00-unpack: @echo "speedo: /*" @echo "speedo: * $(1)" @echo "speedo: */" @@ -999,6 +1011,13 @@ $(stampdir)/stamp-$(1)-00-unpack: $(stampdir)/stamp-directories cd "$$$${pkg}"; \ AUTOGEN_SH_SILENT=1 ./autogen.sh; \ elif [ -n "$$$${tar}" ]; then \ + tar2="$(OVERRIDE_TARBALLS)/$$$$(basename $$$${tar})";\ + if [ -f "$$$${tar2}" ]; then \ + tar="$$$$tar2"; \ + echo "speedo: /*"; \ + echo "speedo: * Note: using an override"; \ + echo "speedo: */"; \ + fi; \ echo "speedo: unpacking $(1) from $$$${tar}"; \ case "$$$${tar}" in \ *.gz) pretar=zcat ;; \ @@ -1245,7 +1264,7 @@ endef # Insert the template for each source package. $(foreach spkg, $(speedo_spkgs), $(eval $(call SPKG_template,$(spkg)))) -$(stampdir)/stamp-final: $(stampdir)/stamp-directories clean-pkg-versions +$(stampdir)/stamp-final: clean-pkg-versions ifeq ($(TARGETOS),w32) $(stampdir)/stamp-final: $(addprefix $(stampdir)/stamp-w64-final-,$(speedo_w64_build_list)) endif @@ -1311,10 +1330,14 @@ $(bdir)/README.txt: $(bdir)/NEWS.tmp $(topsrc)/README $(w32src)/README.txt \ | sed -e '/^#/d' \ | awk '{printf "%s\r\n", $$0}' >$(bdir)/README.txt -$(bdir)/g4wihelp.dll: $(w32src)/g4wihelp.c $(w32src)/exdll.h +$(bdir)/g4wihelp.dll: $(w32src)/g4wihelp.c $(w32src)/exdll.h $(w32src)/exdll.c (set -e; cd $(bdir); \ - $(W32CC) -I. -shared -O2 -o g4wihelp.dll $(w32src)/g4wihelp.c \ - -lwinmm -lgdi32; \ + $(W32CC) -DUNICODE -static-libgcc -I . -O2 -c \ + -o exdll.o $(w32src)/exdll.c; \ + $(W32CC) -DUNICODE -static-libgcc -I. -shared -O2 \ + -o g4wihelp.dll $(w32src)/g4wihelp.c exdll.o \ + -lwinmm -lgdi32 -luserenv \ + -lshell32 -loleaut32 -lshlwapi -lmsimg32; \ $(STRIP) g4wihelp.dll) w32_insthelpers: $(bdir)/g4wihelp.dll @@ -1343,8 +1366,7 @@ installer: all w32_insthelpers $(w32src)/inst-options.ini $(bdir)/README.txt done; \ fi \ ) - $(MAKENSIS) -V2 $$($(MAKENSIS) -version \ - | grep -q ^v3 && echo "-INPUTCHARSET CP1252 ") \ + $(MAKENSIS) -V2 \ -DINST_DIR=$(idir) \ -DINST6_DIR=$(idir6) \ -DBUILD_DIR=$(bdir) \ @@ -1511,10 +1533,8 @@ sign-installer: if [ -e "$${msifile}" ]; then \ $(call MKSWDB_commands,$${msifile},$${reldate},"wixlib_"); \ fi; \ - echo "speedo: /*" ;\ - echo "speedo: * Verification result" ;\ - echo "speedo: */" ;\ - osslsigncode verify $${exefile} \ + echo "speedo: /* (osslsigncode verify disabled) */" ;\ + echo osslsigncode verify $${exefile} \ ) @@ -1524,9 +1544,9 @@ endif # -# Check availibility of standard tools +# Check availibility of standard tools and prepare everything. # -check-tools: +check-tools: $(stampdir)/stamp-directories # diff --git a/build-aux/speedo/w32/exdll.c b/build-aux/speedo/w32/exdll.c new file mode 100644 index 0000000..7815523 --- /dev/null +++ b/build-aux/speedo/w32/exdll.c @@ -0,0 +1,286 @@ +#include "exdll.h" + +unsigned int g_stringsize; +stack_t **g_stacktop; +LPTSTR g_variables; + +// utility functions (not required but often useful) + +int NSISCALL popstring(LPTSTR str) +{ + stack_t *th; + if (!g_stacktop || !*g_stacktop) return 1; + th=(*g_stacktop); + if (str) lstrcpy(str,th->text); + *g_stacktop = th->next; + GlobalFree((HGLOBAL)th); + return 0; +} + +int NSISCALL popstringn(LPTSTR str, int maxlen) +{ + stack_t *th; + if (!g_stacktop || !*g_stacktop) return 1; + th=(*g_stacktop); + if (str) lstrcpyn(str,th->text,maxlen?maxlen:g_stringsize); + *g_stacktop = th->next; + GlobalFree((HGLOBAL)th); + return 0; +} + +void NSISCALL pushstring(LPCTSTR str) +{ + stack_t *th; + if (!g_stacktop) return; + th=(stack_t*)GlobalAlloc(GPTR,(sizeof(stack_t)+(g_stringsize)*sizeof(*str))); + lstrcpyn(th->text,str,g_stringsize); + th->next=*g_stacktop; + *g_stacktop=th; +} + +LPTSTR NSISCALL getuservariable(const int varnum) +{ + if (!isvalidnsisvarindex(varnum)) return NULL; + return (LPWSTR)((wchar_t*)g_variables+varnum*g_stringsize); +} + +void NSISCALL setuservariable(const int varnum, LPCTSTR var) +{ + if (var && isvalidnsisvarindex(varnum)) + lstrcpy((LPWSTR)((wchar_t*)g_variables + varnum*g_stringsize), var); +} + +#ifdef UNICODE +int NSISCALL PopStringA(LPSTR ansiStr) +{ + LPWSTR wideStr = (LPWSTR) GlobalAlloc(GPTR, g_stringsize*sizeof(WCHAR)); + int rval = popstring(wideStr); + WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL); + GlobalFree((HGLOBAL)wideStr); + return rval; +} + +int NSISCALL PopStringNA(LPSTR ansiStr, int maxlen) +{ + int realLen = maxlen ? maxlen : g_stringsize; + LPWSTR wideStr = (LPWSTR) GlobalAlloc(GPTR, realLen*sizeof(WCHAR)); + int rval = popstringn(wideStr, realLen); + WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, realLen, NULL, NULL); + GlobalFree((HGLOBAL)wideStr); + return rval; +} + +void NSISCALL PushStringA(LPCSTR ansiStr) +{ + LPWSTR wideStr = (LPWSTR) GlobalAlloc(GPTR, g_stringsize*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize); + pushstring(wideStr); + GlobalFree((HGLOBAL)wideStr); + return; +} + +void NSISCALL GetUserVariableW(const int varnum, LPWSTR wideStr) +{ + lstrcpyW(wideStr, getuservariable(varnum)); +} + +void NSISCALL GetUserVariableA(const int varnum, LPSTR ansiStr) +{ + LPWSTR wideStr = getuservariable(varnum); + WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL); +} + +void NSISCALL SetUserVariableA(const int varnum, LPCSTR ansiStr) +{ + if (ansiStr && isvalidnsisvarindex(varnum)) + { + LPWSTR wideStr = (LPWSTR)((char*)g_variables + varnum * g_stringsize); + MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize); + } +} + +#else +// ANSI defs +int NSISCALL PopStringW(LPWSTR wideStr) +{ + LPSTR ansiStr = (LPSTR) GlobalAlloc(GPTR, g_stringsize); + int rval = popstring(ansiStr); + MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize); + GlobalFree((HGLOBAL)ansiStr); + return rval; +} + +int NSISCALL PopStringNW(LPWSTR wideStr, int maxlen) +{ + int realLen = maxlen ? maxlen : g_stringsize; + LPSTR ansiStr = (LPSTR) GlobalAlloc(GPTR, realLen); + int rval = popstringn(ansiStr, realLen); + MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, realLen); + GlobalFree((HGLOBAL)ansiStr); + return rval; +} + +void NSISCALL PushStringW(LPWSTR wideStr) +{ + LPSTR ansiStr = (LPSTR) GlobalAlloc(GPTR, g_stringsize); + WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL); + pushstring(ansiStr); + GlobalFree((HGLOBAL)ansiStr); +} + +void NSISCALL GetUserVariableW(const int varnum, LPWSTR wideStr) +{ + LPSTR ansiStr = getuservariable(varnum); + MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize); +} + +void NSISCALL GetUserVariableA(const int varnum, LPSTR ansiStr) +{ + lstrcpyA(ansiStr, getuservariable(varnum)); +} + +void NSISCALL SetUserVariableW(const int varnum, LPCWSTR wideStr) +{ + if (wideStr && isvalidnsisvarindex(varnum)) + { + LPSTR ansiStr = (char*)g_variables + varnum * g_stringsize; + WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL); + } +} +#endif + +// playing with integers + +INT_PTR NSISCALL nsishelper_str_to_ptr(LPCTSTR s) +{ + INT_PTR v=0; + if (*s == _T('0') && (s[1] == _T('x') || s[1] == _T('X'))) + { + s++; + for (;;) + { + int c=*(++s); + if (c >= _T('0') && c <= _T('9')) c-=_T('0'); + else if (c >= _T('a') && c <= _T('f')) c-=_T('a')-10; + else if (c >= _T('A') && c <= _T('F')) c-=_T('A')-10; + else break; + v<<=4; + v+=c; + } + } + else if (*s == _T('0') && s[1] <= _T('7') && s[1] >= _T('0')) + { + for (;;) + { + int c=*(++s); + if (c >= _T('0') && c <= _T('7')) c-=_T('0'); + else break; + v<<=3; + v+=c; + } + } + else + { + int sign=0; + if (*s == _T('-')) sign++; else s--; + for (;;) + { + int c=*(++s) - _T('0'); + if (c < 0 || c > 9) break; + v*=10; + v+=c; + } + if (sign) v = -v; + } + + return v; +} + +unsigned int NSISCALL myatou(LPCTSTR s) +{ + unsigned int v=0; + + for (;;) + { + unsigned int c=*s++; + if (c >= _T('0') && c <= _T('9')) c-=_T('0'); + else break; + v*=10; + v+=c; + } + return v; +} + +int NSISCALL myatoi_or(LPCTSTR s) +{ + int v=0; + if (*s == _T('0') && (s[1] == _T('x') || s[1] == _T('X'))) + { + s++; + for (;;) + { + int c=*(++s); + if (c >= _T('0') && c <= _T('9')) c-=_T('0'); + else if (c >= _T('a') && c <= _T('f')) c-=_T('a')-10; + else if (c >= _T('A') && c <= _T('F')) c-=_T('A')-10; + else break; + v<<=4; + v+=c; + } + } + else if (*s == _T('0') && s[1] <= _T('7') && s[1] >= _T('0')) + { + for (;;) + { + int c=*(++s); + if (c >= _T('0') && c <= _T('7')) c-=_T('0'); + else break; + v<<=3; + v+=c; + } + } + else + { + int sign=0; + if (*s == _T('-')) sign++; else s--; + for (;;) + { + int c=*(++s) - _T('0'); + if (c < 0 || c > 9) break; + v*=10; + v+=c; + } + if (sign) v = -v; + } + + // Support for simple ORed expressions + if (*s == _T('|')) + { + v |= myatoi_or(s+1); + } + + return v; +} + +INT_PTR NSISCALL popintptr() +{ + TCHAR buf[128]; + if (popstringn(buf,COUNTOF(buf))) + return 0; + return nsishelper_str_to_ptr(buf); +} + +int NSISCALL popint_or() +{ + TCHAR buf[128]; + if (popstringn(buf,COUNTOF(buf))) + return 0; + return myatoi_or(buf); +} + +void NSISCALL pushintptr(INT_PTR value) +{ + TCHAR buffer[30]; + wsprintf(buffer, sizeof(void*) > 4 ? _T("%Id") : _T("%d"), value); + pushstring(buffer); +} diff --git a/build-aux/speedo/w32/exdll.h b/build-aux/speedo/w32/exdll.h index bb13ae0..f419dc3 100644 --- a/build-aux/speedo/w32/exdll.h +++ b/build-aux/speedo/w32/exdll.h @@ -1,91 +1,47 @@ -/* exdll.h for use with gpg4win - * Copyright (C) 1999-2005 Nullsoft, Inc. - * - * This license applies to everything in the NSIS package, except - * where otherwise noted. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must - * not claim that you wrote the original software. If you use this - * software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ************************************************************ - * 2005-11-14 wk Applied license text to original exdll.h file from - * NSIS 2.0.4 and did some formatting changes. - */ - -#ifndef _EXDLL_H_ -#define _EXDLL_H_ - -/* only include this file from one place in your DLL. (it is all - static, if you use it in two places it will fail) */ +#include <windows.h> +#ifndef ___NSIS_PLUGIN__H___ +#define ___NSIS_PLUGIN__H___ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NSISCALL +# define NSISCALL __stdcall +#endif +#if !defined(_WIN32) && !defined(LPTSTR) +# define LPTSTR TCHAR* +#endif + + + +#ifndef NSISCALL +# define NSISCALL WINAPI +#endif #define EXDLL_INIT() { \ g_stringsize=string_size; \ g_stacktop=stacktop; \ g_variables=variables; } -/* For page showing plug-ins */ -#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8) -#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd) -#define NOTIFY_BYE_BYE 'x' + +enum NSPIM +{ + NSPIM_UNLOAD, + NSPIM_GUIUNLOAD +}; + +typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM); typedef struct _stack_t { struct _stack_t *next; - char text[1]; /* This should be the length of string_size. */ +#ifdef UNICODE + WCHAR text[1]; // this should be the length of g_stringsize when allocating +#else + char text[1]; +#endif } stack_t; - -static unsigned int g_stringsize; -static stack_t **g_stacktop; -static char *g_variables; - -static int __stdcall popstring(char *str, size_t maxlen); /* 0 on success, 1 on empty stack */ -static void __stdcall pushstring(const char *str); - -enum - { - INST_0, // $0 - INST_1, // $1 - INST_2, // $2 - INST_3, // $3 - INST_4, // $4 - INST_5, // $5 - INST_6, // $6 - INST_7, // $7 - INST_8, // $8 - INST_9, // $9 - INST_R0, // $R0 - INST_R1, // $R1 - INST_R2, // $R2 - INST_R3, // $R3 - INST_R4, // $R4 - INST_R5, // $R5 - INST_R6, // $R6 - INST_R7, // $R7 - INST_R8, // $R8 - INST_R9, // $R9 - INST_CMDLINE, // $CMDLINE - INST_INSTDIR, // $INSTDIR - INST_OUTDIR, // $OUTDIR - INST_EXEDIR, // $EXEDIR - INST_LANG, // $LANGUAGE - __INST_LAST -}; - typedef struct { int autoclose; int all_user_var; @@ -94,58 +50,127 @@ typedef struct { int exec_reboot; int reboot_called; int XXX_cur_insttype; /* deprecated */ - int XXX_insttype_changed; /* deprecated */ + int plugin_api_version; /* Used to be insttype_changed */ int silent; int instdir_error; int rtl; int errlvl; + int alter_reg_view; + int status_update; } exec_flags_t; typedef struct { exec_flags_t *exec_flags; int (__stdcall *ExecuteCodeSegment)(int, HWND); + void (__stdcall *validate_filename)(LPTSTR); + int (__stdcall *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); } extra_parameters_t; -/* Utility functions (not required but often useful). */ -static int __stdcall -popstring(char *str, size_t maxlen) -{ - stack_t *th; - if (!g_stacktop || !*g_stacktop) - return 1; - th=(*g_stacktop); - lstrcpyn (str, th->text, maxlen); - *g_stacktop = th->next; - GlobalFree((HGLOBAL)th); - return 0; -} - -static void __stdcall -pushstring(const char *str) -{ - stack_t *th; - if (!g_stacktop) return; - th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize); - lstrcpyn(th->text,str,g_stringsize); - th->next=*g_stacktop; - *g_stacktop=th; -} - -static char * __stdcall -getuservariable(const int varnum) +enum { - if (varnum < 0 || varnum >= __INST_LAST) return NULL; - return g_variables+varnum*g_stringsize; -} +INST_0, // $0 +INST_1, // $1 +INST_2, // $2 +INST_3, // $3 +INST_4, // $4 +INST_5, // $5 +INST_6, // $6 +INST_7, // $7 +INST_8, // $8 +INST_9, // $9 +INST_R0, // $R0 +INST_R1, // $R1 +INST_R2, // $R2 +INST_R3, // $R3 +INST_R4, // $R4 +INST_R5, // $R5 +INST_R6, // $R6 +INST_R7, // $R7 +INST_R8, // $R8 +INST_R9, // $R9 +INST_CMDLINE, // $CMDLINE +INST_INSTDIR, // $INSTDIR +INST_OUTDIR, // $OUTDIR +INST_EXEDIR, // $EXEDIR +INST_LANG, // $LANGUAGE +__INST_LAST +}; -static void __stdcall -setuservariable(const int varnum, const char *var) -{ - if (var != NULL && varnum >= 0 && varnum < __INST_LAST) - lstrcpy(g_variables + varnum*g_stringsize, var); +extern unsigned int g_stringsize; +extern stack_t **g_stacktop; +extern LPTSTR g_variables; + +void NSISCALL pushstring(LPCTSTR str); +void NSISCALL pushintptr(INT_PTR value); +#define pushint(v) pushintptr((INT_PTR)(v)) +int NSISCALL popstring(LPTSTR str); // 0 on success, 1 on empty stack +int NSISCALL popstringn(LPTSTR str, int maxlen); // with length limit, pass 0 for g_stringsize +INT_PTR NSISCALL popintptr(); +#define popint() ( (int) popintptr() ) +int NSISCALL popint_or(); // with support for or'ing (2|4|8) +INT_PTR NSISCALL nsishelper_str_to_ptr(LPCTSTR s); +#define myatoi(s) ( (int) nsishelper_str_to_ptr(s) ) // converts a string to an integer +unsigned int NSISCALL myatou(LPCTSTR s); // converts a string to an unsigned integer, decimal only +int NSISCALL myatoi_or(LPCTSTR s); // with support for or'ing (2|4|8) +LPTSTR NSISCALL getuservariable(const int varnum); +void NSISCALL setuservariable(const int varnum, LPCTSTR var); + +#ifdef UNICODE +#define PopStringW(x) popstring(x) +#define PushStringW(x) pushstring(x) +#define SetUserVariableW(x,y) setuservariable(x,y) + +int NSISCALL PopStringA(LPSTR ansiStr); +int NSISCALL PopStringNA(LPSTR ansiStr, int maxlen); +void NSISCALL PushStringA(LPCSTR ansiStr); +void NSISCALL GetUserVariableW(const int varnum, LPWSTR wideStr); +void NSISCALL GetUserVariableA(const int varnum, LPSTR ansiStr); +void NSISCALL SetUserVariableA(const int varnum, LPCSTR ansiStr); + +#else +// ANSI defs + +#define PopStringA(x) popstring(x) +#define PushStringA(x) pushstring(x) +#define SetUserVariableA(x,y) setuservariable(x,y) + +int NSISCALL PopStringW(LPWSTR wideStr); +void NSISCALL PushStringW(LPWSTR wideStr); +void NSISCALL GetUserVariableW(const int varnum, LPWSTR wideStr); +void NSISCALL GetUserVariableA(const int varnum, LPSTR ansiStr); +void NSISCALL SetUserVariableW(const int varnum, LPCWSTR wideStr); + +#endif + +#ifdef __cplusplus } - - - -#endif/*_EXDLL_H_*/ +#endif + +#endif//!___NSIS_PLUGIN__H___ + +#ifndef COUNTOF +#define COUNTOF(a) (sizeof(a)/sizeof(a[0])) +#endif + +// minimal tchar.h emulation +#ifndef _T +# define _T TEXT +#endif +#if !defined(TCHAR) && !defined(_TCHAR_DEFINED) +# ifdef UNICODE +# define TCHAR WCHAR +# else +# define TCHAR char +# endif +#endif + +#define isvalidnsisvarindex(varnum) ( ((unsigned int)(varnum)) < (__INST_LAST) ) + +#define ERRORPRINTF(fmt, ...) \ + { \ + char buf[512]; \ + snprintf(buf, 511, "ERROR: " fmt, ##__VA_ARGS__); \ + buf[511] = '\0'; \ + OutputDebugStringA(buf); \ + } diff --git a/build-aux/speedo/w32/g4wihelp.c b/build-aux/speedo/w32/g4wihelp.c index 626f3f1..bae4b83 100644 --- a/build-aux/speedo/w32/g4wihelp.c +++ b/build-aux/speedo/w32/g4wihelp.c @@ -1,6 +1,7 @@ -/* g4wihelp.c - NSIS Helper DLL used with gpg4win. -*- coding: latin-1; -*- - * Copyright (C) 2005 g10 Code GmbH +/* g4wihelp.c - NSIS Helper DLL used with gpg4win. + * Copyright (C) 2005, 2023 g10 Code GmbH * Copyright (C) 2001 Justin Frankel + * Copyright (C) 2016, 2017 Intevation GmbH * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any @@ -23,22 +24,41 @@ ************************************************************ * The code for the splash screen has been taken from the Splash * plugin of the NSIS 2.04 distribution. That code comes without - * explicit copyright notices in the source files or author names, it + * explicit copyright notices in tyhe source files or author names, it * seems that it has been written by Justin Frankel; not sure about * the year, though. [wk 2005-11-28] * * Fixed some compiler warnings. [wk 2014-02-24]. + * Merged code from GnuPG version. [wk 2023-04-24]. + * + * Compile time macros: + * ENABLE_SLIDE_SHOW :: Define for Gpg4win. */ -#include <stdio.h> #include <windows.h> +#include <stdio.h> +#include <tlhelp32.h> +#include <psapi.h> +#include <stdio.h> +#include <string.h> #include "exdll.h" +/* We keep some code here for documentation reasons. That code has not + * yet been converted to the Unicode NSIS plugin API. */ +/* #define ENABLE_SOUND_GADGET 1 */ +/* #define ENABLE_SPLASH_GADGET 1 */ +/* #define ENABLE_SERVICE_MANAGEMENT 1 */ + + static HINSTANCE g_hInstance; /* Our Instance. */ static HWND g_hwndParent; /* Handle of parent window or NULL. */ static HBITMAP g_hbm; /* Handle of the splash image. */ static int sleepint; /* Milliseconds to show the spals image. */ +#ifdef ENABLE_SLIDE_SHOW +void +slide_stop(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop); +#endif /* Standard entry point for DLLs. */ int WINAPI @@ -46,6 +66,12 @@ DllMain (HANDLE hinst, DWORD reason, LPVOID reserved) { if (reason == DLL_PROCESS_ATTACH) g_hInstance = hinst; + else if (reason == DLL_PROCESS_DETACH) + { +#ifdef ENABLE_SLIDE_SHOW + slide_stop (NULL, 0, NULL, NULL); +#endif + } return TRUE; } @@ -53,7 +79,7 @@ DllMain (HANDLE hinst, DWORD reason, LPVOID reserved) /* Dummy function for testing. */ void __declspec(dllexport) -dummy (HWND hwndParent, int string_size, char *variables, +dummy (HWND hwndParent, int string_size, LPTSTR variables, stack_t **stacktop, extra_parameters_t *extra) { g_hwndParent = hwndParent; @@ -67,21 +93,66 @@ dummy (HWND hwndParent, int string_size, char *variables, // you should empty the stack of your parameters, and ONLY your // parameters. - // do your stuff here + /* Let's dump the variables. */ { - char buf[1024]; - snprintf (buf, sizeof buf, "$R0=%s\r\n$R1=%s\r\n", - getuservariable(INST_R0), - getuservariable(INST_R1)); - MessageBox (g_hwndParent,buf,0,MB_OK); - - snprintf (buf, sizeof buf, - "autoclose =%d\r\n" + char line[512]; + char *p; + const unsigned char *s = (void*)g_variables; + int i,j; + + for (i=0; i < string_size* __INST_LAST; i+=32, s += 32) + { + for (j=0; j < 32; j++) + if (s[j]) + break; + if (j != 32) + { + p = line; + *p = 0; + snprintf (p, 10, "%05x: ", i); + p += strlen (p); + for (j=0; j < 32; j++) + { + snprintf (p, 10, "%02x", s[j]); + p += strlen (p); + } + strcat (p, " |"); + p += strlen (p); + for (j=0; j < 32; j++) + { + if (s[j] >= 32 && s[j] < 127) + *p = s[j]; + else + *p = '.'; + p++; + } + strcat (p, "|"); + OutputDebugStringA (line); + } + } + } + + + { + wchar_t buf[1024]; + + swprintf(buf, 1024, + L"stringsize=%d\r\n$0=%s\r\n$1=%s\r\n$R0=%s\r\n$R1=%s\r\n", + string_size, + getuservariable(INST_0), + getuservariable(INST_1), + getuservariable(INST_R0), + getuservariable(INST_R1)); + MessageBoxW(g_hwndParent,buf,0,MB_OK); + + swprintf (buf, 1024, + L"autoclose =%d\r\n" "all_user_var =%d\r\n" "exec_error =%d\r\n" "abort =%d\r\n" "exec_reboot =%d\r\n" "reboot_called=%d\r\n" + "api_version =%d\r\n" "silent =%d\r\n" "instdir_error=%d\r\n" "rtl =%d\r\n" @@ -92,30 +163,34 @@ dummy (HWND hwndParent, int string_size, char *variables, extra->exec_flags->abort, extra->exec_flags->exec_reboot, extra->exec_flags->reboot_called, + extra->exec_flags->plugin_api_version, extra->exec_flags->silent, extra->exec_flags->instdir_error, extra->exec_flags->rtl, extra->exec_flags->errlvl); - MessageBox(g_hwndParent,buf,0,MB_OK); + MessageBoxW(g_hwndParent,buf,0,MB_OK); } } + void __declspec(dllexport) -runonce (HWND hwndParent, int string_size, char *variables, +runonce (HWND hwndParent, int string_size, LPTSTR variables, stack_t **stacktop, extra_parameters_t *extra) { - const char *result; + LPCWSTR result; g_hwndParent = hwndParent; EXDLL_INIT(); - CreateMutexA (NULL, 0, getuservariable(INST_R0)); - result = GetLastError ()? "1":"0"; + CreateMutexW (NULL, 0, getuservariable(INST_R0)); + result = GetLastError ()? L"1" : L"0"; setuservariable (INST_R0, result); } + +#ifdef ENABLE_SOUND_GADGET void __declspec(dllexport) playsound (HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters_t *extra) @@ -139,8 +214,10 @@ stopsound (HWND hwndParent, int string_size, char *variables, EXDLL_INIT(); PlaySound (NULL, NULL, 0); } +#endif /*ENABLE_SOUND_GADGET*/ +#ifdef ENABLE_SPLASH_GADGET /* Windows procedure to control the splashimage. This one pauses the execution until the sleep time is over or the user closes this windows. */ @@ -268,10 +345,10 @@ showsplash (HWND hwndParent, int string_size, char *variables, } UnregisterClass (classname, g_hInstance); } +#endif /*ENABLE_SPLASH_GADGET*/ - -/* Service Management. */ +#ifdef ENABLE_SERVICE_MANAGEMENT /* Use this to report unexpected errors. FIXME: This is really not very descriptive. */ void @@ -626,9 +703,8 @@ service_delete (HWND hwndParent, int string_size, char *variables, setuservariable (INST_R0, "0"); return; } +#endif /*ENABLE_SERVICE_MANAGEMENT*/ - -#include <stdio.h> /* Extract config file parameters. FIXME: Not particularly robust. We expect some reasonable formatting. The parser below is very @@ -644,6 +720,7 @@ void config_init (char **keys, char **values, int max) { /* First, parse the command line. */ + LPCWSTR wcmdline; char *cmdline; char *begin = NULL; char *end = NULL; @@ -655,7 +732,15 @@ config_init (char **keys, char **values, int max) *keys = NULL; *values = NULL; - cmdline = getuservariable (INST_CMDLINE); + cmdline = malloc (4096); + if (!cmdline) + return; + + wcmdline = getuservariable (INST_CMDLINE); + *cmdline = 0; + WideCharToMultiByte(CP_ACP, 0, wcmdline, -1, cmdline, 4095, NULL, NULL); + if (!*cmdline) + return; mark = (*cmdline == '"') ? (cmdline++, '"') : ' '; while (*cmdline && *cmdline != mark) @@ -721,6 +806,7 @@ config_init (char **keys, char **values, int max) conf = fopen (fname, "r"); free (fname); + free (cmdline); if (!conf) return; @@ -843,7 +929,7 @@ config_lookup (char *key) void __declspec(dllexport) -config_fetch (HWND hwndParent, int string_size, char *variables, +config_fetch (HWND hwndParent, int string_size, LPTSTR variables, stack_t **stacktop, extra_parameters_t *extra) { char key[256]; @@ -854,23 +940,23 @@ config_fetch (HWND hwndParent, int string_size, char *variables, EXDLL_INIT(); /* The expected stack layout: key. */ - if (popstring (key, sizeof (key))) + if (PopStringNA (key, sizeof (key))) err = 1; if (err) { - setuservariable (INST_R0, ""); + setuservariable (INST_R0, L""); return; } value = config_lookup (key); - setuservariable (INST_R0, value == NULL ? "" : value); + SetUserVariableA (INST_R0, value == NULL ? "" : value); return; } void __declspec(dllexport) -config_fetch_bool (HWND hwndParent, int string_size, char *variables, +config_fetch_bool (HWND hwndParent, int string_size, LPTSTR variables, stack_t **stacktop, extra_parameters_t *extra) { char key[256]; @@ -882,18 +968,18 @@ config_fetch_bool (HWND hwndParent, int string_size, char *variables, EXDLL_INIT(); /* The expected stack layout: key. */ - if (popstring (key, sizeof (key))) + if (PopStringNA (key, sizeof (key))) err = 1; if (err) { - setuservariable (INST_R0, ""); + setuservariable (INST_R0, L""); return; } value = config_lookup (key); if (value == NULL || *value == '\0') { - setuservariable (INST_R0, ""); + setuservariable (INST_R0, L""); return; } @@ -903,7 +989,7 @@ config_fetch_bool (HWND hwndParent, int string_size, char *variables, || atoi (value) != 0) result = 1; - setuservariable (INST_R0, result == 0 ? "0" : "1"); + SetUserVariableA (INST_R0, result == 0 ? "0" : "1"); return; } @@ -911,99 +997,107 @@ config_fetch_bool (HWND hwndParent, int string_size, char *variables, /* Return a string from the Win32 Registry or NULL in case of error. Caller must release the return value. A NULL for root is an alias for HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE in turn. */ -char * -read_w32_registry_string (HKEY root, const char *dir, const char *name) +static wchar_t * +read_w32_registry_string (HKEY root, const wchar_t *dir, const wchar_t *name) { HKEY root_key; HKEY key_handle; DWORD n1, nbytes, type; - char *result = NULL; + wchar_t *result = NULL; root_key = root; - if (! root_key) + if (!root_key) root_key = HKEY_CURRENT_USER; - if( RegOpenKeyEx( root_key, dir, 0, KEY_READ, &key_handle ) ) + if (RegOpenKeyExW (root_key, dir, 0, KEY_READ, &key_handle)) { if (root) return NULL; /* no need for a RegClose, so return direct */ /* It seems to be common practise to fall back to HKLM. */ - if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle) ) + if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle)) return NULL; /* still no need for a RegClose, so return direct */ } nbytes = 1; - if( RegQueryValueEx( key_handle, name, 0, NULL, NULL, &nbytes ) ) { - if (root) - goto leave; - /* Try to fallback to HKLM also vor a missing value. */ - RegCloseKey (key_handle); - if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle) ) - return NULL; /* Nope. */ - if (RegQueryValueEx( key_handle, name, 0, NULL, NULL, &nbytes)) - goto leave; + if (RegQueryValueExW (key_handle, name, 0, NULL, NULL, &nbytes)) + { + if (root) + goto leave; + /* Try to fallback to HKLM also for a missing value. */ + RegCloseKey (key_handle); + if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle)) + return NULL; /* Nope. */ + if (RegQueryValueExW (key_handle, name, 0, NULL, NULL, &nbytes)) + goto leave; } - result = malloc( (n1=nbytes+1) ); - - if( !result ) - goto leave; - if( RegQueryValueEx( key_handle, name, 0, &type, result, &n1 ) ) { - free(result); result = NULL; + result = calloc ((n1=nbytes+1), sizeof *result); + if (!result) goto leave; - } - result[nbytes] = 0; /* make sure it is really a string */ + + if (RegQueryValueExW (key_handle, name, 0, &type, + (unsigned char *)result, &n1)) + { + free (result); + result = NULL; + goto leave; + } + result[nbytes] = 0; /* Make sure it is really a string */ leave: - RegCloseKey( key_handle ); + RegCloseKey (key_handle); return result; } +/* Registry keys for PATH for HKLM and HKCU. */ #define ENV_HK HKEY_LOCAL_MACHINE -#define ENV_REG "SYSTEM\\CurrentControlSet\\Control\\" \ - "Session Manager\\Environment" - /* The following setting can be used for a per-user setting. */ +#define ENV_REG L"SYSTEM\\CurrentControlSet\\Control\\" \ + "Session Manager\\Environment" #define ENV_HK_USER HKEY_CURRENT_USER -#define ENV_REG_USER "Environment" +#define ENV_REG_USER L"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 - the past. */ + * 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 + * the past. + * [wk 2023-04-24]: Can this be lifted now that we use the wchar_t API? + */ #define PATH_LENGTH_LIMIT 2047 void __declspec(dllexport) -path_add (HWND hwndParent, int string_size, char *variables, +path_add (HWND hwndParent, int string_size, LPTSTR 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[] = ";"; + wchar_t dir[PATH_LENGTH_LIMIT]; + wchar_t is_user_install[2]; + wchar_t *path; + wchar_t *path_new; + size_t path_new_size; + wchar_t *comp; + const wchar_t delims[] = L";"; int is_user; HKEY key_handle = 0; HKEY root_key; - const char *env_reg; + const wchar_t *env_reg; + /* wchar_t *tokctx; Context var for wcstok - not yet needed. */ g_hwndParent = hwndParent; EXDLL_INIT(); - setuservariable (INST_R0, "0"); - -/* MessageBox (g_hwndParent, "XXX 1", 0, MB_OK); */ + setuservariable (INST_R0, L"0"); /* Default return value. */ /* The expected stack layout: path component. */ - if (popstring (dir, sizeof (dir))) + if (popstringn (dir, COUNTOF (dir))) return; + dir[COUNTOF(dir)-1] = 0; /* The expected stack layout: HKEY component. */ - if (popstring (is_user_install, sizeof (is_user_install))) + if (popstringn (is_user_install, COUNTOF (is_user_install))) return; + is_user_install[COUNTOF(is_user_install)-1] = 0; - if (!strcmp(is_user_install, "1")) + if (!wcscmp (is_user_install, L"1")) { root_key = ENV_HK_USER; env_reg = ENV_REG_USER; @@ -1014,107 +1108,100 @@ path_add (HWND hwndParent, int string_size, char *variables, env_reg = ENV_REG; } - path = read_w32_registry_string (root_key, env_reg, "Path"); - - if (! path) + path = read_w32_registry_string (root_key, env_reg, L"Path"); + if (!path) { - path = strdup (""); + path = wcsdup (L""); } -/* MessageBox (g_hwndParent, "XXX 3", 0, MB_OK); */ - /* Old path plus semicolon plus dir plus terminating nul. */ - path_new_size = strlen (path) + 1 + strlen (dir) + 1; + path_new_size = wcslen (path) + 1 + wcslen (dir) + 1; if (path_new_size > PATH_LENGTH_LIMIT) { - MessageBox (g_hwndParent, "PATH env variable too big", 0, MB_OK); + MessageBox (g_hwndParent, L"PATH env variable too big", 0, MB_OK); free (path); return; } -/* MessageBox (g_hwndParent, "XXX 4", 0, MB_OK); */ - - path_new = malloc (path_new_size); + path_new = calloc (path_new_size, sizeof *path_new); if (!path_new) { free (path); return; } -/* MessageBox (g_hwndParent, "XXX 5", 0, MB_OK); */ - - strcpy (path_new, path); - strcat (path_new, ";"); - strcat (path_new, dir); - -/* MessageBox (g_hwndParent, "XXX 6", 0, MB_OK); */ -/* MessageBox (g_hwndParent, dir, 0, MB_OK); */ -/* MessageBox (g_hwndParent, "XXX 7", 0, MB_OK); */ + wcscpy (path_new, path); + wcscat (path_new, L";"); + wcscat (path_new, dir); /* Check if the directory already exists in the path. */ - comp = strtok (path, delims); + comp = wcstok (path, delims/*, &tokctx*/); do { -/* MessageBox (g_hwndParent, comp, 0, MB_OK); */ + /* MessageBox (g_hwndParent, comp, 0, MB_OK); */ if (!comp) break; - if (!strcmp (comp, dir)) + if (!wcscmp (comp, dir)) { free (path); free (path_new); return; } - comp = strtok (NULL, delims); + comp = wcstok (NULL, delims/*, &tokctx*/); } while (comp); free (path); /* Update the path key. */ - RegCreateKey (root_key, env_reg, &key_handle); - RegSetValueEx (key_handle, "Path", 0, REG_EXPAND_SZ, - path_new, path_new_size); + RegCreateKeyW (root_key, env_reg, &key_handle); + RegSetValueEx (key_handle, L"Path", 0, REG_EXPAND_SZ, + (unsigned char*)path_new, + wcslen (path_new) * sizeof *path_new); RegCloseKey (key_handle); - SetEnvironmentVariable("PATH", path_new); + SetEnvironmentVariableW(L"PATH", path_new); free (path_new); /* MessageBox (g_hwndParent, "XXX 9", 0, MB_OK); */ - setuservariable (INST_R0, "1"); + setuservariable (INST_R0, L"1"); /* success. */ } void __declspec(dllexport) -path_remove (HWND hwndParent, int string_size, char *variables, +path_remove (HWND hwndParent, int string_size, LPTSTR 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[] = ";"; + wchar_t dir[PATH_LENGTH_LIMIT]; + wchar_t is_user_install[2]; + wchar_t *path; + wchar_t *path_new; + size_t path_new_size; + wchar_t *comp; + const wchar_t delims[] = L";"; HKEY key_handle = 0; int changed = 0; int count = 0; HKEY root_key; - const char *env_reg; + const wchar_t *env_reg; + /* wchar_t *tokctx; Context var for wcstok - not yet needed. */ g_hwndParent = hwndParent; EXDLL_INIT(); - setuservariable (INST_R0, "0"); + setuservariable (INST_R0, L"0"); /* The expected stack layout: path component. */ - if (popstring (dir, sizeof (dir))) + if (popstringn (dir, COUNTOF (dir))) return; + dir[COUNTOF(dir)-1] = 0; /* The expected stack layout: HKEY component. */ - if (popstring (is_user_install, sizeof (is_user_install))) + if (popstringn (is_user_install, COUNTOF (is_user_install))) return; + is_user_install[COUNTOF(is_user_install)-1] = 0; - if (!strcmp(is_user_install, "1")) + if (!wcscmp (is_user_install, L"1")) { root_key = ENV_HK_USER; env_reg = ENV_REG_USER; @@ -1125,51 +1212,112 @@ path_remove (HWND hwndParent, int string_size, char *variables, env_reg = ENV_REG; } - path = read_w32_registry_string (root_key, env_reg, "Path"); - + path = read_w32_registry_string (root_key, env_reg, L"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); + path_new_size = wcslen (path) + 1; + path_new = calloc (path_new_size, sizeof *path_new); if (!path_new) { free (path); return; } - path_new[0] = '\0'; /* Compose the new path. */ - comp = strtok (path, delims); + comp = wcstok (path, delims/*, &tokctx*/); do { - if (strcmp (comp, dir)) + if (wcscmp (comp, dir)) { - if (count != 0) - strcat (path_new, ";"); - strcat (path_new, comp); + if (count) + wcscat (path_new, L";"); + wcscat (path_new, comp); count++; } else changed = 1; - - comp = strtok (NULL, delims); } - while (comp); + while ((comp = wcstok (NULL, delims/*, &tokctx*/))); free (path); - if (! changed) + if (!changed) { free (path_new); return; } /* Set a key for our CLSID. */ - RegCreateKey (root_key, env_reg, &key_handle); - RegSetValueEx (key_handle, "Path", 0, REG_EXPAND_SZ, - path_new, path_new_size); + RegCreateKeyW (root_key, env_reg, &key_handle); + RegSetValueEx (key_handle, L"Path", 0, REG_EXPAND_SZ, + (unsigned char*)path_new, + wcslen (path_new) * sizeof *path_new); RegCloseKey (key_handle); free (path_new); - setuservariable (INST_R0, "1"); + setuservariable (INST_R0, L"1"); /* success */ +} + + +/** @brief Kill processes with the name name. + * + * This function tries to kill a process using ExitProcess. + * + * If it does not work it does not work. No return values. + * The intention is to make an effort to kill something during + * installation / uninstallation. + * + * The function signature is explained by NSIS. + */ +void __declspec(dllexport) __cdecl KillProc(HWND hwndParent, + int string_size, + char *variables, + stack_t **stacktop) +{ + HANDLE h; + PROCESSENTRY32 pe32; + + if (!stacktop || !*stacktop || !(*stacktop)->text) + { + ERRORPRINTF ("Invalid call to KillProc."); + return; + } + + + h = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0); + if (h == INVALID_HANDLE_VALUE) + { + ERRORPRINTF ("Failed to create Toolhelp snapshot"); + return; + } + pe32.dwSize = sizeof (PROCESSENTRY32); + + if (!Process32First (h, &pe32)) + { + ERRORPRINTF ("Failed to get first process"); + CloseHandle (h); + return; + } + + do + { + if (!wcscmp ((*stacktop)->text, pe32.szExeFile)) + { + HANDLE hProc = OpenProcess (PROCESS_ALL_ACCESS, FALSE, + pe32.th32ProcessID); + if (!hProc) + { + ERRORPRINTF ("Failed to open process handle."); + continue; + } + if (!TerminateProcess (hProc, 1)) + { + ERRORPRINTF ("Failed to terminate process."); + } + CloseHandle (hProc); + } + } + while (Process32Next (h, &pe32)); + CloseHandle (h); } diff --git a/build-aux/speedo/w32/inst.nsi b/build-aux/speedo/w32/inst.nsi index bc41fac..cbf2d10 100644 --- a/build-aux/speedo/w32/inst.nsi +++ b/build-aux/speedo/w32/inst.nsi @@ -1,5 +1,5 @@ -# inst.nsi - Installer for GnuPG on Windows. -*- coding: latin-1; -*- -# Copyright (C) 2005, 2014 g10 Code GmbH +# inst.nsi - Installer for GnuPG on Windows. +# Copyright (C) 2005, 2014, 2019-2021 g10 Code GmbH # 2017 Intevation GmbH # # This file is part of GnuPG. @@ -31,6 +31,9 @@ # # WITH_GUI - Include the GPA GUI +# This one must be done before addplugindir. +Unicode true + !cd "${INST_DIR}" !addincludedir "${W32_SRCDIR}" !addplugindir "${BUILD_DIR}" @@ -64,7 +67,7 @@ File version: ${PROD_VERSION}\r\n\ Release date: ${BUILD_ISODATE}" !define ABOUT_GERMAN \ - "GnuPG is die häufigst verwendete Software zur Mail- und Datenverschlüsselung.\ + "GnuPG is die häufigst verwendete Software zur Mail- und Datenverschlüsselung.\ \r\n\r\n$_CLICK \ \r\n\r\n\r\n\r\n\r\nDies ist GnuPG Version ${VERSION}.\r\n\ Dateiversion: ${PROD_VERSION}\r\n\ @@ -256,14 +259,14 @@ LangString T_GPLShort ${LANG_ENGLISH} \ You may distribute it as long as you give the recipients the same \ rights you have received." LangString T_GPLShort ${LANG_GERMAN} \ - "In aller Kürze: Sie haben das Recht, die Software zu jedem Zweck \ - einzusetzen. Sie können die Software weitergeben, sofern Sie dem \ - Empfänger dieselben Rechte einräumen, die auch Sie erhalten haben." + "In aller Kürze: Sie haben das Recht, die Software zu jedem Zweck \ + einzusetzen. Sie können die Software weitergeben, sofern Sie dem \ + Empfänger dieselben Rechte einräumen, die auch Sie erhalten haben." LangString T_RunKeyManager ${LANG_ENGLISH} \ "Run the key manager" LangString T_RunKeyManager ${LANG_GERMAN} \ - "Die Schlüsselverwaltung aufrufen" + "Die Schlüsselverwaltung aufrufen" LangString T_MoreInfo ${LANG_ENGLISH} \ "Click here to see how to help the GnuPG Project" @@ -280,8 +283,8 @@ LangString T_ShowReadme ${LANG_GERMAN} \ LangString T_NoKeyManager ${LANG_ENGLISH} \ "No key manager has been installed, thus we can't run one now." LangString T_NoKeyManager ${LANG_GERMAN} \ - "Es wurde keine Schlüsselverwaltung installiert. \ - Deswegen kann sie jetzt auch nicht ausgeführt werden." + "Es wurde keine Schlüsselverwaltung installiert. \ + Deswegen kann sie jetzt auch nicht ausgeführt werden." # Functions @@ -289,7 +292,7 @@ LangString T_NoKeyManager ${LANG_GERMAN} \ LangString T_AlreadyRunning ${LANG_ENGLISH} \ "An instance of this installer is already running." LangString T_AlreadyRunning ${LANG_GERMAN} \ - "Ein Exemplar dieses Installers läuft bereits." + "Ein Exemplar dieses Installers läuft bereits." Function G4wRunOnce Push $R0 @@ -416,23 +419,23 @@ LangString T_InstallOptLinks ${LANG_GERMAN} "Startlinks" LangString T_InstOptLabelA ${LANG_ENGLISH} \ "Please select where GnuPG shall install links:" LangString T_InstOptLabelA ${LANG_GERMAN} \ - "Bitte wählen Sie, welche Verknüpfungen angelegt werden sollen:" + "Bitte wählen Sie, welche Verknüpfungen angelegt werden sollen:" LangString T_InstOptLabelB ${LANG_ENGLISH} \ "(Only programs will be linked into the quick launch bar.)" LangString T_InstOptLabelB ${LANG_GERMAN} \ - "(In die Schnellstartleiste werden nur Verknüpfungen für \ + "(In die Schnellstartleiste werden nur Verknüpfungen für \ Programme angelegt.) " LangString T_InstOptFieldA ${LANG_ENGLISH} \ "Start Menu" LangString T_InstOptFieldA ${LANG_GERMAN} \ - "Startmenü" + "Startmenü" LangString T_InstOptFieldB ${LANG_ENGLISH} \ "Desktop" LangString T_InstOptFieldB ${LANG_GERMAN} \ - "Arbeitsfläche" + "Arbeitsfläche" LangString T_InstOptFieldC ${LANG_ENGLISH} \ "Quick Launch Bar" @@ -447,9 +450,9 @@ LangString T_FoundExistingVersion ${LANG_ENGLISH} \ Do you want to overwrite it with version ${VERSION}?" LangString T_FoundExistingVersion ${LANG_GERMAN} \ "Version $R1 ist hier bereits installiert. $\r$\n\ - Möchten Sie diese mit Version ${VERSION} überschreiben? $\r$\n\ + Möchten Sie diese mit Version ${VERSION} überschreiben? $\r$\n\ $\r$\n\ - (Sie können in jedem Fall mit JA antworten, falls es sich um \ + (Sie können in jedem Fall mit JA antworten, falls es sich um \ eine neuere oder dieselbe Version handelt.)" LangString T_FoundExistingVersionB ${LANG_ENGLISH} \ "A version of GnuPG has already been installed on the system. \ @@ -460,7 +463,7 @@ LangString T_FoundExistingVersionB ${LANG_GERMAN} \ "Eine Version von GnuPG ist hier bereits installiert. \ $\r$\n\ $\r$\n\ - Möchten die die Installation von GnuPG fortführen?" + Möchten die die Installation von GnuPG fortführen?" @@ -476,16 +479,16 @@ LangString T_AdminWanted ${LANG_GERMAN} \ Administratorrechten zu installieren. \ $\r$\n\ $\r$\n\ - Möchten die die Installation von GnuPG ohne Administratorrechte fortführen?" + Möchten die die Installation von GnuPG ohne Administratorrechte fortführen?" # From Function PrintCloseOtherApps LangString T_CloseOtherApps ${LANG_ENGLISH} \ "Please make sure that other applications are not running. \ GnuPG will try to install anyway but a reboot may be required." LangString T_CloseOtherApps ${LANG_GERMAN} \ - "Bitte stellen Sie sicher, daß alle anderen Anwendugen geschlossen \ + "Bitte stellen Sie sicher, daß alle anderen Anwendugen geschlossen \ sind. GnuPG wird auf jeden Fall versuchen, eine Installation \ - durchzuführen; es ist dann aber u.U. notwendig, das System neu zu starten." + durchzuführen; es ist dann aber u.U. notwendig, das System neu zu starten." # TrimNewlines - taken from the NSIS reference @@ -659,7 +662,6 @@ Section "GnuPG" SEC_gnupg File "share/gnupg/sks-keyservers.netCA.pem" SetOutPath "$INSTDIR\share\doc\gnupg\examples" - File "share/doc/gnupg/examples/VS-NfD.prf" File "share/doc/gnupg/examples/Automatic.prf" File "share/doc/gnupg/examples/pwpattern.list" @@ -728,7 +730,7 @@ LangString DESC_SEC_gnupg ${LANG_ENGLISH} \ LangString DESC_SEC_gnupg ${LANG_GERMAN} \ "Der GnuPG Core ist, wie der Name schon sagt, der Kernbestandteil \ dieser Software. Der GnuPG Core stellt die eigentliche \ - Verschlüsselung sowie die Verwaltung der Schlüssel bereit." + Verschlüsselung sowie die Verwaltung der Schlüssel bereit." LangString DESC_Menu_gnupg_manual ${LANG_ENGLISH} \ "Show the manual for the GnuPG Core" @@ -981,7 +983,7 @@ SectionEnd LangString DESC_SEC_gpa ${LANG_ENGLISH} \ "The GnuPG Assistant is the graphical interface of GnuPG" LangString DESC_SEC_gpa ${LANG_GERMAN} \ - "Der GnuPG Assistent ist die graphische Oberfläche von GnuPG." + "Der GnuPG Assistent ist die graphische Oberfläche von GnuPG." LangString DESC_Menu_gpa ${LANG_ENGLISH} \ "Run the GnuGP Assistant." @@ -1324,7 +1326,6 @@ Section "-un.gnupg" Delete "$INSTDIR\bin\gpg-check-pattern.exe" Delete "$INSTDIR\bin\gpg-wks-client.exe" - Delete "$INSTDIR\share\doc\gnupg\examples\VS-NfD.prf" Delete "$INSTDIR\share\doc\gnupg\examples\Automatic.prf" Delete "$INSTDIR\share\doc\gnupg\examples\pwpattern.list" RMDir "$INSTDIR\share\doc\gnupg\examples" diff --git a/build-aux/speedo/w32/wixlib.wxs b/build-aux/speedo/w32/wixlib.wxs index d3ffc08..5d84336 100644 --- a/build-aux/speedo/w32/wixlib.wxs +++ b/build-aux/speedo/w32/wixlib.wxs @@ -157,9 +157,6 @@ and then manually edited: <Component Id="cmpB5509E83C14EE3080355A3EAF09D1C8D" Directory="dir6694D0A4AAD84EF827096DD86D1B4FA2" Guid="FEC81836-944E-4613-A498-E620B981EB04"> <File Id="fil0615847C26E386E0B892124531F2ABBC" KeyPath="yes" Source="$(var.SourceDir)\lib\libnpth.dll.a" Name="libnpth.imp"/> </Component> - <Component Id="cmp909B0412FDFCFD5092D93932AF982A72" Directory="dirC2E6BF1CC65903EA3A1AD83349586122" Guid="D30E7138-0D1C-48F4-8F53-E1EC6333F610"> - <File Id="fil322067E40CE41C36574A7CC520D75876" KeyPath="yes" Source="$(var.SourceDir)\share\doc\gnupg\examples\VS-NfD.prf" Name="VS-NfD.prf"/> - </Component> <Component Id="cmp909B0412FDFCFD5092D93932AF982A73" Directory="dirC2E6BF1CC65903EA3A1AD83349586122" Guid="D30E7138-0D1C-48F4-8F53-E1EC6333F611"> <File Id="fil322067E40CE41C36574A7CC520D75877" KeyPath="yes" Source="$(var.SourceDir)\share\doc\gnupg\examples\Automatic.prf" Name="Automatic.prf"/> </Component> |