From 2fa5cd37b832c035e6594b2569d83d7032269743 Mon Sep 17 00:00:00 2001 From: anders_k Date: Mon, 6 Apr 2020 18:04:10 +0000 Subject: [PATCH] Added RegKeyIsEmpty LogicLib operator git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7165 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/generalpurpose.but | 2 +- Docs/src/history.but | 2 +- Include/LogicLib.nsh | 18 ++++++++++++++++++ Include/x64.nsh | 9 +++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Docs/src/generalpurpose.but b/Docs/src/generalpurpose.but index 47c3b142..a16376d1 100644 --- a/Docs/src/generalpurpose.but +++ b/Docs/src/generalpurpose.but @@ -85,7 +85,7 @@ This is similar to \R{getfiletime}{GetFileTime}, only it acts on the system buil \c user_var(output) knownfolderid -Get the path of a \W{https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid}{known folder}. The error flag is set and the output variable is empty if the call fails or the knownfolderid guid is not available. This function is only able to resolve known folders Windows Vista or higher. +Get the path of a \W{https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid}{known folder}. The error flag is set and the output variable is empty if the call fails or the knownfolderid guid is not available. This function is only able to resolve known folders on Windows Vista or higher. \c !include WinCore.nsh \c !include LogicLib.nsh diff --git a/Docs/src/history.but b/Docs/src/history.but index 1f84fe83..76a9dc20 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -6,7 +6,7 @@ Released on ? ?th, 2020 \S1{v3.06-rl} Release Notes -? +20th anniversary \S1{v3.06-cl} Changelog diff --git a/Include/LogicLib.nsh b/Include/LogicLib.nsh index 5cd21e3c..33f98d26 100644 --- a/Include/LogicLib.nsh +++ b/Include/LogicLib.nsh @@ -68,6 +68,8 @@ ; ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a; ; ${SectionIsReadOnly} a; ${SectionIsExpanded} a; ; ${SectionIsPartiallySelected} a +; Additional tests: +; HK RegKeyIsEmpty SubKey ; ; Examples: ; See LogicLib.nsi in the Examples folder for lots of example usage. @@ -351,6 +353,22 @@ !macroend !define AltRegView `"" AltRegView ""` + !macro _RegKeyIsEmpty _a _b _t _f + !insertmacro _LOGICLIB_TEMP + ClearErrors + EnumRegValue $_LOGICLIB_TEMP ${_a} `${_b}` "" + !if `${_f}` != `` + IfErrors "" `${_f}` ; Skip calls to EnumRegKey and _== if possible + !else + IfErrors +3 + StrCpy $_LOGICLIB_TEMP "1" ; The default value is also named "", make sure we don't mistake it as empty + Goto +2 + !endif + EnumRegKey $_LOGICLIB_TEMP ${_a} `${_b}` "" + !insertmacro _== $_LOGICLIB_TEMP "" `${_t}` `${_f}` + !macroend + !define RegKeyIsEmpty `RegKeyIsEmpty` + ; "Any instruction" test !macro _Cmd _a _b _t _f !define _t=${_t} diff --git a/Include/x64.nsh b/Include/x64.nsh index 2b77ed57..59d9e8c2 100644 --- a/Include/x64.nsh +++ b/Include/x64.nsh @@ -23,6 +23,15 @@ ; Abort "Unsupported CPU architecture!" ; ${EndIf} ; +; ${If} ${IsNativeAMD64} +; File "amd64\myapp.exe" +; ${ElseIf} ${IsNativeIA32} +; ${OrIf} ${IsWow64} +; File "x86\myapp.exe" +; ${Else} +; Abort "Unsupported CPU architecture!" +; ${EndIf} +; ; DisableX64FSRedirection disables file system redirection. ; EnableX64FSRedirection enables file system redirection. ;