Exetools  

Go Back   Exetools > General > General Discussion

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-15-2006, 15:37
Zest
 
Posts: n/a
How to load and then patch in 16 bit environments?

Hi,
I want to use interrupt 21h function al=1h and ah=4Bh

Here is the first and second program.
http://rapidshare.com/files/2394260/EXEC.rar

In fact,I want to change one byte of the second program.(For example the string which is used in V.EXE to show DOS version) And at last I want to run the second program while it's changed already by the First program.

So what should I do after loading the second program by putting 1 in AL.
How can I access to the elements of the second program.
For example data segment and code segment.
Also let me know how to run the second program after changing some of its parts.
Please explain it well or just show me a snippet of code.
So I can understand this concept in coding.


Thanks in advance.
Best Regards,
Zest.


Here is the code:
Code:
TITLE A PROGRAM TO EXECUTE ANOTHER ONE
PAGE 62,133

stseg SEGMENT STACK

      BYTE 4*1024 DUP (?)

stseg ENDS

dtseg SEGMENT PUBLIC 'DATA'
      PathName   BYTE "C:\v.exe",0
      ParamBlock WORD 0
                 DWORD CmdLine
                 DWORD Dummy,Dummy
                 
      CmdLine    BYTE  4,'v.exe',0dh
      Dummy      BYTE  20 DUP (?)   


dtseg ENDS

cdseg SEGMENT PUBLIC 'CODE'
main  PROC FAR
      ASSUME cs:cdseg,ds:dtseg,ss:stseg,es:dtseg

      mov ax,SEG dtseg
      mov ds,ax
      mov es,ax

     ;using an algo to free some memory for the second program

      mov ah,4Bh  ;trying to load the second program
      mov al,1
      mov dx,SEG PathName
      mov ds,dx
      lea dx,PathName
      mov bx,SEG ParamBlock
      mov es,bx
      lea bx,ParamBlock
      int 21h

;Now the second program is loaded but not executed.
;it's time to change the data in the second one.
;But i don't know how to get access to data and code section
;of the second program.
     
     
      ;Wait for keypress
      xor ah,ah
      int 16h
     
     
      mov ah,4ch
      int 21h
main  ENDP   
cdseg ENDS
PUBLIC main
END main
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT +8. The time now is 03:47.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )