Compare commits

...

12 Commits

Author SHA1 Message Date
f64dbacdbd Version set to 1.0-alpha13 2016-08-27 13:10:31 +02:00
2a88c4f2a8 Event sources and toolbar management now more dynamic 2016-08-27 13:01:58 +02:00
6ee34cdd47 Additional mnemonics introduced in Edit menu 2016-08-27 09:21:11 +02:00
65c87bcbc0 Toolbar management enhanced 2016-08-27 09:20:06 +02:00
1bdf4a2b8a UI strings revised 2016-08-27 07:30:30 +02:00
a8856b951b Windows folder icon arranged 2016-08-27 06:58:58 +02:00
6e58183d16 Panel icon loading simplified 2016-08-27 06:58:57 +02:00
9daa5b52a4 Incorrect letter case referencing EapHost service fixed 2016-08-27 06:58:57 +02:00
9704046868 EventMonitor upgraded
- Clipboard support
- Filtering by source and/or by message level
- Schannel event source added
(closes #8)
2016-08-27 06:58:21 +02:00
3b8bc90a0f "Add/Remove Programs" contact info changed from Amebis to GÉANT 2016-08-26 17:56:28 +02:00
b5c8b8ee67 Product icon introduced 2016-08-26 17:47:16 +02:00
53e31b1be7 Additional resource-loading functions introduced 2016-08-26 15:54:31 +02:00
36 changed files with 2896 additions and 625 deletions

Binary file not shown.

View File

@@ -84,7 +84,7 @@ VOID WINAPI EapPeerFreeErrorMemory(_In_ EAP_ERROR *ppEapError)
///
/// Obtains a set of function pointers for an implementation of the EAP peer method currently loaded on the EAPHost service.
/// Obtains a set of function pointers for an implementation of the EAP peer method currently loaded on the EapHost service.
///
/// \sa [EapPeerGetInfo function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363608.aspx)
///
@@ -135,7 +135,7 @@ DWORD WINAPI EapPeerGetInfo(_In_ EAP_TYPE* pEapType, _Out_ EAP_PEER_METHOD_ROUTI
#pragma warning(disable: 4702) // Compiler is smart enough to find out the initialize() method is empty => never throws an exception.
///
/// Initializes an EAP peer method for EAPHost.
/// Initializes an EAP peer method for EapHost.
///
/// \sa [EapPeerGetInfo function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363613.aspx)
///
@@ -206,7 +206,7 @@ DWORD APIENTRY EapPeerShutdown(_Out_ EAP_ERROR **ppEapError)
///
/// Returns the user data and user identity after being called by EAPHost.
/// Returns the user data and user identity after being called by EapHost.
///
/// \sa [EapPeerGetIdentity function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363607.aspx)
///
@@ -263,7 +263,7 @@ DWORD APIENTRY EapPeerGetIdentity(
///
/// Starts an EAP authentication session on the peer EAPHost using the EAP method.
/// Starts an EAP authentication session on the peer EapHost using the EAP method.
///
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
///
@@ -351,7 +351,7 @@ DWORD APIENTRY EapPeerEndSession(
///
/// Processes a packet received by EAPHost from a supplicant.
/// Processes a packet received by EapHost from a supplicant.
///
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
///
@@ -930,7 +930,7 @@ DWORD WINAPI EapPeerQueryInteractiveUIInputFields(
///
/// Converts user information into a user BLOB that can be consumed by EAPHost run-time functions.
/// Converts user information into a user BLOB that can be consumed by EapHost run-time functions.
///
/// \sa [EapPeerQueryUIBlobFromInteractiveUIInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb204696.aspx)
///

View File

@@ -78,7 +78,7 @@ bool wxEventMonitorApp::OnInit()
}
#endif
m_mainWnd = new wxEventMonitorFrame();
m_mainWnd = new wxEventMonitorFrame(NULL);
wxPersistentRegisterAndRestore<wxEventMonitorFrame>(m_mainWnd);
m_mainWnd->Show();

View File

@@ -48,8 +48,6 @@ wxETWEvent::wxETWEvent(wxEventType type, const EVENT_RECORD &record) :
m_record(record),
wxEvent(0, type)
{
DoSetExtendedData(record.ExtendedDataCount, record.ExtendedData);
DoSetUserData(record.UserDataLength, record.UserData);
}
@@ -57,92 +55,6 @@ wxETWEvent::wxETWEvent(const wxETWEvent& event) :
m_record(event.m_record),
wxEvent(event)
{
DoSetExtendedData(event.m_record.ExtendedDataCount, event.m_record.ExtendedData);
DoSetUserData(event.m_record.UserDataLength, event.m_record.UserData);
}
wxETWEvent::~wxETWEvent()
{
if (m_record.ExtendedData)
delete (unsigned char*)m_record.ExtendedData;
if (m_record.UserData)
delete (unsigned char*)m_record.UserData;
}
bool wxETWEvent::SetExtendedData(size_t extended_data_count, const EVENT_HEADER_EXTENDED_DATA_ITEM *extended_data)
{
if (m_record.ExtendedData)
delete (unsigned char*)m_record.ExtendedData;
return DoSetExtendedData(extended_data_count, extended_data);
}
bool wxETWEvent::SetUserData(size_t user_data_length, const void *user_data)
{
if (m_record.UserData)
delete (unsigned char*)m_record.UserData;
return DoSetUserData(user_data_length, user_data);
}
bool wxETWEvent::DoSetExtendedData(size_t extended_data_count, const EVENT_HEADER_EXTENDED_DATA_ITEM *extended_data)
{
if (extended_data_count) {
wxASSERT_MSG(extended_data, wxT("extended data is NULL"));
// Count the total required memory.
size_t data_size = 0;
for (size_t i = 0; i < extended_data_count; i++)
data_size += extended_data[i].DataSize;
// Allocate memory for extended data.
m_record.ExtendedData = (EVENT_HEADER_EXTENDED_DATA_ITEM*)(new unsigned char[sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM)*extended_data_count + data_size]);
wxCHECK_MSG(m_record.ExtendedData, false, wxT("extended data memory allocation failed"));
// Bulk-copy extended data descriptors.
memcpy(m_record.ExtendedData, extended_data, sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM) * extended_data_count);
// Copy the data.
unsigned char *ptr = (unsigned char*)(m_record.ExtendedData + extended_data_count);
for (size_t i = 0; i < extended_data_count; i++) {
if (extended_data[i].DataSize) {
memcpy(ptr, (void*)(extended_data[i].DataPtr), extended_data[i].DataSize);
m_record.ExtendedData[i].DataPtr = (ULONGLONG)ptr;
ptr += extended_data[i].DataSize;
} else
m_record.ExtendedData[i].DataPtr = NULL;
}
} else
m_record.ExtendedData = NULL;
m_record.ExtendedDataCount = extended_data_count;
return true;
}
bool wxETWEvent::DoSetUserData(size_t user_data_length, const void *user_data)
{
if (user_data_length) {
wxASSERT_MSG(user_data, wxT("user data is NULL"));
// Allocate memory for user data.
m_record.UserData = new unsigned char[user_data_length];
wxCHECK_MSG(m_record.UserData, false, wxT("user data memory allocation failed"));
// Copy user data.
memcpy(m_record.UserData, user_data, user_data_length);
} else
m_record.UserData = NULL;
m_record.UserDataLength = user_data_length;
return true;
}
@@ -238,12 +150,18 @@ END_EVENT_TABLE()
// {6EB8DB94-FE96-443F-A366-5FE0CEE7FB1C}
const GUID wxETWListCtrl::s_provider_eaphost = { 0X6EB8DB94, 0XFE96, 0X443F, { 0XA3, 0X66, 0X5F, 0XE0, 0XCE, 0XE7, 0XFB, 0X1C } };
const GUID wxETWListCtrl::s_provider_eaphost = { 0x6EB8DB94, 0xFE96, 0x443F, { 0xA3, 0x66, 0x5F, 0xE0, 0xCE, 0xE7, 0xFB, 0x1C } };
// {1F678132-5938-4686-9FDC-C8FF68F15C85}
const GUID wxETWListCtrl::s_provider_schannel = { 0x1F678132, 0x5938, 0x4686, { 0x9F, 0xDC, 0xC8, 0xFF, 0x68, 0xF1, 0x5C, 0x85 } };
wxETWListCtrl::wxETWListCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) :
m_proc(NULL),
m_item_id(0),
m_scroll_auto(true),
m_level(TRACE_LEVEL_INFORMATION),
m_rec_db(wxETWEVENT_RECORDS_MAX),
m_rec_idx(wxETWEVENT_RECORDS_MAX),
wxListCtrl(parent, id, pos, size, style, validator, name)
{
this->AppendColumn(_("Time" ), wxLIST_FORMAT_LEFT, 100);
@@ -252,6 +170,32 @@ wxETWListCtrl::wxETWListCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos
this->AppendColumn(_("Source"), wxLIST_FORMAT_LEFT, 100);
this->AppendColumn(_("Event" ), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE_USEHEADER);
// Maximum expected column widths for pre-formatted row display
m_col_format_width[0] = 26;
m_col_format_width[1] = 5;
m_col_format_width[2] = 5;
m_col_format_width[3] = std::max<int>(std::max<int>(_countof("EapHost"), _countof("Schannel")), _countof(PRODUCT_NAME_STR)) - 1;
m_col_format_width[4] = 0;
// Prepare all possible item attributes.
wxColour col_bg((unsigned long)0xffffff);
m_item_attr[0][0].SetBackgroundColour(col_bg );
m_item_attr[0][0].SetTextColour ((unsigned long)0x666666);
m_item_attr[0][1].SetBackgroundColour(col_bg );
m_item_attr[0][1].SetTextColour ((unsigned long)0x000000);
m_item_attr[0][2].SetBackgroundColour(col_bg );
m_item_attr[0][2].SetTextColour ((unsigned long)0x00aacc);
m_item_attr[0][3].SetBackgroundColour(col_bg );
m_item_attr[0][3].SetTextColour ((unsigned long)0x0000ff);
m_item_attr[1][0].SetBackgroundColour(col_bg );
m_item_attr[1][0].SetTextColour ((unsigned long)0xcccccc);
m_item_attr[1][1].SetBackgroundColour(col_bg );
m_item_attr[1][1].SetTextColour ((unsigned long)0xaaaaaa);
m_item_attr[1][2].SetBackgroundColour(col_bg );
m_item_attr[1][2].SetTextColour ((unsigned long)0xaaeeee);
m_item_attr[1][3].SetBackgroundColour(col_bg );
m_item_attr[1][3].SetTextColour ((unsigned long)0xaaaaff);
// Start a new session.
ULONG ulResult;
for (unsigned int i = 0; ; i++) {
@@ -304,9 +248,11 @@ wxETWListCtrl::wxETWListCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos
0,
NULL)) != ERROR_SUCCESS)
{
wxLogError(_("Error enabling event provider (error %u)."), ulResult);
wxLogDebug(wxString::Format(_("Error enabling %s event provider (error %u)."), wxT(PRODUCT_NAME_STR)), ulResult);
return;
}
m_sources.insert(EAPMETHOD_TRACE_EVENT_PROVIDER);
if ((ulResult = EnableTraceEx(
&s_provider_eaphost,
&((const EVENT_TRACE_PROPERTIES*)m_session)->Wnode.Guid,
@@ -317,14 +263,28 @@ wxETWListCtrl::wxETWListCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos
0,
NULL)) != ERROR_SUCCESS)
{
// If the EAPHost trace provider failed to enable, do not despair.
wxLogDebug(_("Error enabling EAPHost event provider (error %u)."), ulResult);
// If the EapHost trace provider failed to enable, do not despair.
wxLogDebug(wxString::Format(_("Error enabling %s event provider (error %u)."), wxT("EapHost")), ulResult);
}
if ((ulResult = EnableTraceEx(
&s_provider_schannel,
&((const EVENT_TRACE_PROPERTIES*)m_session)->Wnode.Guid,
m_session,
EVENT_CONTROL_CODE_ENABLE_PROVIDER,
TRACE_LEVEL_VERBOSE,
0, 0,
0,
NULL)) != ERROR_SUCCESS)
{
// If the Schannel trace provider failed to enable, do not despair.
wxLogDebug(wxString::Format(_("Error enabling %s event provider (error %u)."), wxT("Schannel")), ulResult);
}
// Process events in separate thread, not to block wxWidgets' message pump.
wxArrayString sessions;
sessions.Add(m_session.name());
m_proc = new wxEventTraceProcessorThread(this->GetEventHandler(), sessions);
m_proc = new wxEventTraceProcessorThread(GetEventHandler(), sessions);
wxASSERT_MSG(m_proc, wxT("error allocating thread memory"));
if (m_proc->Run() != wxTHREAD_NO_ERROR) {
wxFAIL_MSG("Can't create the thread!");
@@ -344,6 +304,16 @@ wxETWListCtrl::~wxETWListCtrl()
}
// Disable event providers.
EnableTraceEx(
&s_provider_schannel,
&((const EVENT_TRACE_PROPERTIES*)m_session)->Wnode.Guid,
m_session,
EVENT_CONTROL_CODE_DISABLE_PROVIDER,
TRACE_LEVEL_VERBOSE,
0, 0,
0,
NULL);
EnableTraceEx(
&s_provider_eaphost,
&((const EVENT_TRACE_PROPERTIES*)m_session)->Wnode.Guid,
@@ -367,24 +337,235 @@ wxETWListCtrl::~wxETWListCtrl()
}
void wxETWListCtrl::OnETWEvent(wxETWEvent& event)
void wxETWListCtrl::CopySelected() const
{
EVENT_RECORD &rec = event.GetRecord();
// Prepare text in ANSI and Unicode flavours.
string dataA, rowA;
wstring dataW, rowW;
for (long item = -1; (item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED)) != -1;) {
FormatRow(m_rec_db.at_abs(m_rec_idx.at(item)), rowA, rowW);
rowA += "\r\n"; dataA += rowA;
rowW += L"\r\n"; dataW += rowW;
}
// Put text to clipboard.
CopyToClipboard(dataA, dataW);
}
void wxETWListCtrl::CopyAll() const
{
// Prepare text in ANSI and Unicode flavours.
string dataA, rowA;
wstring dataW, rowW;
for (size_t i = 0, n = m_rec_db.size(); i < n; i++) {
FormatRow(m_rec_db[i], rowA, rowW);
rowA += "\r\n"; dataA += rowA;
rowW += L"\r\n"; dataW += rowW;
}
// Put text to clipboard.
CopyToClipboard(dataA, dataW);
}
void wxETWListCtrl::ClearAll()
{
m_rec_idx.clear();
m_rec_db.clear();
if (GetItemCount())
SetItemCount(0);
}
void wxETWListCtrl::SelectAll()
{
for (long item = 0, count = GetItemCount(); item < count; item++)
SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
void wxETWListCtrl::SelectNone()
{
for (long item = -1; (item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED)) != -1;)
SetItemState(item, 0, wxLIST_STATE_SELECTED);
}
void wxETWListCtrl::RebuildItems()
{
ChildrenRepositioningGuard child_reposition(this);
// Get current focus and selection.
set<size_t> focus, selection;
for (long item = -1; (item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED)) != -1;)
focus.insert(m_rec_idx[item]);
for (long item = -1; (item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED)) != -1;)
selection.insert(m_rec_idx[item]);
// Get current view position (scrolling).
long
item_top = GetTopItem(),
item_page_count = GetCountPerPage(),
item_center = std::min<long>(
item_top + item_page_count / 2, // Index of item in the centre of the view
(item_top + m_rec_idx.size()) / 2); // Index of the item in the centre between top viewed item and the last (when list is not overflowed)
size_t center = item_center < m_rec_idx.size() ? m_rec_idx[item_center] : -1;
// Rebuild the index.
m_rec_idx.clear();
set<size_t>::const_iterator selection_end = selection.end(), focus_end = focus.end();
vector<long> selection_out, focus_out;
long center_out = -1;
for (size_t i = 0, n = m_rec_db.size(); i < n; i++) {
size_t i_abs = m_rec_db.abs(i);
if (i_abs == center)
center_out = m_rec_idx.size();
if (IsVisible(m_rec_db[i])) {
if (selection.find(i_abs) != selection_end)
selection_out.push_back(m_rec_idx.size());
if (focus.find(i_abs) != focus_end)
focus_out.push_back(m_rec_idx.size());
m_rec_idx.push_back(i_abs);
}
}
// Set new item count.
long item_count = (long)m_rec_idx.size();
if (GetItemCount() != item_count)
SetItemCount(item_count);
if (item_count) {
// Restore focus and selection.
for (size_t i = 0, n = focus_out.size(); i < n; i++)
SetItemState(focus_out[i], wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
SelectNone();
for (size_t i = 0, n = selection_out.size(); i < n; i++)
SetItemState(selection_out[i], wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
// Restore scrolling.
if (center_out != -1) {
wxRect pos1, pos2;
GetItemRect(GetTopItem(), pos1);
GetItemRect(std::max<long>(std::min<long>(center_out, item_count - 1) - item_page_count / 2, 0), pos2);
ScrollList(pos2.x - pos1.x, pos2.y - pos1.y);
} else
EnsureVisible(item_count - 1);
// Refresh items.
item_top = GetTopItem();
RefreshItems(item_top, std::min<long>(item_top + item_page_count, item_count));
}
}
bool wxETWListCtrl::IsVisible(const EVENT_RECORD &rec) const
{
return
m_sources.find(rec.EventHeader.ProviderId) != m_sources.end() &&
rec.EventHeader.EventDescriptor.Level <= m_level;
}
void wxETWListCtrl::FormatRow(const event_rec &rec, std::string &rowA, std::wstring &rowW) const
{
rowA.clear();
rowW.clear();
// Merge columns.
string colA;
wxString colW;
for (size_t i = 0; i < _countof(m_col_format_width); i++) {
// Get column text.
colW = OnGetItemText(rec, i);
size_t len = colW.Length();
if (len < m_col_format_width[i]) {
// Pad it to required length.
colW.Append(wxT(' '), m_col_format_width[i] - len);
} else if (m_col_format_width[i] && len > m_col_format_width[i]) {
// Truncate it and add horizontal ellipsis.
colW.Truncate(m_col_format_width[i] - 3);
colW.Append(wxT("..."));
}
// Convert to ACP.
WideCharToMultiByte(CP_ACP, 0, colW.c_str(), -1, colA, NULL, NULL);
// Append to output.
if (i) {
rowA += " ";
rowW += L" ";
}
rowA += colA;
rowW += colW;
}
}
bool wxETWListCtrl::CopyToClipboard(const std::string &dataA, const std::wstring &dataW) const
{
if (OpenClipboard(GetHWND())) {
EmptyClipboard();
HGLOBAL h;
size_t size;
size = (dataA.length() + 1) * sizeof(CHAR);
h = GlobalAlloc(GMEM_MOVEABLE, size);
if (h) {
LPVOID d = GlobalLock(h);
if (d) {
memcpy(d, dataA.data(), size);
GlobalUnlock(h);
SetClipboardData(CF_TEXT, h);
}
}
size = (dataW.length() + 1) * sizeof(WCHAR);
h = GlobalAlloc(GMEM_MOVEABLE, size);
if (h) {
LPVOID d = GlobalLock(h);
if (d) {
memcpy(d, dataW.data(), size);
GlobalUnlock(h);
SetClipboardData(CF_UNICODETEXT, h);
}
}
CloseClipboard();
return true;
} else
return false;
}
wxListItemAttr *wxETWListCtrl::OnGetItemAttr(long item) const
{
const event_rec &rec = m_rec_db.at_abs(m_rec_idx.at(item));
bool is_ours = IsEqualGUID(rec.EventHeader.ProviderId, EAPMETHOD_TRACE_EVENT_PROVIDER) ? true : false;
int column = 0;
// Prepare item to insert into the list.
wxListItem item;
item.SetId(m_item_id++);
item.SetTextColour(
rec.EventHeader.EventDescriptor.Level >= TRACE_LEVEL_VERBOSE ? (is_ours ? 0x666666 : 0xcccccc) :
rec.EventHeader.EventDescriptor.Level >= TRACE_LEVEL_INFORMATION ? (is_ours ? 0x000000 : 0xaaaaaa) :
rec.EventHeader.EventDescriptor.Level >= TRACE_LEVEL_WARNING ? (is_ours ? 0x00aacc : 0xaaeeee) :
(is_ours ? 0x0000ff : 0xaaaaff));
item.SetBackgroundColour(0xffffff);
// Select appropriate attributes acording to race, colour, or creed...
return (wxListItemAttr*)(
((const EVENT_RECORD&)rec).EventHeader.EventDescriptor.Level >= TRACE_LEVEL_VERBOSE ? (is_ours ? &(m_item_attr[0][0]) : &(m_item_attr[1][0])) :
((const EVENT_RECORD&)rec).EventHeader.EventDescriptor.Level >= TRACE_LEVEL_INFORMATION ? (is_ours ? &(m_item_attr[0][1]) : &(m_item_attr[1][1])) :
((const EVENT_RECORD&)rec).EventHeader.EventDescriptor.Level >= TRACE_LEVEL_WARNING ? (is_ours ? &(m_item_attr[0][2]) : &(m_item_attr[1][2])) :
(is_ours ? &(m_item_attr[0][3]) : &(m_item_attr[1][3])));
}
{
// Output event time-stamp.
wxString wxETWListCtrl::OnGetItemText(long item, long column) const
{
return OnGetItemText(m_rec_db.at_abs(m_rec_idx.at(item)), column);
}
wxString wxETWListCtrl::OnGetItemText(const event_rec &rec, long column) const
{
switch (column) {
case 0: {
// Get event time-stamp.
FILETIME ft;
ft.dwHighDateTime = rec.EventHeader.TimeStamp.HighPart;
ft.dwLowDateTime = rec.EventHeader.TimeStamp.LowPart;
@@ -395,39 +576,36 @@ void wxETWListCtrl::OnETWEvent(wxETWEvent& event)
ULONGLONG
ts = rec.EventHeader.TimeStamp.QuadPart,
nanosec = (ts % 10000000) * 100;
microsec = (ts % 10000000) / 10;
item.SetColumn(column++);
item.SetText(tstring_printf(_T("%04d-%02d-%02d %02d:%02d:%02d.%09I64u"),
st_local.wYear, st_local.wMonth, st_local.wDay, st_local.wHour, st_local.wMinute, st_local.wSecond, nanosec));
this->InsertItem(item);
return tstring_printf(_T("%04d-%02d-%02d %02d:%02d:%02d.%06I64u"),
st_local.wYear, st_local.wMonth, st_local.wDay, st_local.wHour, st_local.wMinute, st_local.wSecond, microsec);
}
// Output process ID.
item.SetColumn(column++);
item.SetText(wxString::Format(wxT("%u"), rec.EventHeader.ProcessId));
this->SetItem(item);
case 1:
// Get process ID.
return wxString::Format(wxT("%u"), rec.EventHeader.ProcessId);
// Output thread ID.
item.SetColumn(column++);
item.SetText(wxString::Format(wxT("%u"), rec.EventHeader.ThreadId));
this->SetItem(item);
case 2:
// Get thread ID.
return wxString::Format(wxT("%u"), rec.EventHeader.ThreadId);
// Output event source.
item.SetColumn(column++);
item.SetText(is_ours ? wxT(PRODUCT_NAME_STR) : wxT("EAPHost"));
this->SetItem(item);
case 3:
// Get event source.
return
IsEqualGUID(rec.EventHeader.ProviderId, EAPMETHOD_TRACE_EVENT_PROVIDER) ? wxT(PRODUCT_NAME_STR) :
IsEqualGUID(rec.EventHeader.ProviderId, s_provider_eaphost ) ? wxT("EapHost" ) :
IsEqualGUID(rec.EventHeader.ProviderId, s_provider_schannel ) ? wxT("Schannel" ) : wxEmptyString;
item.SetColumn(column++);
{
case 4: {
// Get event meta-info.
unique_ptr<TRACE_EVENT_INFO> info;
ULONG ulResult;
if ((ulResult = TdhGetEventInformation(&rec, 0, NULL, info)) == ERROR_SUCCESS) {
if ((ulResult = TdhGetEventInformation((PEVENT_RECORD)&rec, 0, NULL, info)) == ERROR_SUCCESS) {
if (info->DecodingSource != DecodingSourceWPP) {
if (rec.EventHeader.Flags & EVENT_HEADER_FLAG_STRING_ONLY) {
// This is a string-only event. Print it.
item.SetText((LPCWSTR)rec.UserData);
return (LPCWSTR)rec.UserData;
} else {
// This is not a string-only event. Prepare parameters.
@@ -437,25 +615,146 @@ void wxETWListCtrl::OnETWEvent(wxETWEvent& event)
props.reserve(info->TopLevelPropertyCount);
props_msg.reserve(info->TopLevelPropertyCount);
for (ULONG i = 0; i < info->TopLevelPropertyCount; i++) {
props.push_back(std::move(PropertyToString(&rec, info.get(), i, NULL, 0, nPtrSize)));
props.push_back(std::move(PropertyToString((PEVENT_RECORD)&rec, info.get(), i, NULL, 0, nPtrSize)));
props_msg.push_back((DWORD_PTR)props[i].c_str());
}
if (info->EventMessageOffset) {
// Format the message.
item.SetText(wstring_msg(0, (LPCTSTR)((LPCBYTE)info.get() + info->EventMessageOffset), props_msg.data()).c_str());
return wstring_msg(0, (LPCTSTR)((LPCBYTE)info.get() + info->EventMessageOffset), props_msg.data()).c_str();
}
}
} else if (info->EventMessageOffset) {
// This is a WPP event.
item.SetText((LPCWSTR)((LPCBYTE)info.get() + info->EventMessageOffset));
return (LPCWSTR)((LPCBYTE)info.get() + info->EventMessageOffset);
}
}
}
}
this->SetItem(item);
return wxEmptyString;
}
void wxETWListCtrl::OnETWEvent(wxETWEvent& event)
{
// Move event, since event handlers will have no use of it and destroy it in the end.
// This way we save memory allocation and copying.
event_rec rec(std::move(event.GetRecord()));
// Is event visible according to current view settings?
bool is_visible = IsVisible(rec);
// Move event to the end of the queue.
size_t pos = m_rec_db.push_back(std::move(rec));
bool has_moved;
if (!m_rec_idx.empty() && m_rec_idx.front() == pos) {
// This event overwrote previous head element in index.
m_rec_idx.pop_front();
has_moved = true;
} else
has_moved = false;
if (is_visible) {
// Push event absolute subscript to the index too.
m_rec_idx.push_back(pos);
}
long item_count = (long)m_rec_idx.size();
if (GetItemCount() != item_count)
SetItemCount(item_count);
if (item_count) {
if (m_scroll_auto) {
// Bring the record into view.
this->EnsureVisible(item.GetId());
EnsureVisible(item_count - 1);
}
if (has_moved) {
long item_top = GetTopItem();
RefreshItems(item_top, std::min<long>(item_top + GetCountPerPage(), item_count));
}
}
}
//////////////////////////////////////////////////////////////////////////
// wxPersistentETWListCtrl
//////////////////////////////////////////////////////////////////////////
wxPersistentETWListCtrl::wxPersistentETWListCtrl(wxETWListCtrl *wnd) : wxPersistentWindow<wxETWListCtrl>(wnd)
{
}
wxString wxPersistentETWListCtrl::GetKind() const
{
return wxT(wxPERSIST_TLW_KIND);
}
void wxPersistentETWListCtrl::Save() const
{
const wxETWListCtrl * const wnd = static_cast<const wxETWListCtrl*>(GetWindow());
// Save log's column widths.
wxListItem col;
col.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_WIDTH);
for (int i = 0, n = wnd->GetColumnCount(); i < n; i++) {
wnd->GetColumn(i, col);
SaveValue(wxString::Format(wxT("Column%sWidth"), col.GetText().c_str()), col.GetWidth());
}
SaveValue(wxT("ScrollAuto" ), wnd->m_scroll_auto);
SaveValue(wxT("SourceCount"), (long)wnd->m_sources.size());
long i = 0;
for (wxETWListCtrl::guidset::const_iterator src = wnd->m_sources.cbegin(), src_end = wnd->m_sources.cend(); src != src_end; ++src, i++)
SaveValue(wxString::Format(wxT("Source%u"), i), tstring_guid(*src));
SaveValue(wxT("Level"), (int)wnd->m_level);
}
bool wxPersistentETWListCtrl::Restore()
{
wxETWListCtrl * const wnd = static_cast<wxETWListCtrl*>(GetWindow());
// Restore log's column widths.
wxListItem col;
col.SetMask(wxLIST_MASK_TEXT);
for (int i = 0, n = wnd->GetColumnCount(); i < n; i++) {
wnd->GetColumn(i, col);
int width;
if (RestoreValue(wxString::Format(wxT("Column%sWidth"), col.GetText().c_str()), &width))
wnd->SetColumnWidth(i, width);
}
RestoreValue(wxT("ScrollAuto"), &(wnd->m_scroll_auto));
wnd->m_sources.clear();
long n;
if (RestoreValue(wxT("SourceCount"), &n)) {
wxString guid_str;
for (long i = 0; i < n; i++) {
if (RestoreValue(wxString::Format(wxT("Source%u"), i), &guid_str)) {
GUID guid;
if (StringToGuid(guid_str.c_str(), &guid))
wnd->m_sources.insert(guid);
}
}
} else {
// Insert our provider by default.
wnd->m_sources.insert(EAPMETHOD_TRACE_EVENT_PROVIDER);
}
int dummy_int;
if (RestoreValue(wxT("Level"), &dummy_int))
wnd->m_level = (UCHAR)std::min<int>(std::max<int>(dummy_int, TRACE_LEVEL_ERROR), TRACE_LEVEL_VERBOSE);
return true;
}

View File

@@ -20,6 +20,11 @@
#include <wx/event.h>
///
/// Maximum number of event records kept
///
#define wxETWEVENT_RECORDS_MAX 1000000
///
/// ETW event
///
@@ -28,24 +33,32 @@ wxDECLARE_EVENT(wxEVT_ETW_EVENT, wxETWEvent);
#define wxETWEventHandler(func) wxEVENT_HANDLER_CAST(wxETWEventFunction, func)
#define EVT_ETW_EVENT(func) wx__DECLARE_EVT0(wxEVT_ETW_EVENT, wxETWEventHandler(func))
///
/// Event trace processor
///
class wxEventTraceProcessorThread;
///
/// Event list control
///
class wxETWListCtrl;
///
/// Event trace processor
/// Supports saving/restoring wxETWListCtrl state
///
class wxEventTraceProcessorThread;
class wxPersistentETWListCtrl;
#pragma once
#include <wx/listctrl.h>
#include <wx/persist/window.h>
#include <wx/thread.h>
#include <WinStd/ETW.h>
#include <memory>
#include <vector>
#include <set>
class wxETWEvent : public wxEvent
@@ -53,23 +66,10 @@ class wxETWEvent : public wxEvent
public:
wxETWEvent(wxEventType type = wxEVT_NULL, const EVENT_RECORD &record = s_record_null);
wxETWEvent(const wxETWEvent& event);
virtual ~wxETWEvent();
virtual wxEvent *Clone() const { return new wxETWEvent(*this); }
inline const EVENT_RECORD& GetRecord() const { return m_record; }
inline EVENT_RECORD& GetRecord() { return m_record; }
inline const EVENT_HEADER& GetHeader() const { return m_record.EventHeader; }
inline const ETW_BUFFER_CONTEXT& GetBufferContext() const { return m_record.BufferContext; }
bool SetExtendedData(size_t extended_data_count, const EVENT_HEADER_EXTENDED_DATA_ITEM *extended_data);
inline size_t GetExtendedDataCount() const { return m_record.ExtendedDataCount; }
inline const EVENT_HEADER_EXTENDED_DATA_ITEM& GetExtendedData(size_t index) const { wxASSERT(index < m_record.ExtendedDataCount); return m_record.ExtendedData[index]; }
bool SetUserData(size_t user_data_length, const void *user_data);
inline size_t GetUserDataLength() const { return m_record.UserDataLength; }
inline void *GetUserData() const { return m_record.UserData; }
inline const winstd::event_rec& GetRecord() const { return m_record; }
inline winstd::event_rec& GetRecord() { return m_record; }
protected:
bool DoSetExtendedData(size_t extended_data_count, const EVENT_HEADER_EXTENDED_DATA_ITEM *extended_data);
@@ -82,7 +82,7 @@ public:
static const EVENT_RECORD s_record_null;
protected:
EVENT_RECORD m_record; ///< ETW event record
winstd::event_rec m_record; ///< ETW event record
};
@@ -111,26 +111,116 @@ protected:
class wxETWListCtrl : public wxListCtrl
{
protected:
///
/// Functor for GUID comparison
///
struct less_guid : public std::binary_function<GUID, GUID, bool>
{
bool operator()(const GUID &a, const GUID &b) const
{
if (a.Data1 < b.Data1) return true;
if (a.Data1 > b.Data1) return false;
if (a.Data2 < b.Data2) return true;
if (a.Data2 > b.Data2) return false;
if (a.Data3 < b.Data3) return true;
if (a.Data3 > b.Data3) return false;
if (memcmp(a.Data4, b.Data4, sizeof(a.Data4)) < 0) return true;
return false;
}
};
///
/// A set of GUIDs
///
typedef std::set<GUID, less_guid> guidset;
public:
wxETWListCtrl(
wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxNO_BORDER,
long style = wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VIRTUAL|wxNO_BORDER,
const wxValidator &validator = wxDefaultValidator,
const wxString &name = wxListCtrlNameStr);
virtual ~wxETWListCtrl();
inline bool IsEmpty() const { return m_rec_db.empty(); }
void CopySelected() const;
void CopyAll() const;
void ClearAll();
void SelectAll();
void SelectNone();
void RebuildItems();
inline bool IsSourceEnabled(const GUID &guid) const
{
return m_sources.find(guid) != m_sources.end();
}
inline void EnableSource(const GUID &guid, bool enable = true)
{
guidset::iterator s = m_sources.find(guid);
if (enable) {
if (s == m_sources.end()) {
m_sources.insert(guid);
RebuildItems();
}
} else {
if (s != m_sources.end()) {
m_sources.erase(s);
RebuildItems();
}
}
}
friend class wxPersistentETWListCtrl; // Allow saving/restoring window state.
protected:
bool IsVisible(const EVENT_RECORD &rec) const;
void FormatRow(const winstd::event_rec &rec, std::string &rowA, std::wstring &rowW) const;
bool CopyToClipboard(const std::string &dataA, const std::wstring &dataW) const;
virtual wxListItemAttr *OnGetItemAttr(long item) const;
virtual wxString OnGetItemText(long item, long column) const;
virtual wxString OnGetItemText(const winstd::event_rec &rec, long column) const;
void OnETWEvent(wxETWEvent& event);
DECLARE_EVENT_TABLE()
public:
static const GUID s_provider_eaphost; ///< EAPHost event provider ID
bool m_scroll_auto; ///< Is autoscrolling enabled?
UCHAR m_level; ///< Shows messages up to this level of verboseness
static const GUID s_provider_eaphost; ///< EapHost event provider ID
static const GUID s_provider_schannel; ///< Schannel event provider ID
protected:
winstd::event_session m_session; ///< Event session
wxEventTraceProcessorThread *m_proc; ///< Processor thread
long m_item_id; ///< Next free list item ID
guidset m_sources; ///< Set of enabled sources
wxListItemAttr m_item_attr[2][4]; ///< Current item attributes
winstd::vector_queue<winstd::event_rec> m_rec_db; ///< Event record database
winstd::vector_queue<size_t> m_rec_idx; ///< Event record database indices of shown records
size_t m_col_format_width[5]; ///< Column widths for pre-formatted row display (0 = unlimited)
};
class wxPersistentETWListCtrl : public wxPersistentWindow<wxETWListCtrl>
{
public:
wxPersistentETWListCtrl(wxETWListCtrl *wnd);
virtual wxString GetKind() const;
virtual void Save() const;
virtual bool Restore();
};
inline wxPersistentObject *wxCreatePersistentObject(wxETWListCtrl *wnd)
{
return new wxPersistentETWListCtrl(wnd);
}

Binary file not shown.

View File

@@ -25,27 +25,239 @@
// wxEventMonitorFrame
//////////////////////////////////////////////////////////////////////////
wxBEGIN_EVENT_TABLE(wxEventMonitorFrame, wxEventMonitorFrameBase)
EVT_MENU(wxID_EXIT, wxEventMonitorFrame::OnExit)
wxEND_EVENT_TABLE()
wxEventMonitorFrame::wxEventMonitorFrame() : wxEventMonitorFrameBase(NULL)
wxEventMonitorFrame::wxEventMonitorFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) :
wxFrame(parent, id, title, pos, size, style, name)
{
this->SetSizeHints(wxSize(150,150), wxDefaultSize);
m_mgr.SetManagedWindow(this);
m_mgr.SetFlags(wxAUI_MGR_DEFAULT);
// Load main window icons.
#ifdef __WINDOWS__
wxIcon icon_small(wxT("00_EventMonitor.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));
wxIconBundle icons;
icons.AddIcon(icon_small);
icons.AddIcon(wxIcon(wxT("00_EventMonitor.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)));
SetIcons(icons);
icons.AddIcon(wxIcon(wxT("00_EventMonitor.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)));
icons.AddIcon(wxIcon(wxT("00_EventMonitor.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON ), ::GetSystemMetrics(SM_CYICON )));
this->SetIcons(icons);
#else
wxIcon icon_small(wxICON(00_EventMonitor.ico));
SetIcon(icon_small);
this->SetIcon(wxIcon(wxICON(00_EventMonitor.ico)));
#endif
wxString prod_name(wxT(PRODUCT_NAME_STR));
wxString prod_status_bar;
prod_status_bar.Printf(_("Toggles display of %s records"), wxT(PRODUCT_NAME_STR));
winstd::library lib_comres;
lib_comres.load(_T("comres.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE);
winstd::library lib_ieframe;
lib_ieframe.load(_T("ieframe.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE);
winstd::library lib_shell32;
lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE);
wxSize size_menu(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
wxSize size_tool(size_menu);
m_menubar = new wxMenuBar(0);
m_menuProgram = new wxMenu();
wxMenuItem* m_menuItemExit;
m_menuItemExit = new wxMenuItem(m_menuProgram, wxID_EXIT, _("E&xit") + wxT('\t') + wxT("Alt+F4"), _("Quits this program"), wxITEM_NORMAL);
m_menuItemExit->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(240), size_menu));
m_menuProgram->Append(m_menuItemExit);
m_menubar->Append(m_menuProgram, _("&Program"));
m_menuEdit = new wxMenu();
wxMenuItem* m_menuEditCopy;
m_menuEditCopy = new wxMenuItem(m_menuEdit, wxID_COPY, wxEmptyString , wxEmptyString, wxITEM_NORMAL);
m_menuEditCopy->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(243), size_menu));
m_menuEdit->Append(m_menuEditCopy);
wxMenuItem* m_menuEditCopyAll;
m_menuEditCopyAll = new wxMenuItem(m_menuEdit, wxID_COPY_ALL, _("Copy A&ll") + wxT('\t') + wxT("Ctrl+Shift+C"), _("Copies all records to clipboard (including hidden)"), wxITEM_NORMAL);
m_menuEditCopyAll->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(133), size_menu));
m_menuEdit->Append(m_menuEditCopyAll);
wxMenuItem* m_menuEditClear;
m_menuEditClear = new wxMenuItem(m_menuEdit, wxID_CLEAR, _("Clear"), _("Clears all records from the log"), wxITEM_NORMAL);
m_menuEditClear->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(200), size_menu));
m_menuEdit->Append(m_menuEditClear);
m_menuEdit->AppendSeparator();
wxMenuItem* m_menuEditSelectAll;
m_menuEditSelectAll = new wxMenuItem(m_menuEdit, wxID_SELECT_ALL, _("Select &All") + wxT('\t') + wxT("Ctrl+A"), _("Selects all visible records"), wxITEM_NORMAL);
m_menuEdit->Append(m_menuEditSelectAll);
wxMenuItem* m_menuEditSelectNone;
m_menuEditSelectNone = new wxMenuItem(m_menuEdit, wxID_SELECT_NONE, _("Select &None") , _("Clears record selection"), wxITEM_NORMAL);
m_menuEdit->Append(m_menuEditSelectNone);
m_menubar->Append(m_menuEdit, _("&Edit"));
m_menuView = new wxMenu();
wxMenuItem* m_menuViewScrollAuto;
m_menuViewScrollAuto = new wxMenuItem(m_menuView, wxID_VIEW_SCROLL_AUTO, _("Auto &Scroll") + wxT('\t') + wxT("Ctrl+S"), _("Automatically scrolls to the most recent records as they come-in"), wxITEM_CHECK);
//m_menuViewScrollAuto->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(231), size_menu));
m_menuView->Append(m_menuViewScrollAuto);
m_menuView->AppendSeparator();
wxMenuItem* m_menuViewSourceEapHost;
m_menuViewSourceEapHost = new wxMenuItem(m_menuView, wxID_VIEW_SOURCE_EAPHOST, wxT("EapHost"), wxString::Format(_("Toggles display of %s records"), wxT("EapHost")), wxITEM_CHECK);
//m_menuViewSourceEapHost->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(273), size_menu));
m_menuView->Append(m_menuViewSourceEapHost);
wxMenuItem* m_menuViewSourceSchannel;
m_menuViewSourceSchannel = new wxMenuItem(m_menuView, wxID_VIEW_SOURCE_SCHANNEL, wxT("Schannel"), wxString::Format(_("Toggles display of %s records"), wxT("Schannel")), wxITEM_CHECK);
//m_menuViewSourceSchannel->SetBitmaps(wxLoadIconFromResource(lib_ieframe, MAKEINTRESOURCE(36870), size_menu));
m_menuView->Append(m_menuViewSourceSchannel);
m_menuViewSourceProduct = new wxMenuItem(m_menuView, wxID_VIEW_SOURCE_PRODUCT, prod_name , prod_status_bar, wxITEM_CHECK);
//m_menuViewSourceProduct->SetBitmaps(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, size_menu.GetWidth(), size_menu.GetHeight()));
m_menuView->Append(m_menuViewSourceProduct);
m_menuView->AppendSeparator();
m_menuViewLevelVerbose = new wxMenuItem(m_menuView, wxID_VIEW_LEVEL_VERBOSE, _("Verbose") + wxT('\t') + wxT("Ctrl+1"), _("Displays all levels of records"), wxITEM_RADIO);
//m_menuViewLevelVerbose->SetBitmaps(wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2863), size_menu));
m_menuView->Append(m_menuViewLevelVerbose);
m_menuViewLevelInformation = new wxMenuItem(m_menuView, wxID_VIEW_LEVEL_INFORMATION, _("Informational") + wxT('\t') + wxT("Ctrl+2"), _("Displays all records up to informational level"), wxITEM_RADIO);
//m_menuViewLevelInformation->SetBitmaps(wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2859), size_menu));
m_menuView->Append(m_menuViewLevelInformation);
m_menuViewLevelWarning = new wxMenuItem(m_menuView, wxID_VIEW_LEVEL_WARNING, _("Warning") + wxT('\t') + wxT("Ctrl+3"), _("Displays all records up to warning level"), wxITEM_RADIO);
//m_menuViewLevelWarning->SetBitmaps(wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2865), size_menu));
m_menuView->Append(m_menuViewLevelWarning);
m_menuViewLevelError = new wxMenuItem(m_menuView, wxID_VIEW_LEVEL_ERROR, _("Error") + wxT('\t') + wxT("Ctrl+4"), _("Displays error level records only"), wxITEM_RADIO);
//m_menuViewLevelError->SetBitmaps(wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2861), size_menu));
m_menuView->Append(m_menuViewLevelError);
m_menuView->AppendSeparator();
wxMenuItem* m_menuViewToolbarEdit;
m_menuViewToolbarEdit = new wxMenuItem(m_menuView, wxID_VIEW_TOOLBAR_EDIT, _("&Edit toolbar"), _("Toggles display of Edit toolbar"), wxITEM_CHECK);
m_menuView->Append(m_menuViewToolbarEdit);
wxMenuItem* m_menuViewToolbarView;
m_menuViewToolbarView = new wxMenuItem(m_menuView, wxID_VIEW_TOOLBAR_VIEW, _("&View toolbar"), _("Toggles display of View toolbar"), wxITEM_CHECK);
m_menuView->Append(m_menuViewToolbarView);
m_menubar->Append(m_menuView, _("&View"));
this->SetMenuBar(m_menubar);
m_toolbarEdit = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_LAYOUT);
m_toolEditCopy = m_toolbarEdit->AddTool(wxID_COPY, _("Copy"), wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(243), size_tool), _("Copies selected records to clipboard") + wxT(" (") + wxT("Ctrl+C") + wxT(")"), wxITEM_NORMAL);
m_toolEditCopyAll = m_toolbarEdit->AddTool(wxID_COPY_ALL, _("Copy All"), wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(133), size_tool), _("Copies all records to clipboard (including hidden)") + wxT(" (") + wxT("Ctrl+Shift+C") + wxT(")"), wxITEM_NORMAL);
m_toolEditClear = m_toolbarEdit->AddTool(wxID_CLEAR, _("Clear"), wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(200), size_tool), _("Clears all records from the log"), wxITEM_NORMAL);
m_toolbarEdit->Realize();
m_mgr.AddPane(m_toolbarEdit, wxAuiPaneInfo().Name(wxT("ToolbarEdit")).Top().Caption(_("Edit")).PinButton(true).Dock().Resizable().FloatingSize(wxDefaultSize).LeftDockable(false).RightDockable(false).Layer(1).ToolbarPane());
m_toolbarView = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_LAYOUT);
m_toolViewScrollAuto = m_toolbarView->AddTool(wxID_VIEW_SCROLL_AUTO, _("Auto Scroll"), wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(231), size_tool), _("Automatically scrolls to the most recent records as they come-in") + wxT(" (") + wxT("Ctrl+S") + wxT(")"), wxITEM_CHECK);
m_toolbarView->AddSeparator();
m_toolViewSourceEapHost = m_toolbarView->AddTool(wxID_VIEW_SOURCE_EAPHOST, "EapHost", wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(273), size_tool), wxString::Format(_("Toggles display of %s records"), wxT("EapHost")), wxITEM_CHECK);
m_toolViewSourceSchannel = m_toolbarView->AddTool(wxID_VIEW_SOURCE_SCHANNEL, "Schannel", wxLoadIconFromResource(lib_ieframe, MAKEINTRESOURCE(36870), size_tool), wxString::Format(_("Toggles display of %s records"), wxT("Schannel")), wxITEM_CHECK);
m_toolViewSourceProduct = m_toolbarView->AddTool(wxID_VIEW_SOURCE_PRODUCT, prod_name, wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, size_tool.GetWidth(), size_tool.GetHeight()), prod_status_bar, wxITEM_CHECK);
m_toolbarView->AddSeparator();
m_toolViewLevelVerbose = m_toolbarView->AddTool(wxID_VIEW_LEVEL_VERBOSE, _("Verbose"), wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2863), size_tool), _("Displays all levels of records") + wxT(" (") + wxT("Ctrl+1") + wxT(")"), wxITEM_RADIO);
m_toolViewLevelInformation = m_toolbarView->AddTool(wxID_VIEW_LEVEL_INFORMATION, _("Informational"), wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2859), size_tool), _("Displays all records up to informational level") + wxT(" (") + wxT("Ctrl+2") + wxT(")"), wxITEM_RADIO);
m_toolViewLevelWarning = m_toolbarView->AddTool(wxID_VIEW_LEVEL_WARNING, _("Warning"), wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2865), size_tool), _("Displays all records up to warning level") + wxT(" (") + wxT("Ctrl+3") + wxT(")"), wxITEM_RADIO);
m_toolViewLevelError = m_toolbarView->AddTool(wxID_VIEW_LEVEL_ERROR, _("Error"), wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2861), size_tool), _("Displays error level records only") + wxT(" (") + wxT("Ctrl+4") + wxT(")"), wxITEM_RADIO);
m_toolbarView->Realize();
m_mgr.AddPane(m_toolbarView, wxAuiPaneInfo().Name(wxT("ToolbarView")).Top().Caption(_("View")).PinButton(true).Dock().Resizable().FloatingSize(wxDefaultSize).LeftDockable(false).RightDockable(false).Layer(1).ToolbarPane());
m_panel = new wxEventMonitorLogPanel(this);
m_mgr.AddPane(m_panel, wxAuiPaneInfo() .Name(wxT("LogPanel")).Center() .Caption(_("Log Trace")).CaptionVisible(false).CloseButton(false).PaneBorder(false).Dock().Resizable().FloatingSize(wxDefaultSize).Floatable(false));
m_statusBar = this->CreateStatusBar(1, wxST_SIZEGRIP, wxID_ANY);
m_mgr.Update();
this->Centre(wxBOTH);
// Restore persistent state of wxAuiManager manually, since m_mgr is not on the heap.
wxPersistentAuiManager(&m_mgr).Restore();
// Connect Events
this->Connect(wxID_EXIT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnExit ));
this->Connect(wxID_COPY , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditCopyUpdate ));
this->Connect(wxID_COPY , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditCopy ));
this->Connect(wxID_COPY_ALL , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditCopyAllUpdate ));
this->Connect(wxID_COPY_ALL , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditCopyAll ));
this->Connect(wxID_CLEAR , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditClearUpdate ));
this->Connect(wxID_CLEAR , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditClear ));
this->Connect(wxID_SELECT_ALL , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditSelectAllUpdate ));
this->Connect(wxID_SELECT_ALL , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditSelectAll ));
this->Connect(wxID_SELECT_NONE , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditSelectNoneUpdate));
this->Connect(wxID_SELECT_NONE , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditSelectNone ));
this->Connect(wxID_VIEW_SCROLL_AUTO , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewScrollUpdate ));
this->Connect(wxID_VIEW_SCROLL_AUTO , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewScroll ));
this->Connect(wxID_VIEW_SOURCE_EAPHOST , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ), new wxObjectWithData<GUID>(wxETWListCtrl::s_provider_eaphost ));
this->Connect(wxID_VIEW_SOURCE_EAPHOST , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ), new wxObjectWithData<GUID>(wxETWListCtrl::s_provider_eaphost ));
this->Connect(wxID_VIEW_SOURCE_SCHANNEL, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ), new wxObjectWithData<GUID>(wxETWListCtrl::s_provider_schannel));
this->Connect(wxID_VIEW_SOURCE_SCHANNEL, wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ), new wxObjectWithData<GUID>(wxETWListCtrl::s_provider_schannel));
this->Connect(wxID_VIEW_SOURCE_PRODUCT , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ), new wxObjectWithData<GUID>(EAPMETHOD_TRACE_EVENT_PROVIDER ));
this->Connect(wxID_VIEW_SOURCE_PRODUCT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ), new wxObjectWithData<GUID>(EAPMETHOD_TRACE_EVENT_PROVIDER ));
this->Connect(wxID_VIEW_LEVEL_VERBOSE , wxID_VIEW_LEVEL_ERROR, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewLevelUpdate ));
this->Connect(wxID_VIEW_LEVEL_VERBOSE , wxID_VIEW_LEVEL_ERROR, wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewLevel ));
this->Connect(wxID_VIEW_TOOLBAR_EDIT , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewToolbarUpdate ), new wxObjectWithData<wxAuiPaneInfo*>(&m_mgr.GetPane(m_toolbarEdit)));
this->Connect(wxID_VIEW_TOOLBAR_EDIT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewToolbar ), new wxObjectWithData<wxAuiPaneInfo*>(&m_mgr.GetPane(m_toolbarEdit)));
this->Connect(wxID_VIEW_TOOLBAR_VIEW , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewToolbarUpdate ), new wxObjectWithData<wxAuiPaneInfo*>(&m_mgr.GetPane(m_toolbarView)));
this->Connect(wxID_VIEW_TOOLBAR_VIEW , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewToolbar ), new wxObjectWithData<wxAuiPaneInfo*>(&m_mgr.GetPane(m_toolbarView)));
}
wxEventMonitorFrame::~wxEventMonitorFrame()
{
// Disconnect Events
this->Disconnect(wxID_EXIT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnExit ));
this->Disconnect(wxID_COPY , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditCopyUpdate ));
this->Disconnect(wxID_COPY , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditCopy ));
this->Disconnect(wxID_COPY_ALL , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditCopyAllUpdate ));
this->Disconnect(wxID_COPY_ALL , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditCopyAll ));
this->Disconnect(wxID_CLEAR , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditClearUpdate ));
this->Disconnect(wxID_CLEAR , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditClear ));
this->Disconnect(wxID_SELECT_ALL , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditSelectAllUpdate ));
this->Disconnect(wxID_SELECT_ALL , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditSelectAll ));
this->Disconnect(wxID_SELECT_NONE , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditSelectNoneUpdate));
this->Disconnect(wxID_SELECT_NONE , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditSelectNone ));
this->Disconnect(wxID_VIEW_SCROLL_AUTO , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewScrollUpdate ));
this->Disconnect(wxID_VIEW_SCROLL_AUTO , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewScroll ));
this->Disconnect(wxID_VIEW_SOURCE_EAPHOST , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ));
this->Disconnect(wxID_VIEW_SOURCE_EAPHOST , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ));
this->Disconnect(wxID_VIEW_SOURCE_SCHANNEL, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ));
this->Disconnect(wxID_VIEW_SOURCE_SCHANNEL, wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ));
this->Disconnect(wxID_VIEW_SOURCE_PRODUCT , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ));
this->Disconnect(wxID_VIEW_SOURCE_PRODUCT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ));
this->Disconnect(wxID_VIEW_LEVEL_VERBOSE , wxID_VIEW_LEVEL_ERROR, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewLevelUpdate ));
this->Disconnect(wxID_VIEW_LEVEL_VERBOSE , wxID_VIEW_LEVEL_ERROR, wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewLevel ));
this->Disconnect(wxID_VIEW_TOOLBAR_EDIT , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewToolbarUpdate ));
this->Disconnect(wxID_VIEW_TOOLBAR_EDIT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewToolbar ));
this->Disconnect(wxID_VIEW_TOOLBAR_VIEW , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewToolbarUpdate ));
this->Disconnect(wxID_VIEW_TOOLBAR_VIEW , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewToolbar ));
// Save wxAuiManager's state.
wxPersistentAuiManager(&m_mgr).Save();
m_mgr.UnInit();
}
@@ -55,6 +267,147 @@ void wxEventMonitorFrame::OnExit(wxCommandEvent& /*event*/)
}
void wxEventMonitorFrame::OnEditCopyUpdate(wxUpdateUIEvent& event)
{
event.Enable(m_panel->m_log->GetSelectedItemCount() != 0);
}
void wxEventMonitorFrame::OnEditCopy(wxCommandEvent& /*event*/)
{
m_panel->m_log->CopySelected();
}
void wxEventMonitorFrame::OnEditCopyAllUpdate(wxUpdateUIEvent& event)
{
event.Enable(!m_panel->m_log->IsEmpty());
}
void wxEventMonitorFrame::OnEditCopyAll(wxCommandEvent& /*event*/)
{
m_panel->m_log->CopyAll();
}
void wxEventMonitorFrame::OnEditClearUpdate(wxUpdateUIEvent& event)
{
event.Enable(!m_panel->m_log->IsEmpty());
}
void wxEventMonitorFrame::OnEditClear(wxCommandEvent& /*event*/)
{
m_panel->m_log->ClearAll();
}
void wxEventMonitorFrame::OnEditSelectAllUpdate(wxUpdateUIEvent& event)
{
event.Enable(m_panel->m_log->GetSelectedItemCount() != m_panel->m_log->GetItemCount());
}
void wxEventMonitorFrame::OnEditSelectAll(wxCommandEvent& /*event*/)
{
m_panel->m_log->SelectAll();
}
void wxEventMonitorFrame::OnEditSelectNoneUpdate(wxUpdateUIEvent& event)
{
event.Enable(m_panel->m_log->GetSelectedItemCount() != 0);
}
void wxEventMonitorFrame::OnEditSelectNone(wxCommandEvent& /*event*/)
{
m_panel->m_log->SelectNone();
}
void wxEventMonitorFrame::OnViewScrollUpdate(wxUpdateUIEvent& event)
{
event.Check(m_panel->m_log->m_scroll_auto);
}
void wxEventMonitorFrame::OnViewScroll(wxCommandEvent& event)
{
m_panel->m_log->m_scroll_auto = event.IsChecked();
if (m_panel->m_log->m_scroll_auto) {
// Scroll to the last record.
long count = m_panel->m_log->GetItemCount();
if (count)
m_panel->m_log->EnsureVisible(count - 1);
}
}
void wxEventMonitorFrame::OnViewSourceUpdate(wxUpdateUIEvent& event)
{
wxObjectWithData<GUID> *source = dynamic_cast<wxObjectWithData<GUID>*>(event.m_callbackUserData);
if (source) {
// Update GUI control according to event source state.
event.Check(m_panel->m_log->IsSourceEnabled(source->m_data));
event.Enable(true);
} else
event.Enable(false);
}
void wxEventMonitorFrame::OnViewSource(wxCommandEvent& event)
{
wxObjectWithData<GUID> *source = dynamic_cast<wxObjectWithData<GUID>*>(event.m_callbackUserData);
if (source) {
// Enable event source.
m_panel->m_log->EnableSource(source->m_data, event.IsChecked());
}
}
void wxEventMonitorFrame::OnViewLevelUpdate(wxUpdateUIEvent& event)
{
// Update GUI control according to log level.
event.Check(TRACE_LEVEL_ERROR + wxID_VIEW_LEVEL_ERROR - event.GetId() == m_panel->m_log->m_level);
}
void wxEventMonitorFrame::OnViewLevel(wxCommandEvent& event)
{
UCHAR state_new = TRACE_LEVEL_ERROR + wxID_VIEW_LEVEL_ERROR - event.GetId();
if (m_panel->m_log->m_level != state_new) {
// Set new log level.
m_panel->m_log->m_level = state_new;
m_panel->m_log->RebuildItems();
}
}
void wxEventMonitorFrame::OnViewToolbarUpdate(wxUpdateUIEvent& event)
{
wxObjectWithData<wxAuiPaneInfo*> *source = dynamic_cast<wxObjectWithData<wxAuiPaneInfo*>*>(event.m_callbackUserData);
if (source && source->m_data) {
// Update GUI control according to toolbar/panel visibility.
event.Check(source->m_data->IsShown());
event.Enable(true);
} else
event.Enable(false);
}
void wxEventMonitorFrame::OnViewToolbar(wxCommandEvent& event)
{
wxObjectWithData<wxAuiPaneInfo*> *source = dynamic_cast<wxObjectWithData<wxAuiPaneInfo*>*>(event.m_callbackUserData);
if (source && source->m_data) {
// Toggle toolbar/panel visibility.
source->m_data->Show(!source->m_data->IsShown());
m_mgr.Update();
}
}
//////////////////////////////////////////////////////////////////////////
// wxPersistentEventMonitorFrame
//////////////////////////////////////////////////////////////////////////

