mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[TASKMGR] Process page: Improve readability of command line string formatting code
This commit is contained in:
parent
018264f38f
commit
6d16d27462
1 changed files with 4 additions and 2 deletions
|
@ -1222,6 +1222,7 @@ void ProcessPage_OnOpenFileLocation(void)
|
||||||
DWORD dwProcessId;
|
DWORD dwProcessId;
|
||||||
DWORD dwLength;
|
DWORD dwLength;
|
||||||
LPWSTR pszExePath;
|
LPWSTR pszExePath;
|
||||||
|
static const WCHAR szCmdFormat[] = L"/select,\"%s\"";
|
||||||
LPWSTR pszCmdLine = NULL;
|
LPWSTR pszCmdLine = NULL;
|
||||||
|
|
||||||
dwProcessId = GetSelectedProcessId();
|
dwProcessId = GetSelectedProcessId();
|
||||||
|
@ -1240,11 +1241,12 @@ void ProcessPage_OnOpenFileLocation(void)
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
|
|
||||||
/* Build the shell command line */
|
/* Build the shell command line */
|
||||||
pszCmdLine = HeapAlloc(GetProcessHeap(), 0, (dwLength + CONST_STR_LEN(L"/select,\"\"")) * sizeof(WCHAR));
|
dwLength += CONST_STR_LEN(szCmdFormat) - CONST_STR_LEN(L"%s");
|
||||||
|
pszCmdLine = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
|
||||||
if (!pszCmdLine)
|
if (!pszCmdLine)
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
|
|
||||||
StringCchPrintfW(pszCmdLine, dwLength + CONST_STR_LEN(L"/select,\"\""), L"/select,\"%s\"", pszExePath);
|
StringCchPrintfW(pszCmdLine, dwLength, szCmdFormat, pszExePath);
|
||||||
|
|
||||||
/* Call the shell to open the file location and select it */
|
/* Call the shell to open the file location and select it */
|
||||||
ShellExecuteW(NULL, L"open", L"explorer.exe", pszCmdLine, NULL, SW_SHOWNORMAL);
|
ShellExecuteW(NULL, L"open", L"explorer.exe", pszCmdLine, NULL, SW_SHOWNORMAL);
|
||||||
|
|
Loading…
Reference in a new issue