Add deprecated ExtraPlugins plugin to blocklist
@@ -198,39 +198,43 @@ static BOOLEAN EnumPluginsDirectoryCallback(
_In_opt_ PVOID Context
)
{
+ static PCWSTR PhpPluginBlocklist[] =
+ {
+ L"CommonUtil.dll",
+ L"ExtraPlugins.dll"
+ };
+ BOOLEAN blacklistedPlugin = FALSE;
PH_STRINGREF baseName;
PPH_STRING fileName;
baseName.Buffer = Information->FileName;
baseName.Length = Information->FileNameLength;
- if (PhEndsWithStringRef2(&baseName, L".dll", TRUE))
+ for (ULONG i = 0; i < ARRAYSIZE(PhpPluginBlocklist); i++)
+ {
+ if (PhEndsWithStringRef2(&baseName, PhpPluginBlocklist[i], TRUE))
{
- // Plugin blacklist
- if (PhEndsWithStringRef2(&baseName, L"CommonUtil.dll", TRUE))
+ blacklistedPlugin = TRUE;
+ break;
+ }
+ }
+
+ if (blacklistedPlugin)
{
- fileName = PhCreateStringEx(NULL, PluginsDirectory->Length + Information->FileNameLength);
- memcpy(fileName->Buffer, PluginsDirectory->Buffer, PluginsDirectory->Length);
- memcpy(&fileName->Buffer[PluginsDirectory->Length / 2], Information->FileName, Information->FileNameLength);
+ fileName = PhConcatStringRef2(&PluginsDirectory->sr, &baseName);
PhDeleteFileWin32(fileName->Buffer);
PhDereferenceObject(fileName);
}
- else
- {
- if (!PhIsPluginDisabled(&baseName))
+ else if (!PhIsPluginDisabled(&baseName))
{
- fileName = PhCreateStringEx(NULL, PluginsDirectory->Length + Information->FileNameLength);
- memcpy(fileName->Buffer, PluginsDirectory->Buffer, PluginsDirectory->Length);
- memcpy(&fileName->Buffer[PluginsDirectory->Length / 2], Information->FileName, Information->FileNameLength);
+ fileName = PhConcatStringRef2(&PluginsDirectory->sr, &baseName);
PhLoadPlugin(fileName);
PhDereferenceObject(fileName);
}
- }
- }
return TRUE;
}
