mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +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 dwLength;
|
||||
LPWSTR pszExePath;
|
||||
static const WCHAR szCmdFormat[] = L"/select,\"%s\"";
|
||||
LPWSTR pszCmdLine = NULL;
|
||||
|
||||
dwProcessId = GetSelectedProcessId();
|
||||
|
@ -1240,11 +1241,12 @@ void ProcessPage_OnOpenFileLocation(void)
|
|||
goto Cleanup;
|
||||
|
||||
/* 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)
|
||||
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 */
|
||||
ShellExecuteW(NULL, L"open", L"explorer.exe", pszCmdLine, NULL, SW_SHOWNORMAL);
|
||||
|
|
Loading…
Reference in a new issue