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

commit 032b5aacd233cd7b83ab6282aad638c161fdc400
Author:     Robert Naumann <[email protected]>
AuthorDate: Thu Apr 23 19:28:14 2020 +0200
Commit:     Robert Naumann <[email protected]>
CommitDate: Sat Apr 25 19:04:09 2020 +0200

    [CONTROL] Fix hang while calling RunControlPanel() CORE-11373
    
    - based on a patch by Jira user "wimh"
    - also addressed Hermes' suggestion to use ARRAYSIZE instead of MAX_PATH
---
 base/applications/control/control.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/base/applications/control/control.c 
b/base/applications/control/control.c
index e08ed829b2f..a13000c1153 100644
--- a/base/applications/control/control.c
+++ b/base/applications/control/control.c
@@ -57,18 +57,12 @@ OpenShellFolder(LPWSTR lpFolderCLSID)
 static INT
 RunControlPanel(LPCWSTR lpCmd)
 {
-    /*
-     * Old method:
-     *
     WCHAR szParameters[MAX_PATH];
-    wcscpy(szParameters, L"shell32.dll,Control_RunDLL ");
-    wcscat(szParameters, lpCmd);
-    return RUNDLL(szParameters);
-     */
+    StringCchCopyW(szParameters, ARRAYSIZE(szParameters), 
L"shell32.dll,Control_RunDLL ");
+    if (FAILED(StringCchCatW(szParameters, ARRAYSIZE(szParameters), lpCmd)))
+        return 0;
 
-    /* New method: */
-    Control_RunDLLW(GetDesktopWindow(), 0, lpCmd, SW_SHOW);
-    return 1;
+    return RUNDLL(szParameters);
 }
 
 INT

Reply via email to