3 TITLE RECINIT
.SAL - MS-DOS
File/Disk Recovery Utility
4 ;*****************************************************************************
5 ;*****************************************************************************
7 ;*****************************************************************************
11 INCLUDE RECSEG
.INC ;AN000;bgb
12 INCLUDE DOSSYM
.INC ;AN000;BGB
13 INCLUDE SYSCALL.INC ;AN000;BGB
14 INCLUDE RECEQU
.INC ;AN000;BGB
15 INCLUDE RECMACRO
.INC ;AN000;BGB
16 INCLUDE RECPARSE
.INC ;AN000;BGB
20 ;*****************************************************************************
21 ; External Data Declarations
22 ;*****************************************************************************
23 data segment public para
'Data' ;an000;bgb
24 EXTRN movsi
:word ;move si pointer here for display of invalid parm ;an031;bgb
25 extrn command_line_buffer
:byte ;AN000;bgb
26 extrn ExitStatus
:Byte ;AN000;bgb
30 Extrn User_Drive
:Byte ;AN000;BGB
32 Extrn Drive_Letter_Msg
:Byte ;AN000;BGB
33 Extrn Parse_Error_Msg
:Byte
34 extrn fname_buffer
:byte ;AN000;BGB
35 extrn PSP_Segment
:word ;AN000;bgb
36 extrn fatal_error
:byte ;AN000;bgb
37 extrn found
:byte ;AN000;bgb
38 extrn done
:byte ;AN000;bgb
39 extrn bpb_buffer
:byte ;AN000;bgb
40 extrn data_start_low
:word ;AN000;bgb
41 extrn data_start_high
:word ;AN000;bgb
42 extrn driveletter
:byte ;AN000;bgb
43 extrn drive
:byte ;AN000;bgb
44 extrn transrc
:byte ;AN000;bgb
45 extrn int_23_old_off
:word ;AN000;bgb
46 extrn int_23_old_seg
:word ;AN000;bgb
47 extrn int_24_old_off
:word ;AN000;bgb
48 extrn int_24_old_seg
:word ;AN000;bgb
49 extrn append
:byte ;AN000;bgb
51 extrn fat12_string
:byte ;AN000;bgb
52 extrn fat16_string
:byte ;AN000;bgb
53 extrn media_id_buffer
:byte ;AN000;bgb
54 extrn fs_not_fat
:byte ;AN000;bgb ;an022;bgb
55 extrn FS_String_Buffer
:Byte ;AN011;bgb ;an022;bgb
56 extrn FS_String_end
:Byte ;AN011;bgb ;an022;bgb
61 code segment public para
'CODE' ;an000;bgb
63 ;*****************************************************************************
65 ;*****************************************************************************
66 public Main_Init
, Init_Io
, Preload_Messages
, Parse_recover
67 public Parse_good
, Parse_err
, Validate_Target_Drive
68 public Check_Target_Drive
, Check_For_Network
, Check_Translate_Drive
69 public Hook_interrupts
, Clear_Append_X
, RECOVER_IFS
, Reset_Append_X
70 public exitpgm
;an026;bgb
71 ;*****************************************************************************
72 ; External Routine Declarations
73 ;*****************************************************************************
74 ; Extrn EXEC_FS_Recover:Near ;an022;bgb
77 Extrn Main_Routine
:Near
81 ;*****************************************************************************
82 ;Routine name: MAIN_INIT
83 ;*****************************************************************************
85 ;description: Main routine for recover program
87 ;Called Procedures: get_psp
89 ; Validate_Target_Drive
91 ; RECOVER_IFS (goes to main-routine)
97 ;Change History: Created 5/8/87 MT
102 ; Parse input and load messages (CALL Init_Input_Output)
104 ; Check target drive letter (CALL Validate_Target_Drive)
106 ; Set up Control Break (CALL Hook_Interrupts)
108 ; CALL RECOVER_IFS (goes to main routine)
113 ;*****************************************************************************
114 procedure Main_Init
;;AN000;
116 Set_Data_Segment
;Set DS,ES to Data segment ;AN000;bgb
118 mov Fatal_Error
,No
;Init the error flag ;AN000;
119 call Init_Io
;Setup messages and parse ;AN000;
120 cmp Fatal_Error
,Yes
;Error occur? ;AN000;
121 ; $IF NE ;Nope, keep going ;AN000;
123 call Validate_Target_Drive
;Check drive letter ;AN000;
124 cmp Fatal_Error
,Yes
;Error occur? ;AN000;
125 ; $IF NE ;Nope, keep going ;AN000;
127 call Hook_Interrupts
;Set CNTRL -Break hook ;AN000;
128 cmp Fatal_Error
,Yes
;Error occur? ;AN000;
129 ; $IF NE ;Nope, keep going ;AN000;
131 call RECOVER_IFS
;RECOVER correct file system ;AN000;
138 exitpgm: mov al,ExitStatus
;Get Errorlevel ;AN000;
139 DOS_Call Exit
;Exit program ;AN000;
140 int 20h
;If other exit fails ;AN000;
142 Main_Init endp
; ;AN000;
144 ;*****************************************************************************
145 ;Routine name: get_psp
146 ;*****************************************************************************
147 ;Description: get info from the psp area
149 ;Called Procedures: get_drive
151 ;Change History: Created 8/7/87 bgb
156 ; command_line_buffer
161 ; move command line into data seg
162 ; get drive number of target
163 ; get addr of data seg
166 ;*****************************************************************************
167 Procedure get_psp
;;AN000;
168 DOS_Call GetCurrentPSP
;Get PSP segment address :AN000;bgb
169 mov PSP_Segment
,bx ;Save it for later ;AN000;bgb
170 ; get command line from psp ;AN000;bgb
171 mov cx,PSP_Segment
;point ds to data seg ;AN000;bgb
172 mov ds,cx ; " " " " " ;AN000;bgb
173 assume
ds:NOTHING
,es:dg
; " " " " " ;AN000;bgb
174 mov si,Command_Line_Parms
;ds:si --> old area in psp ;AN000;bgb
175 LEA di,command_line_buffer
; es:di -> new area in data
176 mov cx,128 ; do for 128 bytes
177 rep movsb ; mov 1 byte until cx=0
178 ; get the drive number of the target from the psp (0=default, a=1, b=2, c=3) ;AN000;bgb
179 mov bl,ds:[FCB1
] ;Get target drive from FCB -74 ;AN000;
180 Set_Data_Segment
;Set DS,ES to Data segment ;AN000;bgb
183 get_psp endp
; ;AN000;
186 ;*****************************************************************************
187 ;Routine name: get_drive
188 ;*****************************************************************************
189 ;Description: get drive letter from reg bl
191 ;Change History: Created 8/7/87 bgb
193 ;Input: bl = drive num (default=0)
201 ; IF drive-num = default
202 ; get default drive number (a=1)
207 ; move letter into data areas
209 ;*****************************************************************************
210 Procedure get_drive
;;AN000;
211 ; convert drive number to drive letter
212 cmp bl,0 ;a=1 b=2 c=3 ;Is it default drive? 0=default ;AN000;
213 ; $IF E ;Yes, turn it into drive letter ;AN000;
215 ; get default drive number
216 DOS_Call Get_Default_Drive
;Get default drive num in al ;AN000;
218 mov drive
,al ; ;AN000;bgb
219 ; $ELSE ;Not default, A=1 ;AN000;
222 ; bl already contains the correct drive number - save it
224 mov drive
,bl ; ;AN000;bgb
228 add al,"A" ;convert it to letter ;AN000;
229 mov driveletter
,al ;set up prompt msg ;AN000;bgb
230 mov Drive_Letter_Msg
,al ;Save it in message ;AN000;
231 mov User_Drive
,al ;Put it into path strings ; ;
233 get_drive endp
; ;AN000;
235 ;*****************************************************************************
236 ;Routine name: Init_Io
237 ;*****************************************************************************
238 ;description: Initialize messages, Parse command line if FAT file system
240 ;Called Procedures: Preload_Messages
243 ;Change History: Created 5/10/87 MT
245 ;Input: PSP command line at 81h and length at 80h
247 ;Output: FS_Not_FAT = YES/NO
248 ; Drive_Letter_Msg set up for any future messages that need it
252 ; Load messages (CALL Preload_Messages)
254 ; Get file system type (12-bit fat, 16-bit fat, big fat, ifs)
255 ; IF old-type-diskette, or
256 ; dos4.00 12-bit fat, or
257 ; dos4.00 16-bit fat, then
258 ; Go handle FAT based Recover syntax's (Call Parse_Recover)
264 ;*****************************************************************************
265 Procedure Init_IO
;;AN000;
266 ; load the error messages from the system ;an022;bgb
267 call Preload_Messages
;Load up message retriever ;AN000;
268 ifdef fsexec
;an022;bgb
269 mov FS_Not_FAT
,No
;an022;bgb
270 cmp Fatal_Error
,YES
;Quit? ;AN000; ;an022;bgb
271 ; $IF NE ;Nope, keep going ;AN000; ;an022;bgb
273 ; get file system type from ioctl ;an022;bgb
274 mov al,generic_ioctl
;al=0d (get media id) ;AN000;;an030;bgb
275 xor bx,bx ;use default drive ;AN009;b;an022;bgbgb
276 mov ch,Rawio
;8 = disk io ;an030;bgb;an022;bgb
277 mov cl,Get_Media_Id
;66h ;an030;bgb
278 lea dx,Media_ID_Buffer
;Point at buffer ;AN000; ;an022;bgb
279 DOS_Call IOCtl
;Do function call ah=44 ;AN000; ;an022;bgb
280 ; is it DOS 3.3 or below? ;carry flag means old dos ;an022;bgb
281 ; $IF C,OR ;Old style diskette, OR ;AN000; ;an022;bgb
283 ; is it a new-12 bit fat? ;an022;bgb
284 lea si,FAT12_String
;Check for FAT_12 string ;AN000; ;an022;bgb
285 lea di,Media_ID_Buffer
.Media_ID_File_System
; ;AN0;an022;bgb00;
286 mov cx,Len_FS_ID_String
;Length of compare ;AN00;an022;bgb0;
287 repe cmpsb ;Find it? ;AN00;an022;bgb0;
288 ; $IF E,OR ;Nope, keep going ;AN000; ;an022;bgb
290 ; is it a new 16-bit fat? ;an022;bgb
291 lea si,FAT16_String
;Check for FAT_16 string ;AN000; ;an022;bgb
292 lea di,Media_ID_Buffer
.Media_ID_File_System
; ;AN0;an022;bgb00;
293 mov cx,Len_FS_ID_String
;Length of compare ;AN00;an022;bgb0;
294 repe cmpsb ;Do compare ;AN00;an022;bgb0;
295 ; $IF E ; is it new 16-bit fat? ;AN000; ;an022;bgb
299 ; file system is fat based, continue (old or new) ;an022;bgb
300 call Parse_Recover
;Yes, go sort out syntax ;an022;bgb
302 ; non-fat based system ;an022;bgb
303 ifdef fsexec
;an022;bgb
304 ; $ELSE ;We got FS other than FAT ;AN000; ;an022;bgb
307 mov FS_Not_FAT
,Yes
;Indicate exec file system ;AN000; ;an022;bgb
308 mov cx,8 ;an022;bgb;an011;bgb
309 lea si,Media_ID_Buffer
.Media_ID_File_System
;get file system;an022;bgb ;an011;bgb
310 lea di,fs_string_buffer
;put it here ;an022;bgb;an011;bgb
311 rep movsb ;an022;bgb;an011;bgb
312 lea di,fs_string_buffer
;point to beginning again ;an022;bgb;an011;bgb
313 ; $DO COMPLEX ;search th string until eol found ;an022;bgb;an011;bgb
316 inc di ;next char ;an022;bgb;an011;bgb
317 ; $STRTDO ;start loop here ;an022;bgb;an011;bgb
319 cmp byte ptr [di],' ' ;end of string ? ;an022;bgb ;an011;bgb
320 ; $ENDDO E ;end loop when eol found ;an022;bgb;an011;bgb
322 lea si,fs_string_end
;get end of string - rec.exe ;an022;bgb;an011;bgb
323 mov cx,8 ; 8 more chars ;an022;bgb;an011;bgb
324 rep movsb ;move it in ;an022;bgb;an011;bgb
325 ; $ENDIF ; fat based file system ;AN000; ;an022;bgb
327 ; $ENDIF ; no error from msg retreiver ;AN00;an022;bgb0;
331 Init_Io endp
; ;AN000;
333 ;*****************************************************************************
334 ;Routine name: Preload_Messages
335 ;*****************************************************************************
336 ;Description: Preload messages using common message retriever routines.
338 ;Called Procedures: SysLoadMsg
340 ;Change History: Created 5/1/87 MT
342 ;Input: Fatal_Error = NO
344 ;Output: Fatal_Error = YES/NO
348 ; Preload All messages (Call SysLoadMsg)
350 ; Display SysLoadMsg error message
354 ;*****************************************************************************
355 Procedure Preload_Messages
;;AN000; ;
356 call SysLoadMsg
;Preload the messages ;AN000;
357 ; $IF C ;Error? ;AN000;
359 call SysDispMsg
;Display preload msg ;AN000;
360 mov Fatal_Error
, YES
;Indicate error exit ;AN000;
365 Preload_Messages endp
; ;AN000;
367 ;*****************************************************************************
368 ;Routine name: Parse_Command_Line
369 ;*****************************************************************************
370 ;Description: Parse the command line. Check for errors, and display error and
371 ; exit program if found. Use parse error messages except in case
372 ; of no parameters, which has its own message
374 ;Called Procedures: Message (macro)
379 ;Change History: Created 5/1/87 MT
381 ;Input: Fatal_Error = NO
383 ;Output: Fatal_Error = YES/NO
390 ; set up regs to call sysparse
391 ;DO UNTIL error=yes or return(ax)=finish(-1)
393 ; IF ax=good return(0)
401 ;A. normal proc == 1- ax=good 0
403 ;B. no parm == 1- ax=error 2
405 ;C. too many == 1- ax=good 0
407 ;D. syntax == 1- ax=error 9
408 ;*****************************************************************************
409 Procedure Parse_recover
; ;AN000;bgb
410 push ds ; save ds ;AN000;bgb
411 ; set up to call sysparse ;AN000;bgb
412 set_data_segment
;ds,es point to data seg
413 LEA si,command_line_buffer
;ds:si -> cmd line
414 LEA di,parms_input_block
;es:di--> parms input block ;AN000;bgb
415 xor cx,cx ;cx = 0 ;AN000;bgb
416 xor dx,dx ;dx = 0 ;AN000;bgb
418 ; call sysparse until error or end of cmd line ;AN000;bgb
421 call SysParse
;go parse ;AN000;bgb
422 cmp ax,$p_rc_eol
; -1 end of command line? ;AN000;bgb
423 ; $LEAVE E ; yes - done ;AN000;bgb
425 cmp ax,$p_no_error
; good return code ??? (0) ;AN000;bgb
426 ; $IF E ; yes ;AN000;bgb
428 call parse_good
; go get it ;AN000;bgb
429 ; $ELSE ; ax not= good ;AN000;bgb
432 call parse_err
; check for error ;AN000;bgb
433 ; $ENDIF ; eol ;AN000;bgb
435 cmp Fatal_Error
,YES
;Can we continue? ;AN000;bgb
436 ; $LEAVE E ;NO ;AN000;bgb
438 ; $ENDDO ; ;AN000;bgb
444 Parse_recover endp
; ;AN000;bgb
447 ;*****************************************************************************
448 ;Routine name: parse_good
449 ;*****************************************************************************
451 ;Description: when the ax register returned by sysparse indicates and error,
452 ; this procedure is called. it then determines which error
453 ; occurred, and calls parse_message to display the msg.
455 ;Called Procedures: parse_message (macro)
457 ;Change History: Created 7/23/87 bgb
461 ;Output: Fatal_Error = YES/NO
468 ; save drive number and letter
476 ;*****************************************************************************
478 Procedure Parse_good
; ;AN000;bgb
479 cmp parse_type
,$p_drive
; 6 if data=drive ;AN000;bgb
480 ; $IF E ; not eol, good syntax, drive entered ;AN000;bgb
482 mov bl,byte ptr parse_addr
;AN000;bgb
483 dec bl ;Make drive 0 based ;AN000;bgb
484 mov drive
,bl ;AN000;bgb
485 add bl,'A' ;make it character ;AN000;bgb
486 mov driveletter
,bl ;save into drive letter ;AN000;bgb
487 ; $ELSE ; no - filespec entered ;AN000;bgb
490 cmp parse_type
,$p_file_spec
; 5 if data = filespec ;AN000;bgb
491 ; $IF E ; was file spec entered ;AN000;bgb
493 ; push si ; save input offset reg ;AN000;bgb
494 ; push ds ; save input seg reg ;AN000;bgb
495 ; push cx ; save count ;AN000;bgb
496 ; push es ; save other seg reg ;AN000;bgb
497 ; mov cx,ds ;es points to data ;AN000;bgb
498 ; mov es,cx ;es points to data ;AN000;bgb
499 ; mov si,word ptr parse_addr ;get offset to filespec ;AN000;bgb
500 ; mov ds,word ptr parse_addr+2 ;get segment to filespec ;AN000;bgb
501 ; mov cx,128 ; mov 128 bytes ;AN000;bgb
502 ; rep movs es:fname_buffer,ds:[si] ;move it ;AN000;bgb
503 ; pop es ; save other seg reg ;AN000;bgb
504 ; pop cx ; save other seg reg ;AN000;bgb
505 ; pop ds ; save other seg reg ;AN000;bgb
506 ; pop si ; save other seg reg ;AN000;bgb
507 ; $ELSE ; no, no drive or filespec ;AN000;bgb
510 mov ax,$p_syntax
;tell user bad syntax ;AN000;bgb
511 parse_message
;display msg ;AN000;bgb
512 mov Fatal_Error
,YES
;Indicate death! ;AN000;bgb
513 ; $ENDIF ; was drive entered ? ;AN000;bgb
515 ; $ENDIF ;if data=drive ;AN000;bgb
519 parse_good endp
; ;AN000;bgb
522 ;*****************************************************************************
523 ;Routine name: parse_err
524 ;*****************************************************************************
526 ;Description: when the ax register returned by sysparse indicates and error,
527 ; this procedure is called. it then determines which error
528 ; occurred, and calls parse_message to display the msg.
530 ;Called Procedures: parse_message (macro)
532 ;Change History: Created 7/23/87 bgb
536 ;Output: Fatal_Error = YES/NO
541 ; IF ax=done (end of cmd line?) -1
542 ; IF found=no (eol, but no parameters listed)
545 ; ELSE (error other than eol)
548 ;*****************************************************************************
550 Procedure Parse_err
; ;AN000;bgb
551 mov Fatal_Error
,YES
;Indicate death! ;AN000;bgb ;AN000;bgb
552 cmp ax,$P_Op_Missing
; 2 = no parameters ? ;AN000;bgb
555 message baddrv
; yes (invalid drive or filename) ;AN000;bgb
559 mov byte ptr [si],00 ;zero terminate display string ;an031;bgb
560 dec si ;look at previous char ;an031;bgb
563 dec si ;look at previous char ;an031;bgb
564 cmp byte ptr [si],' ' ;find parm separator ;an031;bgb
565 jnz nextsi
;loop until begin of parm found
566 mov movsi
,si ;mov si into display parms ;an031;bgb
567 parse_message
;no- display parse message ;AN000;bgb ;AN000;bgb
571 parse_err endp
; ;AN000;bgb
574 ;*****************************************************************************
575 ;Routine name: Validate_Target_Drive
576 ;*****************************************************************************
578 ;Description: Control routine for validating the specified format target drive.
579 ; If any of the called routines find an error, they will print
580 ; message and terminate program, without returning to this routine
582 ;Called Procedures: Check_Target_Drive
584 ; Check_Translate_Drive
586 ;Change History: Created 5/1/87 MT
588 ;Input: Fatal_Error = NO
590 ;Output: Fatal_Error = YES/NO
595 ; CALL Check_Target_Drive
597 ; CALL Check_For_Network
599 ; CALL Check_Translate_Drive
603 ;*****************************************************************************
605 Procedure Validate_Target_Drive
; ;AN000;
606 call Check_For_Network
;See if Network drive letter ;AN000;
607 cmp Fatal_Error
,YES
;Can we continue? ;AN000;
608 ; $IF NE ;Yep ;AN000;
610 call Check_Translate_Drive
;See if Subst, Assigned ;AN000;
611 call Check_Target_Drive
;See if valid drive letter ;AN000;
612 ; $ENDIF ;- Fatal_Error passed back ;AN000;
616 Validate_Target_Drive endp
; ;AN000;
618 ;*****************************************************************************
619 ;Routine name: Check_Target_Drive
620 ;*****************************************************************************
622 ;Description: Check to see if valid DOS drive by checking if drive is
623 ; removable. If error, the drive is invalid. Save default
624 ; drive info. Also get target drive BPB information, and compute
625 ; the start of the data area
627 ;Called Procedures: Message (macro)
629 ;Change History: Created 5/1/87 MT
631 ;Input: Fatal_Error = NO
633 ;Output: Fatal_Error = YES/NO
634 ; User_Drive = default drive
640 ; See if drive LOCAL (INT 21h, AX=4409h IOCtl)
641 ; IF error - drive invalid
642 ; Display Invalid drive message
645 ; Get BPB of target drive (Generic IOCtl Get Device parameters)
646 ; Compute start of data area
648 ;*****************************************************************************
650 Procedure Check_Target_Drive
; ;AN000;
651 mov al,0Dh ;Get BPB information ;AN000;
652 mov cx,0860h ; " " " " ;AN000;
653 ;;;;;;;;mov bl,byte ptr parse_addr ; " " " " ;AN000;
654 mov bl,drive
;drive number ;A=0,B=1 ;AN000;bgb
655 inc bl ;a=1 ;AN000;bgb
656 lea dx,BPB_Buffer
; " " " " ;AN000;
657 DOS_Call IOCtl
; " " " " ;AN000;
658 xor cx,cx ;Find # sectors used by FAT's ;AN000;
659 mov cl,BPB_Buffer
.NumberOfFATs
; " " " " ;AN000;
660 mov ax,BPB_Buffer
.SectorsPerFAT
; " " " " ;AN000;
661 mul cx ; " " " " ;AN000;
662 push dx ;Save results ;AN000;
663 push ax ; " " ;AN000;
664 mov ax,BPB_Buffer
.RootEntries
;Find number of sectors in root ;AN000;
665 mov cl,Dir_Entries_Per_Sector
; by dividing RootEntries ;AN000;
666 div cl ; by (512/32) ;AN000;
667 pop bx ;Get low sectors per FAT back ;AN000;
668 pop dx ;Get high part ;AN000;
669 add ax,bx ;Add to get FAT+Dir sectors ;AN000;
670 adc dx,bp ;zero ;High part ;AN000;
671 add ax,ReservedSectors
;Add in Boot record sectors ;AN000;
672 adc dx,bp ;zero ;to get start of data (DX:AX) ;AN000;
673 mov Data_Start_Low
,ax ;Save it ;AN000;
674 mov Data_Start_High
,dx ; ;AN000;
675 ret ;And we're outa here ;AN000;
676 Check_Target_Drive endp
; ;AN000;
678 ;*****************************************************************************
679 ;Routine name: Check_For_Network
680 ;*****************************************************************************
682 ;Description: See if target drive isn't local, or if it is a shared drive. If
683 ; so, exit with error message. The IOCtl call is not checked for
684 ; an error because it is called previously in another routine, and
685 ; invalid drive is the only error it can generate. That condition
686 ; would not get this far
688 ;Called Procedures: Message (macro)
690 ;Change History: Created 5/1/87 MT
695 ;Output: Fatal_Error = YES/NO
699 ; See if drive is local (INT 21h, AX=4409 IOCtl)
701 ; Display network message
704 ; IF 8000h bit set on return
705 ; Display assign message
710 ;*****************************************************************************
712 Procedure Check_For_Network
; ;AN000;
713 ; is device local? int 21, ah=44, al=9
714 mov bl,drive
;drive number ;A=0,B=1 ;AN000;bgb
715 inc bl ;drive number ;A=1,B=2 for IOCtl call;AN000;bgb
716 mov al,09h ;See if drive is local ;AC000;bgb
717 DOS_Call IOCtl
;-this will fail if bad drive ;AC000;
718 ; $IF C ;CarrY means invalid drive ;AC000;
720 Message BadDrv
;Print message ;AC000;
721 mov Fatal_Error
,Yes
;Indicate error ;AN000;
725 test dx,Net_Check
;if (x & 1200H)(redir or shared); ;
726 ; $IF NZ ;Found a net drive ;AC000;
728 Message NotNetM
;Tell 'em ;AC000;
729 mov Fatal_Error
,Yes
;Indicate bad stuff ;AN000;
730 ; $ELSE ;Local drive, now check assign ;AN000;
733 test dx,Assign_Check
;8000h bit is bad news ; ;
734 ; $IF NZ ;Found it ;AC000;
736 Message SubstErr
;Tell error ;AC000;
737 mov Fatal_Error
,Yes
;Indicate bad stuff ;AN000;
746 Check_For_Network endp
; ;AN000;
748 ;*****************************************************************************
749 ;Routine name: Check_Translate_Drive
750 ;*****************************************************************************
752 ;Description: Do a name translate call on the drive letter to see if it is
753 ; assigned by SUBST or ASSIGN
755 ;Called Procedures: Message (macro)
757 ;Change History: Created 5/1/87 MT
759 ;Input: Drive_Letter_Msg has drive string
762 ;Output: Fatal_Error = YES/NO
766 ; Put drive letter in ASCIIZ string "d:\",0
767 ; Do name translate call (INT 21)
769 ; Display assigned message
773 ;*****************************************************************************
775 Procedure Check_Translate_Drive
; ;AN000;
776 mov al,Drive_Letter_Msg
;Get target drive letter into ;AN000;
777 mov TranSrc
,al ; "d:\",0 string ;AN000;
778 lea si,TranSrc
;Point to translate string ;AN000;
779 push ds ;Set ES=DS (Data segment) ; ;
781 lea di,FatTbl
;Point at output buffer ; ;
782 DOS_Call xNameTrans
;Get real path ;AC000;
785 mov bl,byte ptr [TranSrc
] ;Get drive letter from path ; ;
786 cmp bl,byte ptr [Fattbl
] ;Did drive letter change? ; ;
787 ; $IF NE ;If not the same, it be bad ;AC000;
789 Message SubstErr
;Tell user ;AC000;
790 mov Fatal_Error
,Yes
;Setup error flag ;AN000;
796 mov Fatal_Error
,Yes
;Setup error flag ;AN000; ;an017;bgb
798 mov cx,bp ;zero ;an017;bgb
799 mov dx,0100h ;an017;bgb
800 call sysdispmsg
;an017;bgb
801 ; $ENDIF ; ;AN000; ;an017;bgb
805 Check_Translate_Drive endp
; ;AN000;
807 ;*****************************************************************************
808 ;Routine name: Hook_Interrupts
809 ;*****************************************************************************
811 ;Description: Change the interrupt handler for INT 13h to point to the
812 ; ControlC_Handler routine
814 ;Called Procedures: None
816 ;Change History: Created 4/21/87 MT
825 ; Point at ControlC_Handler routine
826 ; Set interrupt handler (INT 21h, AX=2523h)
828 ;*****************************************************************************
830 Procedure Hook_Interrupts
; ;AN000;
832 DOS_Call Get_Interrupt_Vector
;Get the INT 23h handler ;AC000;
833 mov word ptr INT_23_Old_Off
,bx ;
835 mov word ptr INT_23_Old_Seg
,bx ; ;AN000;
836 mov al,23h
;Specify CNTRL handler ; ;
837 lea dx, INT_23
;Point at it ; ;
838 push ds ;Save data seg ; ;
839 push cs ;Point to code segment ; ;
841 DOS_Call Set_Interrupt_Vector
;Set the INT 23h handler ;AC000;
842 pop ds ;Get Data degment back ; ;
844 DOS_Call Get_Interrupt_Vector
;Get the INT 24h handler ;AC000;
845 mov word ptr INT_24_Old_Off
,bx ;Save it
847 mov word ptr INT_24_Old_Seg
,bx ;
848 mov al,24h
;Specify handler ; ;
849 lea dx, INT_24
;Point at it ; ;
850 push ds ;Save data seg ; ;
851 push cs ;Point to code segment ; ;
853 DOS_Call Set_Interrupt_Vector
;Set the INT 23h handler ;AC000;
854 pop ds ;Get Data degment back ; ;
857 Hook_Interrupts endp
; ;AN000;
859 ;*****************************************************************************
860 ;Routine name: Hook_CNTRL_C
861 ;*****************************************************************************
863 ;Description: Change the interrupt handler for INT 13h to point to the
864 ; ControlC_Handler routine
866 ;Called Procedures: None
868 ;Change History: Created 4/21/87 MT
877 ; Point at ControlC_Handler routine
878 ; Set interrupt handler (INT 21h, AX=2523h)
880 ;*****************************************************************************
882 ;rocedure Hook_CNTRL_C ; ;AN000;
883 ; mov al,23H ;Specify CNTRL handler ; ;
884 ; mov dx, offset ControlC_Handler ;Point at it ; ;
885 ; push ds ;Save data seg ; ;
886 ; push cs ;Point to code segment ; ;
888 ; DOS_Call Set_Interrupt_Vector ;Set the INT 23h handler ;AC000;
889 ; pop ds ;Get Data degment back ; ;
891 ;ook_CNTRL_C endp ; ;AN000;
895 ;;;;;;; Message msgInterrupt ; ;AC000;
896 ;;;;;;;;mov ExitStatus, ExitCtrlC
898 ;*****************************************************************************
899 ;Routine name: Clear_Append_X
900 ;*****************************************************************************
902 ;Description: Determine if Append /XA is turned on thru INT 2Fh, and shut
903 ; off for life of RECOVER if it is.
905 ;Called Procedures: None
908 ;Change History: Created 5/13/87 MT
912 ;Output: APPEND = YES/NO
918 ; See if APPEND /X is present (INT 2Fh, AX=0B706h)
920 ; Turn append /X off (INT 2Fh, AX=B707h, BX = 0)
924 ;*****************************************************************************
926 Procedure Clear_Append_X
; ;AN000;
927 mov Append
,NO
;Init the Append /X flag ;AN000;
928 mov ax,Append_X
;Is Append /X there? ;AN000;
929 int Multiplex
; " " " " ;AN000;
930 cmp bx,Append_X_Set
;Was it turned on? ;AN000;
933 mov Append
,YES
;Indicate that it was on ;AN000;
934 mov ax,Set_Append_X
;Turn Append /X off ;AN000;
935 xor bx,bx ;Append_Off ; " " " " ;AN000;
936 int Multiplex
; " " " " ;AN000;
941 Clear_Append_X endp
; ;AN000;
944 ;*****************************************************************************
945 ;Routine name: RECOVER_IFS
946 ;*****************************************************************************
950 ;Called Procedures: Main_Routine
953 ;Change History: Created 5/8/87 MT
955 ;Input: FS_Not_FAT = Yes/No
962 ; IF File system other than FAT
963 ; Go call file system specific RECOVER (CALL EXEC_FS_RECOVER)
965 ; Do FAT based RECOVER (CALL Main_Routine)
968 ;*****************************************************************************
970 Procedure RECOVER_IFS
; ;AN000;
971 ifdef fsexec
;an022;bgb
972 ; cmp FS_Not_Fat,YES ;Is the target FS a FAT? ;AN000; ;an022;bgb
973 ; $IF E ;No, so need to exec the ;AN000; ;an022;bgb
974 ; call EXEC_FS_RECOVER ; file system specific prog. ;AN000; ;an022;bgb
975 ; $ELSE ;It's a FAT ;AN000; ;an022;bgb
977 call clear_append_x
;BGB
978 call Main_Routine
;Use canned code! ;AN000;
979 call reset_append_x
;BGB
980 ifdef fsexec
;an022;bgb
981 ; $ENDIF ; ;AN000; ;an022;bgb
985 RECOVER_IFS endp
; ;AN000;
987 ;*****************************************************************************
988 ;Routine name: Reset_Append_X
989 ;*****************************************************************************
991 ;description: If APPEND /XA was on originally, turn it back on
993 ;Called Procedures: None
996 ;Change History: Created 5/13/87 MT
1000 ;Output: APPEND = YES/NO
1006 ; Turn append /X on (INT 2Fh, AX=B707h, BX = 1)
1009 ;*****************************************************************************
1011 Procedure Reset_Append_X
; ;AN000;
1012 cmp Append
,Yes
;Was Append /X on to start with?;AN000;
1013 ; $IF E ;Yep ;AN000;
1015 mov ax,Set_Append_X
;Turn Append /X off ;AN000;
1016 mov bx,Append_On
; " " " " ;AN000;
1017 int Multiplex
; " " " " ;AN000;
1022 Reset_Append_X endp
; ;AN000;
1026 end main_init
;AC000;bgb