https://git.reactos.org/?p=reactos.git;a=commitdiff;h=497fe0a884925bbbc9852…
commit 497fe0a884925bbbc9852d5537524e90d9da26b6
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Dec 20 10:47:08 2020 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Dec 20 10:47:08 2020 +0100
[INTL] Implement the selection of a property page by command line
---
dll/cpl/intl/intl.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/dll/cpl/intl/intl.c b/dll/cpl/intl/intl.c
index 13ec00906a8..1942be8d714 100644
--- a/dll/cpl/intl/intl.c
+++ b/dll/cpl/intl/intl.c
@@ -36,7 +36,6 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam);
HINSTANCE hApplet = 0;
-HWND hCPLWindow;
HINF hSetupInf = INVALID_HANDLE_VALUE;
DWORD IsUnattendedSetupEnabled = 0;
DWORD UnattendLCID = 0;
@@ -173,6 +172,7 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
PROPSHEETPAGE psp[3];
PROPSHEETHEADER psh;
PGLOBALDATA pGlobalData;
+ INT nPage = 0;
LONG ret;
if (OpenSetupInf())
@@ -180,6 +180,9 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
ParseSetupInf();
}
+ if (uMsg == CPL_STARTWPARMSW && lParam != 0)
+ nPage = _wtoi((PWSTR)lParam);
+
pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBALDATA));
if (pGlobalData == NULL)
return FALSE;
@@ -192,11 +195,11 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
- psh.hwndParent = hCPLWindow;
+ psh.hwndParent = hwnd;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON);
psh.pszCaption = Caption;
- psh.nPages = 0; //sizeof(psp) / sizeof(PROPSHEETPAGE);
+ psh.nPages = 0;
psh.nStartPage = 0;
psh.ppsp = psp;
psh.pfnCallback = PropSheetProc;
@@ -212,6 +215,9 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
psh.nPages++;
}
+ if (nPage != 0 && nPage <= psh.nPages)
+ psh.nStartPage = nPage;
+
ret = (LONG)(PropertySheet(&psh) != -1);
HeapFree(GetProcessHeap(), 0, pGlobalData);
@@ -227,7 +233,7 @@ CPlApplet(HWND hwndCpl,
LPARAM lParam1,
LPARAM lParam2)
{
- switch(uMsg)
+ switch (uMsg)
{
case CPL_INIT:
return TRUE;
@@ -248,12 +254,11 @@ CPlApplet(HWND hwndCpl,
}
case CPL_DBLCLK:
- {
- UINT uAppIndex = (UINT)lParam1;
- hCPLWindow = hwndCpl;
- Applets[uAppIndex].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
+ Applets[(UINT)lParam1].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
break;
- }
+
+ case CPL_STARTWPARMSW:
+ return Applets[(UINT)lParam1].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
}
return FALSE;