Don't allow scripts to delete a HKEY root
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6964 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
06984d4da3
commit
d0abb34ae8
1 changed files with 2 additions and 1 deletions
|
@ -187,7 +187,7 @@ static LONG NSISCALL DeleteRegTree(HKEY hThisKey, LPCTSTR SubKey, REGSAM Samview
|
|||
TCHAR child[MAX_PATH+1]; // NB - don't change this to static (recursive function)
|
||||
while (RegEnumKey(hKey, 0, child, COUNTOF(child)) == ERROR_SUCCESS)
|
||||
{
|
||||
if (onlyifempty) return (RegCloseKey(hKey), !ERROR_SUCCESS);
|
||||
if (onlyifempty) return (RegCloseKey(hKey), ERROR_CAN_NOT_COMPLETE);
|
||||
if ((retval = DeleteRegTree(hKey, child, SamviewAndFlags)) != ERROR_SUCCESS) break;
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
|
@ -210,6 +210,7 @@ static LONG NSISCALL DeleteRegTree(HKEY hThisKey, LPCTSTR SubKey, REGSAM Samview
|
|||
static LONG NSISCALL RegDeleteScriptKey(int RootKey, LPCTSTR SubKey, REGSAM SamviewAndFlags)
|
||||
{
|
||||
HKEY hKey;
|
||||
if (!SubKey[0]) return ERROR_CAN_NOT_COMPLETE; // Don't allow scripts to delete a HKEY root
|
||||
SamviewAndFlags |= KEY_FROMSCRIPT;
|
||||
hKey = GetRegKeyAndSAM(GetRegRootKey(RootKey), &SamviewAndFlags);
|
||||
return hKey ? DeleteRegTree(hKey, SubKey, SamviewAndFlags) : ERROR_INVALID_HANDLE; // ERROR_CANTOPEN?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue