void DumpStrings(hadesmem::Process const& process, hadesmem::PeFile const& pe_file) { std::wostream& out = GetOutputStreamW(); std::uint8_t* const file_beg = static_cast<std::uint8_t*>(pe_file.GetBase()); void* const file_end = file_beg + pe_file.GetSize(); // TODO: Fix to not require multiple passes. WriteNewline(out); WriteNormal(out, L"Narrow Strings:", 1); WriteNewline(out); DumpStringsImpl(process, pe_file, file_beg, file_end, false); WriteNewline(out); WriteNormal(out, L"Wide Strings (Pass 1):", 1); WriteNewline(out); DumpStringsImpl(process, pe_file, file_beg, file_end, true); WriteNewline(out); WriteNormal(out, L"Wide Strings (Pass 2):", 1); WriteNewline(out); DumpStringsImpl(process, pe_file, file_beg + 1, file_end, true); }
void DumpPeFile(hadesmem::Process const& process, hadesmem::PeFile const& pe_file, std::wstring const& path) { std::wostream& out = GetOutputStreamW(); ClearWarnForCurrentFile(); WriteNewline(out); std::wstring const architecture_str{pe_file.Is64() ? L"64-Bit File: Yes" : L"64-Bit File: No"}; WriteNormal(out, architecture_str, 1); std::uint32_t const k1MB = (1U << 20); std::uint32_t const k100MB = k1MB * 100; if (pe_file.GetSize() > k100MB) { // Not actually unsupported, just want to flag large files for use in perf // testing. WriteNewline(out); WriteNormal(out, L"WARNING! File is over 100MB.", 0); // WarnForCurrentFile(WarningType::kUnsupported); } DumpHeaders(process, pe_file); DumpSections(process, pe_file); DumpOverlay(process, pe_file); DumpTls(process, pe_file); DumpExports(process, pe_file); bool has_new_bound_imports_any = false; DumpImports(process, pe_file, has_new_bound_imports_any); DumpBoundImports(process, pe_file, has_new_bound_imports_any); DumpRelocations(process, pe_file); if (!g_quiet && g_strings) { DumpStrings(process, pe_file); } HandleWarnings(path); }
void DumpPeFile(hadesmem::Process const& process, hadesmem::PeFile const& pe_file, std::wstring const& path) { std::wostream& out = std::wcout; ClearWarnForCurrentFile(); std::uint32_t const k1MB = (1U << 20); std::uint32_t const k100MB = k1MB * 100; if (pe_file.GetSize() > k100MB) { // Not actually unsupported, just want to flag large files. WriteNewline(out); WriteNormal(out, L"WARNING! File is over 100MB.", 0); WarnForCurrentFile(WarningType::kUnsupported); } DumpHeaders(process, pe_file); DumpSections(process, pe_file); DumpTls(process, pe_file); DumpExports(process, pe_file); bool has_new_bound_imports_any = false; DumpImports(process, pe_file, has_new_bound_imports_any); DumpBoundImports(process, pe_file, has_new_bound_imports_any); DumpRelocations(process, pe_file); DumpStrings(process, pe_file); HandleWarnings(path); }