https://git.reactos.org/?p=reactos.git;a=commitdiff;h=da36f799c728bc5477e85da590c31e6c20d553c4

commit da36f799c728bc5477e85da590c31e6c20d553c4
Author:     Kyle Katarn <[email protected]>
AuthorDate: Sat Sep 19 16:23:44 2020 +0200
Commit:     GitHub <[email protected]>
CommitDate: Sat Sep 19 16:23:44 2020 +0200

    [SHELL32] Minimal SHRunControlPanel implementation (#3095)
    
    CORE-9215
    Co-authored-by: Stanislav Motylkov <[email protected]>
---
 dll/win32/shell32/wine/shellord.c | 21 ++++++++++++++++++++-
 sdk/include/psdk/shlobj.h         | 10 ++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/dll/win32/shell32/wine/shellord.c 
b/dll/win32/shell32/wine/shellord.c
index ab0969a157b..37ff171d4b6 100644
--- a/dll/win32/shell32/wine/shellord.c
+++ b/dll/win32/shell32/wine/shellord.c
@@ -1472,10 +1472,29 @@ HRESULT WINAPI SHWinHelp(HWND hwnd, LPCWSTR pszHelp, 
UINT uCommand, ULONG_PTR dw
  *  SHRunControlPanel [SHELL32.161]
  *
  */
-BOOL WINAPI SHRunControlPanel (LPCWSTR commandLine, HWND parent)
+BOOL WINAPI SHRunControlPanel (_In_ LPCWSTR commandLine, _In_opt_ HWND parent)
 {
+#ifdef __REACTOS__
+    /*
+     * TODO: Run in-process when possible, using
+     * 
HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\InProcCPLs
+     * and possibly some extra rules.
+     * See also 
https://docs.microsoft.com/en-us/windows/win32/api/shlobj/nf-shlobj-shruncontrolpanel
+     * "If the specified Control Panel item is already running, 
SHRunControlPanel
+     *  attempts to switch to that instance rather than opening a new 
instance."
+     * This function is not supported as of Windows Vista, where it always 
returns FALSE.
+     * However we need to keep it "alive" even when ReactOS is compliled as 
NT6+
+     * in order to keep control panel elements launch commands.
+     */
+    TRACE("(%s, %p)n", debugstr_w(commandLine), parent);
+    WCHAR parameters[MAX_PATH] = L"shell32.dll,Control_RunDLL ";
+    wcscat(parameters, commandLine);
+
+    return ((INT_PTR)ShellExecuteW(parent, L"open", L"rundll32.exe", 
parameters, NULL, SW_SHOWNORMAL) > 32);
+#else
        FIXME("(%s, %p): stub\n", debugstr_w(commandLine), parent);
        return FALSE;
+#endif
 }
 
 static LPUNKNOWN SHELL32_IExplorerInterface=0;
diff --git a/sdk/include/psdk/shlobj.h b/sdk/include/psdk/shlobj.h
index b478ca228f7..422714c7b9d 100644
--- a/sdk/include/psdk/shlobj.h
+++ b/sdk/include/psdk/shlobj.h
@@ -2466,6 +2466,16 @@ HRESULT WINAPI CIDLData_CreateFromIDArray(
   _In_reads_opt_(cidl) PCUIDLIST_RELATIVE_ARRAY apidl,
   _Outptr_ IDataObject **ppdtobj);
 
+/****************************************************************************
+ * SHRunControlPanel
+ */
+
+BOOL
+WINAPI
+SHRunControlPanel(
+  _In_ LPCWSTR commandLine,
+  _In_opt_ HWND parent);
+
 /****************************************************************************
  * SHOpenWithDialog
  */

Reply via email to