Thread: Next intruction to execute (IP)

  1. #1
    Registered User albert_sps's Avatar
    Join Date
    Mar 2008
    Location
    Tegucigalpa
    Posts
    6

    Question Next intruction to execute (IP)

    I have a script that load into memory a .exe file. I know the CS:IP address, but how can I execute code using this address and an interrupt of DOS after i have loaded file into memory. I'm using Turbo c++.

    I have not to use interrupt 21h, 0x4b subfunction.

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by albert_sps View Post
    I have a script that load into memory a .exe file. I know the CS:IP address, but how can I execute code using this address and an interrupt of DOS after i have loaded file into memory. I'm using Turbo c++.

    I have not to use interrupt 21h, 0x4b subfunction.
    So basically your task is to rewrite DOS. Okay then...

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You mean that you have loaded an executable into memory, but you don't know how to "jump to it"?

    It's pretty simple really, just store the start-address (CS:IP) in memory, and use the indirect jump instruction:
    Code:
        jmp dword ptr [startaddress]
    Now, how you get back to where you started is a different matter.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting 32 bit binary IP to decimal IP (vice-versa)
    By Mankthetank19 in forum C Programming
    Replies: 15
    Last Post: 12-28-2009, 07:17 PM
  2. Replies: 6
    Last Post: 06-08-2006, 04:11 PM
  3. Ip adresses
    By Da-Nuka in forum Networking/Device Communication
    Replies: 8
    Last Post: 02-27-2005, 02:25 PM