在开始调用驱动杀杀软的时候,有如下代码。前面的GetInputState,然后再PostThreadMessageA还有PeekMessageA是用来隐藏初始化,后面的CreatEventA可以用来当做互斥变量。
一、关于GetInputState、PostThreadMessageA还有PeekMessageA三个函数作用,GetInputState(http://msdn.microsoft.com/en-us/library/windows/desktop/ms644935(v=vs.85).aspx)是用来判断线程消息队列是否有键盘消息或者按键消息的。然后Post和Peek分别是发送和接收消息。
二、CreatEvent的话,则是创建一个事件,通过GetLastError来判断错误代码是否为183(ERROR_ALREADY_EXISTS),起到互斥作用。
代码如下:
.text:7100125B ; =============== S U B R O U T I N E =======================================
.text:7100125B
.text:7100125B
.text:7100125B ; DWORD __stdcall kill_SecProcess(LPVOID)
.text:7100125B kill_SecProcess proc near ; DATA XREF: DllEntryPoint+7Co
.text:7100125B ; SvchostEntry_W32Time+36o
.text:7100125B
.text:7100125B var_20 = dword ptr -20h
.text:7100125B Msg = tagMSG ptr -1Ch
.text:7100125B
.text:7100125B sub esp, 20h
.text:7100125E push ebx
.text:7100125F push ebp
.text:71001260 push esi
.text:71001261 push edi
.text:71001262 call ds:GetInputState
.text:71001268 xor esi, esi
.text:7100126A push esi ; lParam
.text:7100126B push esi ; wParam
.text:7100126C push esi ; Msg
.text:7100126D call ds:GetCurrentThreadId
.text:71001273 push eax ; idThread
.text:71001274 call ds:PostThreadMessageA ;
.text:7100127A push 1 ; wRemoveMsg
.text:7100127C push esi ; wMsgFilterMax
.text:7100127D push esi ; wMsgFilterMin
.text:7100127E push esi ; hWnd
.text:7100127F lea eax, [esp+40h+Msg]
.text:71001283 push eax ; lpMsg
.text:71001284 call ds:PeekMessageA
.text:7100128A mov edi, ds:LoadLibraryW
.text:71001290 push offset aSleep ; "Sleep"
.text:71001295 push offset LibFileName ; "kernel32.dll"
.text:7100129A call edi ; LoadLibraryW
.text:7100129C mov ebx, ds:GetProcAddress
.text:710012A2 push eax ; hModule
.text:710012A3 call ebx ; GetProcAddress
.text:710012A5 mov ebp, eax ; ebp :Sleep
.text:710012A7 call Anti_debug
.text:710012AC test eax, eax
.text:710012AE jnz short loc_710012E4
.text:710012B0 nop
.text:710012B1 nop
.text:710012B2 push offset Name ; "NSDownLoader26AVip20081206"
.text:710012B7 push esi ; bInitialState
.text:710012B8 push esi ; bManualReset
.text:710012B9 push esi ; lpEventAttributes
.text:710012BA call ds:CreateEventA ; 创建事件对象,初始无信号,并自动置事件有信号
.text:710012C0 mov [esp+30h+var_20], eax
.text:710012C4 call ds:GetLastError
.text:710012CA cmp [esp+30h+var_20], esi
.text:710012CE jz short loc_710012D7
.text:710012D0 cmp eax, 183 ; 判断该对象是否已经被创建,如果是则退出进程
.text:710012D5 jnz short loc_710012EB ; 如果该对象第一次被创建
.text:710012D7
不过