[SHELL32] Avoid SHRunControlPanel to be Vista compatible (#9114)

This commit is contained in:
Whindmar Saksit
2026-06-14 00:24:59 +02:00
committed by GitHub
parent a4610203d1
commit a83411cfef
5 changed files with 28 additions and 9 deletions
-1
View File
@@ -754,7 +754,6 @@ LRESULT CTrayClockWnd::OnLButtonDblClick(UINT uMsg, WPARAM wParam, LPARAM lParam
{
if (IsWindowVisible())
{
//FIXME: use SHRunControlPanel
ShellExecuteW(m_hWnd, NULL, L"timedate.cpl", NULL, NULL, SW_NORMAL);
}
return TRUE;
-2
View File
@@ -723,7 +723,6 @@ public:
break;
case ID_SHELL_CMD_ADJUST_DAT:
//FIXME: Use SHRunControlPanel
ShellExecuteW(m_hWnd, NULL, L"timedate.cpl", NULL, NULL, SW_NORMAL);
break;
@@ -779,7 +778,6 @@ public:
SHFindComputer(NULL, NULL);
break;
case IDHK_SYS_PROPERTIES:
//FIXME: Use SHRunControlPanel
ShellExecuteW(m_hWnd, NULL, L"sysdm.cpl", NULL, NULL, SW_NORMAL);
break;
case IDHK_NEXT_TASK:
+7 -1
View File
@@ -267,7 +267,13 @@ HRESULT STDMETHODCALLTYPE CShellDispatch::RefreshMenu()
HRESULT STDMETHODCALLTYPE CShellDispatch::ControlPanelItem(BSTR szDir)
{
TRACE("(%p, %ls)\n", this, szDir);
return SHRunControlPanel(szDir, NULL) ? S_OK : S_FALSE;
if (LOBYTE(GetVersion()) < 6)
SHELL32_RunControlPanel(szDir, NULL);
else if (!szDir)
return E_INVALIDARG; // NT5 does not check, just silently fails
else
ShellExecuteW(NULL, NULL, szDir, NULL, NULL, SW_SHOWNORMAL);
return S_OK;
}
// *** IShellDispatch2 methods ***
+4 -1
View File
@@ -213,7 +213,10 @@ UINT
MapVerbToDfmCmd(_In_ LPCSTR verba);
UINT
GetDfmCmd(_In_ IContextMenu *pCM, _In_ LPCSTR verba);
#define SHELL_ExecuteControlPanelCPL(hwnd, cpl) SHRunControlPanel((cpl), (hwnd))
EXTERN_C BOOL WINAPI
SHELL32_RunControlPanel(_In_ PCWSTR commandLine, _In_opt_ HWND parent);
#define SHELL_ExecuteControlPanelCPL(hwnd, cpl) SHELL32_RunControlPanel((cpl), (hwnd))
// CStubWindow32 --- The owner window of file property sheets.
+17 -4
View File
@@ -1663,9 +1663,10 @@ HRESULT WINAPI SHWinHelp(HWND hwnd, LPCWSTR pszHelp, UINT uCommand, ULONG_PTR dw
* SHRunControlPanel [SHELL32.161]
*
*/
BOOL WINAPI SHRunControlPanel (_In_ LPCWSTR commandLine, _In_opt_ HWND parent)
{
#ifdef __REACTOS__
EXTERN_C BOOL WINAPI
SHELL32_RunControlPanel(_In_ PCWSTR commandLine, _In_opt_ HWND parent)
{
/*
* TODO: Run in-process when possible, using
* HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\InProcCPLs
@@ -1678,10 +1679,22 @@ BOOL WINAPI SHRunControlPanel (_In_ LPCWSTR commandLine, _In_opt_ HWND parent)
* in order to keep control panel elements launch commands.
*/
WCHAR parameters[MAX_PATH] = L"shell32.dll,Control_RunDLL ";
TRACE("(%s, %p)n", debugstr_w(commandLine), parent);
if (!commandLine)
return FALSE;
wcscat(parameters, commandLine);
return ((INT_PTR)ShellExecuteW(parent, L"open", L"rundll32.exe", parameters, NULL, SW_SHOWNORMAL) > 32);
}
#endif
BOOL WINAPI SHRunControlPanel(_In_ LPCWSTR commandLine, _In_opt_ HWND parent)
{
#ifdef __REACTOS__
TRACE("(%s, %p)n", debugstr_w(commandLine), parent);
/* MSDN indicates that ROS should have a version check here but Vista+ just forwards to SHUNIMPL
if (LOBYTE(GetVersion()) >= 6)
return FALSE;
*/
return SHELL32_RunControlPanel(commandLine, parent);
#else
FIXME("(%s, %p): stub\n", debugstr_w(commandLine), parent);
return FALSE;