My Software is writing to an ini file in c:\users...\documents and from time to time I get error reports from users where the WritePrivateProfileString call returns false and then GetLastError returns 2 (ERROR_FILE_NOT_FOUND).
I don't understand how this can happen and I wasn't able to reproduce it, since WritePrivateProfileString is supposed to create the file if it's missing. If the directory didn't exist, the error would be ERROR_PATH_NOT_FOUND, if the file couldn't be created for permission reasons, it would be ERROR_ACCESS_DENIED.
So does anyone know why/when this function can produce this error? And how I can deal with it? As in: I rely on the file being created if necessary.