Почему нельзя прервать вызов ReadConsole?
???????????, ??? ???-?? ? ???? ???? ????? ?????:
BOOL Res =
ReadConsole(
GetStdHandle(STD_INPUT_HANDLE),
Buffer,
sizeof(Buffer),
&ReadChars,
NULL);
??????, ??????, ??? ? ?????-?? ?????? ????? ????????? ???????? ????? ReadConsole() (?? ??????? ??????). ??? ??? ????????
??? ??????????, ?? CancelIoEx(), ?? CancelSynchronousIo() ?? ???????? ? ???? ??????. CancelIoEx() ?????????? ?????? ERROR_INVALID_HANDLE, ? CancelSynchronousIo() - ERROR_OBJECT_NOT_FOUND. ????? ?????????, ?? GetStdHandle() ?????????? ???????? “3”, ??? ?? ?????-?? ?????? ?? ????????? (handle) ???????? ???????.
???????? ??????????? ? ???, ??? ?????????? ?????????? ????????????? ????????? ????????? Csrss (? Windows 7 - Conhost). ?????????? ??????? ????? ReadConsole() ?? ????? ???? ????????? RPC ?????? ? Csrss, ?????? ????????? ? ????. ??????????????, ???????? ??????? ???????? ????? ???? ?? ?????? CancelIoEx() ? ?????????? LPC ?????, ?????? ???????? «?????» RPC. ?????? ????????? ?? ????? ????????? ?? ????? ???????. ?? ? RPC ?????????? ????? ?????? ????? ????? ????? ???? ????????.
???????? ?????? ???????? ??????. ??-??????, ????? ???????? ????????? ?????, ???????? ???????. ??-??????, ????? ??????????? ?????????? ???? ? ??????? WriteConsoleInput(), ????????????? ??? ????? ReadConsole(). ? ????????? ??????? ????? ?????????? ?? ??????????? ????? ? ??????????? ReadConsole() ? ???? ?????????? ??? ReadConsoleInput(). ???? ???? ???? ?????? ??? ????????? ???????. ? ?????, ?? ?????? ??? ???…
Cross-posted from blog.not-a-kernel-guy.com.