Skip to content

Commit

Permalink
Added IMAGE_DEBUG_TYPE_* values introduced with Windows 10.
Browse files Browse the repository at this point in the history
  • Loading branch information
JusticeRage committed Jan 22, 2016
1 parent 42d50e4 commit fc22a46
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
6 changes: 5 additions & 1 deletion manape/nt_values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,11 @@ const flag_dict DEBUG_TYPES =
("IMAGE_DEBUG_TYPE_OMAP_FROM_SRC", 8)
("IMAGE_DEBUG_TYPE_BORLAND", 9)
("IMAGE_DEBUG_TYPE_RESERVED", 10)
("IMAGE_DEBUG_TYPE_CLSID", 11);
("IMAGE_DEBUG_TYPE_CLSID", 11)
("IMAGE_DEBUG_TYPE_VC_FEATURE", 12)
("IMAGE_DEBUG_TYPE_POGO", 13)
("IMAGE_DEBUG_TYPE_ILTCG", 14)
("IMAGE_DEBUG_TYPE_MPX", 15);

// ----------------------------------------------------------------------------

Expand Down
41 changes: 41 additions & 0 deletions test/pe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,47 @@ BOOST_AUTO_TEST_CASE(parse_sections)
check_section(sec[5], ".reloc", 0x1ac, 0x7000, 0x200, 0x2c00, 0, 0, 0, 0, 0x42000040);
}

// ----------------------------------------------------------------------------

/**
* @brief Helper function which checks that a section contains the expected data.
*/
void check_debug_directory_entry(mana::debug_directory_entry d,
const std::string& type,
boost::uint32_t size,
boost::uint32_t address_raw_data,
boost::uint32_t pointer_raw_data)
{
BOOST_CHECK(*nt::translate_to_flag(d.Type, nt::DEBUG_TYPES) == type);
BOOST_CHECK(d.SizeofData == size);
BOOST_CHECK(d.AddressOfRawData == address_raw_data);
BOOST_CHECK(d.PointerToRawData == pointer_raw_data);
BOOST_CHECK(d.Characteristics == 0);
BOOST_CHECK(d.MajorVersion == 0);
BOOST_CHECK(d.MinorVersion == 0);
BOOST_CHECK(d.TimeDateStamp == 0x569a5cdb);
}

// ----------------------------------------------------------------------------

BOOST_AUTO_TEST_CASE(parse_debug_info)
{
mana::PE pe("testfiles/manatest.exe");

auto pdebug = pe.get_debug_info();
BOOST_ASSERT(pdebug);
auto debug = *pdebug;
BOOST_ASSERT(debug.size() == 4);
for (int i = 0 ; i < 4 ; i++) {
BOOST_ASSERT(debug[i]);
}

check_debug_directory_entry(*debug[0], "IMAGE_DEBUG_TYPE_CODEVIEW", 71, 0x3280, 0x1880);
check_debug_directory_entry(*debug[1], "IMAGE_DEBUG_TYPE_VC_FEATURE", 20, 0x32c8, 0x18c8);
check_debug_directory_entry(*debug[2], "IMAGE_DEBUG_TYPE_POGO", 632, 0x32dc, 0x18dc);
check_debug_directory_entry(*debug[3], "IMAGE_DEBUG_TYPE_ILTCG", 0, 0, 0);
}

// ----------------------------------------------------------------------------
BOOST_AUTO_TEST_SUITE_END()
// ----------------------------------------------------------------------------

0 comments on commit fc22a46

Please sign in to comment.