; 浜様様様様様様様様様様様様様様融 ; PROTECT 3.0 ; 藩様様様様様様様様様様様様様様夕 ; ; 痰ガ PROTECT Б錺 痰※碎 薑矣 Гカ ; ※腑痰ム, pКョキ き ├ pp : ; Disk Manadger ; FDisk ; ; Copyright (c) 1990 by Gurtjak D. ( Donetsk, USSR ) ; All right reserved. ; main segment para public assume cs:main,ds:main org 100h start: jmp install LastDrive1 db 'Q' Len_Pass db 0 Password db 10 dup ( 0 ) Table1 db 36 dup ( 0 ) ext_table1 db 108 dup ( 0 ) Table2 db 36 dup ( 0 ) ext_table2 db 108 dup ( 0 ) Int_13h PROC FAR pushf push ax mov al,1 test dl,80h je old_int cmp ah,2 jz read cmp ah,3 jz write cmp ah,5 jz write cmp ah,6 jz write cmp ah,7 jz write cmp ah,10 jz read cmp ah,11 jz write old_int: pop ax popf db 0eah ; jmp oldvector ofs13 dw 0 seg13 dw 0 read: mov al,2 write: push di push si push ds push bp push cs pop ds mov bp,16 mov si,offset Table1 cmp dl,81h jne loop1 mov si,offset Table2 loop1: call Track cmp di,[si+1] jb Next_Drive jz Begin_Track cmp di,[si+5] ja Next_Drive jnz Error End_Track: cmp dh,[si+7] ja Next_Drive jnz Error End_Sector: cmp cl,[si+8] ja Next_Drive jmp short Error Begin_Track: cmp di,0 ; 皀痰 0- ぎ牀Κ je Error cmp dh,[si+3] jb Next_Drive jnz Error Begin_Sector: cmp cl,[si+4] jnb Error Next_Drive: add si,9 dec bp jnz loop1 No_Error: pop bp pop ds pop si pop di jmp short old_int Error: mov ah,[si] and ah,al jz No_Error xor di,di mov ds,di mov byte ptr ds:441h,1 pop bp pop ds pop si pop di pop ax popf stc Ret 2 Int_13h ENDP Int_2fh PROC NEAR ; 甄 √ぅ ax - 9400h ; 〓Бモ al - 0ffh, es:bx - むメ Table1 ; 甄 √ぅ bx = 1234h 皰 bp:si - むメ old int 13h cmp ah,94h je addr_t db 0eah ofs2f dw 0 seg2f dw 0 addr_t: mov al,0FFh push cs pop es cmp bx,1234h jne no_old mov bp,cs:seg13 mov si,cs:ofs13 no_old: mov bx,offset Table1 iret Int_2fh ENDP Track PROC NEAR push cx push ax mov ax,cx xchg ah,al mov cl,6 shr ah,cl mov di,ax pop ax pop cx ret Track ENDP Install: push cs pop ds mov dx,offset Title1 mov ah,9 int 21h xor ax,ax mov es,ax mov si,es:[13h*4] mov bp,es:[13h*4+2] mov ax,9400h mov bx,1234h int 2fh mov OldSeg13,bp mov OldOfs13,si l123: mov bx,81h mov di,offset LastByte call ComLine cmp byte ptr [di],'/' jne loc_00 cmp byte ptr [di+1],'p' jne loc_00 jmp Protect_Diskette loc_00: mov ax,9400h int 2fh cmp al,0ffh jne o1 jmp Olr_Install o1: mov ax,201h mov cx,1 mov dx,80h push cs pop es mov bx,offset LastByte call OldDisk ; read part. table jnc ErRd jmp ERRORREAD errd: mov si,1beh mov dx,offset Table1 mov bp,4 mov di,0 xor al,al call Interp_Part mov si,1aeh mov di,-1 mov bp,12 mov dx,offset ext_table1 call Interp_Part add al,'B' mov LastDrive1,al mov ax,201h mov cx,1 mov dx,81h push cs pop es mov bx,offset LastByte call OldDisk ; read part. table jc Keep_Int mov si,1beh mov dx,offset Table2 mov bp,4 mov di,0 call Interp_Part mov si,1aeh mov di,-1 mov bp,12 mov dx,offset ext_table2 call Interp_Part Keep_int: mov ax,3513h int 21h mov seg13,es mov ofs13,bx mov dx,offset Int_13h mov ax,2513h int 21h mov ax,352fh int 21h mov seg2f,es mov ofs2f,bx mov dx,offset Int_2fh mov ax,252fh int 21h lea dx,Install inc dx int 27h ErrorRead: mov dx,offset Q6 mov ah,9 int 21h jmp short Quit Olr_Install: mov al,es:[bx-12] mov LastDrive1,al mov di,offset LastByte mov bx,81h call ComLine cmp byte ptr [di],'/' jne Disk mov ah,94h int 2fh cmp byte ptr [di+1],'i' je New_Install jmp Par_Error ; □ 皀竕ォ 筥c罔 Disk: mov ah,94h int 2fh call Enter_Password jc quit call Conf jnc quit jmp Par_Error quit: xor ah,ah int 21h New_Install: push es push cs pop es mov al,0 mov di,offset Table1 mov cx,288 rep stosb pop es call Enter_Password jc quit mov dx,offset Q2 mov ah,9 int 21h push bx sub bx,10 mov bp,offset lastbyte mov dx,bp mov byte ptr [bp],11 mov ah,0ah int 21h mov dx,offset Password mov al,[bp+1] mov es:[bx-1],al mov Len_Pass,al mov cl,al xor ch,ch mov di,bx mov si,bp add si,2 loop10: lodsb xor al,0aah stosb xchg di,dx mov [di],al inc di xchg di,dx loop loop10 pop bx enterconf: mov dx,offset Q3 mov ah,9 int 21h mov ah,10 mov dx,7fh mov di,dx mov byte ptr [di],80 int 21h inc di mov al,[di] cbw add ax,di mov si,ax inc si ;?? mov byte ptr [si],0 call Conf jc enterconf mov ah,3ch mov cx,100000b mov dx,offset File int 21h jc qq mov bx,ax mov ah,40h mov dx,100h mov cx,offset lastbyte sub cx,100h int 21h mov ah,3eh int 21h qq: jmp quit Par_Error: mov dx,offset Q4 mov ah,9 int 21h jmp quit Olr_Protect: mov dx,offset Q7 mov ah,9 int 21h jmp quit Protect_Diskette: cmp Len_Pass,0 je Par_Error mov cl,Len_Pass mov len_P_Pas,cl xor ch,ch cld mov si,offset Password mov di,offset P_Pasw rep movsb mov dx,80h call ProtectDisk jnc ne1 jmp ErrorRead ne1: mov dx,81h call ProtectDisk jmp quit ProtectDisk PROC NEAR push ds pop es mov bx,offset LastByte mov ax,201h mov cx,1 push dx call OldDisk ; 腮ガ MBS LastByte pop dx jnc ReadOk cmp dl,80h jne ReadOk jmp ExitProtect ; メ 爬 艪キ┬ え瓷 1 ; 瓠 - 爬覃 諷 ReadOk: cmp word ptr [bx],0ebh je Olr_Protect ; 牀▲爲 竅→ 薑硅 mov si,bx mov di,offset LastByte+512 mov cx,512 push si rep movsb pop si ; 珮ガ MBS lastbyte+200h cld mov di,si ; え珮ガ MBS lastbyte lodsb xor al,0aah stosb loop_120: lodsb mov ah,[di-1] xor al,ah stosb cmp di,offset LastByte+512 jne loop_120 ; 痺ガ え牀竡 ▲珀 3- 瓮皰 え瓷 mov bx,offset LastByte mov ax,301h mov cx,3 push dx call OldDisk pop dx jnc Inst cmp dl,80h jne Inst jmp errorread Inst: mov bx,81h mov di,offset LastByte call ComLine Loop_D: call Comline cmp byte ptr [di],0 je end_loopd call InDrive jnc okin jmp Par_Error okin: mov al,ah cbw ; ax - ム え瓷 , ch - ム ※腑痰ム or ch,80h cmp ch,dl jne loop_D push dx push di mov di,offset LastByte + 3beh cmp al,3 jbe Calc_Ofs GDrive: mov dx,3 sub dx,ax mov ax,dx Calc_Ofs: mov dl,10h imul dl add di,ax mov cx,10h mov al,0 rep stosb pop di pop dx jmp short Loop_D end_loopd: mov di,offset LastByte+1022 mov word ptr [di],0aa55h mov di,offset LastByte+512 mov si,offset Part_Table mov cx,offset LastByte - offset Part_Table rep movsb mov bx,offset LastByte+512 mov cx,1 mov ax,301h call OldDisk jnc okWrite cmp dl,80h je ExitProtect okWrite: clc ret ExitProtect: stc ret ProtectDisk ENDP ;---------------------------------------------- Conf PROC NEAR push es push bx mov bx,81h mov di,offset LastByte loop_001: call ComLine cmp byte ptr [di],0 je okTest call TestOk jc Exit_Conf jmp short Loop_001 okTest: mov bx,81h loop_002: call ComLine cmp byte ptr [di],0 je Exit_Conf call TestOk ; ah - drive; al - char num. ; ch - phys. numb sub al,'0' mov dl,al mov al,ah cbw mov dh,9 mul dh mov si,offset Table1 cmp ch,0 je Phys0 mov si,offset Table2 Phys0: add si,ax mov [si],dl push bx push ax mov ah,94h int 2fh pop ax cmp ch,0 je Phys00 add bx,144 Phys00: add bx,ax mov byte ptr es:[bx],dl pop bx jmp short loop_002 Exit_Conf: pop bx pop es ret TestOk PROC NEAR call InDrive jc c_par_er mov al,[di+2] cmp al,'0' jb C_Par_Er cmp al,'4' jae C_Par_Er clc ret c_par_er: stc ret TestOk ENDP Conf ENDP InDrive PROC NEAR ; ah,al - ム え瓷; ch - ム ※腑痰ム mov ch,0 loop_01: cmp byte ptr [di+1],':' jne Cc_Par_Er mov al,[di] cmp al,61h jbe loc_123 sub al,20h loc_123: cmp al,'C' jb Cc_Par_Er cmp al,LastDrive1 jbe lab_123 cmp al,'Z' ja Cc_Par_Er mov ch,1 sub al,lastdrive1 dec al jmp short l_321 lab_123: sub al,'C' l_321: mov ah,al clc ret cc_par_er: stc ret InDrive ENDP Enter_Password PROC NEAR push di cmp byte ptr es:[bx-11],0 je Ok mov ah,9 mov dx,offset Q1 int 21h mov di,offset LastByte +5 xor cx,cx push di loop_p : mov ah,8 int 21h cmp al,13 jz eenter xor al,0aah mov [di],al inc di mov dl,' ' mov ah,2 int 21h inc cx jmp short loop_p eenter: pop si mov di,bx sub di,10 mov dl,es:[di-1] cmp dl,cl jne Pas_Error cld repe cmpsb jne Pas_Error Ok: clc pop di ret Pas_Error: mov dx,offset Q5 mov ah,9 int 21h pop di stc ret Enter_Password ENDP ComLine PROC NEAR ; di - <筌 , bx - . . 痰. ; -> bx - . 甄イ. . 痰. push ds pop es push di scan1: mov cx,bx sub cx,81h mov bp,80h cmp cl,[bp] jge exit_sc mov al,[bx] inc bx cmp al,' ' jz scan1 cmp al,',' jz exit_sc stosb jmp short scan1 exit_sc: xor al,al stosb pop di ret ComLine ENDP Interp_Part PROC NEAR ; al - 瘍モ腮 え瓷 loop2: push di mov cx,[bx+si+2] push cx call Track xchg si,dx mov [si+1],di pop cx and cl,3fh mov [si+4],cl xchg si,dx mov cx,[bx+si+6] jcxz NoPresent inc al NoPresent: push cx call Track xchg si,dx mov [si+5],di pop cx and cl,3fh mov [si+8],cl xchg si,dx mov cl,[bx+si+1] mov ch,[bx+si+5] xchg si,dx mov [si+3],cl mov [si+7],ch xchg si,dx add dx,9 pop di cmp di,0 jl low11 add si,10h jmp short abc00 low11: sub si,10h abc00: dec bp jnz loop2 ret Interp_Part ENDP OldDisk PROC NEAR pushf db 9ah ; call OldOfs13 dw 0 OldSeg13 dw 0 ret OldDisk ENDP Title1 db 10,13 db ' 痰ガ 薑硅 Гカ 癶ムぎ え瓷',10,13 db ' (c) 窶硼 . ( ユ ) ム瓱 3.0 04.12.90',10,13 db '$' Q1 db 10,13,' ▲え皀 牀 >','$' Q2 db 10,13,' ▲え皀 覃 牀 >','$' Q3 db 10,13,' ▲え皀 筥c罔 >','$' Q4 db 10,13,' 荐! モ',10,13,'$' Q5 db 10,13,' メぅ┘ 牀',10,13,'$' Q6 db 10,13,' 荐! え瓷 ',10,13,'$' Q7 db 10,13,' 薑 礒 ° 竅←キ',10,13,'$' File db 'PROTECT.COM',0 ;----------------------------------------------------------- Part_Table: Of_P equ $-600h stpart: jmp short next_c next_c: cli xor ax,ax mov ss,ax mov sp,7c00h mov si,sp push ax pop es push ax pop ds sti cld mov di,600h mov cx,100h rep movsb db 0eah dw offset stnext - offset stpart + 0600h dw 0 ; 珮ガ 瓮¥ むメ 0:600h ; ムイガ 祚←キ┘ stnext: mov dl,81h mov bx,800h ; MBS え瓷 2 茱 むメ 0:800h call ReadMBS mov dl,80h mov bx,7c00h ; MBS え瓷 1 茱 むメ 0:7c00h call ReadMBS mov si,7dffh call Decode mov si,9ffh call Decode cld mov si,offset QPW - Of_P call Message mov di,offset BufP - Of_P push di xor cx,cx loop11: xor ah,ah int 16h cmp al,13 je EnterP xor al,0aah stosb inc cx mov al,' ' mov ah,0eh mov bx,7 int 10h jmp short loop11 EnterP: mov si,offset Len_P_Pas - Of_P cmp cl,[si] pop di jne No_Comp mov si,offset P_Pasw - Of_P repe cmpsb jne No_Comp ; 牀 □イキ ※讚. mov bx,7c00h mov dl,80h call WriteMBS mov dl,81h mov bx,800h call WriteMBS return: db 0eah dw 7c00h,0 No_Comp: mov si,offset No_Comp_Mes - Of_P call Message jmp short return Decode PROC NEAR mov di,si std loop_c: lodsb mov ah,[si] xor al,ah stosb cmp si,800h je ll_00 cmp si,7c00h jne loop_c ll_00: lodsb xor al,0aah stosb ret Decode ENDP Message PROC NEAR loc_7: lodsb cmp al,0 je loc_8 push si mov bx,7 mov ah,0eh int 10h pop si jmp short loc_7 loc_8: ret Message ENDP ReadMBS PROC NEAR mov dh,0 mov ax,201h mov cx,3 int 13h ret ReadMBS ENDP WriteMBS PROC NEAR mov dh,0 mov ax,301h mov cx,1 int 13h ret WriteMBS ENDP Len_P_Pas db 0 P_Pasw db 10 dup (0) QPW db 'Password >',0 No_Comp_Mes db 'Invalid Password',0 BufP db 10 dup (0) LastByte db 0 main ENDS end start