> Probably, it makes sense just to return STATUS_BUFFER_TOO_SMALL if
you believe the buffer is not large enough to hold all data???
This is definitely not a good idea.
Usually, when I use WriteFile function, I check the result
and if it fails, I assume disk is full. And I guess almost
everyone does this. It’s logical to expect WriteFile
just write all data or fail. Adjusting a buffer according to
data is usual in some read APIs (like registry), not in case of
WriteFile.
Moreover WriteFile does not have any
“dwNumberOfBytesNeededBecauseOfThirdPartyDriver” parameter,
neither has NtWriteFile.
L.