home *** CD-ROM | disk | FTP | other *** search
- (*---------------------------------------------------------*)
- (* PROTECT.PAS *)
- (* PROTECT erzeugt einen Schreibschutz fuer Disketten- *)
- (* oder Festplattenlaufwerke fuer MS-DOS-Maschinen. *)
- (* Compilieren als COM-File mit 100 Paragraphen f. Heap. *)
- (*---------------------------------------------------------*)
- PROGRAM Protect;
- (*$K-,U-,C-,V-,I-,R-*)
-
- (*$I REGS8088.INC *)
- (*$I MAKEINT.INC *)
-
- CONST
- bios_disk_io : BYTE = $13;
- oldint : intentry_ = (offset : 0; segment : 0);
- drive : BYTE = 0;
- (*---------------------------------------------------------*)
- PROCEDURE intdisk0;
- LABEL oldinterrupt, writeprotect;
-
- (*$I beginint.inc *)
- WITH pgmrecs DO BEGIN
- IF (pgmah <> 3) AND (pgmah <> 5) THEN GOTO oldinterrupt;
- IF pgmdl <> 0 THEN GOTO oldinterrupt;
- pgmflags:= pgmflags OR 1;
- GOTO writeprotect;
- END;
- oldinterrupt:
- (*$I exitint.inc*)
- oldint);
- writeprotect:
- (*$I endint.inc *)
- END; (* intdisk0 *)
- (*---------------------------------------------------------*)
- PROCEDURE intdisk1;
- LABEL oldinterrupt, writeprotect;
-
- (*$I beginint.inc *)
- WITH pgmrecs DO BEGIN
- IF (pgmah <> 3) AND (pgmah <> 5) THEN GOTO oldinterrupt;
- IF pgmdl <> 1 THEN GOTO oldinterrupt;
- pgmflags:= pgmflags OR 1;
- GOTO writeprotect;
- END;
- oldinterrupt:
- (*$I exitint.inc*)
- oldint);
- writeprotect:
- (*$I endint.inc *)
- END; (* intdisk1 *)
- (*---------------------------------------------------------*)
- PROCEDURE intdisk2;
- LABEL oldinterrupt, writeprotect;
-
- (*$I beginint.inc *)
- WITH pgmrecs DO BEGIN
- IF (pgmah <> 3) AND (pgmah <> 5) THEN GOTO oldinterrupt;
- IF pgmdl <> 2 THEN GOTO oldinterrupt;
- pgmflags:= pgmflags OR 1;
- GOTO writeprotect;
- END;
- oldinterrupt:
- (*$I exitint.inc*)
- oldint);
- writeprotect:
- (*$I endint.inc *)
- END; (* intdisk2 *)
- (*---------------------------------------------------------*)
- PROCEDURE intdisk3;
- LABEL oldinterrupt, writeprotect;
-
- (*$I beginint.inc *)
- WITH pgmrecs DO BEGIN
- IF (pgmah <> 3) AND (pgmah <> 5) THEN GOTO oldinterrupt;
- IF pgmdl <> 3 THEN GOTO oldinterrupt;
- pgmflags:= pgmflags OR 1;
- GOTO writeprotect;
- END;
- oldinterrupt:
- (*$I exitint.inc*)
- oldint);
- writeprotect:
- (*$I endint.inc *)
- END; (* intdisk3 *)
- (*---------------------------------------------------------*)
- PROCEDURE intdisk4;
- LABEL oldinterrupt, writeprotect;
-
- (*$I beginint.inc *)
- WITH pgmrecs DO BEGIN
- IF (pgmah <> 3) AND (pgmah <> 5) THEN GOTO oldinterrupt;
- IF pgmdl <= 3 THEN GOTO oldinterrupt;
- pgmflags:= pgmflags OR 1;
- GOTO writeprotect;
- END;
- oldinterrupt:
- (*$I exitint.inc*)
- oldint);
- writeprotect:
- (*$I endint.inc *)
- END; (* intdisk4 *)
- (*---------------------------------------------------------*)
- PROCEDURE intdisk5;
- LABEL oldinterrupt, writeprotect;
-
- (*$I beginint.inc *)
- WITH pgmrecs DO BEGIN
- IF (pgmah <> 3) AND (pgmah <> 5) THEN GOTO oldinterrupt;
- pgmflags:= pgmflags OR 1;
- GOTO writeprotect;
- END;
- oldinterrupt:
- (*$I exitint.inc*)
- oldint);
- writeprotect:
- (*$I endint.inc *)
- END; (* intdisk5 *)
- (*---------------------------------------------------------*)
- PROCEDURE parameter;
- VAR id: STRING[80]; i: INTEGER;
- BEGIN
- IF paramcount = 0 THEN BEGIN
- WriteLn('Schutz fuer alle Laufwerke!'); drive := 5;
- END
- ELSE IF paramcount > 1 THEN BEGIN
- WriteLn('Zu viel Parameter in Kommandozeile...'); Halt;
- END
- ELSE BEGIN
- id := paramstr(1);
- FOR i := 1 TO Length(id) DO id[i] := UpCase(id[i]);
- IF (id >= 'A:') AND (id <= 'D:') THEN BEGIN
- WriteLn ('Schutz fuer Laufwerk ',id);
- drive := Ord(id[1]) - Ord('A');
- END
- ELSE IF id = 'HD' THEN BEGIN
- WriteLn ('Schutz fuer Festplatte...');
- drive := 4;
- END
- ELSE BEGIN
- WriteLn ('Falsche Laufwerkangabe!'); Halt;
- END;
- END;
- END; (* parameter *)
- (*---------------------------------------------------------*)
- BEGIN (* Protect *)
- parameter;
- WITH oldint DO intget(bios_disk_io, segment, offset);
- CASE drive OF
- 0 : intset (bios_disk_io, cseg, ofs(intdisk0));
- 1 : intset (bios_disk_io, cseg, ofs(intdisk1));
- 2 : intset (bios_disk_io, cseg, ofs(intdisk2));
- 3 : intset (bios_disk_io, cseg, ofs(intdisk3));
- 4 : intset (bios_disk_io, cseg, ofs(intdisk4));
- 5 : intset (bios_disk_io, cseg, ofs(intdisk5));
- END;
- makeresident;
- END. (* Protect *)
-