@@ -90,20 +90,25 @@ std::vector<std::uint8_t> pe_builder::create() const {
9090
9191 std::vector<std::uint32_t > sym_to_rva (bin_.symbols ().size (), 0 );
9292
93- for (auto const bb : bin_.basic_blocks ()) {
94- sym_to_rva[bb->sym_id .value ] = current_virtual_address + instr_offset;
95-
96- for (auto const & instr : bb->instructions ) {
97- contents.insert (end (contents),
98- std::begin (instr.bytes ), std::begin (instr.bytes ) + instr.length );
99- instr_offset += instr.length ;
100- }
101-
102- contents.push_back (0xCC );
103- contents.push_back (0xCC );
104- contents.push_back (0xCC );
105- instr_offset += 3 ;
106- }
93+ sym_to_rva[bin_.entrypoint ()->sym_id .value ] = current_virtual_address + instr_offset;
94+ contents.push_back (0xEB );
95+ contents.push_back (0xFE );
96+ instr_offset += 2 ;
97+
98+ // for (auto const bb : bin_.basic_blocks()) {
99+ // sym_to_rva[bb->sym_id.value] = current_virtual_address + instr_offset;
100+
101+ // for (auto const& instr : bb->instructions) {
102+ // contents.insert(end(contents),
103+ // std::begin(instr.bytes), std::begin(instr.bytes) + instr.length);
104+ // instr_offset += instr.length;
105+ // }
106+
107+ // contents.push_back(0xCB);
108+ // contents.push_back(0xCB);
109+ // contents.push_back(0xCB);
110+ // instr_offset += 2;
111+ // }
107112
108113 // The code section is the last section (after the data blocks).
109114 auto const code_section = section_header (contents, data_blocks.size ());
0 commit comments