Function at 0x409590
Capabilities:
Extract resource via kernel32 functions
Read file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x4e7590
mov eax, dword fs:[0]
push eax
sub esp, 0x2c
push ebx
push esi
mov eax, dword [0x512054]
xor eax, esp
push eax
lea eax, [esp + 0x38]
mov dword fs:[0], eax
xor esi, esi
cmp dword [edi + 8], esi
jne 0x409951
mov ecx, dword [edi + 4]
cmp ecx, 0xffff
jae 0x40974a
mov al, byte [edi + 0x17]
cmp al, 2
jne 0x4095fd
push 0x2000
push esi
push esi
movzx eax, cx
mov ecx, dword [0x5195d0]
push esi
push eax
push ecx
call dword [sym.imp.USER32.dll_LoadImageW]
mov dword [edi + 8], eax
jmp 0x4098f8
mov dword [esp + 0xc], esi
mov dword [esp + 0x10], esi
mov dword [esp + 0x40], esi
cmp al, 4
jne 0x409693
push ecx
mov eax, esp
movzx edx, cx
mov dword [esp + 0x1c], esp
push ecx
mov dword [eax], edx
mov eax, esp
lea esi, [esp + 0x14]
mov dword [esp + 0x20], esp
mov dword [eax], 0x4f6120
call fcn.00409370
test al, al
je 0x409693
lea esi, [esp + 0x14]
call fcn.00409520
lea esi, [esp + 0x1c]
lea eax, [esp + 0x14]
call fcn.0044b590
mov byte [esp + 0x40], 2
mov esi, dword [eax]
mov eax, dword [esp + 0x10]
mov ecx, dword [0x5195d0]
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_SizeofResource]
mov edx, dword [esp + 0xc]
push edx
mov ebx, eax
call dword [sym.imp.KERNEL32.dll_LockResource]
mov ecx, dword [esi]
mov edx, dword [ecx + 0xc]
push ebx
push eax
push esi
call edx
lea ecx, [esp + 0x1c]
mov dword [edi + 8], eax
mov byte [esp + 0x40], 1
call fcn.00409540
jmp 0x40971d
cmp byte [edi + 0x17], 3
jne 0x409732
mov eax, dword [edi + 4]
push ecx
movzx eax, ax
mov ecx, esp
mov dword [esp + 0x1c], esp
push ecx
mov dword [ecx], eax
mov eax, esp
lea esi, [esp + 0x14]
mov dword [esp + 0x20], esp
mov dword [eax], 0x4f6128
call fcn.00409370
test al, al
je 0x409732
lea esi, [esp + 0x14]
call fcn.00409570
lea esi, [esp + 0x1c]
lea eax, [esp + 0x14]
call fcn.0044b590
mov byte [esp + 0x40], 4
mov ecx, dword [esp + 0x10]
mov edx, dword [0x5195d0]
mov esi, dword [eax]
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_SizeofResource]
mov ebx, eax
mov eax, dword [esp + 0xc]
push eax
call dword [sym.imp.KERNEL32.dll_LockResource]
mov ecx, dword [esi]
mov edx, dword [ecx + 0xc]
push ebx
push eax
push esi
call edx
lea ecx, [esp + 0x1c]
mov dword [edi + 8], eax
mov byte [esp + 0x40], 3
call fcn.00409540
mov byte [esp + 0x40], 0
mov eax, dword [esp + 0x14]
test eax, eax
je 0x409732
mov ecx, dword [eax]
mov edx, dword [ecx + 8]
push eax
call edx
mov eax, dword [esp + 0xc]
test eax, eax
je 0x4098f8
push eax
call dword [sym.imp.KERNEL32.dll_FreeResource]
jmp 0x4098f8
cmp ecx, esi
je 0x409794
lea eax, [esp + 0x14]
push eax
call fcn.00406bd0
lea eax, [esp + 0x14]
mov dword [esp + 0x40], 5
call fcn.00409470
mov byte [edi + 0x17], al
mov dword [esp + 0x40], 0xffffffff
mov eax, dword [esp + 0x14]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x409794
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
cmp byte [edi + 0x17], 2
jne 0x4097b5
mov ecx, dword [edi + 4]
push 0x2010
push esi
push esi
push esi
push ecx
push esi
call dword [sym.imp.USER32.dll_LoadImageW]
mov dword [edi + 8], eax
jmp 0x4098f8
mov edx, dword [edi + 4]
push 0x4f6118
push edx
lea eax, [esp + 0x14]
push eax
mov dword [esp + 0x18], esi
call fcn.004cafad
add esp, 0xc
test eax, eax
jne 0x4098f8
mov eax, dword [esp + 0xc]
cmp eax, esi
je 0x4098f8
push 2
push esi
push eax
call fcn.004cac40
mov ecx, dword [esp + 0x18]
add esp, 0xc
push ecx
call fcn.004cae62
mov edx, dword [esp + 0x10]
add esp, 4
push 0
push 0
push edx
mov ebx, eax
call fcn.004cac40
add esp, 0xc
push ebx
call fcn.004c94d1
add esp, 4
mov dword [esp + 0x14], eax
test eax, eax
je 0x4098eb
mov ecx, dword [esp + 0xc]
push ecx
push ebx
push 1
push eax
call fcn.004cab99
mov al, byte [edi + 0x17]
add esp, 0x10
cmp al, 4
jne 0x409880
lea esi, [esp + 0x18]
call fcn.00409520
lea esi, [esp + 0x1c]
lea eax, [esp + 0x18]
mov dword [esp + 0x40], 6
call fcn.0044b590
mov byte [esp + 0x40], 7
mov eax, dword [eax]
mov ecx, dword [esp + 0x14]
mov edx, dword [eax]
mov edx, dword [edx + 0xc]
push ebx
push ecx
push eax
call edx
mov ecx, esi
mov dword [edi + 8], eax
mov byte [esp + 0x40], 6
call fcn.00409540
jmp 0x4098c6
cmp al, 3
jne 0x4098de
lea esi, [esp + 0x18]
call fcn.00409570
lea esi, [esp + 0x1c]
lea eax, [esp + 0x18]
mov dword [esp + 0x40], 8
call fcn.0044b590
mov byte [esp + 0x40], 9
mov eax, dword [eax]
mov edx, dword [esp + 0x14]
mov ecx, dword [eax]
push ebx
push edx
push eax
mov eax, dword [ecx + 0xc]
call eax
mov ecx, esi
mov dword [edi + 8], eax
mov byte [esp + 0x40], 8
call fcn.00409540
mov dword [esp + 0x40], 0xffffffff
mov eax, dword [esp + 0x18]
test eax, eax
je 0x4098de
mov ecx, dword [eax]
mov edx, dword [ecx + 8]
push eax
call edx
mov eax, dword [esp + 0x14]
push eax
call fcn.004ca7dd
add esp, 4
mov ecx, dword [esp + 0xc]
push ecx
call fcn.004ca87d
add esp, 4
mov eax, dword [edi + 8]
xor ecx, ecx
cmp eax, ecx
jne 0x409922
xor edx, edx
mov word [edi + 0x14], dx
mov dword [edi + 0xc], ecx
mov dword [edi + 0x10], ecx
mov byte [edi + 0x16], dl
mov ecx, dword [esp + 0x38]
mov dword fs:[0], ecx
pop ecx
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
lea ecx, [esp + 0x1c]
push ecx
push 0x18
push eax
call dword [sym.imp.GDI32.dll_GetObjectW]
mov eax, dword [esp + 0x20]
movzx ecx, word [edi + 0x14]
cdq
idiv ecx
cmp word [esp + 0x2e], 0x20
mov edx, dword [esp + 0x24]
mov dword [edi + 0x10], edx
mov dword [edi + 0xc], eax
sete al
mov byte [edi + 0x16], al
mov ecx, dword [esp + 0x38]
mov dword fs:[0], ecx
pop ecx
pop esi
pop ebx
mov esp, ebp
pop ebp
ret