View File

@@ -30,20 +30,92 @@ class wxPersistentEventMonitorFrame;
#pragma once;
#include "LogPanel.h"
#include "wxEventMonitor_UI.h"
#include <wx/frame.h>
#include <wx/menu.h>
#include <wx/statusbr.h>
#include <wx/aui/auibar.h>
#include <wx/aui/framemanager.h>
#include <wx/persist/toplevel.h>
#include <WinStd/Win.h>
class wxEventMonitorFrame : public wxEventMonitorFrameBase
class wxEventMonitorFrame : public wxFrame
{
protected:
enum {
wxID_COPY_ALL = 1000,
wxID_SELECT_ALL,
wxID_SELECT_NONE,
wxID_VIEW_SCROLL_AUTO,
wxID_VIEW_SOURCE_EAPHOST,
wxID_VIEW_SOURCE_SCHANNEL,
wxID_VIEW_SOURCE_PRODUCT,
wxID_VIEW_LEVEL_VERBOSE,
wxID_VIEW_LEVEL_INFORMATION,
wxID_VIEW_LEVEL_WARNING,
wxID_VIEW_LEVEL_ERROR,
wxID_VIEW_TOOLBAR_EDIT,
wxID_VIEW_TOOLBAR_VIEW,
};
public:
wxEventMonitorFrame();
wxEventMonitorFrame(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Event Monitor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600,400), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, const wxString& name = wxT("EventMonitor"));
~wxEventMonitorFrame();
friend class wxPersistentEventMonitorFrame;
protected:
void OnExit(wxCommandEvent& event);
wxDECLARE_EVENT_TABLE();
void OnEditCopyUpdate(wxUpdateUIEvent& event);
void OnEditCopy(wxCommandEvent& event);
void OnEditCopyAllUpdate(wxUpdateUIEvent& event);
void OnEditCopyAll(wxCommandEvent& event);
void OnEditClearUpdate(wxUpdateUIEvent& event);
void OnEditClear(wxCommandEvent& event);
void OnEditSelectAllUpdate(wxUpdateUIEvent& event);
void OnEditSelectAll(wxCommandEvent& event);
void OnEditSelectNoneUpdate(wxUpdateUIEvent& event);
void OnEditSelectNone(wxCommandEvent& event);
void OnViewScrollUpdate(wxUpdateUIEvent& event);
void OnViewScroll(wxCommandEvent& event);
void OnViewSourceUpdate(wxUpdateUIEvent& event);
void OnViewSource(wxCommandEvent& event);
void OnViewLevelUpdate(wxUpdateUIEvent& event);
void OnViewLevel(wxCommandEvent& event);
void OnViewToolbarUpdate(wxUpdateUIEvent& event);
void OnViewToolbar(wxCommandEvent& event);
protected:
wxMenuBar* m_menubar;
wxMenu* m_menuProgram;
wxMenu* m_menuEdit;
wxMenu* m_menuView;
wxMenuItem* m_menuViewSourceProduct;
wxMenuItem* m_menuViewLevelVerbose;
wxMenuItem* m_menuViewLevelInformation;
wxMenuItem* m_menuViewLevelWarning;
wxMenuItem* m_menuViewLevelError;
wxAuiToolBar* m_toolbarEdit;
wxAuiToolBarItem* m_toolEditCopy;
wxAuiToolBarItem* m_toolEditCopyAll;
wxAuiToolBarItem* m_toolEditClear;
wxAuiToolBar* m_toolbarView;
wxAuiToolBarItem* m_toolViewScrollAuto;
wxAuiToolBarItem* m_toolViewSourceEapHost;
wxAuiToolBarItem* m_toolViewSourceSchannel;
wxAuiToolBarItem* m_toolViewSourceProduct;
wxAuiToolBarItem* m_toolViewLevelVerbose;
wxAuiToolBarItem* m_toolViewLevelInformation;
wxAuiToolBarItem* m_toolViewLevelWarning;
wxAuiToolBarItem* m_toolViewLevelError;
wxStatusBar* m_statusBar;
wxEventMonitorLogPanel* m_panel;
wxAuiManager m_mgr;
};

