The get_tmp_outfile chooses everthing after the first "." as extension. It should choose everting after the last "."
Filename: "Report of meeting 02.04.25 regarding something.doc"
IS => Extension : "04.25 regarding something.doc"
SHOULD => "doc"
If the filename is very long and the dot early in the filename the temp filename could be longer than MAX_PATH.