Why is the callback given to ReadFileEx() not receiving the correct OVERLAPPED structure?

后端 未结 2 1257
北海茫月
北海茫月 2021-01-24 15:08

For some reason, my callback isn\'t receiving the address of the correct OVERLAPPED structure after a call to ReadFileEx. What can cause this?

相关标签:
2条回答
  • 2021-01-24 15:48

    Also, it's also quite possible that ownership of the original OVL struct was not relinquished when the callback was set up, and so overwritten between the setup and the callback.

    Or even possible that an inexperienced developer might allocate it on the stack of the thread setting it up - not a good move :)

    0 讨论(0)
  • 2021-01-24 16:01

    I forgot to specify FILE_FLAG_OVERLAPPED to CreateFile.

    0 讨论(0)
提交回复
热议问题