View File

@@ -51,13 +51,7 @@ void wxPersistentEventMonitorLogPanel::Save() const
{
const wxEventMonitorLogPanel * const wnd = static_cast<const wxEventMonitorLogPanel*>(GetWindow());
// Save log's column widths.
wxListItem col;
col.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_WIDTH);
for (int i = 0, n = wnd->m_log->GetColumnCount(); i < n; i++) {
wnd->m_log->GetColumn(i, col);
SaveValue(wxString::Format(wxT("Column%sWidth"), col.GetText().c_str()), col.GetWidth());
}
wxPersistentETWListCtrl(wnd->m_log).Save();
}
@@ -65,16 +59,7 @@ bool wxPersistentEventMonitorLogPanel::Restore()
{
wxEventMonitorLogPanel * const wnd = static_cast<wxEventMonitorLogPanel*>(GetWindow());
// Restore log's column widths.
wxListItem col;
col.SetMask(wxLIST_MASK_TEXT);
for (int i = 0, n = wnd->m_log->GetColumnCount(); i < n; i++) {
wnd->m_log->GetColumn(i, col);
int width;
if (RestoreValue(wxString::Format(wxT("Column%sWidth"), col.GetText().c_str()), &width))
wnd->m_log->SetColumnWidth(i, width);
}
wxPersistentETWListCtrl(wnd->m_log).Restore();
return true;
}

