Hello,
Welcome to Microsoft Q&A!
Thank you for pointing out the lack of detail in the document. Our team will improve it.
"what kind of "buffer overflow" is this ?"
"what does that mean when it happens, especially for a file handle ? "
"Is it something like "not enough bytes were written" (I assume it could be, for a file, that no more space is available, but isn't it another error ?)"
Buffer overflow, too much information is being passed into a container that does not have enough space, This container can be a file, file stream, physical disk, volume, console buffer, tape drive, socket, communications resource, mailslot, or pipe.
"if such an error occurs, will the completion routine be called ? "
In my test, if buffer overflow occurs, completion routine be called successfully.
"And is it possible that some bytes have been successfully written ? (the number of bytes written as reported by the completion routine being less than the expected count)"
The target container is filled and excess data overflows.
"assuming that I can retry sending the "missing" bytes, should I do that by issuing a new WriteFileEx() without the bytes already sent ?"
If you want send the "missing" bytes, the first thing is to make the container bigger. WriteFileEx() cannot currently add data to the end of a file.
"in such a case can it be/should it be done from the completion routine, or from the caller of WriteFileEx() ? In both cases, the problem is that subsequent calls to WriteFileEx () might have been already queued for other handles, so it seems very difficult to handle properly"
Need to use GetLastError in your program to check for errors.
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.