From 7c0a2a1851dc9ed9f26d04b548e366df3b145f49 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 8 Apr 2005 14:04:05 +0000 Subject: [PATCH] fixed bug #1178756 - EnumRegValue now sets the error flag if the enumeration index is out of range git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3951 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/registry.but | 5 +++-- Source/exehead/exec.c | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Docs/src/registry.but b/Docs/src/registry.but index 0a9a0cf5..2489a300 100644 --- a/Docs/src/registry.but +++ b/Docs/src/registry.but @@ -60,12 +60,13 @@ Set user variable $x with the name of the 'index'th registry key in root_key\\Su \c user_var(output) root_key subkey index -Set user variable $x with the name of the 'index'th registry value in root_key\\Subkey. Valid values for root_key are listed under WriteRegStr. Returns an empty string if there are no more values, and returns an empty string and sets the error flag if there is an error. +Set user variable $x with the name of the 'index'th registry value in root_key\\Subkey. Valid values for root_key are listed under WriteRegStr. Returns an empty string and sets the error flag if there are no more values or if there is an error. \c StrCpy $0 0 \c loop: +\c ClearErrors \c EnumRegValue $1 HKLM Software\Microsoft\Windows\CurrentVersion $0 -\c StrCmp $1 "" done +\c IfErrors done \c IntOp $0 $0 + 1 \c ReadRegStr $2 HKLM Software\Microsoft\Windows\CurrentVersion $1 \c MessageBox MB_YESNO|MB_ICONQUESTION "$1 = $2$\n$\nMore?" IDYES loop diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index 2ec4706d..de710265 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -1223,7 +1223,11 @@ static int NSISCALL ExecuteEntry(entry *entry_) { DWORD d=NSIS_MAX_STRLEN-1; if (parm4) RegEnumKey(key,b,p,d); - else RegEnumValue(key,b,p,&d,NULL,NULL,NULL,NULL); + else if (RegEnumValue(key,b,p,&d,NULL,NULL,NULL,NULL)!=ERROR_SUCCESS) + { + exec_error++; + break; + } p[NSIS_MAX_STRLEN-1]=0; RegCloseKey(key); }