Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions SystemInformer/include/phapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ typedef struct _PH_LOG_ENTRY
PPH_STRING Name;
HANDLE ParentProcessId;
PPH_STRING ParentName;
PPH_STRING CommandLine;
NTSTATUS ExitStatus;
} Process;
struct
Expand Down Expand Up @@ -230,6 +231,7 @@ VOID PhLogProcessEntry(
_In_ PPH_STRING Name,
_In_opt_ HANDLE ParentProcessId,
_In_opt_ PPH_STRING ParentName,
_In_opt_ PPH_STRING CommandLine,
_In_opt_ ULONG Status
);

Expand Down
11 changes: 10 additions & 1 deletion SystemInformer/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ VOID PhpFreeLogEntry(
{
PhDereferenceObject(Entry->Process.Name);
if (Entry->Process.ParentName) PhDereferenceObject(Entry->Process.ParentName);
if (Entry->Process.CommandLine) PhDereferenceObject(Entry->Process.CommandLine);
}
else if (Entry->Type >= PH_LOG_ENTRY_SERVICE_FIRST && Entry->Type <= PH_LOG_ENTRY_SERVICE_LAST)
{
Expand All @@ -72,6 +73,7 @@ PPH_LOG_ENTRY PhpCreateProcessLogEntry(
_In_ PPH_STRING Name,
_In_opt_ HANDLE ParentProcessId,
_In_opt_ PPH_STRING ParentName,
_In_opt_ PPH_STRING CommandLine,
_In_opt_ ULONG Status
)
{
Expand All @@ -90,6 +92,12 @@ PPH_LOG_ENTRY PhpCreateProcessLogEntry(
entry->Process.ParentName = ParentName;
}

if (!PhIsNullOrEmptyString(CommandLine))
{
PhReferenceObject(CommandLine);
entry->Process.CommandLine = CommandLine;
}

entry->Process.ExitStatus = Status;

return entry;
Expand Down Expand Up @@ -179,10 +187,11 @@ VOID PhLogProcessEntry(
_In_ PPH_STRING Name,
_In_opt_ HANDLE ParentProcessId,
_In_opt_ PPH_STRING ParentName,
_In_opt_ PPH_STRING CommandLine,
_In_opt_ ULONG Status
)
{
PhpLogEntry(PhpCreateProcessLogEntry(Type, ProcessId, Name, ParentProcessId, ParentName, Status));
PhpLogEntry(PhpCreateProcessLogEntry(Type, ProcessId, Name, ParentProcessId, ParentName, CommandLine, Status));
}

VOID PhLogServiceEntry(
Expand Down
23 changes: 23 additions & 0 deletions SystemInformer/logwnd.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ static PPH_STRING PhpGetStringForSelectedLogEntries(
temp = PhFormatLogEntry(entry);
PhAppendStringBuilder(&stringBuilder, &temp->sr);
PhDereferenceObject(temp);

if (entry->Type >= PH_LOG_ENTRY_PROCESS_FIRST && entry->Type <= PH_LOG_ENTRY_PROCESS_LAST && !PhIsNullOrEmptyString(entry->Process.CommandLine))
{
PhAppendStringBuilder2(&stringBuilder, L" [");
PhAppendStringBuilder(&stringBuilder, &entry->Process.CommandLine->sr);
PhAppendStringBuilder2(&stringBuilder, L"]");
}

PhAppendStringBuilder2(&stringBuilder, L"\r\n");

ContinueLoop:
Expand Down Expand Up @@ -174,6 +182,7 @@ INT_PTR CALLBACK PhpLogDlgProc(
PhListView_AddColumn(ListViewContext, 0, 0, 0, LVCFMT_LEFT, 140, L"Time");
PhListView_AddColumn(ListViewContext, 1, 1, 1, LVCFMT_LEFT, 140, L"Type");
PhListView_AddColumn(ListViewContext, 2, 2, 2, LVCFMT_LEFT, 260, L"Message");
PhListView_AddColumn(ListViewContext, 3, 3, 3, LVCFMT_LEFT, 300, L"Command Line");
PhLoadListViewColumnsFromSetting(SETTING_LOG_LIST_VIEW_COLUMNS, ListViewHandle);

PhInitializeLayoutManager(&WindowLayoutManager, hwndDlg);
Expand Down Expand Up @@ -362,6 +371,20 @@ INT_PTR CALLBACK PhpLogDlgProc(
PhDereferenceObject(string);
}
}
else if (dispInfo->item.iSubItem == 3)
{
if (FlagOn(dispInfo->item.mask, LVIF_TEXT))
{
if (entry->Type >= PH_LOG_ENTRY_PROCESS_FIRST && entry->Type <= PH_LOG_ENTRY_PROCESS_LAST && !PhIsNullOrEmptyString(entry->Process.CommandLine))
{
wcsncpy_s(dispInfo->item.pszText, dispInfo->item.cchTextMax, entry->Process.CommandLine->Buffer, _TRUNCATE);
}
else
{
dispInfo->item.pszText[0] = UNICODE_NULL;
}
}
}
}
break;
}
Expand Down
3 changes: 2 additions & 1 deletion SystemInformer/mwpgproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,7 @@ VOID PhMwpOnProcessAdded(
ProcessItem->ProcessName,
parentProcessId,
parentName,
ProcessItem->CommandLine,
0
);

Expand Down Expand Up @@ -1205,7 +1206,7 @@ VOID PhMwpOnProcessRemoved(
}
}

PhLogProcessEntry(PH_LOG_ENTRY_PROCESS_DELETE, ProcessItem->ProcessId, ProcessItem->ProcessName, NULL, NULL, exitStatus);
PhLogProcessEntry(PH_LOG_ENTRY_PROCESS_DELETE, ProcessItem->ProcessId, ProcessItem->ProcessName, NULL, NULL, ProcessItem->CommandLine, exitStatus);

if (PhMwpNotifyIconNotifyMask & PH_NOTIFY_PROCESS_DELETE)
{
Expand Down
Loading