31 typedef struct _PHP_PLUGIN_LOAD_ERROR
37 typedef struct _PHP_PLUGIN_MENU_HOOK
54 _In_ BOOLEAN StartupParameters
62 static ULONG NextPluginId =
IDPLUGINS + 1;
97 _Out_opt_ PULONG FoundIndex
103 remainingPart = List->sr;
105 while (remainingPart.
Length != 0)
112 *FoundIndex = (ULONG)(namePart.
Buffer - List->Buffer);
149 if (Disable && !found)
153 if (disabled->
Length != 0)
159 memcpy(&newDisabled->
Buffer[disabled->
Length / 2 + 1], BaseName->Buffer, BaseName->Length);
169 else if (!Disable && found)
175 removeCount = (ULONG)BaseName->Length / 2;
177 if (foundIndex + (ULONG)BaseName->Length / 2 < (ULONG)disabled->
Length / 2)
182 else if (foundIndex != 0)
190 memcpy(newDisabled->
Buffer, disabled->
Buffer, foundIndex *
sizeof(WCHAR));
191 memcpy(&newDisabled->
Buffer[foundIndex], &disabled->
Buffer[foundIndex + removeCount],
192 disabled->
Length - removeCount *
sizeof(WCHAR) - foundIndex *
sizeof(WCHAR));
200 static BOOLEAN EnumPluginsDirectoryCallback(
202 _In_opt_ PVOID Context
208 baseName.
Buffer = Information->FileName;
209 baseName.
Length = Information->FileNameLength;
217 memcpy(&fileName->
Buffer[PluginsDirectory->
Length / 2], Information->FileName, Information->FileNameLength);
235 HANDLE pluginsDirectoryHandle;
248 PluginsDirectory = pluginsDirectory;
252 &pluginsDirectoryHandle,
264 NtClose(pluginsDirectoryHandle);
279 for (i = 0; i < LoadErrors->
Count; i++)
281 loadError = LoadErrors->
Items[i];
292 MB_ICONERROR | MB_YESNO,
298 for (i = 0; i < LoadErrors->
Count; i++)
300 loadError = LoadErrors->
Items[i];
350 if (!LoadLibrary(fileName->
Buffer))
380 _In_ BOOLEAN StartupParameters
421 for (i = 0; i < parameters->
Count; i++)
439 buffer = Name->Buffer;
440 count = Name->Length /
sizeof(WCHAR);
442 for (i = 0; i < count; i++)
444 if (!iswalnum(buffer[i]) && buffer[i] !=
' ' && buffer[i] !=
'.' && buffer[i] !=
'_')
494 plugin->
Name = pluginName;
551 lookupPlugin.
Name = *Name;
555 return CONTAINING_RECORD(links,
PH_PLUGIN, Links);
571 return &Plugin->Information;
591 return &Plugin->Callbacks[Callback];
609 return &GeneralCallbacks[Callback];
628 nextPluginId = NextPluginId;
629 NextPluginId += Count;
658 _In_ ULONG_PTR Location,
659 _In_opt_ PWSTR InsertAfter,
662 _In_opt_ PVOID Context
667 addMenuItem.
Plugin = Plugin;
669 addMenuItem.
Text = Text;
672 if (Location < 0x1000)
674 addMenuItem.
Location = (ULONG)Location;
682 Id &= ~PH_MENU_ITEM_VALID_FLAGS;
708 Statistics->CommitPages = PhGetItemCircularBuffer_ULONG(&
PhCommitHistory, 0);
709 Statistics->PhysicalPages = PhGetItemCircularBuffer_ULONG(&
PhPhysicalHistory, 0);
711 Statistics->MaxCpuProcessId = UlongToHandle(PhGetItemCircularBuffer_ULONG(&
PhMaxCpuHistory, 0));
712 Statistics->MaxIoProcessId = UlongToHandle(PhGetItemCircularBuffer_ULONG(&
PhMaxIoHistory, 0));
725 #ifdef PH_RECORD_MAX_USAGE
730 Statistics->MaxCpuUsageHistory = NULL;
731 Statistics->MaxIoReadOtherHistory = NULL;
732 Statistics->MaxIoWriteHistory = NULL;
736 static VOID NTAPI PhpPluginEMenuItemDeleteFunction(
742 pluginMenuItem = Item->
Context;
772 _In_opt_ PVOID Context
782 pluginMenuItem->
Plugin = Plugin;
783 pluginMenuItem->
Id = Id;
784 pluginMenuItem->
Context = Context;
786 item->
Context = pluginMenuItem;
805 _In_opt_ PVOID Context
813 if (!MenuInfo->PluginHookList)
817 hook->Plugin = Plugin;
818 hook->Context = Context;
837 _In_ HWND OwnerWindow,
842 MenuInfo->Menu = Menu;
843 MenuInfo->OwnerWindow = OwnerWindow;
844 MenuInfo->Flags = Flags;
865 if (MenuInfo->PluginHookList)
867 for (i = 0; i < MenuInfo->PluginHookList->Count; i++)
869 hook = MenuInfo->PluginHookList->Items[i];
872 menuHookInfo.
Context = hook->Context;
884 pluginMenuItem = Item->
Context;
886 pluginMenuItem->
OwnerWindow = MenuInfo->OwnerWindow;
910 _In_opt_ PVOID Context,
936 _In_ ULONG ExtensionSize,
986 _In_opt_ PVOID Context,
998 RegistrationData->UpdateCallback,
999 RegistrationData->MessageCallback
1035 _In_reads_bytes_opt_(InLength) PVOID InBuffer,
1036 _In_ ULONG InLength,
1037 _Out_writes_bytes_opt_(OutLength) PVOID OutBuffer,
1038 _In_ ULONG OutLength