[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
This commit is contained in:
Robert Naumann 2020-04-23 19:28:14 +02:00
parent e15746849a
commit 032b5aacd2

View file

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