Browse Source

* avoid FindFirst failing due to Attribute parameter bigger than $FF

git-svn-id: trunk@33894 -
Tomas Hajny 9 năm trước cách đây
mục cha
commit
c1afb4b63b

+ 1 - 1
rtl/go32v2/dos.pp

@@ -796,7 +796,7 @@ begin
   if attr=$8 then
   if attr=$8 then
    dosregs.ecx:=8
    dosregs.ecx:=8
   else
   else
-   dosregs.ecx:=attr and (not 8);
+   dosregs.ecx:=attr and (not 8) and $FF; { no required attributes }
   dosregs.edx:=tb_offset+Sizeof(LFNSearchrec)+1;
   dosregs.edx:=tb_offset+Sizeof(LFNSearchrec)+1;
   dosmemput(tb_segment,tb_offset+Sizeof(LFNSearchrec)+1,path^,strlen(path)+1);
   dosmemput(tb_segment,tb_offset+Sizeof(LFNSearchrec)+1,path^,strlen(path)+1);
   dosregs.ds:=tb_segment;
   dosregs.ds:=tb_segment;

+ 1 - 1
rtl/msdos/dos.pp

@@ -591,7 +591,7 @@ begin
   if attr=$8 then
   if attr=$8 then
    dosregs.cx:=8
    dosregs.cx:=8
   else
   else
-   dosregs.cx:=attr and (not 8);
+   dosregs.cx:=attr and (not 8) and $FF; { No required attributes }
   dosregs.dx:=Ofs(path^);
   dosregs.dx:=Ofs(path^);
   dosregs.ds:=Seg(path^);
   dosregs.ds:=Seg(path^);
   dosregs.di:=Ofs(w);
   dosregs.di:=Ofs(w);

+ 3 - 2
rtl/os2/dos.pas

@@ -92,8 +92,9 @@ threadvar
   LastDosErrorModuleName: string;
   LastDosErrorModuleName: string;
 
 
 
 
-const   FindResvdMask = $00003737; {Allowed bits in attribute
-                                    specification for DosFindFirst call.}
+const
+  FindResvdMask = $00003737 {Allowed bits for DosFindFirst parameter Attribute}
+             and $000000FF; {combined with a mask for allowed attributes only}
 
 
 
 
 function GetMsCount: int64;
 function GetMsCount: int64;

+ 2 - 2
rtl/os2/sysutils.pp

@@ -72,8 +72,8 @@ const
  faOpenReplace = $00040000; {Truncate if file exists}
  faOpenReplace = $00040000; {Truncate if file exists}
  faCreate      = $00050000; {Create if file does not exist, truncate otherwise}
  faCreate      = $00050000; {Create if file does not exist, truncate otherwise}
 
 
- FindResvdMask = $00003737; {Allowed bits in attribute
-                             specification for DosFindFirst call.}
+ FindResvdMask = $00003737  {Allowed bits for DosFindFirst parameter Attribute}
+             and $000000FF; {combined with a mask for allowed attributes only}
 
 
 function FileOpen (const FileName: rawbytestring; Mode: integer): THandle;
 function FileOpen (const FileName: rawbytestring; Mode: integer): THandle;
 Var
 Var

+ 1 - 1
rtl/watcom/dos.pp

@@ -464,7 +464,7 @@ begin
   if attr=$8 then
   if attr=$8 then
    dosregs.ecx:=8
    dosregs.ecx:=8
   else
   else
-   dosregs.ecx:=attr and (not 8);
+   dosregs.ecx:=attr and (not 8) and $FF; { No required attributes }
   dosregs.edx:=tb_offset+Sizeof(LFNSearchrec)+1;
   dosregs.edx:=tb_offset+Sizeof(LFNSearchrec)+1;
   dosmemput(tb_segment,tb_offset+Sizeof(LFNSearchrec)+1,path^,strlen(path)+1);
   dosmemput(tb_segment,tb_offset+Sizeof(LFNSearchrec)+1,path^,strlen(path)+1);
   dosregs.ds:=tb_segment;
   dosregs.ds:=tb_segment;