Precall and Postcall

14 Jun 2009 Chengyu Song qebek sebek qemu windows
When using hooking technology to intercept system calls, there are two different places to collect information: before the original function is called (precall) and after the original function returns (postcall). For example, in Sebek Win32 client, when callback function OnZwReadFile is called, it first calls the original function s_fnZwReadFile, after the original function returns, it checks whether the original call succeeds, if does, it then calls the data collection function LogIfStdHandle:

Is Handle Std

11 Jun 2009 Chengyu Song qebek qemu sebek windows
Sebek Windows client has two keystroke sources, one is read or write std stream, the other is csrss port. In the callback function of NtReadFile and NtWriteFile, Sebek will check if the given file handle match one of the three standard stream handles. if matches, it then logs the given data of keystrokes: __asm { mov EAX, FS:[18h] mov [pTIB], EAX } if(FileHandle == pTIB->pPEB->ProcessParameters->StandardOutput || FileHandle == pTIB->pPEB->ProcessParameters->StandardInput ||