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

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x64
push ebx
push esi
push edi
mov edi, ecx
mov byte [ebp - 4], dl
mov esi, dword [edi + 0x10]
test esi, esi
jne 0x405ccb
mov esi, dword [edi + 0x14]
mov ecx, dword [edi + 8]
test ecx, ecx
je 0x405ce8
call fcn.00407726
push esi
push eax
push 0x1011
call fcn.00406b59
add esp, 0xc
jmp 0x405cf5
push esi
push 0x1012
call fcn.00406b59
pop ecx
pop ecx
push 0x101d
call fcn.00406b59
mov edi, dword [edi + 0x14]
lea eax, [ebp - 0x38]
pop ecx
push edi
push eax
call dword [sym.imp.ntdll.dll_RtlInitUnicodeString]
push 0x2a
lea eax, [ebp - 0x38]
mov dword [ebp - 0x60], 0x18
mov dword [ebp - 0x58], eax
xor ebx, ebx
push 7
lea eax, [ebp - 0x40]
mov dword [ebp - 0x5c], ebx
push eax
lea eax, [ebp - 0x60]
mov dword [ebp - 0x54], 0x40
push eax
push 0xc0100080
lea eax, [ebp - 8]
mov dword [ebp - 0x50], ebx
push eax
mov dword [ebp - 0x4c], ebx
call dword [sym.imp.ntdll.dll_NtOpenFile]
mov esi, eax
test esi, esi
jns 0x405d6c
push 0x1013
call fcn.00406b59
pop ecx
push esi
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ecx, eax
call fcn.00406b9e
jmp 0x406039
lea eax, [ebp - 0x24]
mov ecx, edi
push eax
push 0x402e08
call fcn.00407685
mov esi, eax
test esi, esi
jns 0x405da0
push 0x1014
call fcn.00406b59
pop ecx
push esi
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ecx, eax
call fcn.00406b9e
jmp 0x406025
push dword [ebp - 0x24]
lea eax, [ebp - 0x38]
push eax
call dword [sym.imp.ntdll.dll_RtlInitUnicodeString]
push 0x4021
lea eax, [ebp - 0x38]
mov dword [ebp - 0x60], 0x18
mov dword [ebp - 0x58], eax
lea eax, [ebp - 0x40]
push ebx
push eax
lea eax, [ebp - 0x60]
mov dword [ebp - 0x5c], ebx
push eax
push 0x100000
lea eax, [ebp - 0x28]
mov dword [ebp - 0x54], 0x40
push eax
mov dword [ebp - 0x50], ebx
mov dword [ebp - 0x4c], ebx
call dword [sym.imp.ntdll.dll_NtOpenFile]
mov ecx, dword [ebp - 0x24]
mov esi, eax
call fcn.00406a2d
test esi, esi
jns 0x405dfc
push 0x1015
jmp 0x405d87
mov ecx, dword [ebp - 0x28]
lea eax, [ebp - 0x10]
push eax
lea edx, [ebp - 0x30]
call fcn.004058ec
push dword [ebp - 0x28]
mov esi, eax
call dword [sym.imp.ntdll.dll_NtClose]
test esi, esi
jns 0x405e24
push 0x1016
jmp 0x405d87
mov ebx, dword [ebp - 0x30]
mov ecx, 0x200
mov edx, dword [0x411ed0]
cmp ebx, 1
jne 0x405e53
mov edi, dword [ebp - 0x10]
cmp edi, ecx
je 0x405e6a
push 0x108b
call fcn.00406b59
pop ecx
mov esi, 0xc0000001
jmp 0x406025
cmp ebx, 3
jne 0x405e67
cmp edx, 0x40b03c
jne 0x405e67
push 0x108c
jmp 0x405e43
mov edi, dword [ebp - 0x10]
mov eax, ebx
sub eax, 0
je 0x405ea5
sub eax, 1
je 0x405e9b
sub eax, 1
je 0x405e91
sub eax, 1
je 0x405e87
push 0x1017
jmp 0x405e43
mov eax, dword [edx + 0x10]
mov ecx, 0x600
jmp 0x405ea7
mov eax, dword [edx + 8]
mov ecx, 0x2000
jmp 0x405ea7
mov eax, dword [edx + 4]
mov ecx, 0x600
jmp 0x405ea7
mov eax, dword [edx]
mov dword [ebp - 0x14], eax
xor edx, edx
mov eax, ecx
mov dword [ebp - 0x18], ecx
div edi
mov esi, ecx
mov dword [ebp - 0x20], ecx
test edx, edx
je 0x405ec3
sub esi, edx
add esi, edi
mov dword [ebp - 0x20], esi
cmp ebx, 3
jne 0x405ece
imul esi, edi, 0x18
mov dword [ebp - 0x20], esi
lea ecx, [esi + edi]
call fcn.00406a1a
mov dword [ebp - 0x24], eax
test eax, eax
jne 0x405ef2
push 0x1018
call fcn.00406b59
pop ecx
mov esi, 0xc000009a
jmp 0x406025
push 0
push edi
push 0
push eax
call fcn.0040a9a0
mov edi, dword [ebp - 0x24]
test eax, eax
je 0x405f09
sub edi, eax
add edi, dword [ebp - 0x10]
xor ecx, ecx
mov dword [ebp - 0x1c], edi
push ecx
push ecx
push ecx
push ecx
push 0x90018
lea eax, [ebp - 0x48]
mov dword [ebp - 0x2c], ecx
push eax
push ecx
push ecx
push ecx
push dword [ebp - 8]
mov dword [ebp - 0x30], ecx
mov byte [ebp - 2], cl
mov byte [ebp - 3], cl
mov byte [ebp - 1], cl
call dword [sym.imp.ntdll.dll_NtFsControlFile]
test eax, eax
jns 0x405f4d
cmp byte [ebp - 4], 0
jne 0x405f49
mov byte [ebp - 1], 1
mov dword [ebp - 0x2c], eax
jmp 0x405f92
mov byte [ebp - 2], 1
xor ecx, ecx
lea eax, [ebp - 0x48]
push ecx
push ecx
push ecx
push ecx
push 0x90020
push eax
push ecx
push ecx
push ecx
push dword [ebp - 8]
call dword [sym.imp.ntdll.dll_NtFsControlFile]
test eax, eax
jns 0x405f75
mov byte [ebp - 3], 1
mov dword [ebp - 0x30], eax
jmp 0x405f92
cmp byte [ebp - 2], 1
jne 0x405f92
push 0x101e
call fcn.00406b59
mov dword [esp], 0x101d
call fcn.00406b59
pop ecx
xor eax, eax
push eax
push eax
push eax
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x405fac
push 0x1019
jmp 0x405fd8
lea eax, [ebp - 0xc]
push 0
push eax
cmp ebx, 3
jne 0x406040
push esi
push edi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x405fd3
cmp dword [ebp - 0xc], esi
je 0x40605d
push 0x101a
call fcn.00406b59
pop ecx
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, eax
call fcn.00406b9e
mov bl, byte [ebp - 1]
mov esi, 0xc0000001
cmp byte [ebp - 2], 0
jne 0x40601d
test bl, bl
jne 0x40601d
push 0
push 0
push 0
push 0
push 0x9001c
lea eax, [ebp - 0x48]
push eax
push 0
push 0
push 0
push dword [ebp - 8]
call dword [sym.imp.ntdll.dll_NtFsControlFile]
mov ecx, dword [ebp - 0x24]
call fcn.00406a2d
push dword [ebp - 8]
call dword [sym.imp.ntdll.dll_NtClose]
push 0x101d
call fcn.00406b59
pop ecx
pop edi
mov eax, esi
pop esi
pop ebx
leave
ret
push dword [ebp - 0x10]
push edi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x405fd3
mov eax, dword [ebp - 0x10]
cmp dword [ebp - 0xc], eax
jne 0x405fd3
xor ecx, ecx
test ebx, ebx
js 0x40607d
cmp ebx, 1
jle 0x406076
cmp ebx, 2
je 0x40612d
cmp ebx, 3
jne 0x40607d
movzx ecx, byte [edi + 1]
add ecx, 2
mov edx, dword [ebp - 0x14]
add edx, ecx
cmp ebx, 3
jne 0x406149
mov eax, 0x200
sub eax, ecx
push eax
push edx
lea eax, [ecx + edi]
push eax
call sub.msvcrt.dll_memcpy
mov edx, dword [ebp - 0x14]
lea ecx, [ebx + 0x7d]
mov eax, dword [ebp - 0x10]
add esp, 0xc
add edi, eax
lea esi, [edx + 0x200]
rep movsd dword es:[edi], dword [esi]
lea esi, [edx + 0x400]
mov edx, dword [ebp - 0x1c]
lea ecx, [ebx + 0x7d]
lea edi, [edx + eax*2]
rep movsd dword es:[edi], dword [esi]
imul ecx, eax, 0xb
xor edi, edi
xor esi, esi
mov dword [ebp - 0x14], edi
mov dword [ebp - 0x18], ecx
test ecx, ecx
je 0x406101
cmp esi, 0x6a
je 0x4060f6
cmp esi, 0x6b
je 0x4060f6
cmp esi, 0x70
je 0x4060f6
movzx ecx, byte [esi + edx]
mov eax, edi
shr eax, 1
add ecx, eax
shl edi, 0x1f
add edi, ecx
mov ecx, dword [ebp - 0x18]
inc esi
cmp esi, ecx
jb 0x4060d5
mov eax, dword [ebp - 0x10]
mov dword [ebp - 0x14], edi
imul esi, eax, 0xc
cmp ecx, esi
jae 0x40611a
mov eax, dword [ebp - 0x14]
lea edi, [ecx + edx]
mov ecx, esi
sub ecx, dword [ebp - 0x18]
dec ecx
shr ecx, 2
inc ecx
rep stosd dword es:[edi], eax
mov edi, dword [ebp - 0x1c]
push esi
push edi
lea eax, [esi + edi]
push eax
call sub.msvcrt.dll_memcpy
mov esi, dword [ebp - 0x20]
jmp 0x406159
cmp dword [0x411ed0], 0x40b028
push 0x54
pop ecx
je 0x40607d
mov byte [edi + 0x24], 0x80
jmp 0x40607d
mov eax, dword [ebp - 0x18]
sub eax, ecx
push eax
push edx
lea eax, [ecx + edi]
push eax
call sub.msvcrt.dll_memcpy
add esp, 0xc
xor eax, eax
push eax
push eax
push eax
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
je 0x405fa5
lea eax, [ebp - 0xc]
cmp ebx, 1
jne 0x4061d2
xor esi, esi
push esi
push eax
push 0x200
push edi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4061c8
cmp dword [ebp - 0xc], 0x200
jne 0x4061c8
push esi
push esi
push 0x1800
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
je 0x405fa5
push esi
lea eax, [ebp - 0xc]
mov esi, 0x200
push eax
push esi
lea eax, [edi + 0x400]
push eax
jmp 0x4061d7
push 0x101b
jmp 0x405fd8
push 0
push eax
push esi
push edi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4061c8
cmp dword [ebp - 0xc], esi
jne 0x4061c8
xor eax, eax
xor esi, esi
sub ebx, eax
je 0x406215
sub ebx, 1
je 0x40620e
sub ebx, 1
je 0x406207
sub ebx, 1
jne 0x40621a
mov eax, 0x402f78
jmp 0x40621a
mov eax, 0x402f60
jmp 0x40621a
mov eax, 0x402f54
jmp 0x40621a
mov eax, 0x402f4c
mov bl, byte [ebp - 1]
push eax
cmp bl, 1
jne 0x406234
push 0x101f
call fcn.00406b59
pop ecx
pop ecx
push dword [ebp - 0x2c]
jmp 0x406249
cmp byte [ebp - 3], 1
jne 0x40625b
push 0x1020
call fcn.00406b59
pop ecx
pop ecx
push dword [ebp - 0x30]
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ecx, eax
call fcn.00406b9e
jmp 0x405ff3
push 0x101c
call fcn.00406b59
pop ecx
pop ecx
jmp 0x405ff3