1
{*****************************************************************************
3
*****************************************************************************}
5
procedure DosDir(func:byte;const s:string);
7
buffer : array[0..255] of char;
10
move(s[1],buffer,length(s));
11
buffer[length(s)]:=#0;
12
DoDirSeparators(pchar(@buffer));
13
{ True DOS does not like backslashes at end
14
Win95 DOS accepts this !!
15
but "\" and "c:\" should still be kept and accepted hopefully PM }
16
if (length(s)>0) and (buffer[length(s)-1]='\') and
17
Not ((length(s)=1) or ((length(s)=3) and (s[2]=':'))) then
18
buffer[length(s)-1]:=#0;
19
syscopytodos(longint(@buffer),length(s)+1);
20
regs.realedx:=tb_offset;
21
regs.realds:=tb_segment;
23
regs.realeax:=$7100+func
25
regs.realeax:=func shl 8;
26
sysrealintr($21,regs);
27
if (regs.realflags and carryflag) <> 0 then
28
GetInOutRes(lo(regs.realeax));
32
procedure mkdir(const s : string);[IOCheck];
34
If (s='') or (InOutRes <> 0) then
40
procedure rmdir(const s : string);[IOCheck];
44
If (s='') or (InOutRes <> 0) then
50
procedure chdir(const s : string);[IOCheck];
54
If (s='') or (InOutRes <> 0) then
56
{ First handle Drive changes }
57
if (length(s)>=2) and (s[2]=':') then
59
regs.realedx:=(ord(s[1]) and (not 32))-ord('A');
61
sysrealintr($21,regs);
63
sysrealintr($21,regs);
64
if byte(regs.realeax)<>byte(regs.realedx) then
69
{ DosDir($3b,'c:') give Path not found error on
74
{ do the normal dos chdir }
79
procedure getdir(drivenr : byte;var dir : shortstring);
81
temp : array[0..255] of char;
85
regs.realedx:=drivenr;
86
regs.realesi:=tb_offset;
87
regs.realds:=tb_segment;
92
sysrealintr($21,regs);
93
if (regs.realflags and carryflag) <> 0 then
95
GetInOutRes(lo(regs.realeax));
96
Dir := char (DriveNr + 64) + ':\';
100
syscopyfromdos(longint(@temp),251);
101
{ conversion to Pascal string including slash conversion }
103
while (temp[i]<>#0) do
105
if temp[i] in AllowDirectorySeparators then
106
temp[i]:=DirectorySeparator;
113
{ upcase the string }
114
if not FileNameCaseSensitive then
116
if drivenr<>0 then { Drive was supplied. We know it }
117
dir[1]:=char(65+drivenr-1)
120
{ We need to get the current drive from DOS function 19H }
121
{ because the drive was the default, which can be unknown }
123
sysrealintr($21,regs);
124
i:= (regs.realeax and $ff) + ord('A');