function IsLegalFileName(FileName: string): boolean;<br>var<br> CharSet: set of '"'..'|';<br> i: integer;<br>begin<br> result := true;<br> FileName := ExtractFileName(FileName);<br> CharSet := ['"', '*', '/', ':', '<', '>', '?', '/', '|'];<br> for i := 1 to Length(FileName) do<br> begin<br> if FileName in CharSet then<br> begin<br> result := false;<br> exit;<br> end;<br> end;<br>end;<br>