Here it is:

Code:
{$O-}
function TVirtualFileSystem.FindFile(aname: string; var afilerecord: TFileRecord): int64;
var
  FileRecordEntry: TFileRecord;
  buffer: pointer;
  i,m,size: integer;
  foundpos: integer;
  OrigFilePos: int64;
begin

  result :=0;

  FileRecordEntry.filename := 'Not Found';
  FileRecordEntry.filesize := 0;
  FileRecordEntry.startblock := 0;
  afilerecord :=FileRecordEntry;
  foundpos:=0;
  if aname = '/' then
  begin
    //read first dir entry
    //TODO: can this be simplified by assuming a fixed /
    self.ReadBlock(1,FileRecordEntry,0,SizeOf(TFileRecord));

    //compare ( is the first entry realy an / )
    if FileRecordEntry.filename = aname then
    begin
      result := foundpos * SizeOf(TFileRecord);
      afilerecord := FileRecordEntry;
    end;
  end
  else
  begin
    //browse through FileRecord(s) in virtual file stream
    OrigFilePos:=FDir.FPosition;
    FDir.FPosition :=0;
    i:=0;
    m:= (FDir.Size div SizeOf(TFileRecord));
    while i<=m-1 do
    begin
      FDir.Read&#40;FileRecordEntry, SizeOf&#40;TFileRecord&#41; &#41;;
      //compare
      if FileRecordEntry.filename = aname then
      begin
        result &#58;= FDir.FPosition-SizeOf&#40;TFileRecord&#41; ;
        afilerecord &#58;= FileRecordEntry;
        FDir.FPosition &#58;=OrigFilePos;
        break;
      end;
      i&#58;=i+1;
    end;
    FDir.FPosition &#58;=OrigFilePos;
  end;
end;
&#123;$O+&#125;
and calling:
Code:
&#123;$O-&#125;
constructor TvfsFileStream.Create&#40;aname&#58; string; aVFSFileSystem&#58; TObject&#41;;
var
  FileRecordPos&#58; int64;
begin

  FileRecordPos &#58;= 0;
  inherited Create&#40;&#41;;
        FBlockList&#58;=nil;

  //determine if aVFSFileSystem is a TVirtualFileSystem
  if aVFSFileSystem <nil> 0 then
      begin
        //TODO&#58; overwrite current file &#40;e.g. delete it dependend on fmode&#41;
        FSize&#58;=FFileRecord.filesize;
        FFirstBlock &#58;= FFileRecord.startblock;
      end
      else
      begin
        //new file
        FFirstBlock &#58;= TVirtualFileSystem&#40;self.FDataFileP&#41;.NextFreeBlock&#40;&#41;;
        TVirtualFileSystem&#40;self.FDataFileP&#41;.AddFile&#40;aname,FFirstBlock , 0&#41;;
        FSize&#58;=0;
      end;

      FPosition&#58;=0; //go to start of virtual file

      //determine what blocks are used by virtual file &#40;if any&#41;
      FBlockList&#58;=TVirtualFileSystem&#40;self.FDataFileP&#41;.GetBlockList&#40;FFileRecord&#41;;

      //some more for making a new virtual file
      if FFilerecord.filename = 'Not Found' then
      begin
        FFileRecord.filename &#58;= aname;
        FFileRecord.startblock &#58;=TVirtualFileSystem&#40;self.FDataFileP&#41;.NextFreeBlock&#40;&#41;;
      end;
      FPosition&#58;=0; //go back to start of virtual file
    end
    else
      Raise Exception.Create&#40;'aVFSFileSystem must be a TVirtualFileSystem'&#41;;

end;
&#123;$O+&#125;
Now with {$O-} the lines do execute.

But as it turned out the cause of the program malfunctioning was due to another here unrelated part. I even wrote a comment there that i might not work ops: .

Now i think i can also remove the {$O-} again as the optimizer is clever enough not to break things only the breakpoints go slightly wrong.