View File

@@ -25,9 +25,12 @@
#include "Frame.h"
#include "LogPanel.h"
#include "../lib/EAPBase_UI/include/EAP_UI.h"
#include "../include/Version.h"
#include <wxex/common.h>
#include <wxex/object.h>
#include <wxex/persist/auimanager.h>
#include <WinStd/COM.h>
@@ -43,6 +46,8 @@
#include <Sddl.h>
#include <tchar.h>
#include <utility>
#include <vector>
#include <set>
#include <EventsETW.h> // Must include after <Windows.h>

View File

@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: EventMonitor\n"
"POT-Creation-Date: 2016-07-15 13:05+0200\n"
"POT-Creation-Date: 2016-08-27 07:52+0200\n"
"PO-Revision-Date: 2016-06-02 12:27+0200\n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
@@ -17,31 +17,214 @@ msgstr ""
"X-Poedit-KeywordsList: _\n"
"X-Poedit-SearchPath-0: .\n"
#: App.cpp:69 wxEventMonitor_UI.h:54
#: App.cpp:69 Frame.h:67 MSIBuild/En.Win32.Release.Feature-2.idtx:4
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
msgid "Event Monitor"
msgstr ""
#: LogPanel.cpp:30
#: ETWLog.cpp:83
#, c-format
msgid "Error opening event trace (error %u)."
msgstr ""
#: ETWLog.cpp:171
msgid "Time"
msgstr ""
#: LogPanel.cpp:31
#: ETWLog.cpp:172
msgid "PID"
msgstr ""
#: ETWLog.cpp:173
msgid "TID"
msgstr ""
#: ETWLog.cpp:174
msgid "Source"
msgstr ""
#: wxEventMonitor_UI.cpp:23
#: ETWLog.cpp:175
msgid "Event"
msgstr ""
#: ETWLog.cpp:232
msgid "Access denied creating event session: you need administrative privileges (Run As Administrator) or be a member of Performance Log Users group to start event tracing session."
msgstr ""
#: ETWLog.cpp:235
#, c-format
msgid "The %s event session already exists."
msgstr ""
#: ETWLog.cpp:239
#, c-format
msgid "Error creating event session (error %u)."
msgstr ""
#: ETWLog.cpp:255 ETWLog.cpp:270 ETWLog.cpp:284
#, c-format
msgid "Error enabling %s event provider (error %u)."
msgstr ""
#: Frame.cpp:48 Frame.cpp:108 Frame.cpp:113 Frame.cpp:168 Frame.cpp:170
#, c-format
msgid "Toggles display of %s records"
msgstr ""
#: Frame.cpp:65
msgid "E&xit"
msgstr ""
#: wxEventMonitor_UI.cpp:23
msgid "Quit this program"
#: Frame.cpp:65
msgid "Quits this program"
msgstr ""
#: wxEventMonitor_UI.cpp:26
#: Frame.cpp:69
#, fuzzy
msgid "&Program"
msgstr "You don't have %s subscription yet."
#: wxEventMonitor_UI.cpp:32
#: Frame.cpp:78
msgid "Copy A&ll"
msgstr ""
#: Frame.cpp:78 Frame.cpp:156
msgid "Copies all records to clipboard (including hidden)"
msgstr ""
#: Frame.cpp:83 Frame.cpp:158
msgid "Clear"
msgstr ""
#: Frame.cpp:83 Frame.cpp:158
msgid "Clears all records from the log"
msgstr ""
#: Frame.cpp:90
msgid "Select &All"
msgstr ""
#: Frame.cpp:90
msgid "Selects all visible records"
msgstr ""
#: Frame.cpp:94
msgid "Select &None"
msgstr ""
#: Frame.cpp:94
msgid "Clears record selection"
msgstr ""
#: Frame.cpp:97
msgid "&Edit"
msgstr ""
#: Frame.cpp:101
msgid "Auto &Scroll"
msgstr ""
#: Frame.cpp:101 Frame.cpp:164
msgid "Automatically scrolls to the most recent records as they come-in"
msgstr ""
#: Frame.cpp:123 Frame.cpp:176
msgid "Verbose"
msgstr ""
#: Frame.cpp:123 Frame.cpp:176
msgid "Displays all levels of records"
msgstr ""
#: Frame.cpp:127 Frame.cpp:178
msgid "Informational"
msgstr ""
#: Frame.cpp:127 Frame.cpp:178
msgid "Displays all records up to informational level"
msgstr ""
#: Frame.cpp:131 Frame.cpp:180
msgid "Warning"
msgstr ""
#: Frame.cpp:131 Frame.cpp:180
msgid "Displays all records up to warning level"
msgstr ""
#: Frame.cpp:135 Frame.cpp:182
#, fuzzy
msgid "Error"
msgstr "Napaka pri nalaganju knjižnice MSI.DLL (%1!ld!)."
#: Frame.cpp:135 Frame.cpp:182
msgid "Displays error level records only"
msgstr ""
#: Frame.cpp:142
msgid "&Edit toolbar"
msgstr ""
#: Frame.cpp:142
msgid "Toggles display of Edit toolbar"
msgstr ""
#: Frame.cpp:146
msgid "&View toolbar"
msgstr ""
#: Frame.cpp:146
msgid "Toggles display of View toolbar"
msgstr ""
#: Frame.cpp:149
msgid "&View"
msgstr ""
#: Frame.cpp:154
msgid "Copy"
msgstr ""
#: Frame.cpp:154
msgid "Copies selected records to clipboard"
msgstr ""
#: Frame.cpp:156
msgid "Copy All"
msgstr ""
#: Frame.cpp:161
msgid "Edit"
msgstr ""
#: Frame.cpp:164
msgid "Auto Scroll"
msgstr ""
#: Frame.cpp:185
msgid "View"
msgstr ""
#: Frame.cpp:189
msgid "Log Trace"
msgstr ""
#: MSIBuild/En.Win32.Release.Feature-2.idtx:3
#: MSIBuild/En.Win32.Release.Shortcut-2.idtx:3
#: MSIBuild/En.x64.Release.Feature-2.idtx:3
#: MSIBuild/En.x64.Release.Shortcut-2.idtx:3
#, fuzzy
msgid "1252"
msgstr "1250"
#: MSIBuild/En.Win32.Release.Shortcut-2.idtx:4
#: MSIBuild/En.x64.Release.Shortcut-2.idtx:4
msgid "EVENTM~1|GÉANTLink Event Monitor"
msgstr ""
#: MSIBuild/En.Win32.Release.Feature-2.idtx:4
#: MSIBuild/En.Win32.Release.Shortcut-2.idtx:4
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
#: MSIBuild/En.x64.Release.Shortcut-2.idtx:4
msgid "Real-time display of internal events"
msgstr ""

