If the path to the TEMP folder contains (non-ASCII) characters that cannot be encoded in the current 8-bit locale of the user, openfile_mkstemp might fail on Windows.
That is an unlikely scenario. But given that the path to the default TEMP folder on Windows contains the Windows user name, it is still possible.
Use the wide character Windows API to avoid that (unlikely) issue.
Is that the preferred style? Or do you prefer sizeof(tempDirName[0]) in place of sizeof(wchar_t)?