Move plugins home from %ProgramData% to %ProgramFiles% for the sake of security

Whole specs here:
https://notepad-plus-plus.org/community/topic/16996/new-plugins-home-round-2
This commit is contained in:
Don HO 2019-01-25 02:10:11 +01:00
parent c1bf412f57
commit 9fecbae030
4 changed files with 15 additions and 39 deletions

View File

@ -148,16 +148,10 @@ SectionGroup un.Plugins
RMDir "$PLUGIN_INST_PATH\mimeTools"
SectionEnd
Section un.PluginManager
Delete "$INSTDIR\plugins\PluginManager.dll"
Delete "$UPDATE_PATH\plugins\Config\PluginManager.ini"
Delete "$INSTDIR\updater\gpup.exe"
RMDir "$INSTDIR\updater\"
SectionEnd
Section un.DSpellCheck
Delete "$INSTDIR\plugins\DSpellCheck.dll"
Delete "$INSTDIR\plugins\DSpellCheck\DSpellCheck.dll"
Delete "$PLUGIN_INST_PATH\DSpellCheck\DSpellCheck.dll"
Delete "$UPDATE_PATH\plugins\Config\DSpellCheck.ini"
Delete "$ALLUSERS_PLUGIN_CONF_PATH\DSpellCheck.ini"

View File

@ -47,39 +47,28 @@ initUpdatePath:
SetOutPath "$INSTDIR\"
StrCpy $PLUGIN_INST_PATH "$INSTDIR\plugins"
StrCpy $ALLUSERS_PLUGIN_CONF_PATH "$PLUGIN_INST_PATH\Config"
${If} $noUserDataChecked == ${BST_CHECKED}
File "..\bin\doLocalConf.xml"
StrCpy $PLUGIN_INST_PATH "$INSTDIR\plugins"
StrCpy $ALLUSERS_PLUGIN_CONF_PATH "$INSTDIR\plugins\Config"
StrCpy $USER_PLUGIN_CONF_PATH "$INSTDIR\plugins\Config"
StrCpy $USER_PLUGIN_CONF_PATH "$ALLUSERS_PLUGIN_CONF_PATH"
CreateDirectory $PLUGIN_INST_PATH\config
${ELSE}
IfFileExists $INSTDIR\doLocalConf.xml 0 +2
Delete $INSTDIR\doLocalConf.xml
; "SetShellVarContext all" makes "$APPDATA\${APPNAME}\plugins" to "%PROGRAMDATA%\Notepad++\plugins"
SetShellVarContext all
StrCpy $PLUGIN_INST_PATH "$APPDATA\${APPNAME}\plugins"
StrCpy $ALLUSERS_PLUGIN_CONF_PATH "$APPDATA\${APPNAME}\plugins\Config"
CreateDirectory $PLUGIN_INST_PATH
AccessControl::GrantOnFile "$PLUGIN_INST_PATH" "(S-1-5-32-545)" "ListDirectory + GenericRead + GenericExecute"
CreateDirectory $ALLUSERS_PLUGIN_CONF_PATH
AccessControl::GrantOnFile "$ALLUSERS_PLUGIN_CONF_PATH" "(S-1-5-32-545)" "FullAccess"
SetShellVarContext current
StrCpy $USER_PLUGIN_CONF_PATH "$APPDATA\${APPNAME}\plugins\Config"
StrCpy $UPDATE_PATH "$APPDATA\${APPNAME}"
CreateDirectory $UPDATE_PATH\plugins\config
${EndIf}
WriteIniStr "$INSTDIR\uninstall.ini" "Uninstall" "UPDATE_PATH" $UPDATE_PATH
WriteIniStr "$INSTDIR\uninstall.ini" "Uninstall" "PLUGIN_INST_PATH" $PLUGIN_INST_PATH
WriteIniStr "$INSTDIR\uninstall.ini" "Uninstall" "USER_PLUGIN_CONF_PATH" $USER_PLUGIN_CONF_PATH
WriteIniStr "$INSTDIR\uninstall.ini" "Uninstall" "ALLUSERS_PLUGIN_CONF_PATH" $ALLUSERS_PLUGIN_CONF_PATH
; WriteIniStr "$INSTDIR\uninstall.ini" "Uninstall" "UPDATE_PATH" $UPDATE_PATH
; WriteIniStr "$INSTDIR\uninstall.ini" "Uninstall" "PLUGIN_INST_PATH" $PLUGIN_INST_PATH
; WriteIniStr "$INSTDIR\uninstall.ini" "Uninstall" "USER_PLUGIN_CONF_PATH" $USER_PLUGIN_CONF_PATH
; WriteIniStr "$INSTDIR\uninstall.ini" "Uninstall" "ALLUSERS_PLUGIN_CONF_PATH" $ALLUSERS_PLUGIN_CONF_PATH
alreadyDone:
FunctionEnd
@ -91,6 +80,7 @@ Function un.setPathAndOptions
ReadINIStr $ALLUSERS_PLUGIN_CONF_PATH "$INSTDIR\uninstall.ini" "Uninstall" "ALLUSERS_PLUGIN_CONF_PATH"
FunctionEnd
Function copyCommonFiles
SetOverwrite off
SetOutPath "$UPDATE_PATH\"

View File

@ -1012,14 +1012,13 @@ bool NppParameters::load()
}
}
_pluginRootDir = _nppPath;
PathAppend(_pluginRootDir, TEXT("plugins"));
generic_string nppPluginRootParent;
if (_isLocal)
{
_userPath = nppPluginRootParent = _nppPath;
_pluginRootDir = _nppPath;
PathAppend(_pluginRootDir, TEXT("plugins"));
_userPluginConfDir = _pluginRootDir;
PathAppend(_userPluginConfDir, TEXT("Config"));
}
@ -1039,18 +1038,11 @@ bool NppParameters::load()
if (!PathFileExists(_userPluginConfDir.c_str()))
::CreateDirectory(_userPluginConfDir.c_str(), NULL);
_pluginRootDir = getSpecialFolderLocation(CSIDL_COMMON_APPDATA);
PathAppend(_pluginRootDir, TEXT("Notepad++"));
nppPluginRootParent = _pluginRootDir;
PathAppend(_pluginRootDir, TEXT("plugins"));
// For PluginAdmin to launch the wingup with UAC
setElevationRequired(true);
}
_pluginConfDir = _pluginRootDir;
_pluginConfDir = _pluginRootDir; // for plugin list home
PathAppend(_pluginConfDir, TEXT("Config"));
if (!PathFileExists(nppPluginRootParent.c_str()))

View File

@ -10,7 +10,7 @@
<!--
The following shortcuts are dangerous if your computer is compromised.
(But if your computer is compromised, EVERYTHING IS DANGEROUS!)
Remove the comment and use them with your own risk!!!
Remove the comment and use them at your own risk!!!
<Command name="Launch in Firefox" Ctrl="yes" Alt="yes" Shift="yes" Key="88">firefox &quot;$(FULL_CURRENT_PATH)&quot;</Command>
<Command name="Launch in IE" Ctrl="yes" Alt="yes" Shift="yes" Key="73">iexplore &quot;$(FULL_CURRENT_PATH)&quot;</Command>