Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synthetic "immediate" read completion #22

Open
jxy-s opened this issue Aug 19, 2024 · 0 comments
Open

Synthetic "immediate" read completion #22

jxy-s opened this issue Aug 19, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jxy-s
Copy link
Owner

jxy-s commented Aug 19, 2024

During async I/O completion synthetically try to wait for the event to complete inside of the verifier hooks in the immediate context. When successful, return to the caller that the async I/O completed "immediately". It is common programming error to not handle async I/O correctly. Attempting to handle async I/O in an "immediate" context instead in the thread or processing logic that is intended to handle the completion of the I/O is generally errant. This approach attempts to trick the logic into an potentially dangerous programming pattern.

    res = Orig_ReadFile(...);

    if (!res && /* has event to wait on */ && (NtCurrentTeb()->LastErrorValue == ERROR_IO_PENDING))
    {
         NtWaitForSingleObject(...);
         // convert to "immediate" (NtCurrentTeb()->LastErrorValue = ERROR_SUCCESS, return TRUE)
    }
@jxy-s jxy-s added the enhancement New feature or request label Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant