HardwareDevices: Move plugin settings to options window
making kylo singing great again
@@ -67,36 +67,32 @@ VOID NTAPI ShowOptionsCallback(
_In_opt_ PVOID Context
)
{
- PROPSHEETHEADER propSheetHeader = { sizeof(propSheetHeader) };
+ PPH_PLUGIN_OBJECT_PROPERTIES objectProperties = Parameter;
PROPSHEETPAGE propSheetPage;
- HPROPSHEETPAGE pages[2];
- propSheetHeader.dwFlags =
- PSH_NOAPPLYNOW |
- PSH_NOCONTEXTHELP;
- propSheetHeader.hwndParent = (HWND)Parameter;
- propSheetHeader.pszCaption = L"Hardware Devices Plugin";
- propSheetHeader.nPages = 0;
- propSheetHeader.nStartPage = 0;
- propSheetHeader.phpage = pages;
-
- // Disk Drives
+ if (objectProperties->NumberOfPages < objectProperties->MaximumNumberOfPages)
+ {
memset(&propSheetPage, 0, sizeof(PROPSHEETPAGE));
propSheetPage.dwSize = sizeof(PROPSHEETPAGE);
+ propSheetPage.dwFlags = PSP_USETITLE;
propSheetPage.hInstance = PluginInstance->DllBase;
propSheetPage.pszTemplate = MAKEINTRESOURCE(IDD_DISKDRIVE_OPTIONS);
+ propSheetPage.pszTitle = L"Disk Drives";
propSheetPage.pfnDlgProc = DiskDriveOptionsDlgProc;
- pages[propSheetHeader.nPages++] = CreatePropertySheetPage(&propSheetPage);
+ objectProperties->Pages[objectProperties->NumberOfPages++] = CreatePropertySheetPage(&propSheetPage);
+ }
- // Network Adapters
+ if (objectProperties->NumberOfPages < objectProperties->MaximumNumberOfPages)
+ {
memset(&propSheetPage, 0, sizeof(PROPSHEETPAGE));
propSheetPage.dwSize = sizeof(PROPSHEETPAGE);
+ propSheetPage.dwFlags = PSP_USETITLE;
propSheetPage.hInstance = PluginInstance->DllBase;
propSheetPage.pszTemplate = MAKEINTRESOURCE(IDD_NETADAPTER_OPTIONS);
+ propSheetPage.pszTitle = L"Network Adapters";
propSheetPage.pfnDlgProc = NetworkAdapterOptionsDlgProc;
- pages[propSheetHeader.nPages++] = CreatePropertySheetPage(&propSheetPage);
-
- PhModalPropertySheet(&propSheetHeader);
+ objectProperties->Pages[objectProperties->NumberOfPages++] = CreatePropertySheetPage(&propSheetPage);
+ }
}
VOID NTAPI MainWindowShowingCallback(
@@ -336,7 +332,6 @@ LOGICAL DllMain(
info->Author = L"dmex, wj32";
info->Description = L"Plugin for monitoring hardware devices like Disk drives and Network adapters via the System Information window.";
info->Url = L"https://wj32.org/processhacker/forums/viewtopic.php?t=1820";
- info->HasOptions = TRUE;
PhRegisterCallback(
PhGetPluginCallback(PluginInstance, PluginCallbackLoad),
@@ -351,7 +346,7 @@ LOGICAL DllMain(
&PluginUnloadCallbackRegistration
);
PhRegisterCallback(
- PhGetPluginCallback(PluginInstance, PluginCallbackShowOptions),
+ PhGetGeneralCallback(GeneralCallbackOptionsWindowInitializing),
ShowOptionsCallback,
NULL,
&PluginShowOptionsCallbackRegistration
