https://git.reactos.org/?p=reactos.git;a=commitdiff;h=81389f291900d4d7f6107cee6a7a63924366d438
commit 81389f291900d4d7f6107cee6a7a63924366d438 Author: Eric Kohl <[email protected]> AuthorDate: Sun Feb 9 13:07:13 2020 +0100 Commit: Eric Kohl <[email protected]> CommitDate: Sun Feb 9 13:07:13 2020 +0100 [SYSDM] Implement the selection of a property page by command line --- dll/cpl/sysdm/precomp.h | 5 ++--- dll/cpl/sysdm/sysdm.c | 24 +++++++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/dll/cpl/sysdm/precomp.h b/dll/cpl/sysdm/precomp.h index 5eb66604bb5..0e6fbde768a 100644 --- a/dll/cpl/sysdm/precomp.h +++ b/dll/cpl/sysdm/precomp.h @@ -18,19 +18,18 @@ #include <shellapi.h> #include <shlobj.h> #include <setupapi.h> +#include <cpl.h> #include "resource.h" #define NUM_APPLETS (1) -typedef LONG (CALLBACK *APPLET_INITPROC)(VOID); - typedef struct _APPLET { int idIcon; int idName; int idDescription; - APPLET_INITPROC AppletProc; + APPLET_PROC AppletProc; } APPLET, *PAPPLET; extern HINSTANCE hApplet; diff --git a/dll/cpl/sysdm/sysdm.c b/dll/cpl/sysdm/sysdm.c index 8061b1c663b..817c0015db7 100644 --- a/dll/cpl/sysdm/sysdm.c +++ b/dll/cpl/sysdm/sysdm.c @@ -9,12 +9,10 @@ #include "precomp.h" -#include <cpl.h> #include <regstr.h> -LONG CALLBACK SystemApplet(VOID); +static LONG APIENTRY SystemApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam); HINSTANCE hApplet = 0; -HWND hCPLWindow; /* Applets */ APPLET Applets[NUM_APPLETS] = @@ -140,22 +138,28 @@ PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam) /* First Applet */ LONG CALLBACK -SystemApplet(VOID) +SystemApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) { HPROPSHEETPAGE hpsp[MAX_SYSTEM_PAGES]; PROPSHEETHEADER psh; HMODULE hNetIdDll; HPSXA hpsxa = NULL; + INT nPage = 0; LONG Ret; static INITCOMMONCONTROLSEX icc = {sizeof(INITCOMMONCONTROLSEX), ICC_LINK_CLASS}; if (!InitCommonControlsEx(&icc)) return 0; + if (uMsg == CPL_STARTWPARMSW && lParam != 0) + { + nPage = _wtoi((PWSTR)lParam); + } + ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK; - psh.hwndParent = hCPLWindow; + psh.hwndParent = hwnd; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCEW(IDI_USERPROF); psh.pszCaption = MAKEINTRESOURCE(IDS_CPLSYSTEMNAME); @@ -176,6 +180,9 @@ SystemApplet(VOID) SHAddFromPropSheetExtArray(hpsxa, PropSheetAddPage, (LPARAM)&psh); } + if (nPage != 0 && nPage <= psh.nPages) + psh.nStartPage = nPage; + Ret = (LONG)(PropertySheet(&psh) != -1); if (hpsxa != NULL) @@ -219,9 +226,12 @@ CPlApplet(HWND hwndCPl, break; case CPL_DBLCLK: - hCPLWindow = hwndCPl; - Applets[i].AppletProc(); + Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2); break; + + case CPL_STARTWPARMSW: + return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2); + } return FALSE;
