home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR4 / V12N19.ZIP / FILCDR.ZIP / TESTCDR.PAS < prev    next >
Pascal/Delphi Source File  |  1993-07-02  |  5KB  |  176 lines

  1. PROGRAM TestCdr;
  2. {File to test action of CrtLog.  Compile for Windows and
  3.  rename EXE to TESTCDRW.  Compile for (real mode) DOS and
  4.  rename EXE to TESTCDRD.}
  5. USES Strings,
  6. {$IFDEF Windows}
  7.   WinDos, WinCrt, WinProcs, WinTypes;
  8. {$ELSE}
  9.   Dos;
  10. {$ENDIF}
  11. CONST
  12.   DirName        = 'MKDIR.39H';
  13.   NewDirName     = 'RENDIR.56H';
  14.   CreateFileName = 'CREATE.3CH';
  15.   RenameFileName = 'RENAME.56H';
  16.   GetFattrName   = 'GET_ATTR.43H';
  17.   SetFattrName   = 'SET_ATTR.43H';
  18.   GetFTimeName   = 'GET_TIME.57H';
  19.   SetFTimeName   = 'SET_TIME.57H';
  20.   NewFileName    = 'NEW_FILE.5AH';
  21.   ExtFileName    = '\EXT_OPEN.6CH';
  22. VAR
  23.   F, GetAttrFile,
  24.   SetAttrFile,
  25.   GetTimeFile,
  26.   SetTimeFile         : File;
  27.   buff1, buff2, BuffU : ARRAY[0..79] OF Char;
  28.   Att                 : Word;
  29.   Tim                 : LongInt;
  30. BEGIN
  31.   {$IFDEF Windows}
  32.   ScreenSize.X := 50;
  33.   ScreenSize.Y := 32;
  34.   cmdShow := sw_Maximize;
  35.   {$ENDIF}
  36.   WriteLn('TEST PROGRAM for CrtLog');
  37.   WriteLn('-----------------------');
  38.   WriteLn('Every event line in this program''s output window');
  39.   WriteLn('should have a matching line in the CrtLog window');
  40.   WriteLn('EXCEPT lines beginning with an asterisk.');
  41.   WriteLn;
  42.   {$IFNDEF Windows}
  43.   WriteLn('Press Alt+Enter make the program run in a window,');
  44.   WriteLn('then press Enter to continue.');
  45.   ReadLn;
  46.   {$ENDIF}
  47.   WriteLn('Creating directory (39h) ', DirName);
  48.   MkDir(DirName);
  49.   WriteLn('Renaming directory (56h) ', DirName, ' to ', NewDirName);
  50.   StrCopy(buff1, DirName);
  51.   StrCopy(buff2, NewDirName);
  52.   ASM
  53.     MOV AH,56h
  54.     LEA DX,buff1
  55.     PUSH DS
  56.     POP ES
  57.     LEA DI,buff2
  58.     INT 21h
  59.   END;
  60.   ChDir(NewDirName);
  61.   WriteLn('Creating file (3Ch) ', CreateFileName);
  62.   Assign(F, CreateFileName);
  63.   Rewrite(F);
  64.   Close(F);
  65.   WriteLn('Creating file (3Ch) ', GetFAttrName);
  66.   Assign(GetAttrFile, GetFAttrName);
  67.   Rewrite(GetAttrFile);
  68.   Close(GetAttrFile);
  69.   WriteLn('Creating file (3Ch) ', SetFAttrName);
  70.   Assign(SetAttrFile, SetFAttrName);
  71.   Rewrite(SetAttrFile);
  72.   Close(SetAttrFile);
  73.   WriteLn('Creating file (3Ch) ', GetFTimeName);
  74.   Assign(GetTimeFile, GetFTimeName);
  75.   Rewrite(GetTimeFile);
  76.   WriteLn('Creating file (3Ch) ', SetFTimeName);
  77.   Assign(SetTimeFile, SetFTimeName);
  78.   Rewrite(SetTimeFile);
  79.   Write('Creating unique file (5Ah) ');
  80.   ASM
  81.     MOV AH,5Ah
  82.     SUB CX,CX
  83.     LEA DX,BuffU
  84.     INT 21h
  85.     MOV BX,AX
  86.     MOV AH,3Eh
  87.     INT 21h
  88.   END;
  89.   WriteLn(BuffU);
  90.   WriteLn('Creating new file (5Bh) ', NewFileName);
  91.   StrCopy(buff1, NewFileName);
  92.   ASM
  93.     MOV AH,5Bh
  94.     MOV CX,0
  95.     LEA DX,buff1
  96.     INT 21h
  97.     MOV BX,AX
  98.     MOV AH,3Eh
  99.     INT 21h
  100.   END;
  101.   StrCopy(buff1, ExtFileName);
  102.   {$IFNDEF Windows}
  103.   Write('* ');
  104.   {$ENDIF}
  105.   WriteLn('Extended open file (6Ch) ', ExtFileName);
  106.   ASM
  107.     MOV AX,6C00h
  108.     MOV BX,0000000001000010b
  109.     MOV CX,0
  110.     MOV DX,0000000000010010b
  111.     LEA SI,buff1
  112.     INT 21h
  113.     MOV BX,AX
  114.     MOV AH,3Eh
  115.     INT 21h
  116.   END;
  117.   WriteLn('Renaming file (56h) ',
  118.     CreateFileName,' to ', RenameFileName);
  119.   {$I-} Rename(F, RenameFileName); {$I+}
  120.   IF IOresult <> 0 THEN
  121.     WriteLn('*** RENAME FAILED ***');
  122.   {$IFDEF Windows}
  123.   Write('* ');
  124.   {$ENDIF}
  125.   WriteLn('Getting file attributes (43h) of ', GetFAttrName);
  126.   GetFAttr(GetAttrFile, Att);
  127.   Att := 0;
  128.   WriteLn('Setting file attributes (43h)of ', SetFAttrName);
  129.   SetFAttr(SetAttrFile, Att);
  130.   WriteLn('* Getting file time (57h) of ', GetFTimeName);
  131.   GetFTime(GetTimeFile, Tim);
  132.   Close(GetTimeFile);
  133.   Inc(Tim);
  134.   WriteLn('* Setting file time (57h) of ', SetFTimeName);
  135.   SetFTime(SetTimeFile, Tim);
  136.   Close(SetTimeFile);
  137.   WriteLn('Deleting file (41h) ', RenameFileName);
  138.   Erase(F);
  139.   WriteLn('Deleting file (41h) ', GetFAttrName);
  140.   Erase(GetAttrFile);
  141.   WriteLn('Deleting file (41h) ', SetFAttrName);
  142.   Erase(SetAttrFile);
  143.   WriteLn('Deleting file (41h) ', GetFTimeName);
  144.   Erase(GetTimeFile);
  145.   WriteLn('Deleting file (41h) ', SetFTimeName);
  146.   Erase(SetTimeFile);
  147.   WriteLn('Deleting file (41h) ', ExtFileName);
  148.   StrCopy(buff1, ExtFileName);
  149.   ASM
  150.     MOV AH,41h
  151.     LEA DX,buff1
  152.     INT 21h
  153.   END;
  154.   WriteLn('Deleting file (41h) ', NewFileName);
  155.   StrCopy(buff1, NewFileName);
  156.   ASM
  157.     MOV AH,41h
  158.     LEA DX,buff1
  159.     INT 21h
  160.   END;
  161.   WriteLn('Deleting file (41h) ', BuffU);
  162.   ASM
  163.     MOV AH,41h
  164.     LEA DX,BuffU
  165.     INT 21h
  166.   END;
  167.   ChDir('..');
  168.   WriteLn('Removing directory (3Ah) ', NewDirName);
  169.   {$I-} RmDir(NewDirName); {$I+}
  170.   IF IOresult <> 0 THEN
  171.     WriteLn('*** RMDIR FAILED ***');
  172.   Write('Press Enter to quit');
  173.   ReadLn;
  174.   {$IFDEF Windows} DoneWinCrt; {$ENDIF}
  175. END.
  176.