title: JMP to absolute address (op codes)
body: <p>I'm trying to code a exe packer/protector as a way of learning more about assembler, c++, and how PE files work. I've currently got it working so the section containing the EP is XORed with a key and a new section is created that contains my decryption code. Everything works out great except when I try and JMP to the original EP after decryption.</p>
  
  <p>Basically I do this:</p>
  
  <pre><code>DWORD originalEntryPoint = optionalHeader-&gt;AddressOfEntryPoint;
  // -- snip -- //
      crypted.put(0xE9);
   crypted.write((char*)&amp;orginalEntryPoint, sizeof(DWORD)); 
  </code></pre>
  
  <p>But instead of it jumping to the entry point, ollydbg shows that this code disassembles to:</p>
  
  <pre><code>00404030   .-E9 00100000    JMP 00405035 ; should be 00401000 =[
  </code></pre>
  
  <p>and when I try to change it manually in olly the new opcode shows up as</p>
  
  <pre><code>00404030    -E9 CBCFFFFF    JMP crypted.00401000
  </code></pre>
  
  <p>Where did 0xCBCFFFFF come from? How would I generate that from the C++ side?</p>