Add commandline arguments to information dialog
#include <procprv.h>
#include <settings.h>
+#include <shellapi.h>
+
static PWSTR ProtectedSignerStrings[] =
{ L"", L" (Authenticode)", L" (CodeGen)", L" (Antimalware)", L" (Lsa)", L" (Windows)", L" (WinTcb)", L" (WinSystem)", L" (StoreApp)" };
@@ -487,7 +489,37 @@ INT_PTR CALLBACK PhpProcessGeneralDlgProc(
case IDC_VIEWCOMMANDLINE:
{
if (processItem->CommandLine)
- PhShowInformationDialog(hwndDlg, processItem->CommandLine->Buffer, 0);
+ {
+ PPH_STRING commandLineString;
+ INT stringArgCount;
+ PWSTR* stringArgList;
+
+ if (stringArgList = CommandLineToArgvW(processItem->CommandLine->Buffer, &stringArgCount))
+ {
+ PH_STRING_BUILDER sb;
+
+ PhInitializeStringBuilder(&sb, 260);
+
+ for (INT i = 0; i < stringArgCount; i++)
+ {
+ PhAppendFormatStringBuilder(&sb, L"[%d] %s\r\n\r\n", i, stringArgList[i]);
+ }
+
+ PhAppendFormatStringBuilder(&sb, L"[FULL] %s\r\n", processItem->CommandLine->Buffer);
+
+ commandLineString = PhFinalStringBuilderString(&sb);
+
+ LocalFree(stringArgList);
+ }
+ else
+ {
+ commandLineString = PhReferenceObject(processItem->CommandLine);
+ }
+
+ PhShowInformationDialog(hwndDlg, commandLineString->Buffer, 0);
+
+ PhDereferenceObject(commandLineString);
+ }
}
break;
case IDC_VIEWPARENTPROCESS:
