Function at 0x402100
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x1c
push ebx
push esi
push edi
mov edi, dword [ebp + 0xc]
mov esi, ecx
mov dword [esp + 0x10], edx
test edi, edi
je 0x4025d8
mov ebx, dword [ebp + 8]
cmp edx, ebx
je 0x4025d8
mov eax, dword [esi + 4]
mov dword [esp + 0x14], eax
test eax, eax
jne 0x402162
push 0x4000
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov edx, dword [esp + 0x10]
mov dword [esp + 0x14], eax
mov dword [esi + 4], eax
test eax, eax
jne 0x402162
mov eax, 0xffffff94
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
cmp edx, ebx
jbe 0x40231d
cmp edi, 0x4000
jbe 0x402490
mov eax, dword [esi + 4]
mov dword [esp + 0x18], eax
test eax, eax
je 0x402311
mov eax, dword [esi]
lea ecx, [esp + 0x14]
push 0
push ecx
push edx
push eax
mov dword [esp + 0x2c], eax
mov dword [esp + 0x24], 0
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x4021b5
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x4022da
push 0
lea eax, [esp + 0x24]
push eax
push 0x4000
push dword [esp + 0x24]
push dword [esp + 0x2c]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
mov eax, dword [esp + 0x20]
je 0x4022e6
cmp eax, 0x4000
jne 0x4022e6
mov eax, dword [esi + 4]
mov dword [esp + 0x18], eax
test eax, eax
jne 0x40223c
push 0x4000
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov dword [esi + 4], eax
test eax, eax
jne 0x402216
mov eax, 0xffffff94
jmp 0x4022a0
push 0x4000
push 0
push eax
call fcn.00404660
add esp, 0xc
mov edx, ebx
mov ecx, esi
push dword [esi + 4]
push 0x4000
call fcn.004026e0
add esp, 8
jmp 0x4022a0
mov eax, dword [esi]
lea ecx, [esp + 0x1c]
push 0
push ecx
push ebx
push eax
mov dword [esp + 0x24], eax
mov dword [esp + 0x2c], 0
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x40226f
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x40226f
mov eax, 0xffffffd8
jmp 0x4022a0
push 0
lea eax, [esp + 0x28]
push eax
push 0x4000
push dword [esp + 0x24]
push dword [esp + 0x24]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40229b
cmp dword [esp + 0x24], 0x4000
jne 0x40229b
xor eax, eax
jmp 0x4022a0
mov eax, 0xffffffdc
test eax, eax
jne 0x4025da
mov edx, dword [esp + 0x10]
sub edi, 0x4000
add edx, 0x4000
add ebx, 0x4000
mov dword [esp + 0x10], edx
cmp edi, 0x4000
ja 0x402176
mov eax, dword [esi + 4]
mov dword [esp + 0x14], eax
jmp 0x402490
mov eax, 0xffffffd8
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
test eax, eax
jne 0x4025f9
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x4025f9
cmp eax, 0x26
je 0x4025f9
mov eax, 0xffffffdc
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, 0xffffffce
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
add edx, edi
mov dword [esp + 0x14], eax
add ebx, edi
cmp edi, 0x4000
jbe 0x40248c
mov eax, dword [esi + 4]
add edx, 0xffffc000
add ebx, 0xffffc000
mov dword [esp + 0x10], edx
sub edi, 0x4000
mov dword [esp + 0x20], eax
test eax, eax
je 0x402311
mov eax, dword [esi]
lea ecx, [esp + 0x24]
push 0
push ecx
push edx
push eax
mov dword [esp + 0x2c], eax
mov dword [esp + 0x34], 0
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x402382
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x4022da
push 0
lea eax, [esp + 0x1c]
push eax
push 0x4000
push dword [esp + 0x2c]
push dword [esp + 0x2c]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
mov eax, dword [esp + 0x18]
je 0x4022e6
cmp eax, 0x4000
jne 0x4022e6
mov eax, dword [esi + 4]
mov dword [esp + 0x20], eax
test eax, eax
jne 0x402409
push 0x4000
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov dword [esi + 4], eax
test eax, eax
jne 0x4023e3
mov eax, 0xffffff94
jmp 0x40246d
push 0x4000
push 0
push eax
call fcn.00404660
add esp, 0xc
mov edx, ebx
mov ecx, esi
push dword [esi + 4]
push 0x4000
call fcn.004026e0
add esp, 8
jmp 0x40246d
mov eax, dword [esi]
lea ecx, [esp + 0x24]
push 0
push ecx
push ebx
push eax
mov dword [esp + 0x2c], eax
mov dword [esp + 0x34], 0
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x40243c
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x40243c
mov eax, 0xffffffd8
jmp 0x40246d
push 0
lea eax, [esp + 0x18]
push eax
push 0x4000
push dword [esp + 0x2c]
push dword [esp + 0x2c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x402468
cmp dword [esp + 0x14], 0x4000
jne 0x402468
xor eax, eax
jmp 0x40246d
mov eax, 0xffffffdc
test eax, eax
jne 0x4025da
mov edx, dword [esp + 0x10]
cmp edi, 0x4000
ja 0x402331
mov eax, dword [esi + 4]
mov dword [esp + 0x14], eax
sub edx, edi
sub ebx, edi
test eax, eax
je 0x402311
mov eax, dword [esi]
lea ecx, [esp + 0x24]
push 0
push ecx
push edx
push eax
mov dword [esp + 0x30], eax
mov dword [esp + 0x34], 0
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x4024c8
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x4022da
push 0
lea eax, [esp + 0x20]
push eax
push edi
push dword [esp + 0x20]
push dword [esp + 0x30]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
mov eax, dword [esp + 0x1c]
je 0x4025e1
cmp eax, edi
jne 0x4025e1
mov eax, dword [esi + 4]
mov dword [esp + 0x20], eax
test eax, eax
jne 0x402587
test edi, edi
je 0x4025d8
push 0x4000
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov dword [esi + 4], eax
test eax, eax
je 0x402156
push 0x4000
push 0
push eax
call fcn.00404660
add esp, 0xc
cmp edi, 0x4000
jbe 0x402570
push dword [esi + 4]
mov edx, ebx
mov ecx, esi
push 0x4000
call fcn.004026e0
add esp, 8
test eax, eax
jne 0x4025da
sub edi, 0x4000
add ebx, 0x4000
cmp edi, 0x4000
ja 0x402540
push dword [esi + 4]
mov edx, ebx
mov ecx, esi
push edi
call fcn.004026e0
add esp, 8
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov esi, dword [esi]
lea eax, [esp + 0x24]
push 0
push eax
push ebx
push esi
mov dword [esp + 0x34], 0
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x4025b3
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x4022da
push 0
lea eax, [esp + 0x20]
push eax
push edi
push dword [esp + 0x2c]
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x402305
cmp dword [esp + 0x1c], edi
jne 0x402305
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
test eax, eax
jne 0x4025f9
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x4025f9
cmp eax, 0x26
mov eax, 0xffffffdc
jne 0x4025da
pop edi
pop esi
mov eax, 0xffffffd9
pop ebx
mov esp, ebp
pop ebp
ret