function PathHasInvalidCharacters(const S: String; const AllowDriveLetterColon: Boolean): Boolean;
Returns True if the specified string contains characters that are never allowed in paths, or characters and path components that are accepted by the system but might present a security problem (such as '..' and sometimes ':'). Set AllowDriveLetterColon to True when the first character may be a drive letter followed by a colon.