Function at 0x402040
Capabilities:
Access peb ldr_data
Check for peb beingdebugged flag
Get kernel32 base address
Get process heap flags
Get process heap force flags

Disassembly:
push ebp
mov ebp, esp
push edi
mov edi, eax
push esi
push ebx
mov ebx, edx
sub esp, 0x4c
mov dword [ebp - 0x2c], ecx
mov eax, dword [0x41b258]
cmp dword [0x41b25c], eax
je 0x402298
mov dword [esp + 8], 0xc
mov dword [esp + 4], 0
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
mov eax, dword [sym.imp.kernel32.dll_HeapAlloc]
mov dword [ebp - 0x30], eax
call eax
sub esp, 0xc
mov esi, eax
test eax, eax
je 0x402287
mov ecx, dword [ebp - 0x2c]
mov eax, edi
mov edx, ebx
call dbg.append_path
mov dword [esi], eax
mov edi, eax
test eax, eax
je 0x402240
lea eax, [ebp - 0x20]
mov dword [esp + 0xc], 0x416068
mov dword [esp + 0x10], eax
mov dword [esp + 8], 1
mov dword [esp + 4], 0
mov dword [esp], 0x415b98
call sym._CoCreateInstance_20
sub esp, 0x14
test eax, eax
js 0x40223e
mov eax, dword [ebp - 0x20]
lea ecx, [ebp - 0x1c]
mov edx, dword [eax]
mov dword [esp + 8], ecx
mov dword [esp + 4], 0x417208
mov dword [esp], eax
call dword [edx]
sub esp, 0xc
test eax, eax
js 0x402230
mov eax, dword [ebp - 0x1c]
mov edx, dword [eax]
mov dword [esp + 4], edi
mov dword [esp + 8], 0
mov dword [esp], eax
call dword [edx + 0x14]
mov edi, eax
mov eax, dword [ebp - 0x1c]
sub esp, 0xc
mov edx, dword [eax]
mov dword [esp], eax
call dword [edx + 8]
sub esp, 4
test edi, edi
js 0x402230
mov edi, dword [ebp - 0x20]
test edi, edi
je 0x40223e
mov eax, edi
call dbg.extract_icon
mov dword [esi + 4], eax
mov eax, dword [ebp - 0x2c]
cmp eax, 0xffffffff
je 0x402320
lea ecx, [eax + eax - 2]
add ecx, ebx
jae 0x402177
jmp 0x402184
sub ecx, 2
cmp ebx, ecx
ja 0x402184
cmp word [ecx], 0x2e
jne 0x402170
sub ecx, ebx
sar ecx, 1
mov dword [ebp - 0x2c], ecx
mov eax, dword [ebp - 0x2c]
mov dword [esp + 4], 0
lea ecx, [eax + eax + 2]
mov dword [esp + 8], ecx
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x30]
mov dword [ebp - 0x2c], ecx
mov eax, dword [eax + 0x18]
mov dword [esp], eax
mov eax, dword [ebp - 0x30]
call eax
sub esp, 0xc
mov edx, eax
test eax, eax
je 0x4021e0
mov ecx, dword [ebp - 0x2c]
mov dword [esp + 4], ebx
xor ebx, ebx
mov dword [esp], edx
lea eax, [ecx - 2]
mov dword [ebp - 0x30], ecx
mov dword [esp + 8], eax
mov dword [ebp - 0x2c], edx
call sym._memcpy
mov edx, dword [ebp - 0x2c]
mov ecx, dword [ebp - 0x30]
mov word [edx + ecx - 2], bx
mov dword [esi + 8], edx
mov eax, dword [edi]
mov dword [esp], edi
call dword [eax + 8]
mov eax, dword [esi + 4]
sub esp, 4
test eax, eax
mov eax, dword [esi + 8]
je 0x4022e0
test eax, eax
je 0x4022e0
mov eax, dword [0x41b25c]
lea edx, [eax + 1]
mov dword [0x41b25c], edx
mov edx, dword [0x41b260]
mov dword [edx + eax*4], esi
lea esp, [ebp - 0xc]
mov eax, 1
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [ebp - 0x20]
mov edx, dword [eax]
mov dword [esp], eax
call dword [edx + 8]
sub esp, 4
mov edi, dword [esi]
mov ebx, dword [sym.imp.kernel32.dll_HeapFree]
mov edx, dword fs:[0x18]
mov dword [esp + 8], edi
mov dword [esp + 4], 0
mov eax, dword [edx + 0x30]
mov dword [ebp - 0x2c], edx
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call ebx
mov edx, dword [ebp - 0x2c]
sub esp, 0xc
mov dword [esp + 8], esi
mov dword [esp + 4], 0
mov eax, dword [edx + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call ebx
sub esp, 0xc
lea esp, [ebp - 0xc]
xor eax, eax
pop ebx
pop esi
pop edi
pop ebp
ret
lea esi, [eax + eax]
shl eax, 3
mov dword [esp + 4], 0
mov dword [esp + 0xc], eax
mov eax, dword [0x41b260]
mov edx, dword fs:[0x18]
mov dword [esp + 8], eax
mov eax, dword [edx + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapReAlloc]
sub esp, 0x10
test eax, eax
je 0x402287
mov dword [0x41b260], eax
mov dword [0x41b258], esi
jmp 0x402061
mov dword [esp + 8], eax
mov ebx, dword [sym.imp.kernel32.dll_HeapFree]
mov dword [esp + 4], 0
mov edx, dword fs:[0x18]
mov eax, dword [edx + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call ebx
mov eax, dword [esi + 4]
sub esp, 0xc
mov dword [esp], eax
call sym._DestroyIcon_4
mov edi, dword [esi]
sub esp, 4
jmp 0x402246
cmp word [ebx], 0
je 0x40234a
mov ecx, ebx
lea esi, [esi]
nop
add ecx, 2
cmp word [ecx], 0
jne 0x402330
sub ecx, ebx
mov eax, ecx
sub ecx, 2
sar eax, 1
mov dword [ebp - 0x2c], eax
jmp 0x402160
mov dword [ebp - 0x2c], 0
mov ecx, 0xfffffffe
jmp 0x402160