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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
mov ecx, dword [ebp + 0xc]
sub esp, 0x24
push ebx
lea eax, [ecx - 1]
push esi
push edi
cmp eax, 0x1ff
ja 0x402211
mov eax, dword [ebp + 0x10]
dec eax
cmp eax, 0x7ffe
ja 0x402211
imul esi, ecx, 0x54
add esi, dword [0x450170]
cmp dword [esi - 0x54], 0xffffffff
jne 0x402211
mov ecx, dword [ebp + 8]
mov dword [esp + 0x20], 0
test ecx, ecx
je 0x401e5a
mov eax, dword [ecx - 4]
cdq
sub eax, edx
sar eax, 1
jmp 0x401e5c
xor eax, eax
lea edx, [esp + 0x20]
push edx
mov edx, eax
call fcn.00401d0a
mov ecx, dword [esp + 0x20]
mov edi, eax
mov eax, dword [sym.imp.KERNEL32.dll_HeapFree]
mov dword [esp + 0x10], eax
mov dword [esp + 0x14], ecx
test edi, edi
js 0x402170
mov eax, dword [ebp + 0x28]
mov ebx, dword [ebp + 0x14]
push 0
push 0x80
push dword [ebp + 0x1c]
movzx edi, ax
push 0
push dword [ebp + 0x18]
shr eax, 0x1f
push ebx
push ecx
mov dword [ebp + 0x28], eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ecx, eax
cmp ecx, 0xffffffff
mov dword [esp + 0xc], ecx
sete al
jne 0x401f23
test byte [ebp + 0x20], 1
je 0x401f23
cmp ebx, 0xc0000000
jne 0x401f23
push 0
push 0x80
push dword [ebp + 0x1c]
push 0
push dword [ebp + 0x18]
push 0x40000000
push dword [esp + 0x2c]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ecx, eax
mov ebx, 0x40000000
cmp ecx, 0xffffffff
mov dword [esp + 0xc], ecx
sete al
jne 0x401f23
push 0
push 0x80
push dword [ebp + 0x1c]
push 0
push dword [ebp + 0x18]
push SysReAllocStringLen
push dword [esp + 0x2c]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
mov dword [esp + 0xc], eax
mov ebx, SysReAllocStringLen
sete al
test al, al
je 0x401f31
mov edi, 0x80004005
jmp 0x402170
mov ecx, dword [ebp + 0x24]
mov edx, dword [ebp + 0x10]
cmp ecx, 1
jne 0x401f49
cmp edx, 0x100
jge 0x401f49
mov edx, 0x1000
mov eax, dword [esp + 0xc]
mov dword [esi - 0x54], eax
mov eax, dword [ebp + 0x20]
mov dword [esi - 0x4c], eax
mov eax, dword [str._b_M_n]
mov dword [esi - 0x50], 0
mov dword [esi - 0x48], edx
mov byte [esi - 0x2c], cl
mov dword [esi - 0x34], 0
mov dword [esi - 0x25], 0xffffffff
mov dword [esi - 0x21], 0xffffffff
cmp edi, 0x4b0
je 0x401f8a
mov eax, dword [0x45039c]
test byte [ebp + 0x20], 4
mov dword [esi - 0x19], eax
jne 0x401fab
test edx, edx
je 0x401fb2
push edx
push 8
push dword [0x4503d0]
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ecx, dword [ebp + 0x24]
jmp 0x401fb4
mov dword [esi - 0x48], 1
xor eax, eax
mov dword [esi - 0x44], eax
mov eax, dword [sym.imp.KERNEL32.dll_GetFileSizeEx]
cmp ecx, 2
je 0x401ff7
mov byte [esi - 0x2b], 0
cmp ecx, 1
jne 0x401ffb
lea ecx, [esp + 0x20]
mov dword [esp + 0x20], 0
push ecx
push dword [esp + 0x10]
mov dword [esp + 0x2c], 0
call eax
mov eax, dword [esp + 0x20]
or eax, dword [esp + 0x24]
mov ecx, dword [ebp + 0x24]
mov eax, dword [sym.imp.KERNEL32.dll_GetFileSizeEx]
jne 0x401ffb
mov byte [esi - 0x2b], 1
cmp byte [ebp + 0x28], 0
mov dword [esi - 0x40], 0
mov dword [esi - 0x3c], 0
mov dword [esi - 0x29], edi
mov dword [esi - 0x30], 0
mov dword [esi - 0x1d], 0
mov byte [esi - 0x2a], 0
je 0x402155
mov dword [esp + 0x2c], 0
mov dword [esp + 0x20], 0
cmp edi, 0xfde9
jne 0x402047
mov edi, 0x4521fc
jmp 0x40206e
cmp edi, 0x4b0
jne 0x40205d
mov edi, 0x4521f8
mov dword [esi - 0x1d], 2
jmp 0x402075
cmp edi, 0xfde8
jne 0x4021c6
mov edi, 0x4521f4
mov dword [esi - 0x1d], 3
cmp ecx, 8
jne 0x4020a4
lea ecx, [esp + 0x18]
mov dword [esp + 0x18], 0
push ecx
push dword [esi - 0x54]
mov dword [esp + 0x24], 0
call eax
mov eax, dword [esp + 0x18]
or eax, dword [esp + 0x1c]
je 0x40219a
jmp 0x4020e8
cmp ecx, 1
je 0x4020ef
cmp ecx, 2
je 0x40219a
cmp ecx, 0x20
je 0x4020c0
cmp ecx, 4
jne 0x402155
lea ecx, [esp + 0x18]
mov dword [esp + 0x18], 0
push ecx
push dword [esi - 0x54]
mov dword [esp + 0x24], 0
call eax
mov eax, dword [esp + 0x18]
or eax, dword [esp + 0x1c]
je 0x402192
shr ebx, 0x1f
test bl, bl
je 0x402155
push 0
lea eax, [esp + 0x24]
push eax
push dword [esi - 0x1d]
lea eax, [esp + 0x38]
push eax
push dword [esi - 0x54]
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov edx, dword [esi - 0x1d]
cmp dword [esp + 0x20], edx
jne 0x4021bf
lea ecx, [esp + 0x2c]
cmp edx, 4
jb 0x402136
jmp 0x402122
mov eax, dword [ecx]
cmp eax, dword [edi]
jne 0x40213a
sub edx, 4
add ecx, 4
add edi, 4
cmp edx, 4
jae 0x402122
test edx, edx
je 0x40214f
sub edi, ecx
lea ebx, [ebx]
mov al, byte [ecx]
dec edx
cmp al, byte [edi + ecx]
jne 0x4021bf
inc ecx
test edx, edx
jne 0x402142
mov eax, dword [esi - 0x1d]
mov dword [esi - 0x50], eax
test byte [ebp + 0x20], 2
je 0x40216e
push 2
push 0
push 0
push dword [esp + 0x18]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov dword [esi - 0x50], eax
xor edi, edi
mov ebx, dword [esp + 0x10]
mov eax, dword [esp + 0x14]
test eax, eax
je 0x402187
push eax
push 0
push dword [0x4503d0]
call ebx
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0x24
test ebx, 0x40000000
je 0x402155
push 0
lea eax, [esp + 0x1c]
mov dword [esp + 0x1c], 0
push eax
push dword [esi - 0x1d]
push edi
push dword [esi - 0x54]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esi - 0x1d]
cmp dword [esp + 0x18], eax
je 0x402152
mov edi, 0x80004005
jmp 0x402170
mov eax, dword [esi - 0x54]
cmp eax, 0xffffffff
je 0x402203
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esi - 0x44]
mov ebx, dword [esp + 0x10]
mov dword [esi - 0x54], 0xffffffff
test eax, eax
je 0x402207
push eax
push 0
push dword [0x4503d0]
call ebx
mov dword [esi - 0x44], 0
mov edi, 0x80004005
jmp 0x402174
mov ebx, dword [esp + 0x10]
mov edi, 0x80004005
jmp 0x402174
pop edi
pop esi
mov eax, 0x80004005
pop ebx
mov esp, ebp
pop ebp
ret 0x24