Bug SysUtils.FindClose in Windows ? lazarus / 64-FPC development ---------------------------------------------------------------------- bonmario · 2018-05-24 06:38 Hi, sorry for my bad english. I'm using fpc 3.0.4. See this code: 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 procedure TestFindFirst(WrkDir:String);var PathInfo: TSearchRec;begin  SysUtils.FindFirst(AppendPathDelim(WrkDir) + GetAllFilesMask, faDirectory, PathInfo);  SysUtils.FindClose(PathInfo);  {$IFDEF MSWINDOWS}    if (PathInfo.FindHandle <> -1) then begin  {$ENDIF}  {$IFDEF Linux}    if (PathInfo.FindHandle <> nil) then begin  {$ENDIF}      ShowMessage('Error !!!');    end else begin      ShowMessage('Ok ');    end;   Halt;end;  On Linux, using TestFindFirst, passing an existing directory, the value of "PathInfo.FindHandle" is nil. On Windows, using TestFindFirst, passing an existing directory, the value of "PathInfo.FindHandle" that i expecting is -1, but result is the same value that it had before the call of "FindClose". It's a bug? Thanks in advance, Mario ---------------------------------------------------------------------- Jonas Maebe · 2018-05-24 18:02 The values of TSearchRec are undefined after FindClose. You should not use any of them afterwards. ---------------------------------------------------------------------- bonmario · 2018-05-24 18:23 Sorry, I'm just trying to understand the reason for a problem reported here: https://forum.lazarus.freepascal.org/index.php/topic,41345.msg286830/t opicseen.html#new Sorry, but I thought I canceled this thread. Hi, Mario