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:

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
Posted on 2006-11-15 01:38:09 by Zest
I'm afraid this is against The Rules, so you're on your own with this one - try finding & disassembling some old DOS trainers, and perhaps ask about this at the woodmann forum.

And feel free to ask here about other stuff :)
Posted on 2006-11-15 02:26:06 by f0dder
Patchloader.. bleh.
Posted on 2006-11-15 03:20:03 by Homer