.text:00401036 57 push edi ; dwProcessId
.text:00401037 6A 00 push 0 ; bInheritHandle
.text:00401039 68 FF 0F 1F 00 push 1F0FFFh ; dwDesiredAccess
.text:0040103E FF D3 call ebx ; OpenProcess ; 打开进程
.text:00401040 8B F0 mov esi, eax
.text:00401042 85 F6
test
esi, esi
.text:00401044 74 72 jz short loc_4010B8
.text:00401046 8D 44 24 14 lea eax, [esp+364h+var_350]
.text:0040104A 8D 8C 24 1C 01 00 00 lea ecx, [esp+364h+var_248]
.text:00401051 50 push eax
.text:00401052 68 48 02 00 00 push 248h
.text:00401057 51 push ecx
.text:00401058 6A 1B push 1Bh
.text:0040105A 56 push esi
.text:0040105B FF 54 24 24 call [esp+378h+var_354] ; 调用NtQueryInformationProcess函数
.text:0040105F 85 C0
test
eax, eax
.text:00401061 75 4E jnz short loc_4010B1
.text:00401063 50 push eax ; lpUsedDefaultChar
.text:00401064 50 push eax ; lpDefaultChar
.text:00401065 8B 84 24 28 01 00 00 mov eax, [esp+36Ch+lpWideCharStr]
.text:0040106C 8D 54 24 20 lea edx, [esp+36Ch+MultiByteStr]
.text:00401070 68 04 01 00 00 push 104h ; cbMultiByte
.text:00401075 52 push edx ; lpMultiByteStr
.text:00401076 6A FF push 0FFFFFFFFh ; cchWideChar
.text:00401078 50 push eax ; lpWideCharStr
.text:00401079 6A 00 push 0 ; dwFlags
.text:0040107B 6A 00 push 0 ; CodePage
.text:0040107D FF D5 call ebp ; WideCharToMultiByte ; 将UNICODE转为char
.text:0040107F 85 C0
test
eax, eax
.text:00401081 74 2E jz short loc_4010B1
.text:00401083 8D 44 04 17 lea eax, [esp+eax+364h+var_34D]
.text:00401087 8D 4C 24 18 lea ecx, [esp+364h+MultiByteStr]
.text:0040108B 3B C1
cmp
eax, ecx
.text:0040108D 72 0E jb short loc_40109D
.text:0040108F
.text:0040108F loc_40108F: ; CODE XREF: sub_401000+9Bj
.text:0040108F 80 38 5C
cmp
byte ptr [eax], 5Ch
.text:00401092 74 09 jz short loc_40109D
.text:00401094 48 dec eax
.text:00401095 8D 54 24 18 lea edx, [esp+364h+MultiByteStr]
.text:00401099 3B C2
cmp
eax, edx
.text:0040109B 73 F2 jnb short loc_40108F
.text:0040109D
.text:0040109D loc_40109D: ; CODE XREF: sub_401000+8Dj
.text:0040109D ; sub_401000+92j
.text:0040109D 40 inc eax
.text:0040109E 50 push eax ; lpString2
.text:0040109F 8B 84 24 6C 03 00 00 mov eax, [esp+368h+lpString1]
.text:004010A6 50 push eax ; lpString1
.text:004010A7 FF 15 30 80 40 00 call ds:lstrcmpiA ; 将打开的进程名与目标进程名作比较,看目前打开的进程是不是目标进程,
.text:004010AD 85 C0
test
eax, eax
.text:004010AF 74 23 jz short loc_4010D4 ; 如果是,则直接将进程句柄作为返回值返回,否则继续查找
.text:004010B1
.text:004010B1 loc_4010B1: ; CODE XREF: sub_401000+61j
.text:004010B1 ; sub_401000+81j
.text:004010B1 56 push esi ; hObject
.text:004010B2 FF 15 38 80 40 00 call ds:CloseHandle
.text:004010B8
.text:004010B8 loc_4010B8: ; CODE XREF: sub_401000+44j
.text:004010B8 83 C7 04 add edi, 4
.text:004010BB 81 FF 10 27 00 00
cmp
edi, 2710h
.text:004010C1 0F 82 6F FF FF FF jb loc_401036
.text:004010C7 5F pop edi
.text:004010C8 5E pop esi
.text:004010C9 5D pop ebp
.text:004010CA 33 C0 xor eax, eax
.text:004010CC 5B pop ebx
.text:004010CD 81 C4 54 03 00 00 add esp, 354h
.text:004010D3 C3 retn
.text:004010D4 ; ---------------------------------------------------------------------------
.text:004010D4
.text:004010D4 loc_4010D4: ; CODE XREF: sub_401000+AFj
.text:004010D4 8B C6 mov eax, esi
.text:004010D6 5F pop edi
.text:004010D7 5E pop esi
.text:004010D8 5D pop ebp
.text:004010D9 5B pop ebx
.text:004010DA 81 C4 54 03 00 00 add esp, 354h
.text:004010E0 C3 retn
.text:004010E0 sub_401000 endp