Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 187793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:53:12+00:00 2026-05-11T15:53:12+00:00

Lets assume I’ve allocated the address where my codecave is placed using VirtualAllocEx (it

  • 0

Lets assume I’ve allocated the address where my codecave is placed using VirtualAllocEx (it returns the address) and I write my code into that address using WriteProcessMemory().

Here’s the question:

How do I write a jump to my codecave? I know that jumps start with ‘E9‘, but how do I convert the address returned by VirtualAllocEx into a correct UInt32 (dword) so the debugger/compiler will understand the instruction?

For example:

I’m at address 00402020 (OEP of the native app). I write a jump to 004028CF (empty place) ‘JMP 004028CF‘. The instruction in bytes looks like this:

CPU Disasm Address   Hex dump      Command                                  Comments 00402020  E9 AA080000   JMP 004028CF 

‘E9‘ is how we indicate a JMP. What about ‘AA080000‘, how do I generate this?

I need to do something similar so I can initialize a JMP to my codecave, which will be located at an address returned by VirtualAllocEx().

Any help will be gratefully appreciated!

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:53:13+00:00Added an answer on May 11, 2026 at 3:53 pm

    E9 is a relative jump so the later 32 bits are just an offset to the current instruction pointer. See Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 2A: Instruction Set Reference, A-M pages 549ff for details. For more information see Intel® 64 and IA-32 Architectures Software Developer’s Manuals.

    So the opcode to jump from 00402020 to 004028CF should be the following.

         E9  00 00 08 AA 
    Offset   = DestinationAddress - CurrentInstructionPointer 000008AA = 004028CF           - 00402025 

    When the jump instruction is executed, the instruction pointer is already set to the next instruction. So the offset of the jump instruction and the current instruction pointer value differ by 5.

    CurrentInstructionPointer = AddressOfJumpInstruction + 5 

    UPDATE

    Corrected error about the current instruction pointer value. Thanks jn.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets assume that I'm dealing with a service that involves sending large amounts of
Lets assume a simple Spring MVC Controller that receives the ID of a domain
Lets assume my classes are loaded from a compressed .war file or loaded elsewhere,
Lets assume we have this xml: <?xml version=1.0 encoding=UTF-8?> <tns:RegistryResponse status=urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure xmlns:tns=urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0 xmlns:rim=urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0> <tns:RegistryErrorList
Lets assume we have a class which will be widely used throughout the (c#)
Lets assume: Network has_many Channels Network has_many Nicknames Channel has_many Messages Channel belongs_to Network
Lets assume I have a bitmap with a square aspect and width of 2048
Lets assume we've build a system with a DI framework which is working quite
Lets assume we have xml: <tag1> text <tag2> { <tag3> name1 </tag3>:<tag4><val>value1</val>;</tag4> <tag3> name2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.