View File

@@ -13,54 +13,12 @@
///////////////////////////////////////////////////////////////////////////
wxEventMonitorFrameBase::wxEventMonitorFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxFrame( parent, id, title, pos, size, style, name )
{
this->SetSizeHints( wxSize( 150,150 ), wxDefaultSize );
m_mgr.SetManagedWindow(this);
m_mgr.SetFlags(wxAUI_MGR_DEFAULT);
m_menubar = new wxMenuBar( 0 );
m_menuProgram = new wxMenu();
wxMenuItem* m_menuItemExit;
m_menuItemExit = new wxMenuItem( m_menuProgram, wxID_EXIT, wxString( _("E&xit") ) + wxT('\t') + wxT("Alt+F4"), _("Quit this program"), wxITEM_NORMAL );
m_menuProgram->Append( m_menuItemExit );
m_menubar->Append( m_menuProgram, _("&Program") );
this->SetMenuBar( m_menubar );
m_panel = new wxEventMonitorLogPanel( this );
m_mgr.AddPane( m_panel, wxAuiPaneInfo() .Name( wxT("LogPanel") ).Center() .Caption( _("Log Trace") ).CaptionVisible( false ).CloseButton( false ).PaneBorder( false ).Dock().Resizable().FloatingSize( wxDefaultSize ).Floatable( false ) );
m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
m_mgr.Update();
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( wxEventMonitorFrameBase::OnClose ) );
this->Connect( wxEVT_ICONIZE, wxIconizeEventHandler( wxEventMonitorFrameBase::OnIconize ) );
this->Connect( wxEVT_IDLE, wxIdleEventHandler( wxEventMonitorFrameBase::OnIdle ) );
}
wxEventMonitorFrameBase::~wxEventMonitorFrameBase()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( wxEventMonitorFrameBase::OnClose ) );
this->Disconnect( wxEVT_ICONIZE, wxIconizeEventHandler( wxEventMonitorFrameBase::OnIconize ) );
this->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxEventMonitorFrameBase::OnIdle ) );
m_mgr.UnInit();
}
wxEventMonitorLogPanelBase::wxEventMonitorLogPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
m_log = new wxETWListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxNO_BORDER );
m_log = new wxETWListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VIRTUAL|wxNO_BORDER );
bSizerMain->Add( m_log, 1, wxEXPAND, 5 );

