function IsValidFileName(const FileName: string): boolean;
const
InValidChar: array[0..8] of char = ('\', '/', ':', '*', '?', '"', '<', '>', '|');
var
i: integer;
begin
result:=length(FileName) <= MAX_PATH;
if not Result then exit;
for i := low(InValidChar) to high(InValidChar) do
begin
result := pos(InValidChar[i], FileName) = 0;
if not Result then break;
end;
end;