Remove allowAppDataPlugins.xml detection.

Simply plugins loading emplacement:
NPPM_GETAPPDATAPLUGINSALLOWED to check to see if loading plugins from "%APPDATA%\..\Local\Notepad++\plugins" is allowed.
If doLocalConf no
else yes
This commit is contained in:
Don HO 2018-11-03 19:45:04 +01:00
parent 7e555b67fc
commit e9a489c5c9
3 changed files with 11 additions and 7 deletions

View File

@ -384,7 +384,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64 };
#define NPPM_GETAPPDATAPLUGINSALLOWED (NPPMSG + 87)
// BOOL NPPM_GETAPPDATAPLUGINSALLOWED(0, 0)
// Check to see if loading plugins from "%APPDATA%\Notepad++\plugins" is allowed.
// Check to see if loading plugins from "%APPDATA%\..\Local\Notepad++\plugins" is allowed.
#define NPPM_GETCURRENTVIEW (NPPMSG + 88)
// INT NPPM_GETCURRENTVIEW(0, 0)

View File

@ -2287,14 +2287,19 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return _pFileSwitcherPanel->isVisible();
}
case NPPM_GETAPPDATAPLUGINSALLOWED: // if doLocal, it's always false - having doLocal environment cannot load plugins outside
{ // the presence of file "allowAppDataPlugins.xml" will be checked only when not doLocal
// OLD BEHAVIOUR:
// if doLocal, it's always false - having doLocal environment cannot load plugins outside
// the presence of file "allowAppDataPlugins.xml" will be checked only when not doLocal
//
// NEW BEHAVIOUR:
// No more file "allowAppDataPlugins.xml"
// if doLocal - not allowed. Otherwise - allowed.
case NPPM_GETAPPDATAPLUGINSALLOWED:
{
const TCHAR *appDataNpp = pNppParam->getAppDataNppDir();
if (appDataNpp[0]) // if not doLocal
{
generic_string allowAppDataPluginsPath(pNppParam->getNppPath());
PathAppend(allowAppDataPluginsPath, allowAppDataPluginsFile);
return ::PathFileExists(allowAppDataPluginsPath.c_str());
return TRUE;
}
return FALSE;
}

View File

@ -120,7 +120,6 @@ const int COPYDATA_FILENAMESW = 2;
const TCHAR fontSizeStrs[][3] = {TEXT(""), TEXT("5"), TEXT("6"), TEXT("7"), TEXT("8"), TEXT("9"), TEXT("10"), TEXT("11"), TEXT("12"), TEXT("14"), TEXT("16"), TEXT("18"), TEXT("20"), TEXT("22"), TEXT("24"), TEXT("26"), TEXT("28")};
const TCHAR localConfFile[] = TEXT("doLocalConf.xml");
const TCHAR allowAppDataPluginsFile[] = TEXT("allowAppDataPlugins.xml");
const TCHAR notepadStyleFile[] = TEXT("asNotepad.xml");
void cutString(const TCHAR *str2cut, std::vector<generic_string> & patternVect);