View File

@@ -26,261 +26,6 @@
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">1</property>
<object class="Frame" expanded="1">
<property name="aui_managed">1</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">150,150</property>
<property name="name">wxEventMonitorFrameBase</property>
<property name="pos"></property>
<property name="size">600,400</property>
<property name="style">wxDEFAULT_FRAME_STYLE</property>
<property name="subclass"></property>
<property name="title">Event Monitor</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name">EventMonitor</property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<property name="xrc_skip_sizer">1</property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose">OnClose</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize">OnIconize</event>
<event name="OnIdle">OnIdle</event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxMenuBar" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Menu</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_menubar</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxMenu" expanded="1">
<property name="label">&amp;Program</property>
<property name="name">m_menuProgram</property>
<property name="permission">protected</property>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help">Quit this program</property>
<property name="id">wxID_EXIT</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">E&amp;xit</property>
<property name="name">m_menuItemExit</property>
<property name="permission">none</property>
<property name="shortcut">Alt+F4</property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
<object class="CustomControl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name">LogPanel</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption">Log Trace</property>
<property name="caption_visible">0</property>
<property name="center_pane">0</property>
<property name="class">wxEventMonitorLogPanel</property>
<property name="close_button">0</property>
<property name="construction">m_panel = new wxEventMonitorLogPanel( this );&#x0A;</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="declaration">wxEventMonitorLogPanel* m_panel;</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Center</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">0</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="include">class wxEventMonitorLogPanel;</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_panel</property>
<property name="pane_border">0</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">public</property>
<property name="pin_button">0</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="settings"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
<object class="wxStatusBar" expanded="0">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="fields">1</property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_statusBar</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxST_SIZEGRIP</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="Panel" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
@@ -381,13 +126,13 @@
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="permission">public</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL</property>
<property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VIRTUAL</property>
<property name="subclass">wxETWListCtrl; ETWLog.h</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>

