1,221
社区成员
发帖
与我相关
我的任务
分享
NtCreateFile(...)
{
...
if (FILE_FLAG_OVERLAPPED)
NtCreateThread创建线程
....
}
NtReadFile(...)
{
...
if (异步)
{
SetEvent(hReadEvent);
return TRUE;
}
else return read(...);
}
ThreadFun()
{
while(!Terminated)
if (WaitForSingleObject(hReadEvent, -1) == WAIT_OBJECT_0)
{
OVERLAPPED.Internal = read(...);
...
SetEvent(OVERLAPPED.hEvent);
如果程序调用ReadFileEx,可能有CompletionRoutine回调函数, 在此调用
if (lpCompletionRoutine != NULL)
lpCompletionRoutine(...);
}
}
NtClose(Handle...)
{
TerminateThread();
...
}