Function at 0x421670
Capabilities:
Get file size
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x10034
call fcn.0043c8d0
mov eax, dword [section..data]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
push 0x10000
lea eax, [ebp - 0x10008]
mov dword [ebp - 0x10020], ecx
push 0
push eax
mov esi, edx
call fcn.0042a4e0
xor edi, edi
mov dword [ebp - 0x1000c], 0
add esp, 0xc
mov dword [ebp - 0x10018], 0
mov dword [ebp - 0x10024], 0xf0ff
mov dword [ebp - 0x10010], edi
mov dword [0x45771c], edi
lea ebx, [edi + 8]
test esi, esi
je 0x421c33
cmp word [esi], di
je 0x421c33
push edi
push 0x2000080
push 3
push edi
push 7
push SysReAllocString
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x10014], eax
cmp eax, 0xffffffff
jne 0x421766
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [0x45771c], eax
cmp eax, 0x20
jne 0x421c13
push edi
push 0x2000080
push 3
push edi
push 1
push SysReAllocString
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x10014], eax
cmp eax, 0xffffffff
jne 0x421766
push edi
push 0x2000080
push 3
push edi
push 2
push SysReAllocString
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x10014], eax
cmp eax, 0xffffffff
je 0x421bef
lea ecx, [ebp - 0x10030]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_GetFileSizeEx]
test eax, eax
je 0x421be3
mov esi, dword [ebp - 0x10030]
cmp dword [ebp - 0x1002c], edi
jl 0x421796
jg 0x421791
cmp esi, 0xffffffe0
jbe 0x421796
mov esi, 0xffffffe0
push 0
lea eax, [ebp - 0x1000c]
push eax
push 4
lea eax, [ebp - 0x10010]
push eax
push dword [ebp - 0x10014]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x421bef
mov ecx, dword [ebp - 0x1000c]
test ecx, ecx
je 0x421bef
cmp ecx, 2
jae 0x4217d6
xor ebx, ebx
jmp 0x42188f
mov al, byte [ebp - 0x10010]
cmp al, 0xff
jne 0x42181a
cmp byte [ebp - 0x1000f], 0xfe
jne 0x42188f
mov eax, esi
and eax, 1
add esi, eax
cmp ecx, 4
jne 0x421810
cmp byte [ebp - 0x1000e], 0
jne 0x421810
cmp byte [ebp - 0x1000d], 0
jne 0x421810
lea ebx, [ecx + 1]
jmp 0x42188a
mov edi, 2
lea ebx, [edi + 1]
jmp 0x42188f
cmp al, 0xfe
jne 0x421838
cmp byte [ebp - 0x1000f], 0xff
jne 0x42188f
mov edi, 2
mov eax, esi
and eax, 1
add esi, eax
lea ebx, [edi + 2]
jmp 0x42188f
cmp ecx, 2
jbe 0x42188f
cmp al, 0xef
jne 0x42185d
cmp byte [ebp - 0x1000f], 0xbb
jne 0x42188f
cmp byte [ebp - 0x1000e], 0xbf
jne 0x42188f
mov edi, 3
lea ebx, [edi - 1]
jmp 0x42188f
cmp ecx, 4
jne 0x42188f
test al, al
jne 0x42188f
cmp byte [ebp - 0x1000f], al
jne 0x42188f
cmp byte [ebp - 0x1000e], 0xfe
jne 0x42188f
cmp byte [ebp - 0x1000d], 0xff
jne 0x42188f
mov eax, esi
lea ebx, [ecx + 2]
and eax, 1
add esi, eax
mov edi, 4
cmp edi, esi
je 0x421bef
push 0
mov eax, esi
sub eax, edi
test edi, edi
push 0
push edi
push dword [ebp - 0x10014]
cmove eax, esi
mov dword [ebp - 0x1001c], eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 0x10018]
push eax
push 3
push 0x44e5a2
push dword [ebp - 0x10020]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x421be3
cmp dword [ebp - 0x10018], 3
jne 0x421be3
mov edi, dword [ebp - 0x1001c]
lea eax, [edi + 4]
push eax
push 0
push dword [0x45764c]
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov esi, eax
mov dword [ebp - 0x1001c], esi
test esi, esi
jne 0x42191b
mov dword [0x45771c], 8
jmp 0x421bef
push 0
lea eax, [ebp - 0x1000c]
push eax
push edi
push esi
push dword [ebp - 0x10014]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x421bd2
cmp dword [ebp - 0x1000c], 0
je 0x421bd2
push dword [ebp - 0x10014]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test ebx, ebx
jne 0x421986
lea eax, [ebp - 0x10024]
push eax
push dword [ebp - 0x1000c]
push esi
call dword [sym.imp.ADVAPI32.dll_IsTextUnicode]
test eax, eax
mov eax, dword [ebp - 0x10024]
jne 0x421979
test eax, eax
je 0x421986
test al, 0xf0
mov ebx, 0
setne bl
add ebx, 3
add ebx, 0xfffffffd
cmp ebx, 3
ja case.default.0x421992
jmp dword [ebx*4 + 0x421c58]
mov ebx, dword [ebp - 0x1000c]
test bl, 1
je 0x4219bf
mov byte [esi + ebx], 0
mov eax, dword [ebp - 0x1000c]
dec eax
mov dword [ebp - 0x1000c], eax
mov byte [esi + eax], 0
mov ebx, dword [ebp - 0x1000c]
shr ebx, 1
mov edx, esi
mov edi, ebx
je 0x421ac6
nop dword [eax + eax]
mov ax, word [edx]
lea edx, [edx + 2]
movzx ecx, byte [edx - 1]
shl ax, 8
or cx, ax
mov word [edx - 2], cx
sub edi, 1
jne 0x4219d0
jmp 0x421ac6
mov ebx, dword [ebp - 0x1000c]
test bl, 3
je 0x421a18
mov byte [esi + ebx], 0
mov eax, 4
mov ebx, dword [ebp - 0x1000c]
mov ecx, ebx
and ecx, 3
sub eax, ecx
add ebx, eax
mov dword [ebp - 0x1000c], ebx
shr ebx, 2
mov ecx, esi
mov edx, esi
mov edi, ebx
test ebx, ebx
je 0x421ac6
nop dword [eax]
mov ax, word [ecx]
lea edx, [edx + 2]
mov word [edx - 2], ax
lea ecx, [ecx + 4]
sub edi, 1
jne 0x421a30
jmp 0x421ac6
mov ebx, dword [ebp - 0x1000c]
mov eax, ebx
and eax, 3
je 0x421a71
sub ebx, eax
mov dword [ebp - 0x1000c], ebx
mov byte [esi + ebx], 0
mov eax, dword [ebp - 0x1000c]
mov byte [esi + eax + 1], 0
mov ebx, dword [ebp - 0x1000c]
shr ebx, 2
mov edx, esi
mov edi, esi
test ebx, ebx
je 0x421ac6
mov esi, ebx
nop
mov ecx, dword [edx]
lea edi, [edi + 2]
mov eax, ecx
lea edx, [edx + 4]
shr eax, 8
and eax, 0xff00
shr ecx, 0x18
or eax, ecx
mov word [edi - 2], ax
sub esi, 1
jne 0x421a80
mov esi, dword [ebp - 0x1001c]
jmp 0x421ac6
mov ebx, dword [ebp - 0x1000c]
test bl, 1
je 0x421ac4
mov byte [esi + ebx], 0
mov ebx, dword [ebp - 0x1000c]
inc ebx
mov dword [ebp - 0x1000c], ebx
shr ebx, 1
mov dword [ebp - 0x10028], ebx
mov edx, esi
mov dword [ebp - 0x1001c], edx
mov ecx, ebx
mov edi, 0x3fff
test ebx, ebx
je 0x421ba4
push 0
push 0
cmp ecx, 0x3fff
mov eax, ecx
push 0xfffe
cmovae eax, edi
mov edi, eax
lea eax, [ebp - 0x10008]
push eax
push edi
push edx
push 0
push 0xfde9
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov dword [ebp - 0x1000c], eax
test eax, eax
je 0x421bc6
push 0
lea ecx, [ebp - 0x10018]
push ecx
push eax
lea eax, [ebp - 0x10008]
push eax
push dword [ebp - 0x10020]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x421bc6
mov eax, dword [ebp - 0x10018]
cmp eax, dword [ebp - 0x1000c]
jne 0x421bc6
mov edx, dword [ebp - 0x1001c]
mov ecx, dword [ebp - 0x10028]
sub ecx, edi
mov dword [ebp - 0x10028], ecx
lea edx, [edx + edi*2]
mov dword [ebp - 0x1001c], edx
jne 0x421ae3
jmp 0x421ba4
mov ebx, dword [ebp - 0x1000c]
lea eax, [ebp - 0x10018]
push 0
push eax
push ebx
push esi
push dword [ebp - 0x10020]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x421bc6
mov ecx, dword [ebp - 0x10018]
cmp ecx, dword [ebp - 0x1000c]
jne 0x421bc6
push esi
push 0
push dword [0x45764c]
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, ebx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00428cd6
mov esp, ebp
pop ebp
ret
mov eax, dword [sym.imp.KERNEL32.dll_GetLastError]
call eax
mov dword [0x45771c], eax
push esi
push 0
push dword [0x45764c]
call dword [sym.imp.KERNEL32.dll_HeapFree]
jmp 0x421bef
mov eax, dword [sym.imp.KERNEL32.dll_GetLastError]
call eax
mov dword [0x45771c], eax
mov ebx, dword [ebp - 0x10014]
test ebx, ebx
je 0x421c45
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00428cd6
mov esp, ebp
pop ebp
ret
mov ebx, dword [ebp - 0x10014]
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00428cd6
mov esp, ebp
pop ebp
ret
push 0x57
mov dword [0x45771c], 0x57
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov ecx, dword [ebp - 4]
xor eax, eax
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00428cd6
mov esp, ebp
pop ebp
ret