Function at 0x477980
Capabilities:
Check if file exists
Get file attributes
Get file size
Link many functions at runtime
Read file on windows

Disassembly:
sub esp, 0x4c
push ebx
mov ebx, dword [esp + 0x60]
push ebp
mov ebp, dword [esp + 0x58]
push esi
mov esi, dword [esp + 0x74]
push edi
mov edi, dword [esp + 0x70]
mov dword [esp + 0x14], 0
mov dword [ebx], 0xffffffff
test esi, esi
je 0x4779ac
mov byte [esi], 0
cmp word [ebp], 0
je 0x477b16
push 6
push str.hicon:
push ebp
mov byte [esp + 0x1f], 0
mov byte [esp + 0x1d], 0
call fcn.00490257
add esp, 0xc
test eax, eax
je 0x4779e9
push 8
push str.hbitmap:
push ebp
call fcn.00490257
add esp, 0xc
test eax, eax
jne 0x477a5a
cmp word [ebp + 0xa], 0x3a
jne 0x4779fb
mov dword [ebx], 1
add ebp, 0xc
jmp 0x477a04
mov dword [ebx], 0
add ebp, 0x10
cmp word [ebp], 0x2a
mov dword [esp + 0x60], ebp
sete al
mov byte [esp + 0x13], 1
mov byte [esp + 0x11], al
test al, al
je 0x477a2b
add ebp, 2
mov dword [esp + 0x60], ebp
test esi, esi
je 0x477a2b
mov byte [esi], 1
mov eax, ebp
call fcn.0040ea00
test al, al
je 0x477a45
push 0x10
push 0
push ebp
call fcn.00491723
add esp, 0xc
jmp 0x477a4e
push ebp
call fcn.00490d01
add esp, 4
mov dword [esp + 0x14], eax
test eax, eax
je 0x477b16
push 0x2e
push ebp
call fcn.0049184e
mov esi, eax
add esp, 8
mov dword [esp + 0x1c], eax
test esi, esi
je 0x477a76
add esi, 2
mov dword [esp + 0x1c], esi
mov eax, dword [esp + 0x14]
test eax, eax
jne 0x477b24
cmp edi, 1
ja 0x477ae9
test esi, esi
je 0x477b24
push 0x4ad1f4
push esi
call fcn.0048fa09
add esp, 8
test eax, eax
je 0x477ae9
push 0x4ad1fc
push esi
call fcn.0048fa09
add esp, 8
test eax, eax
je 0x477ae9
push 0x4c08a0
push esi
call fcn.0048fa09
add esp, 8
test eax, eax
je 0x477ae9
push 0x4c08a8
push esi
call fcn.0048fa09
add esp, 8
test eax, eax
je 0x477ae9
push 0x4c08b0
push esi
call fcn.0048fa09
add esp, 8
test eax, eax
jne 0x477b20
mov eax, dword [esp + 0x7c]
mov ecx, dword [esp + 0x68]
mov edx, dword [esp + 0x64]
push eax
push ecx
push edx
push edi
push ebp
mov byte [esp + 0x26], 1
mov dword [ebx], 1
call fcn.00478110
add esp, 0x14
mov dword [esp + 0x14], eax
cmp eax, 2
jae 0x477b8b
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret
mov eax, dword [esp + 0x14]
mov byte [esp + 0x12], 0
test esi, esi
je 0x477b8b
push 0x4ad1ec
push esi
call fcn.0048fa09
add esp, 8
test eax, eax
jne 0x477b47
mov dword [ebx], 1
jmp 0x477b87
push 0x4c08b8
push esi
call fcn.0048fa09
add esp, 8
test eax, eax
je 0x477b81
push 0x4c08c0
push esi
call fcn.0048fa09
add esp, 8
test eax, eax
je 0x477b81
push 0x4c08c8
push esi
call fcn.0048fa09
add esp, 8
test eax, eax
jne 0x477b87
mov dword [ebx], eax
jmp 0x477b87
mov dword [ebx], 2
mov eax, dword [esp + 0x14]
mov edx, dword [esp + 0x64]
mov ecx, dword [esp + 0x68]
cmp edx, 0xffffffff
je 0x477b9d
cmp ecx, 0xffffffff
jne 0x477bb6
xor esi, esi
cmp edx, esi
je 0x477ba7
cmp ecx, esi
jne 0x477bb6
mov dword [esp + 0x68], esi
mov dword [esp + 0x64], esi
mov byte [esp + 0x10], 0
jmp 0x477bcc
cmp edx, 0xffffffff
je 0x477bc7
cmp ecx, 0xffffffff
je 0x477bc7
mov byte [esp + 0x10], 0
jmp 0x477bcc
mov byte [esp + 0x10], 1
mov esi, dword [sym.imp.KERNEL32.dll_LoadLibraryW]
xor edi, edi
cmp byte [esp + 0x74], 0
je 0x477bf1
push str.gdiplus
call esi
mov edi, eax
mov eax, dword [esp + 0x14]
test edi, edi
jne 0x477bf1
mov byte [esp + 0x74], 0
test eax, eax
jne 0x477ca1
mov edx, dword [ebx]
cmp edx, 0xffffffff
jle 0x477ca1
cmp byte [esp + 0x74], al
jne 0x477ca1
cmp byte [esp + 0x10], al
je 0x477c18
xor ecx, ecx
jmp 0x477c20
mov eax, dword [esp + 0x64]
mov ecx, dword [esp + 0x68]
push 0x2010
push ecx
push eax
push edx
push ebp
push 0
call dword [sym.imp.USER32.dll_LoadImageW]
mov dword [esp + 0x14], eax
test eax, eax
je 0x477c4f
cmp byte [esp + 0x10], 0
jne 0x477ca1
cmp dword [esp + 0x70], 0
jne 0x477ca1
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret
push ebp
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x477b16
cmp dword [esp + 0x70], 0
jle 0x477c9d
mov eax, dword [esp + 0x7c]
mov ecx, dword [esp + 0x68]
mov edx, dword [esp + 0x64]
push eax
mov eax, dword [esp + 0x74]
push ecx
push edx
push eax
push ebp
call fcn.00478110
add esp, 0x14
mov dword [esp + 0x14], eax
cmp eax, 2
jb 0x477b16
mov byte [esp + 0x12], 1
mov dword [ebx], 1
jmp 0x477ca1
mov eax, dword [esp + 0x14]
mov dword [esp + 0x18], 0
test eax, eax
jne 0x477dc5
mov ecx, ebx
mov dword [ecx], eax
cmp byte [esp + 0x74], al
jne 0x477cfb
cmp dword [esp + 0x1c], eax
je 0x477cfb
mov ebx, dword [esp + 0x1c]
push 0x4c08e0
push ebx
call fcn.0048fa09
add esp, 8
test eax, eax
je 0x477d08
push str.jpeg
push ebx
call fcn.0048fa09
add esp, 8
test eax, eax
je 0x477d08
push 0x4c08f4
push ebx
call fcn.0048fa09
add esp, 8
test eax, eax
je 0x477d08
test edi, edi
jne 0x477d10
push str.gdiplus
call esi
mov edi, eax
test edi, edi
je 0x477e3f
mov esi, dword [sym.imp.KERNEL32.dll_GetProcAddress]
push str.GdiplusStartup
push edi
call esi
push str.GdiplusShutdown
push edi
mov ebp, eax
call esi
push str.GdipCreateBitmapFromFile
push edi
mov dword [esp + 0x30], eax
call esi
push str.GdipCreateHBITMAPFromBitmap
push edi
mov ebx, eax
call esi
push str.GdipDisposeImage
push edi
mov dword [esp + 0x28], eax
call esi
mov esi, eax
xor eax, eax
mov dword [esp + 0x2c], 1
mov dword [esp + 0x30], eax
mov dword [esp + 0x34], eax
mov dword [esp + 0x38], eax
cmp ebp, eax
je 0x477db6
push eax
lea edx, [esp + 0x30]
push edx
lea eax, [esp + 0x2c]
push eax
call ebp
test eax, eax
jne 0x477db6
mov edx, dword [esp + 0x60]
lea ecx, [esp + 0x1c]
push ecx
push edx
call ebx
test eax, eax
jne 0x477dad
mov ecx, dword [esp + 0x1c]
push 0xff000000
lea eax, [esp + 0x18]
push eax
push ecx
call dword [esp + 0x2c]
test eax, eax
je 0x477da6
mov dword [esp + 0x14], 0
mov edx, dword [esp + 0x1c]
push edx
call esi
mov eax, dword [esp + 0x24]
push eax
call dword [esp + 0x2c]
push edi
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov eax, dword [esp + 0x14]
mov ebp, dword [esp + 0x60]
cmp byte [esp + 0x10], 0
mov ebx, dword [sym.imp.GDI32.dll_DeleteObject]
mov edi, dword [esp + 0x6c]
je 0x477fe0
cmp dword [edi], 0
je 0x477df7
lea ecx, [esp + 0x2c]
push ecx
push eax
call dword [sym.imp.USER32.dll_GetIconInfo]
test eax, eax
je 0x477fc5
mov eax, dword [esp + 0x38]
lea edx, [esp + 0x40]
push edx
push 0x18
push eax
call dword [sym.imp.GDI32.dll_GetObjectW]
mov esi, dword [esp + 0x68]
cmp esi, 0xffffffff
jne 0x477f5b
cmp dword [esp + 0x44], 0
je 0x477f7d
fild dword [esp + 0x48]
fidiv dword [esp + 0x44]
fimul dword [esp + 0x64]
fadd qword [0x4c0d40]
call fcn.0049e330
mov esi, eax
mov dword [esp + 0x68], esi
jmp 0x477f7d
push 0
push 0
push 3
push 0
push 0
push SysReAllocString
push ebp
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
je 0x477b16
push 0
push edi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
push eax
push 2
mov dword [esp + 0x68], eax
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov esi, eax
test esi, esi
jne 0x477e8d
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret
push esi
call dword [sym.imp.KERNEL32.dll_GlobalLock]
test eax, eax
jne 0x477eb0
push edi
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, 0x4c
ret
mov edx, dword [esp + 0x60]
push 0
lea ecx, [esp + 0x64]
push ecx
push edx
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
push esi
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
push edi
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 0x477e9f
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x477e9f
lea ecx, [esp + 0x18]
push ecx
push 0x4a17f8
push 0
push 0
push eax
call dword [sym.imp.OLEAUT32.dll_OleCreatePictureIndirect]
test eax, eax
jns 0x477f0d
mov dword [esp + 0x18], 0
mov eax, dword [esp + 0x1c]
mov edx, dword [eax]
push eax
mov eax, dword [edx + 8]
call eax
push esi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov eax, dword [esp + 0x18]
test eax, eax
je 0x477b16
mov ecx, dword [eax]
lea edx, [esp + 0x14]
push edx
push eax
mov eax, dword [ecx + 0xc]
call eax
mov eax, dword [esp + 0x14]
test eax, eax
jne 0x477dc5
mov eax, dword [esp + 0x18]
mov ecx, dword [eax]
mov edx, dword [ecx + 8]
push eax
call edx
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret
cmp dword [esp + 0x48], 0
je 0x477f7d
fild dword [esp + 0x44]
fidiv dword [esp + 0x48]
fimul dword [esp + 0x68]
fadd qword [0x4c0d40]
call fcn.0049e330
mov dword [esp + 0x64], eax
cmp dword [edi], 0
je 0x477fda
mov eax, dword [esp + 0x3c]
push eax
call ebx
mov ecx, dword [esp + 0x38]
push ecx
call ebx
cmp byte [esp + 0x12], 0
jne 0x477fda
cmp byte [esp + 0x13], 0
jne 0x477fda
mov edx, dword [esp + 0x14]
push edx
call dword [sym.imp.USER32.dll_DestroyIcon]
mov eax, dword [esp + 0x64]
mov ecx, dword [edi]
push 0x10
push esi
push eax
push ecx
push ebp
push 0
call dword [sym.imp.USER32.dll_LoadImageW]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret
mov edx, dword [esp + 0x14]
push edx
call dword [sym.imp.USER32.dll_DestroyIcon]
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret
mov eax, dword [esp + 0x14]
jmp 0x477fe4
mov esi, dword [esp + 0x68]
cmp dword [esp + 0x18], 0
je 0x478021
cmp dword [esp + 0x64], 0
jne 0x477ffb
test esi, esi
jne 0x477ffb
lea ecx, [esi + 4]
jmp 0x477ffd
xor ecx, ecx
mov edx, dword [esp + 0x64]
push ecx
mov ecx, dword [esp + 0x6c]
push ecx
push edx
push 0
push eax
call dword [sym.imp.USER32.dll_CopyImage]
mov esi, eax
mov eax, dword [esp + 0x18]
mov ecx, dword [eax]
mov edx, dword [ecx + 8]
push eax
call edx
jmp 0x478081
cmp dword [esp + 0x64], 0
jne 0x47804d
test esi, esi
jne 0x47804d
cmp byte [esp + 0x11], 0
je 0x478039
cmp dword [esp + 0x78], esi
je 0x47804d
cmp dword [esp + 0x70], 1
jl 0x4780d5
cmp dword [edi], 1
je 0x4780d5
cmp byte [esp + 0x11], 0
je 0x478061
mov ecx, dword [esp + 0x78]
neg ecx
sbb ecx, ecx
and ecx, 4
jmp 0x478066
mov ecx, 0xc
mov edx, dword [esp + 0x64]
push ecx
mov ecx, dword [esp + 0x6c]
push ecx
mov ecx, dword [esp + 0x74]
push edx
mov edx, dword [ecx]
push edx
push eax
call dword [sym.imp.USER32.dll_CopyImage]
mov esi, eax
cmp dword [esp + 0x70], 0
jle 0x4780c2
mov ebp, dword [esp + 0x6c]
cmp dword [ebp], 0
jne 0x4780c2
lea eax, [esp + 0x2c]
push eax
mov dword [esp + 0x30], 1
mov dword [esp + 0x3c], esi
mov dword [esp + 0x40], esi
call dword [sym.imp.USER32.dll_CreateIconIndirect]
cmp byte [esp + 0x11], 0
mov edi, eax
jne 0x4780b9
push esi
call ebx
mov esi, edi
mov dword [ebp], 1
cmp dword [esp + 0x14], esi
je 0x4780d3
mov eax, dword [esp + 0x78]
test eax, eax
je 0x4780d3
mov byte [eax], 0
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret