Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
added file size, alignment and checksum to pe main view
Browse files Browse the repository at this point in the history
  • Loading branch information
zodiacon committed Jun 14, 2022
1 parent 78db3e0 commit 612f1bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion TotalPE/PEImageView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,18 @@ void CPEImageView::OnStateChanged(HWND, int from, int to, DWORD oldState, DWORD
void CPEImageView::BuildItems() {
auto& header = PE().get_image();
auto& path = Frame()->GetPEPath();
DWORD fileSize = 0;
HANDLE hFile = ::CreateFile(path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
fileSize = ::GetFileSize(hFile, nullptr);
::CloseHandle(hFile);
}

m_Items = std::vector<DataItem>{
m_Items = std::vector<DataItem> {
{ L"File Name", (PCWSTR)path.Mid(path.ReverseFind(L'\\') + 1), (PCWSTR)path },
{ L"File Size", PEStrings::ToMemorySize(fileSize) },
{ L"Alignment", std::format(L"0x{:X}", header.get_file_align()) },
{ L"Checksum", std::format(L"0x{:X}", header.get_checksum()) },
{ L"Time/Date Stamp", std::format(L"0x{:08X}", header.get_timestamp()) },
{ L"Machine", std::format(L"{} (0x{:X})", header.get_machine(), header.get_machine()), PEStrings::MachineTypeToString(header.get_machine()) },
{ L"Subsystem", std::to_wstring(header.get_sub_system()), PEStrings::SubsystemToString(header.get_sub_system()) },
Expand Down
2 changes: 1 addition & 1 deletion WTLHelper

0 comments on commit 612f1bb

Please sign in to comment.