ReadFileEx
's documentation says:
Accessing the input buffer while a read operation is using the buffer may lead to corruption of the data read into that buffer. Applications must not read from, write to, reallocate, or free the input buffer that a read operation is using until the read operation completes.
This is the first time I've ever heard of reading data causing corruption.
So my question is, why does that happen? How can a read operation possibly cause data corruption?
What's going on underneath that causes this?
Update:
I noticed an interesting sentence on ReadFile
's page:
The
ReadFile
function may fail withERROR_NOT_ENOUGH_QUOTA
, which means the calling process's buffer could not be page-locked.
Maybe this is related to the answer?