This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
107 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "pch.h" | ||
#include "ExceptionsView.h" | ||
#include "SortHelper.h" | ||
|
||
CString CExceptionsView::GetColumnText(HWND, int row, int col) const { | ||
auto& item = m_Items[row]; | ||
|
||
switch (col) { | ||
case 0: return std::format(L"0x{:08X}", item.get_begin_address()).c_str(); | ||
case 1: return std::format(L"0x{:08X}", item.get_end_address()).c_str(); | ||
case 2: return std::format(L"0x{:08X}", item.get_unwind_data_address()).c_str(); | ||
} | ||
return CString(); | ||
} | ||
|
||
void CExceptionsView::DoSort(SortInfo const* si) { | ||
if (si == nullptr) | ||
return; | ||
|
||
auto compare = [&](auto& item1, auto& item2) { | ||
switch (si->SortColumn) { | ||
case 0: return SortHelper::Sort(item1.get_begin_address(), item2.get_begin_address(), si->SortAscending); | ||
case 1: return SortHelper::Sort(item1.get_end_address(), item2.get_end_address(), si->SortAscending); | ||
case 2: return SortHelper::Sort(item1.get_unwind_data_address(), item2.get_unwind_data_address(), si->SortAscending); | ||
} | ||
return false; | ||
}; | ||
std::ranges::sort(m_Items, compare); | ||
} | ||
|
||
LRESULT CExceptionsView::OnCreate(UINT, WPARAM, LPARAM, BOOL&) { | ||
m_hWndClient = m_List.Create(m_hWnd, rcDefault, nullptr, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | | ||
LVS_REPORT | LVS_OWNERDATA | LVS_SINGLESEL | LVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE); | ||
m_List.SetExtendedListViewStyle(LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP); | ||
|
||
auto cm = GetColumnManager(m_List); | ||
cm->AddColumn(L"Dummy", 0, 10); | ||
cm->AddColumn(L"Begin Address", LVCFMT_RIGHT, 120); | ||
cm->AddColumn(L"End Address", LVCFMT_RIGHT, 120); | ||
cm->AddColumn(L"Unwind Address", LVCFMT_RIGHT, 120); | ||
cm->UpdateColumns(); | ||
cm->DeleteColumn(0); | ||
|
||
m_Items = PE().get_exceptions().get_exception_entries(); | ||
m_List.SetItemCount((int)m_Items.size()); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include "View.h" | ||
#include <VirtualListView.h> | ||
|
||
class CExceptionsView : | ||
public CView<CExceptionsView>, | ||
public CVirtualListView<CExceptionsView> { | ||
public: | ||
using CView::CView; | ||
|
||
CString GetColumnText(HWND, int row, int col) const; | ||
void DoSort(SortInfo const* si); | ||
|
||
BEGIN_MSG_MAP(CExceptionsView) | ||
MESSAGE_HANDLER(WM_CREATE, OnCreate) | ||
CHAIN_MSG_MAP(CView<CExceptionsView>) | ||
CHAIN_MSG_MAP(CVirtualListView<CExceptionsView>) | ||
END_MSG_MAP() | ||
|
||
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); | ||
|
||
private: | ||
CListViewCtrl m_List; | ||
std::vector<pe_exception_entry> m_Items; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule WTLHelper
updated
3 files
+1 −0 | WTLHelper/ColumnManager.cpp | |
+9 −0 | WTLHelper/ToolbarHelper.cpp | |
+1 −0 | WTLHelper/ToolbarHelper.h |