TMemIniFile does not support ADS (alternate data streams) lazarus / 34-Windows ---------------------------------------------------------------------- CCRDude · 2016-08-29 14:16 On Windows, additional information can be stored alongside files in ADS - alternate data streams. One example for this is the information whether a file has been downloaded from the Internet, which gets stored in a stream called :Zone.Identifier, which basically is an Ini file. In Delphi, passing "file::Zone.Identifier" to TMemIniFile.Create opens this stream. On Lazarus (1.6, FPC 3.0.0), this fails. Has anyone else come across this and has a simple workaround? ---------------------------------------------------------------------- marcov · 2016-08-29 16:05 Try opening a tfilestream and reading the INI then with ini.loadstream() or so. ---------------------------------------------------------------------- CCRDude · 2016-08-30 09:27 Thank you, I did not think of that! For such a small operation, TIniFile is fine. And while I don't like too many IFDEFs for differences, I can live with that and simply proceed to the next unit tests Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function SetFileZone(const AFilename: string; const AZone: integer): boolean;var   sFilenameWithStream: string;   {$IFDEF FPC}   fs: TFileStream;   oif: TIniFile;   {$ELSE FPC}   mif: TMemIniFile;   {$ENDIF FPC}begin   Result := False;   sFilenameWithStream := AFilename + SFileSuffix;   try      {$IFDEF FPC}      fs := TFileStream.Create(sFilenameWithStream, fmOpenReadWrite or fmShareDenyNone);      try         fs.Seek(0, soFromBeginning);       oif := TIniFile.Create(fs);         try            oif.WriteInteger('ZoneTransfer', 'ZoneId', AZone);            Result := True;         finally            oif.Free;         end;      finally         fs.Free;      end;      {$ELSE FPC}      mif := TMemIniFile.Create(sFilenameWithStream);      try         mif.WriteInteger('ZoneTransfer', 'ZoneId', AZone);         mif.UpdateFile;         Result := True;      finally         mif.Free;      end;      {$ENDIF FPC}   except      on E: Exception do begin         DebugLogger.LogException(E, 'SetFileZone');      end;   end;end; ---------------------------------------------------------------------- Thaddy · 2016-08-30 09:41 I suspect that a simple Tinifile DOES support alternate data streams... As long as the can be identified as .ini ---------------------------------------------------------------------- CCRDude · 2016-08-31 15:22 Just tried, because it would have simplified code, but it isn't so. Which is interesting, since TMemIniFile uses TIniFile for loading, which uses FileExists and a TStringList.LoadFromFile, which again uses TFileStream. So it's either the TFileStream modes that branch into something different, or something even more deep inside. There we would be at the different file handling underneath I've written about on bugs.freepascal.org as well, in case you're the same Thaddy