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
This commit is contained in:
kichik 2005-04-08 14:04:05 +00:00
parent a28ec7b3c1
commit 7c0a2a1851
2 changed files with 8 additions and 3 deletions

View file

@ -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

View file

@ -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);
}