Skip to content

Commit

Permalink
Update issue #303 : If we can't retrieve the process name, as a last …
Browse files Browse the repository at this point in the history
…resort provide any suffix information in the ROT string

Auto size remote graph form columns after refreshing
Could improve this further my exporting GraphStudioNext graphs to the ROT in the same name format as used by Filter Graph Spy.
  • Loading branch information
mikecopperwhite committed Mar 21, 2017
1 parent fae44fe commit b35cfab
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/RemoteGraphForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ BOOL CRemoteGraphForm::OnInitDialog()

// prepare ListCtrl
list_graphs.InsertColumn(0, _T("Process ID"), LVCFMT_RIGHT, 120);
list_graphs.InsertColumn(1, _T("Porcess Name"), LVCFMT_LEFT, 150);
list_graphs.InsertColumn(1, _T("Process Name"), LVCFMT_LEFT, 150);
list_graphs.InsertColumn(2, _T("Instance"), LVCFMT_LEFT, 80);
list_graphs.InsertColumn(3, _T("Creation Time"), LVCFMT_LEFT, 80);
list_graphs.InsertColumn(4, _T("Process Image File"), LVCFMT_LEFT, 350);
Expand Down Expand Up @@ -156,12 +156,15 @@ void CRemoteGraphForm::OnRefreshClick()
const CAtlREMatchContext<>::RECHAR* szEnd = 0;
mc.GetMatch(0, &szStart, &szEnd);
int nLength = (int) (szEnd - szStart);
CString textInstance(szStart, nLength);
const CString textInstance(szStart, nLength);
StrToInt64ExW(CStringW(L"0x") + textInstance, STIF_SUPPORT_HEX, &reinterpret_cast<LONGLONG&>(gr.instance));

mc.GetMatch(1, &szStart, &szEnd);
nLength = (int) (szEnd - szStart);
CString textPID(szStart, nLength);
const CString textPID(szStart, nLength);
CString nameSuffix(szEnd ? szEnd : _T(""));
nameSuffix.Trim();

if (StrToIntExW(CStringW(L"0x") + textPID, STIF_SUPPORT_HEX, &reinterpret_cast<INT&>(gr.pid)))
{
CHandle process;
Expand All @@ -188,6 +191,13 @@ void CRemoteGraphForm::OnRefreshClick()
CString textFileName(szStart, nLength);
gr.processImageFileName = textFileName;
}
else if (nameSuffix.GetLength() > 0)
{
gr.processImageFileName = nameSuffix; // as a last resort add any suffix information from the ROT name rather than leaving blank
#ifndef _WIN64
gr.processImageFileName += _T(" *64"); // If we're 32bit, assume that we can't get process name because remote process is 64bit and show this on the dialog
#endif
}
}

IsWow64Process(process, &gr.processIsWOW64);
Expand Down Expand Up @@ -243,6 +253,11 @@ void CRemoteGraphForm::OnRefreshClick()
}
moniker = NULL;
}

// Set column width automatically to fit contents refreshed above
for (int n=0; n<=4; n++) {
list_graphs.SetColumnWidth(n, LVSCW_AUTOSIZE_USEHEADER);
}
}

void CRemoteGraphForm::OnConnectClick()
Expand Down

0 comments on commit b35cfab

Please sign in to comment.