Function at 0x51d840
Capabilities:
Extract resource via kernel32 functions
Get file size
Read file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x6359d9
mov eax, dword fs:[0]
push eax
sub esp, 0x304
mov eax, dword [0x6e4770]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov eax, dword [ebp + 0xc]
mov esi, dword [sym.imp.KERNEL32.dll_GetFileSize]
test eax, eax
jne 0x51da8e
call sym.WnPicViewer.exe_public:_static_class_UiLib::CDuiString_const____cdecl_UiLib::CPaintManagerUI::GetResourcePath_void_
push eax
lea ecx, [ebp - 0xc0]
call sym.WnPicViewer.exe_public:_void___thiscall_UiLib::CDuiString::constructor_class_UiLib::CDuiString_const__
mov dword [ebp - 4], 0
call sym.WnPicViewer.exe_public:_static_class_UiLib::CDuiString_const____cdecl_UiLib::CPaintManagerUI::GetResourceZip_void_
mov ecx, eax
call sym.WnPicViewer.exe_public:_bool___thiscall_UiLib::CDuiString::IsEmpty_void_const
test al, al
je 0x51d973
push dword [ebp + 8]
lea ecx, [ebp - 0xc0]
call sym.WnPicViewer.exe_public:_class_UiLib::CDuiString_const____thiscall_UiLib::CDuiString::operator_wchar_t_const__
push 0
push 0x80
push 3
push 0
push 1
push SysReAllocString
lea ecx, [ebp - 0xc0]
call sym.WnPicViewer.exe_public:_wchar_t_const____thiscall_UiLib::CDuiString::operator_wchar_t_const__void_const
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x51d8f7
lea ecx, [ebp - 0xc0]
mov dword [ebp - 4], eax
call sym.WnPicViewer.exe_public:_void___thiscall_UiLib::CDuiString::destructor_void_
jmp 0x51db0d
push 0
push ebx
call esi
mov esi, eax
test esi, esi
jne 0x51d919
lea ecx, [ebp - 0xc0]
mov dword [ebp - 4], 0xffffffff
call sym.WnPicViewer.exe_public:_void___thiscall_UiLib::CDuiString::destructor_void_
jmp 0x51db07
push esi
mov dword [ebp - 0x30c], 0
call fcn.0052cd80
add esp, 4
mov edi, eax
lea eax, [ebp - 0x30c]
push 0
push eax
push esi
push edi
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 0x30c], esi
je 0x51da7a
push edi
call fcn.0052ef7e
add esp, 4
lea ecx, [ebp - 0xc0]
mov dword [ebp - 4], 0xffffffff
call sym.WnPicViewer.exe_public:_void___thiscall_UiLib::CDuiString::destructor_void_
jmp 0x51db07
call sym.WnPicViewer.exe_public:_static_class_UiLib::CDuiString_const____cdecl_UiLib::CPaintManagerUI::GetResourceZip_void_
push eax
lea ecx, [ebp - 0xc0]
call sym.WnPicViewer.exe_public:_class_UiLib::CDuiString_const____thiscall_UiLib::CDuiString::operator_class_UiLib::CDuiString_const__
call sym.WnPicViewer.exe_public:_static_bool___cdecl_UiLib::CPaintManagerUI::IsCachedResourceZip_void_
test al, al
je 0x51d994
call sym.WnPicViewer.exe_public:_static_void____cdecl_UiLib::CPaintManagerUI::GetResourceZipHandle_void_
jmp 0x51d9ac
push 2
push 0
lea ecx, [ebp - 0xc0]
call sym.WnPicViewer.exe_public:_wchar_t_const____thiscall_UiLib::CDuiString::operator_wchar_t_const__void_const
push eax
call fcn.0051f150
add esp, 0xc
mov ebx, eax
test ebx, ebx
jne 0x51d9c9
lea ecx, [ebp - 0xc0]
mov dword [ebp - 4], 0xffffffff
call sym.WnPicViewer.exe_public:_void___thiscall_UiLib::CDuiString::destructor_void_
jmp 0x51db0d
lea eax, [ebp - 0x2f0]
push eax
lea eax, [ebp - 0x2f8]
push eax
push 1
push dword [ebp + 8]
push ebx
call fcn.0051ea60
add esp, 0x14
test eax, eax
je 0x51da00
lea ecx, [ebp - 0xc0]
mov dword [ebp - 4], 0xffffffff
call sym.WnPicViewer.exe_public:_void___thiscall_UiLib::CDuiString::destructor_void_
jmp 0x51db0d
mov esi, dword [ebp - 0xc4]
test esi, esi
jne 0x51da21
lea ecx, [ebp - 0xc0]
mov dword [ebp - 4], 0xffffffff
call sym.WnPicViewer.exe_public:_void___thiscall_UiLib::CDuiString::destructor_void_
jmp 0x51db07
push esi
call fcn.0052cd80
push 3
push esi
mov edi, eax
push edi
push dword [ebp - 0x2f8]
push ebx
call fcn.0051f580
add esp, 0x18
test eax, eax
je 0x51da68
cmp eax, 0x600
je 0x51da68
push edi
call fcn.0052ef7e
add esp, 4
call sym.WnPicViewer.exe_public:_static_bool___cdecl_UiLib::CPaintManagerUI::IsCachedResourceZip_void_
test al, al
jne 0x51d95c
push ebx
call fcn.0051e850
jmp 0x51d959
call sym.WnPicViewer.exe_public:_static_bool___cdecl_UiLib::CPaintManagerUI::IsCachedResourceZip_void_
test al, al
jne 0x51da7a
push ebx
call fcn.0051e850
add esp, 4
lea ecx, [ebp - 0xc0]
mov dword [ebp - 4], 0xffffffff
call sym.WnPicViewer.exe_public:_void___thiscall_UiLib::CDuiString::destructor_void_
jmp 0x51daff
push eax
push dword [ebp + 8]
call sym.WnPicViewer.exe_public:_static_struct_HINSTANCE______cdecl_UiLib::CPaintManagerUI::GetResourceDll_void_
push eax
call dword [sym.imp.KERNEL32.dll_FindResourceW]
mov ebx, eax
test ebx, ebx
je 0x51db0d
push ebx
call sym.WnPicViewer.exe_public:_static_struct_HINSTANCE______cdecl_UiLib::CPaintManagerUI::GetResourceDll_void_
push eax
call dword [sym.imp.KERNEL32.dll_LoadResource]
mov dword [ebp - 0x2f8], eax
push ebx
test eax, eax
jne 0x51dac4
call dword [sym.imp.KERNEL32.dll_FreeResource]
jmp 0x51db0d
call sym.WnPicViewer.exe_public:_static_struct_HINSTANCE______cdecl_UiLib::CPaintManagerUI::GetResourceDll_void_
push eax
call dword [sym.imp.KERNEL32.dll_SizeofResource]
mov esi, eax
test esi, esi
je 0x51db07
push esi
call fcn.0052cd80
add esp, 4
mov edi, eax
push esi
push dword [ebp - 0x2f8]
call dword [sym.imp.KERNEL32.dll_LockResource]
push eax
push edi
call fcn.0052e410
add esp, 0xc
push ebx
call dword [sym.imp.KERNEL32.dll_FreeResource]
test edi, edi
jne 0x51db9b
mov esi, dword [sym.imp.KERNEL32.dll_GetFileSize]
push 0
push 0x80
push 3
push 0
push 1
push SysReAllocString
push dword [ebp + 8]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
cmp ebx, 0xffffffff
je 0x51db79
push 0
push ebx
call esi
mov esi, eax
test esi, esi
je 0x51db79
push esi
mov dword [ebp - 0x308], 0
call fcn.0052cd80
add esp, 4
mov edi, eax
lea eax, [ebp - 0x308]
push 0
push eax
push esi
push edi
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 0x308], esi
je 0x51db97
push edi
call fcn.0052ef7e
add esp, 4
xor eax, eax
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0052dfa4
mov esp, ebp
pop ebp
ret
test edi, edi
je 0x51db79
push 4
lea eax, [ebp - 0x310]
push eax
lea eax, [ebp - 0x2fc]
push eax
lea eax, [ebp - 0x300]
push eax
push esi
push edi
call fcn.0052a540
mov ebx, eax
push edi
mov dword [ebp - 0x304], ebx
call fcn.0052ef7e
add esp, 0x1c
test ebx, ebx
je 0x51db79
push 0x2c
lea eax, [ebp - 0x3c]
push 0
push eax
call fcn.0052f1e0
mov eax, dword [ebp - 0x2fc]
add esp, 0xc
mov edx, dword [ebp - 0x300]
neg eax
mov dword [ebp - 0x34], eax
xor bl, bl
mov dword [ebp - 0x38], edx
lea eax, [ebp - 0x2f4]
imul edx, dword [ebp - 0x2fc]
push 0
push 0
push eax
push 0
lea eax, [ebp - 0x3c]
shl edx, 2
push eax
push 0
mov dword [ebp - 0x3c], 0x28
mov dword [ebp - 0x30], 0x200001
mov dword [ebp - 0x2c], 0
mov dword [ebp - 0x28], edx
mov dword [ebp - 0x2f4], 0
call dword [sym.imp.GDI32.dll_CreateDIBSection]
mov edi, eax
mov dword [ebp - 0x2f8], edi
test edi, edi
je 0x51db79
mov eax, dword [ebp - 0x300]
xor esi, esi
imul eax, dword [ebp - 0x2fc]
test eax, eax
jle 0x51dd6c
mov edx, dword [ebp - 0x304]
jmp 0x51dc70
mov eax, dword [ebp - 0x2f4]
mov cl, byte [edx + esi*4 + 3]
mov byte [eax + esi*4 + 3], cl
mov eax, dword [ebp - 0x2f4]
cmp byte [eax + esi*4 + 3], 0xff
lea edi, [eax + esi*4]
jae 0x51dcf8
movzx eax, byte [edx + esi*4 + 3]
movzx ecx, byte [edx + esi*4 + 2]
mov ebx, dword [ebp - 0x304]
imul ecx, eax
mov eax, 0x80808081
mul ecx
shr edx, 7
mov byte [edi], dl
movzx eax, byte [ebx + esi*4 + 3]
movzx ecx, byte [ebx + esi*4 + 1]
imul ecx, eax
mov eax, 0x80808081
mul ecx
mov eax, dword [ebp - 0x2f4]
shr edx, 7
mov byte [eax + esi*4 + 1], dl
movzx eax, byte [ebx + esi*4 + 3]
movzx ecx, byte [ebx + esi*4]
mov bl, 1
imul ecx, eax
mov eax, 0x80808081
mul ecx
mov eax, dword [ebp - 0x2f4]
shr edx, 7
mov byte [eax + esi*4 + 2], dl
mov edx, dword [ebp - 0x304]
jmp 0x51dd1b
mov al, byte [edx + esi*4 + 2]
mov byte [edi], al
mov eax, dword [ebp - 0x2f4]
movzx ecx, byte [edx + esi*4 + 1]
mov byte [eax + esi*4 + 1], cl
mov eax, dword [ebp - 0x2f4]
movzx ecx, byte [edx + esi*4]
mov byte [eax + esi*4 + 2], cl
mov eax, dword [ebp - 0x2f4]
mov ecx, dword [ebp + 0x10]
cmp dword [eax + esi*4], ecx
jne 0x51dd50
mov byte [eax + esi*4], 0
mov bl, 1
mov eax, dword [ebp - 0x2f4]
mov byte [eax + esi*4 + 1], 0
mov eax, dword [ebp - 0x2f4]
mov byte [eax + esi*4 + 2], 0
mov eax, dword [ebp - 0x2f4]
mov byte [eax + esi*4 + 3], 0
mov eax, dword [ebp - 0x300]
inc esi
imul eax, dword [ebp - 0x2fc]
cmp esi, eax
jl 0x51dc70
mov edi, dword [ebp - 0x2f8]
push dword [ebp - 0x304]
call fcn.0052d900
push 0x98
call fcn.0052d905
mov esi, eax
add esp, 8
mov dword [ebp - 0x2f8], esi
mov dword [ebp - 4], 1
test esi, esi
je 0x51dda1
lea ecx, [esi + 0x10]
call sym.WnPicViewer.exe_public:_void___thiscall_UiLib::CDuiString::constructor_void_
jmp 0x51dda3
xor esi, esi
mov dword [esi], edi
mov eax, esi
mov ecx, dword [ebp - 0x300]
mov dword [esi + 4], ecx
mov ecx, dword [ebp - 0x2fc]
mov dword [esi + 8], ecx
mov byte [esi + 0xc], bl
jmp 0x51db7b