View File

@@ -13,53 +13,17 @@
#include <wx/intl.h>
class wxETWListCtrl;
#include <wx/string.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/menu.h>
#include <wx/listctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
class wxEventMonitorLogPanel;
#include <wx/statusbr.h>
#include <wx/frame.h>
#include <wx/aui/aui.h>
#include <wx/listctrl.h>
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class wxEventMonitorFrameBase
///////////////////////////////////////////////////////////////////////////////
class wxEventMonitorFrameBase : public wxFrame
{
private:
protected:
wxMenuBar* m_menubar;
wxMenu* m_menuProgram;
wxStatusBar* m_statusBar;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
public:
wxEventMonitorLogPanel* m_panel;
wxEventMonitorFrameBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Event Monitor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,400 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, const wxString& name = wxT("EventMonitor") );
wxAuiManager m_mgr;
~wxEventMonitorFrameBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxEventMonitorLogPanelBase
///////////////////////////////////////////////////////////////////////////////
@@ -68,9 +32,9 @@ class wxEventMonitorLogPanelBase : public wxPanel
private:
protected:
wxETWListCtrl* m_log;
public:
wxETWListCtrl* m_log;
wxEventMonitorLogPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxT("EventMonitorLogPanel") );
~wxEventMonitorLogPanelBase();

Binary file not shown.

2
desktop.ini Normal file
View File

@@ -0,0 +1,2 @@
[.ShellClassInfo]
IconResource=include\icon_full.ico,0

View File

@@ -29,7 +29,7 @@
// Product version as a single DWORD
// Note: Used for version comparison within C/C++ code.
//
#define PRODUCT_VERSION 0x00ff0c00
#define PRODUCT_VERSION 0x00ff0d00
//
// Product version by components
@@ -39,26 +39,26 @@
//
#define PRODUCT_VERSION_MAJ 0
#define PRODUCT_VERSION_MIN 255
#define PRODUCT_VERSION_REV 12
#define PRODUCT_VERSION_REV 13
#define PRODUCT_VERSION_BUILD 0
//
// Human readable product version and build year for UI
//
#define PRODUCT_VERSION_STR "1.0-alpha12"
#define PRODUCT_VERSION_STR "1.0-alpha13"
#define PRODUCT_BUILD_YEAR_STR "2016"
//
// Numerical version presentation for ProductVersion propery in
// MSI packages (syntax: N.N[.N[.N]])
//
#define PRODUCT_VERSION_INST "0.255.12"
#define PRODUCT_VERSION_INST "0.255.13"
//
// The product code for ProductCode property in MSI packages
// Replace with new on every version change, regardless how minor it is.
//
#define PRODUCT_VERSION_GUID "{6F5B0B97-B6BB-4D3E-9FEC-41E6CDC3868F}"
#define PRODUCT_VERSION_GUID "{13ADDFF3-B249-4AB5-9FAD-E4CDCED62B11}"
//
// Since the product name is not finally confirmed at the time of

1598
include/icon.pdf Normal file

File diff suppressed because one or more lines are too long

BIN
include/icon_full.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

BIN
include/icon_ui.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -60,7 +60,7 @@ namespace eap
///
enum source_t {
source_unknown = -1, ///< Unknown source
source_cache = 0, ///< Credentials were obtained from EAPHost cache
source_cache = 0, ///< Credentials were obtained from EapHost cache
source_preshared, ///< Credentials were set by method configuration
source_storage ///< Credentials were loaded from Windows Credential Manager
};

View File

@@ -77,7 +77,7 @@ namespace eap
/// @{
///
/// Starts an EAP authentication session on the peer EAPHost using the EAP method.
/// Starts an EAP authentication session on the peer EapHost using the EAP method.
///
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
///
@@ -95,7 +95,7 @@ namespace eap
virtual void end_session();
///
/// Processes a packet received by EAPHost from a supplicant.
/// Processes a packet received by EapHost from a supplicant.
///
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
///

View File

@@ -565,7 +565,7 @@ namespace eap
peer(_In_ winstd::eap_type_t eap_method);
///
/// Initializes an EAP peer method for EAPHost.
/// Initializes an EAP peer method for EapHost.
///
/// \sa [EapPeerGetInfo function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363613.aspx)
///
@@ -579,7 +579,7 @@ namespace eap
virtual void shutdown() = 0;
///
/// Returns the user data and user identity after being called by EAPHost.
/// Returns the user data and user identity after being called by EapHost.
///
/// \sa [EapPeerGetIdentity function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363607.aspx)
///
@@ -662,7 +662,7 @@ namespace eap
_Inout_ EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData) const;
///
/// Converts user information into a user BLOB that can be consumed by EAPHost run-time functions.
/// Converts user information into a user BLOB that can be consumed by EapHost run-time functions.
///
/// \sa [EapPeerQueryUIBlobFromInteractiveUIInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb204696.aspx)
///
@@ -679,7 +679,7 @@ namespace eap
/// @{
///
/// Starts an EAP authentication session on the peer EAPHost using the EAP method.
/// Starts an EAP authentication session on the peer EapHost using the EAP method.
///
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
///
@@ -703,7 +703,7 @@ namespace eap
virtual void end_session(_In_ EAP_SESSION_HANDLE hSession) = 0;
///
/// Processes a packet received by EAPHost from a supplicant.
/// Processes a packet received by EapHost from a supplicant.
///
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
///

View File

