diff --git a/locales/de-DE/installer.json b/locales/de-DE/installer.json index fdd91cae..eeb0d9d7 100644 --- a/locales/de-DE/installer.json +++ b/locales/de-DE/installer.json @@ -11,6 +11,7 @@ "ArgusLocation": "Installationsort: {installDir}", "ArgusChange": "Ändern", "ArgusChooseFolder": "Installationsordner für Argus auswählen", + "ArgusProgramFilesNote": "Aus Sicherheitsgründen liegen die Dateien von privilegiertem Dienst, Administratorstart und Kernelsensoren weiterhin in {programFiles}. Sie werden erst angelegt, wenn diese Funktionen aktiviert werden.", "ArgusInstalling": "Argus wird installiert…", "ArgusUpdating": "Argus wird aktualisiert…", "ArgusInstalled": "Argus ist installiert", diff --git a/locales/en-US/installer.json b/locales/en-US/installer.json index ddcb5cab..5d47fc62 100644 --- a/locales/en-US/installer.json +++ b/locales/en-US/installer.json @@ -11,6 +11,7 @@ "ArgusLocation": "Install location: {installDir}", "ArgusChange": "Change", "ArgusChooseFolder": "Choose the folder to install Argus in", + "ArgusProgramFilesNote": "For security, files for the privileged service, “Run as administrator” and kernel sensors are still kept in {programFiles}. They are created only when these features are turned on.", "ArgusInstalling": "Installing Argus…", "ArgusUpdating": "Updating Argus…", "ArgusInstalled": "Argus is installed", diff --git a/locales/es-ES/installer.json b/locales/es-ES/installer.json index 0a5b181a..810b70d0 100644 --- a/locales/es-ES/installer.json +++ b/locales/es-ES/installer.json @@ -11,6 +11,7 @@ "ArgusLocation": "Ubicación de instalación: {installDir}", "ArgusChange": "Cambiar", "ArgusChooseFolder": "Seleccione la carpeta de instalación de Argus", + "ArgusProgramFilesNote": "Por seguridad, los archivos del servicio privilegiado, la ejecución como administrador y los sensores del kernel se siguen guardando en {programFiles}. Solo se crean al activar estas funciones.", "ArgusInstalling": "Instalando Argus…", "ArgusUpdating": "Actualizando Argus…", "ArgusInstalled": "Argus está instalado", diff --git a/locales/fr-FR/installer.json b/locales/fr-FR/installer.json index 94c57f40..862b969f 100644 --- a/locales/fr-FR/installer.json +++ b/locales/fr-FR/installer.json @@ -11,6 +11,7 @@ "ArgusLocation": "Emplacement d’installation : {installDir}", "ArgusChange": "Modifier", "ArgusChooseFolder": "Choisir le dossier d’installation d’Argus", + "ArgusProgramFilesNote": "Pour des raisons de sécurité, les fichiers du service privilégié, de l’exécution en administrateur et des capteurs du noyau restent dans {programFiles}. Ils ne sont créés qu’à l’activation de ces fonctions.", "ArgusInstalling": "Installation d’Argus…", "ArgusUpdating": "Mise à jour d’Argus…", "ArgusInstalled": "Argus est installé", diff --git a/locales/ja-JP/installer.json b/locales/ja-JP/installer.json index 553f1368..5c74c903 100644 --- a/locales/ja-JP/installer.json +++ b/locales/ja-JP/installer.json @@ -11,6 +11,7 @@ "ArgusLocation": "インストール先:{installDir}", "ArgusChange": "変更", "ArgusChooseFolder": "Argus のインストール先を選択", + "ArgusProgramFilesNote": "セキュリティ上の理由から、特権サービス、「管理者として実行」、カーネル センサーのファイルは引き続き {programFiles} に保存されます。これらの機能を有効にしたときにのみ作成されます。", "ArgusInstalling": "Argus をインストール中…", "ArgusUpdating": "Argus を更新中…", "ArgusInstalled": "Argus をインストールしました", diff --git a/locales/ru-RU/installer.json b/locales/ru-RU/installer.json index 7b0b475b..8123d050 100644 --- a/locales/ru-RU/installer.json +++ b/locales/ru-RU/installer.json @@ -11,6 +11,7 @@ "ArgusLocation": "Место установки: {installDir}", "ArgusChange": "Изменить", "ArgusChooseFolder": "Выберите папку для установки Argus", + "ArgusProgramFilesNote": "По соображениям безопасности файлы привилегированной службы, запуска от имени администратора и датчиков ядра по-прежнему хранятся в {programFiles}. Они создаются только при включении этих функций.", "ArgusInstalling": "Установка Argus…", "ArgusUpdating": "Обновление Argus…", "ArgusInstalled": "Argus установлен", diff --git a/locales/zh-CN/installer.json b/locales/zh-CN/installer.json index 373639a5..ba0b5e57 100644 --- a/locales/zh-CN/installer.json +++ b/locales/zh-CN/installer.json @@ -12,6 +12,7 @@ "ArgusLocation": "安装位置:{installDir}", "ArgusChange": "更改", "ArgusChooseFolder": "选择安装 Argus 的文件夹", + "ArgusProgramFilesNote": "出于安全考虑,特权服务、管理员运行与内核传感器的文件仍存放在 {programFiles},仅在开启这些功能后创建。", "ArgusInstalling": "正在安装 Argus…", "ArgusUpdating": "正在更新 Argus…", "ArgusInstalled": "安装完成", diff --git a/locales/zh-TW/installer.json b/locales/zh-TW/installer.json index bdedf86b..26fe26d1 100644 --- a/locales/zh-TW/installer.json +++ b/locales/zh-TW/installer.json @@ -12,6 +12,7 @@ "ArgusLocation": "安裝位置:{installDir}", "ArgusChange": "變更", "ArgusChooseFolder": "選取安裝 Argus 的資料夾", + "ArgusProgramFilesNote": "基於安全考量,特殊權限服務、以系統管理員身分執行與核心感測器的檔案仍存放在 {programFiles},僅在啟用這些功能後建立。", "ArgusInstalling": "正在安裝 Argus…", "ArgusUpdating": "正在更新 Argus…", "ArgusInstalled": "安裝完成", diff --git a/packaging/windows/installer-ui.nsh b/packaging/windows/installer-ui.nsh index df1d845d..8e06ebce 100644 --- a/packaging/windows/installer-ui.nsh +++ b/packaging/windows/installer-ui.nsh @@ -619,6 +619,9 @@ FunctionEnd Var ArgusOldVersion Var ArgusCompare ; 2: not installed; 1: upgrade; 0: same version; -1: newer installed Var ArgusLocationText +Var ArgusInfoIcon ; after the location outside Program Files (ArgusPlaceNote) +Var ArgusInfoFont +Var ArgusTip Function ArgusDetect StrCpy $ArgusCompare 2 @@ -684,12 +687,84 @@ Function ArgusPageMain !insertmacro ArgusPaint $1 link ${NSD_OnClick} $1 ArgusChangeLocation ${EndIf} + ; After the location, for a folder outside Program Files: an info glyph + ; (Segoe MDL2 Assets, in Windows 10 and 11) whose tooltip says what stays + ; in Program Files. ArgusPlaceNote shows or hides it. + ${ArgusScale} $R0 12 + IntOp $R0 0 - $R0 + System::Call 'gdi32::CreateFontW(i R0, i 0, i 0, i 0, i 400, i 0, i 0, i 0, i 1, i 0, i 0, i 5, i 0, w "Segoe MDL2 Assets") p .s' + Pop $ArgusInfoFont + IntOp $3 $2 + 3 + !insertmacro ArgusControl $ArgusInfoIcon dialog STATIC ${ARGUS_LABEL} 0 24 $3 16 16 "${U+E946}" $ArgusInfoFont + !insertmacro ArgusPaint $ArgusInfoIcon ink3 + Call ArgusCreateTip + Call ArgusPlaceNote Call ArgusHideButtons nsDialogs::Show Call ArgusReleaseButton FunctionEnd +; A tooltip over the info glyph and the location line, wrapped to most of the +; page's width, dark with the dark theme. TTF_IDISHWND | TTF_SUBCLASS: the +; controls (SS_NOTIFY) are the tools and pass the tooltip their mouse input. +Function ArgusCreateTip + ; WS_EX_TOPMOST; WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP; CW_USEDEFAULT. + System::Call 'user32::CreateWindowExW(i 0x8, w "tooltips_class32", p 0, i 0x80000003, i 0x80000000, i 0x80000000, i 0x80000000, i 0x80000000, p $HWNDPARENT, p 0, p 0, p 0) p .s' + Pop $ArgusTip + ${If} $ArgusDark = 1 + System::Call 'uxtheme::SetWindowTheme(p $ArgusTip, w "DarkMode_Explorer", p 0)' + ${EndIf} + ${ArgusScale} $R0 360 + SendMessage $ArgusTip 0x418 0 $R0 ; TTM_SETMAXTIPWIDTH + SendMessage $ArgusTip 0x403 2 30000 ; TTM_SETDELAYTIME, TTDT_AUTOPOP + StrCpy $R1 "$(ArgusProgramFilesNote)" + System::Call 'user32::GetParent(p $ArgusInfoIcon) p .R2' + ${ForEach} $R3 0 1 + 1 + ${If} $R3 = 0 + StrCpy $R4 $ArgusInfoIcon + ${Else} + StrCpy $R4 $ArgusLocationText + ${EndIf} + ; TOOLINFOW: cbSize, uFlags, hwnd, uId, rect, hinst, lpszText, lParam, lpReserved. + System::Call '*(&l4, i 0x11, p R2, p R4, i 0, i 0, i 0, i 0, p 0, w R1, p 0, p 0) p .R5' + SendMessage $ArgusTip 0x432 0 $R5 ; TTM_ADDTOOLW + System::Free $R5 + ${Next} +FunctionEnd + +; The components that run as administrator or SYSTEM (the privileged service, +; administrator startup and the sensor driver) are copied to Program Files +; whatever the install folder: elsewhere a standard user could replace them. +; For a folder outside it, the info glyph follows the location's text, which +; is shortened (with an ellipsis) to leave it room, and the tooltip is on. +Function ArgusPlaceNote + StrCpy $0 "$PROGRAMFILES64\" + StrLen $1 $0 + StrCpy $1 "$INSTDIR\" $1 + IntOp $3 $ArgusWidth - 120 ; the location line's width + ${If} $1 == $0 ; StrCmp ignores case, as paths do + ShowWindow $ArgusInfoIcon ${SW_HIDE} + SendMessage $ArgusTip 0x401 0 0 ; TTM_ACTIVATE + ${Else} + IntOp $3 $3 - 22 + StrCpy $R5 "$(ArgusLocation)" + !insertmacro ArgusTextWidth $4 "$R5" $ArgusFontSmall + IntOp $4 $4 + 2 + ${IfThen} $4 > $3 ${|} StrCpy $4 $3 ${|} + IntOp $4 $4 + 28 ; the left margin and a gap + IntOp $5 $ArgusHeight - 37 + ${ArgusScale} $4 $4 + ${ArgusScale} $5 $5 + System::Call 'user32::SetWindowPos(p $ArgusInfoIcon, p 0, i r4, i r5, i 0, i 0, i 0x15)' + ShowWindow $ArgusInfoIcon ${SW_SHOW} + SendMessage $ArgusTip 0x401 1 0 + ${EndIf} + ${ArgusScale} $3 $3 + ${ArgusScale} $4 20 + System::Call 'user32::SetWindowPos(p $ArgusLocationText, p 0, i 0, i 0, i r3, i r4, i 0x16)' +FunctionEnd + Function ArgusPageMainLeave ; A newer version blocks the button; Enter must not get past it either. ${IfThen} $ArgusCompare = -1 ${|} Abort ${|} @@ -715,6 +790,7 @@ Function ArgusChangeLocation ${EndIf} StrCpy $INSTDIR $0 SendMessage $ArgusLocationText ${WM_SETTEXT} 0 "STR:$(ArgusLocation)" + Call ArgusPlaceNote ${EndIf} FunctionEnd diff --git a/scripts/lib/installer-locales.mjs b/scripts/lib/installer-locales.mjs index b484edd7..115de676 100644 --- a/scripts/lib/installer-locales.mjs +++ b/scripts/lib/installer-locales.mjs @@ -6,7 +6,7 @@ export const installerLanguages = { "en-US": "ENGLISH", "zh-CN": "SIMPCHINESE", "zh-TW": "TRADCHINESE", "es-ES": "SPANISH", "de-DE": "GERMAN", "ja-JP": "JAPANESE", "fr-FR": "FRENCH", "ru-RU": "RUSSIAN", }; -const variables = { version: "${DISPLAYVERSION}", oldVersion: "$ArgusOldVersion", installDir: "$INSTDIR", product: "${PRODUCTNAME}", code: "$0" }; +const variables = { version: "${DISPLAYVERSION}", oldVersion: "$ArgusOldVersion", installDir: "$INSTDIR", product: "${PRODUCTNAME}", code: "$0", programFiles: "$PROGRAMFILES64" }; export function nsisText(text) { return text.replaceAll("$", () => "$$").replaceAll('"', '$\\"').replaceAll("\r", "").replaceAll("\n", "$\\r$\\n") .replace(/\{(\w+)\}/g, (_, key) => {