Function at 0x474140
Capabilities:
Check if file exists
Get file attributes
Get file size
Link many functions at runtime
Read file on windows
Resolve function by parsing pe exports

Disassembly:
sub esp, 0x58
mov eax, dword [esp + 0x6c]
mov dword [esp + 8], 0
push ebx
mov ebx, ecx
mov dword [esp + 0x18], ebx
push ebp
mov ebp, edx
mov dword [esp + 0x20], ebp
push esi
mov esi, dword [esp + 0x6c]
push edi
mov edi, dword [esp + 0x74]
mov dword [esi], 0xffffffff
test eax, eax
je 0x474174
mov byte [eax], 0
cmp word [ebx], 0
je 0x4742fb
push 6
push str.hicon:
push ebx
mov byte [esp + 0x23], 0
mov byte [esp + 0x21], 0
call fcn.00491336
add esp, 0xc
test eax, eax
je 0x4741b8
test edi, edi
jne 0x474228
push 8
push str.hbitmap:
push ebx
call fcn.00491336
add esp, 0xc
test eax, eax
jne 0x474228
movzx ecx, word [ebx + 0xa]
xor ebx, ebx
cmp ecx, 0x3a
mov byte [esp + 0x17], 1
setne bl
xor eax, eax
lea ebx, [ebx*4 + 0xc]
add ebx, dword [esp + 0x24]
cmp ecx, 0x3a
sete al
mov dword [esi], eax
movzx eax, word [ebx]
cmp eax, 0x2a
sete byte [esp + 0x15]
jne 0x4741f9
mov eax, dword [esp + 0x7c]
add ebx, 2
test eax, eax
je 0x4741f9
mov byte [eax], 1
mov ecx, ebx
call fcn.0040ded0
test al, al
je 0x474213
push 0x10
push 0
push ebx
call fcn.00492e1e
add esp, 0xc
jmp 0x47421c
push ebx
call fcn.00492a3a
add esp, 4
mov dword [esp + 0x18], eax
test eax, eax
je 0x4742fb
push 0x2e
push ebx
call fcn.0048ca9c
mov esi, eax
add esp, 8
test esi, esi
je 0x47423c
add esi, 2
mov eax, dword [esp + 0x18]
mov edi, dword [esp + 0x6c]
mov ecx, dword [esp + 0x74]
test eax, eax
jne 0x4742b7
cmp ecx, 1
ja 0x4742cf
test esi, esi
je 0x4742b7
push 0x4c60b0
push esi
call fcn.0048f253
add esp, 8
test eax, eax
je 0x4742cf
push 0x4c60b8
push esi
call fcn.0048f253
add esp, 8
test eax, eax
je 0x4742cf
push 0x4c907c
push esi
call fcn.0048f253
add esp, 8
test eax, eax
je 0x4742cf
push 0x4c9084
push esi
call fcn.0048f253
add esp, 8
test eax, eax
je 0x4742cf
push 0x4c908c
push esi
call fcn.0048f253
add esp, 8
test eax, eax
je 0x4742cf
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x74]
mov byte [esp + 0x16], 0
test ecx, ecx
jle 0x474305
mov ecx, dword [esp + 0x70]
mov dword [ecx], 1
jmp 0x47437b
mov ecx, dword [esp + 0x70]
mov edx, dword [esp + 0x74]
push edi
push ebp
mov dword [ecx], 1
mov ecx, ebx
mov byte [esp + 0x1e], 1
call fcn.004748c0
add esp, 8
mov dword [esp + 0x18], eax
cmp eax, 2
jae 0x47437b
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x58
ret
test esi, esi
je 0x47437b
push 0x4c60a8
push esi
call fcn.0048f253
add esp, 8
test eax, eax
jne 0x474327
mov ecx, dword [esp + 0x70]
mov dword [ecx], 1
jmp 0x474377
push 0x4c9094
push esi
call fcn.0048f253
add esp, 8
test eax, eax
je 0x47436d
push 0x4c909c
push esi
call fcn.0048f253
add esp, 8
test eax, eax
je 0x47436d
push 0x4c90a4
push esi
call fcn.0048f253
add esp, 8
test eax, eax
mov eax, dword [esp + 0x18]
jne 0x47437b
mov ecx, dword [esp + 0x70]
mov dword [ecx], 0
jmp 0x47437b
mov ecx, dword [esp + 0x70]
mov dword [ecx], 2
mov eax, dword [esp + 0x18]
cmp ebp, 0xffffffff
je 0x474385
cmp edi, 0xffffffff
jne 0x474395
test ebp, ebp
je 0x47438d
test edi, edi
jne 0x474395
xor edi, edi
xor ebp, ebp
mov dword [esp + 0x28], ebp
cmp ebp, 0xffffffff
je 0x4743a4
mov byte [esp + 0x14], 0
cmp edi, 0xffffffff
jne 0x4743a9
mov byte [esp + 0x14], 1
mov dl, byte [esp + 0x78]
mov dword [esp + 0x1c], 0
mov dword [esp + 0x24], edx
test dl, dl
je 0x4743e4
push str.gdiplus
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
mov edx, dword [esp + 0x24]
mov ecx, eax
xor eax, eax
movzx edx, dl
test ecx, ecx
mov dword [esp + 0x1c], ecx
cmove edx, eax
mov eax, dword [esp + 0x18]
mov dword [esp + 0x24], edx
mov ecx, dword [esp + 0x70]
test eax, eax
jne 0x474484
mov ebp, dword [ecx]
cmp ebp, 0xffffffff
mov dword [esp + 0x2c], ebp
mov ebp, dword [esp + 0x28]
jle 0x474484
test dl, dl
jne 0x474484
mov cl, byte [esp + 0x14]
push 0x2010
test cl, cl
cmove eax, edi
push eax
xor eax, eax
test cl, cl
cmove eax, ebp
push eax
push dword [esp + 0x38]
push ebx
push 0
call dword [sym.imp.USER32.dll_LoadImageW]
mov dword [esp + 0x18], eax
test eax, eax
je 0x474442
cmp byte [esp + 0x14], 0
jne 0x474480
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x58
ret
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x4742fb
mov eax, dword [esp + 0x74]
test eax, eax
jle 0x47447c
push edi
push ebp
mov edx, eax
mov ecx, ebx
call fcn.004748c0
add esp, 8
mov dword [esp + 0x18], eax
cmp eax, 2
jb 0x4742fb
mov byte [esp + 0x16], 1
jmp 0x474480
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x70]
mov dword [esp + 0x20], 0
test eax, eax
jne 0x4746e9
mov dword [ecx], eax
cmp byte [esp + 0x24], al
jne 0x4744d6
test esi, esi
je 0x4744d6
push 0x4c90bc
push esi
call fcn.0048f253
add esp, 8
test eax, eax
je 0x4744f3
push str.jpeg
push esi
call fcn.0048f253
add esp, 8
test eax, eax
je 0x4744f3
push 0x4c90d0
push esi
call fcn.0048f253
add esp, 8
test eax, eax
je 0x4744f3
mov eax, dword [esp + 0x1c]
test eax, eax
jne 0x474618
push str.gdiplus
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
mov dword [esp + 0x1c], eax
jmp 0x4744f7
mov eax, dword [esp + 0x1c]
test eax, eax
jne 0x474618
push eax
push eax
push 3
push eax
push eax
push SysReAllocString
push ebx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebp, eax
cmp ebp, 0xffffffff
je 0x4742fb
push 0
push ebp
call dword [sym.imp.KERNEL32.dll_GetFileSize]
push eax
push 2
mov dword [esp + 0x2c], eax
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov esi, eax
test esi, esi
jne 0x474549
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x58
ret
push esi
call dword [sym.imp.KERNEL32.dll_GlobalLock]
test eax, eax
jne 0x47456c
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push esi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x58
ret
push 0
lea ecx, [esp + 0x28]
push ecx
push dword [esp + 0x2c]
push eax
push ebp
call dword [sym.imp.KERNEL32.dll_ReadFile]
push esi
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea eax, [esp + 0x1c]
push eax
push 0
push esi
call dword [sym.imp.ole32.dll_CreateStreamOnHGlobal]
test eax, eax
js 0x47455b
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x47455b
lea ecx, [esp + 0x20]
push ecx
push 0x4a6820
push 0
push 0
push eax
call dword [sym.imp.OLEAUT32.dll_OleCreatePictureIndirect]
mov ecx, dword [esp + 0x20]
xor edx, edx
test eax, eax
mov eax, dword [esp + 0x1c]
push eax
cmovs ecx, edx
mov dword [esp + 0x24], ecx
mov ecx, dword [eax]
call dword [ecx + 8]
push esi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov ecx, dword [esp + 0x20]
test ecx, ecx
je 0x4742fb
mov eax, dword [ecx]
lea edx, [esp + 0x18]
push edx
push ecx
call dword [eax + 0xc]
mov eax, dword [esp + 0x18]
test eax, eax
jne 0x47460f
mov eax, dword [esp + 0x20]
push eax
mov ecx, dword [eax]
call dword [ecx + 8]
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x58
ret
mov ebp, dword [esp + 0x28]
jmp 0x4746e9
mov esi, dword [sym.imp.KERNEL32.dll_GetProcAddress]
push str.GdiplusStartup
push eax
call esi
push str.GdiplusShutdown
push dword [esp + 0x20]
mov dword [esp + 0x34], eax
call esi
push str.GdipCreateBitmapFromFile
push dword [esp + 0x20]
mov dword [esp + 0x40], eax
call esi
push str.GdipCreateHBITMAPFromBitmap
push dword [esp + 0x20]
mov dword [esp + 0x2c], eax
call esi
push str.GdipDisposeImage
push dword [esp + 0x20]
mov dword [esp + 0x38], eax
call esi
mov esi, eax
mov dword [esp + 0x3c], 1
mov eax, dword [esp + 0x2c]
mov dword [esp + 0x40], 0
mov dword [esp + 0x44], 0
mov dword [esp + 0x48], 0
test eax, eax
je 0x4746db
push 0
lea ecx, [esp + 0x40]
push ecx
lea ecx, [esp + 0x3c]
push ecx
call eax
test eax, eax
jne 0x4746db
lea eax, [esp + 0x28]
push eax
push ebx
call dword [esp + 0x2c]
test eax, eax
jne 0x4746d3
push 0xff000000
lea eax, [esp + 0x1c]
push eax
push dword [esp + 0x30]
call dword [esp + 0x3c]
mov ecx, dword [esp + 0x18]
xor edx, edx
push dword [esp + 0x28]
test eax, eax
cmovne ecx, edx
mov dword [esp + 0x1c], ecx
call esi
push dword [esp + 0x34]
call dword [esp + 0x3c]
push dword [esp + 0x1c]
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov eax, dword [esp + 0x18]
cmp byte [esp + 0x14], 0
je 0x4747e4
mov esi, dword [esp + 0x70]
cmp dword [esi], 0
je 0x474715
lea ecx, [esp + 0x3c]
push ecx
push eax
call dword [sym.imp.USER32.dll_GetIconInfo]
test eax, eax
je 0x4747f8
mov eax, dword [esp + 0x48]
lea ecx, [esp + 0x50]
push ecx
push 0x18
push eax
call dword [sym.imp.GDI32.dll_GetObjectW]
cmp edi, 0xffffffff
jne 0x474760
mov eax, dword [esp + 0x54]
test eax, eax
je 0x474796
movd xmm1, dword [esp + 0x58]
cvtdq2pd xmm1, xmm1
movd xmm0, eax
cvtdq2pd xmm0, xmm0
divsd xmm1, xmm0
movd xmm0, ebp
cvtdq2pd xmm0, xmm0
mulsd xmm1, xmm0
addsd xmm1, qword [0x4c9588]
cvttsd2si edi, xmm1
jmp 0x474796
mov eax, dword [esp + 0x58]
test eax, eax
je 0x474796
movd xmm1, dword [esp + 0x54]
cvtdq2pd xmm1, xmm1
movd xmm0, eax
cvtdq2pd xmm0, xmm0
divsd xmm1, xmm0
movd xmm0, edi
cvtdq2pd xmm0, xmm0
mulsd xmm1, xmm0
addsd xmm1, qword [0x4c9588]
cvttsd2si ebp, xmm1
cmp dword [esi], 0
je 0x4747e0
push dword [esp + 0x4c]
mov esi, dword [sym.imp.GDI32.dll_DeleteObject]
call esi
push dword [esp + 0x48]
call esi
cmp byte [esp + 0x16], 0
jne 0x4747e0
cmp byte [esp + 0x17], 0
jne 0x4747e0
push dword [esp + 0x18]
call dword [sym.imp.USER32.dll_DestroyIcon]
mov ecx, dword [esp + 0x70]
push 0x10
push edi
push ebp
push dword [ecx]
push ebx
push 0
call dword [sym.imp.USER32.dll_LoadImageW]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x58
ret
mov eax, dword [esp + 0x18]
cmp dword [esp + 0x20], 0
je 0x474828
test ebp, ebp
jne 0x47480c
test edi, edi
jne 0x47480c
lea ecx, [ebp + 4]
jmp 0x47480e
push dword [esp + 0x18]
call dword [sym.imp.USER32.dll_DestroyIcon]
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x58
ret
xor ecx, ecx
push ecx
push edi
push ebp
push 0
push eax
call dword [sym.imp.USER32.dll_CopyImage]
mov ecx, dword [esp + 0x20]
mov esi, eax
push ecx
mov edx, dword [ecx]
call dword [edx + 8]
jmp 0x474874
mov dl, byte [esp + 0x15]
test ebp, ebp
jne 0x47484c
test edi, edi
jne 0x47484c
test dl, dl
je 0x4742fd
mov ecx, dword [esp + 0x7c]
test ecx, ecx
je 0x474850
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x58
ret
mov ecx, dword [esp + 0x7c]
test dl, dl
je 0x47485d
neg ecx
sbb ecx, ecx
and ecx, 4
jmp 0x474862
mov ecx, 0xc
push ecx
mov ecx, dword [esp + 0x74]
push edi
push ebp
push dword [ecx]
push eax
call dword [sym.imp.USER32.dll_CopyImage]
mov esi, eax
cmp dword [esp + 0x18], esi
je 0x474885
mov eax, dword [esp + 0x7c]
test eax, eax
je 0x474885
mov byte [eax], 0
pop edi
mov eax, esi
pop esi
pop ebp
pop ebx
add esp, 0x58
ret