@@ -21,7 +21,6 @@
#include <wx/hyperlink.h>
#include <wx/icon.h>
#include <wx/scrolwin.h>
#include <wx/statbmp.h>
#include <Windows.h>
@@ -91,9 +90,14 @@ template <class _Tcred, class _Tbase> class wxEAPCredentialsPanelBase;
template <class _Tcred, class _Tbase> class wxPasswordCredentialsPanel;
///
/// Sets icon from resource
/// Loads icon from resource
///
inline bool wxSetIconFromResource(wxStaticBitmap *bmp, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName);
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, int cx = GetSystemMetrics(SM_CXICON), int cy = GetSystemMetrics(SM_CYICON));
///
/// Loads icon from resource
///
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, const wxSize &size);
///
/// Returns GUI displayable provider name
@@ -160,6 +164,16 @@ public:
// Set extra style here, as wxFormBuilder overrides all default flags.
this->SetExtraStyle(this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
// Load window icons.
#ifdef __WINDOWS__
wxIconBundle icons;
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)));
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON ), ::GetSystemMetrics(SM_CYICON )));
this->SetIcons(icons);
#else
this->SetIcon(wxIcon(wxICON(product.ico)));
#endif
for (std::vector<eap::config_provider>::iterator provider = m_cfg.m_providers.begin(), provider_end = m_cfg.m_providers.end(); provider != provider_end; ++provider) {
bool is_single = provider->m_methods.size() == 1;
std::vector<std::unique_ptr<eap::config_method> >::size_type count = 0;
@@ -310,10 +324,6 @@ public:
/// Constructs a notice pannel and set the title text
///
wxEAPProviderLockedPanel(const eap::config_provider &prov, wxWindow* parent);
protected:
winstd::library m_shell32; ///< shell32.dll resource library reference
wxIcon m_icon; ///< Panel icon
};
@@ -324,10 +334,6 @@ public:
/// Constructs a notice pannel and set the title text
///
wxEAPCredentialWarningPanel(const eap::config_provider &prov, wxWindow* parent);
protected:
winstd::library m_shell32; ///< shell32.dll resource library reference
wxIcon m_icon; ///< Panel icon
};
@@ -381,8 +387,6 @@ protected:
protected:
eap::config_provider &m_prov; ///< EAP method configuration
winstd::library m_shell32; ///< shell32.dll resource library reference
wxIcon m_icon; ///< Panel icon
};
@@ -405,8 +409,6 @@ protected:
protected:
eap::config_provider &m_prov; ///< EAP method configuration
winstd::library m_shell32; ///< shell32.dll resource library reference
wxIcon m_icon; ///< Panel icon
};
@@ -448,8 +450,9 @@ public:
wxEAPCredentialsConfigPanelBase(parent)
{
// Load and set icon.
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
wxSetIconFromResource(m_credentials_icon, m_icon, m_shell32, MAKEINTRESOURCE(/*16770*/269));
winstd::library lib_shell32;
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_credentials_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(/*16770*/269)));
}
///
@@ -613,8 +616,6 @@ protected:
protected:
const eap::config_provider &m_prov; ///< EAP provider
eap::config_method_with_cred &m_cfg; ///< EAP method configuration
winstd::library m_shell32; ///< shell32.dll resource library reference
wxIcon m_icon; ///< Panel icon
winstd::tstring m_target; ///< Credential Manager target
private:
@@ -719,8 +720,9 @@ public:
wxEAPCredentialsPanelBase<_Tcred, _Tbase>(prov, cfg, cred, pszCredTarget, parent, is_config)
{
// Load and set icon.
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
wxSetIconFromResource(m_credentials_icon, m_icon, m_shell32, MAKEINTRESOURCE(269));
winstd::library lib_shell32;
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_credentials_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(269)));
bool layout = false;
if (!m_prov.m_lbl_alt_credential.empty()) {
@@ -785,10 +787,6 @@ protected:
/// \endcond
protected:
winstd::library m_shell32; ///< shell32.dll resource library reference
wxIcon m_icon; ///< Panel icon
private:
static const wxStringCharType *s_dummy_password;
};
@@ -797,17 +795,27 @@ template <class _Tcred, class _Tbase>
const wxStringCharType *wxPasswordCredentialsPanel<_Tcred, _Tbase>::s_dummy_password = wxT("dummypass");
inline bool wxSetIconFromResource(wxStaticBitmap *bmp, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName)
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, int cx, int cy)
{
wxASSERT(bmp);
HICON hIcon;
if (SUCCEEDED(LoadIconWithScaleDown(hinst, pszName, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), &hIcon))) {
if (SUCCEEDED(LoadIconWithScaleDown(hinst, pszName, cx, cy, &hIcon))) {
wxIcon icon;
icon.CreateFromHICON(hIcon);
bmp->SetIcon(icon);
return true;
return icon;
} else
return false;
return wxNullIcon;
}
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, const wxSize &size)
{
HICON hIcon;
if (SUCCEEDED(LoadIconWithScaleDown(hinst, pszName, size.GetWidth(), size.GetHeight(), &hIcon))) {
wxIcon icon;
icon.CreateFromHICON(hIcon);
return icon;
} else
return wxNullIcon;
}

View File

@@ -47,6 +47,16 @@ wxEAPGeneralDialog::wxEAPGeneralDialog(wxWindow *parent, wxWindowID id, const wx
// Set extra style here, as wxFormBuilder overrides all default flags.
this->SetExtraStyle(this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
// Load window icons.
#ifdef __WINDOWS__
wxIconBundle icons;
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)));
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON ), ::GetSystemMetrics(SM_CYICON )));
this->SetIcons(icons);
#else
this->SetIcon(wxIcon(wxICON(product.ico)));
#endif
m_buttonsOK->SetDefault();
}
@@ -174,8 +184,9 @@ void wxEAPNotePanel::CreateContactFields(const eap::config_provider &prov)
wxEAPProviderLockedPanel::wxEAPProviderLockedPanel(const eap::config_provider &prov, wxWindow* parent) : wxEAPNotePanel(parent)
{
// Load and set icon.
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
wxSetIconFromResource(m_note_icon, m_icon, m_shell32, MAKEINTRESOURCE(48));
winstd::library lib_shell32;
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_note_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(48)));
m_note_label->SetLabel(wxString::Format(_("%s has pre-set parts of this configuration. Those parts are locked to prevent accidental modification."),
!prov.m_name.empty() ? prov.m_name.c_str() :
@@ -195,8 +206,9 @@ wxEAPProviderLockedPanel::wxEAPProviderLockedPanel(const eap::config_provider &p
wxEAPCredentialWarningPanel::wxEAPCredentialWarningPanel(const eap::config_provider &prov, wxWindow* parent) : wxEAPNotePanel(parent)
{
// Load and set icon.
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
wxSetIconFromResource(m_note_icon, m_icon, m_shell32, MAKEINTRESOURCE(161));
winstd::library lib_shell32;
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_note_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(161)));
m_note_label->SetLabel(_("Previous attempt to connect failed. Please, make sure your credentials are correct, or try again later."));
m_note_label->Wrap(449);
@@ -265,8 +277,9 @@ wxEAPProviderIdentityPanel::wxEAPProviderIdentityPanel(eap::config_provider &pro
wxEAPProviderIdentityPanelBase(parent)
{
// Load and set icon.
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
wxSetIconFromResource(m_provider_id_icon, m_icon, m_shell32, MAKEINTRESOURCE(259));
winstd::library lib_shell32;
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_provider_id_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(259)));
}
@@ -303,8 +316,9 @@ wxEAPProviderLockPanel::wxEAPProviderLockPanel(eap::config_provider &prov, wxWin
wxEAPProviderLockPanelBase(parent)
{
// Load and set icon.
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
wxSetIconFromResource(m_provider_lock_icon, m_icon, m_shell32, MAKEINTRESOURCE(1003));
winstd::library lib_shell32;
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_provider_lock_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(1003)));
}

View File

@@ -176,7 +176,7 @@ namespace eap
/// @{
///
/// Starts an EAP authentication session on the peer EAPHost using the EAP method.
/// Starts an EAP authentication session on the peer EapHost using the EAP method.
///
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
///
@@ -187,7 +187,7 @@ namespace eap
_In_ DWORD dwMaxSendPacketSize);
///
/// Processes a packet received by EAPHost from a supplicant.
/// Processes a packet received by EapHost from a supplicant.
///
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
///

View File

@@ -748,8 +748,8 @@ void eap::method_tls::get_result(
// But be careful: do so only if this happened after transition from handshake to application data phase.
cfg_method->m_auth_failed = m_phase_prev < phase_application_data && m_phase >= phase_application_data;
// Do not report failure to EAPHost, as it will not save updated configuration then. But we need it to save it, to alert user on next connection attempt.
// EAPHost is well aware of the failed condition.
// Do not report failure to EapHost, as it will not save updated configuration then. But we need it to save it, to alert user on next connection attempt.
// EapHost is well aware of the failed condition.
//ppResult->fIsSuccess = FALSE;
//ppResult->dwFailureReasonCode = EAP_E_AUTHENTICATION_FAILED;

View File

@@ -269,10 +269,6 @@ protected:
virtual bool TransferDataFromWindow();
virtual void OnUpdateUI(wxUpdateUIEvent& event);
/// \endcond
protected:
winstd::library m_shell32; ///< shell32.dll resource library reference
wxIcon m_icon; ///< Panel icon
};
@@ -309,8 +305,6 @@ protected:
protected:
const eap::config_provider &m_prov; ///< EAP provider
eap::config_method_tls &m_cfg; ///< TLS configuration
winstd::library m_certmgr; ///< certmgr.dll resource library reference
wxIcon m_icon; ///< Panel icon
std::list<std::wstring> m_server_names_val; ///< Acceptable authenticating server names
};

View File

@@ -315,8 +315,9 @@ wxTLSCredentialsPanel::wxTLSCredentialsPanel(const eap::config_provider &prov, c
wxEAPCredentialsPanelBase<eap::credentials_tls, wxTLSCredentialsPanelBase>(prov, cfg, cred, pszCredTarget, parent, is_config)
{
// Load and set icon.
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
wxSetIconFromResource(m_credentials_icon, m_icon, m_shell32, MAKEINTRESOURCE(269));
winstd::library lib_shell32;
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_credentials_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(269)));
}
@@ -418,8 +419,9 @@ wxTLSServerTrustPanel::wxTLSServerTrustPanel(const eap::config_provider &prov, e
wxEAPTLSServerTrustConfigPanelBase(parent)
{
// Load and set icon.
if (m_certmgr.load(_T("certmgr.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
wxSetIconFromResource(m_server_trust_icon, m_icon, m_certmgr, MAKEINTRESOURCE(218));
winstd::library lib_certmgr;
if (lib_certmgr.load(_T("certmgr.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_server_trust_icon->SetIcon(wxLoadIconFromResource(lib_certmgr, MAKEINTRESOURCE(218)));
// Do not use cfg.m_server_names directly, so we can decide not to store the value in case of provider-locked configuration.
// Never rely on control disabled state alone, as they can be enabled using external tool like Spy++.

View File

@@ -83,7 +83,7 @@ namespace eap
/// @{
///
/// Processes a packet received by EAPHost from a supplicant.
/// Processes a packet received by EapHost from a supplicant.
///
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
///

View File

@@ -49,7 +49,7 @@ namespace eap
virtual config_method* make_config_method();
///
/// Initializes an EAP peer method for EAPHost.
/// Initializes an EAP peer method for EapHost.
///
/// \sa [EapPeerGetInfo function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363613.aspx)
///
@@ -63,7 +63,7 @@ namespace eap
virtual void shutdown();
///
/// Returns the user data and user identity after being called by EAPHost.
/// Returns the user data and user identity after being called by EapHost.
///
/// \sa [EapPeerGetIdentity function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363607.aspx)
///
@@ -111,7 +111,7 @@ namespace eap
/// @{
///
/// Starts an EAP authentication session on the peer EAPHost using the EAP method.
/// Starts an EAP authentication session on the peer EapHost using the EAP method.
///
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
///
@@ -135,7 +135,7 @@ namespace eap
virtual void end_session(_In_ EAP_SESSION_HANDLE hSession);
///
/// Processes a packet received by EAPHost from a supplicant.
/// Processes a packet received by EapHost from a supplicant.
///
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
///

View File

@@ -147,8 +147,8 @@ void eap::method_ttls::get_result(
// The TLS was OK.
method_tls::get_result(EapPeerMethodResultSuccess, ppResult);
// Do not report failure to EAPHost, as it will not save updated configuration then. But we need it to save it, to alert user on next connection attempt.
// EAPHost is well aware of the failed condition.
// Do not report failure to EapHost, as it will not save updated configuration then. But we need it to save it, to alert user on next connection attempt.
// EapHost is well aware of the failed condition.
//if (reason == EapPeerMethodResultFailure) {
// ppResult->fIsSuccess = FALSE;
// ppResult->dwFailureReasonCode = EAP_E_AUTHENTICATION_FAILED;

View File

@@ -68,8 +68,6 @@ protected:
protected:
const eap::config_provider &m_prov; ///< EAP provider
eap::config_method_ttls &m_cfg; ///< TTLS configuration
winstd::library m_shell32; ///< shell32.dll resource library reference
wxIcon m_icon; ///< Panel icon
};

View File

@@ -31,8 +31,9 @@ wxTTLSConfigPanel::wxTTLSConfigPanel(const eap::config_provider &prov, eap::conf
wxTTLSConfigPanelBase(parent)
{
// Load and set icon.
if (m_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
wxSetIconFromResource(m_outer_identity_icon, m_icon, m_shell32, MAKEINTRESOURCE(265));
winstd::library lib_shell32;
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_outer_identity_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(265)));
}