Function at 0x405ce1
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 0x405cfb
mov esi, dword [edi + 0x14]
mov ecx, dword [edi + 8]
test ecx, ecx
je 0x405d18
call fcn.00407747
push esi
push eax
push 0x1011
call fcn.00406b87
add esp, 0xc
jmp 0x405d25
push esi
push 0x1012
call fcn.00406b87
pop ecx
pop ecx
push 0x101d
call fcn.00406b87
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 0x405d9c
push 0x1013
call fcn.00406b87
pop ecx
push esi
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ecx, eax
call fcn.00406bcc
jmp 0x406069
lea eax, [ebp - 0x24]
mov ecx, edi
push eax
push 0x402e18
call fcn.004076a6
mov esi, eax
test esi, esi
jns 0x405dd0
push 0x1014
call fcn.00406b87
pop ecx
push esi
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ecx, eax
call fcn.00406bcc
jmp 0x406055
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.00406a5b
test esi, esi
jns 0x405e2c
push 0x1015
jmp 0x405db7
mov ecx, dword [ebp - 0x28]
lea eax, [ebp - 0x10]
push eax
lea edx, [ebp - 0x30]
call fcn.0040591c
push dword [ebp - 0x28]
mov esi, eax
call dword [sym.imp.ntdll.dll_NtClose]
test esi, esi
jns 0x405e54
push 0x1016
jmp 0x405db7
mov ebx, dword [ebp - 0x30]
mov ecx, 0x200
mov edx, dword [0x411ed0]
cmp ebx, 1
jne 0x405e83
mov edi, dword [ebp - 0x10]
cmp edi, ecx
je 0x405e9a
push 0x108b
call fcn.00406b87
pop ecx
mov esi, 0xc0000001
jmp 0x406055
cmp ebx, 3
jne 0x405e97
cmp edx, 0x40b03c
jne 0x405e97
push 0x108c
jmp 0x405e73
mov edi, dword [ebp - 0x10]
mov eax, ebx
sub eax, 0
je 0x405ed5
sub eax, 1
je 0x405ecb
sub eax, 1
je 0x405ec1
sub eax, 1
je 0x405eb7
push 0x1017
jmp 0x405e73
mov eax, dword [edx + 0x10]
mov ecx, 0x600
jmp 0x405ed7
mov eax, dword [edx + 8]
mov ecx, 0x2000
jmp 0x405ed7
mov eax, dword [edx + 4]
mov ecx, 0x600
jmp 0x405ed7
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 0x405ef3
sub esi, edx
add esi, edi
mov dword [ebp - 0x20], esi
cmp ebx, 3
jne 0x405efe
imul esi, edi, 0x18
mov dword [ebp - 0x20], esi
lea ecx, [esi + edi]
call fcn.00406a48
mov dword [ebp - 0x24], eax
test eax, eax
jne 0x405f22
push 0x1018
call fcn.00406b87
pop ecx
mov esi, 0xc000009a
jmp 0x406055
push 0
push edi
push 0
push eax
call fcn.0040a980
mov edi, dword [ebp - 0x24]
test eax, eax
je 0x405f39
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 0x405f7d
cmp byte [ebp - 4], 0
jne 0x405f79
mov byte [ebp - 1], 1
mov dword [ebp - 0x2c], eax
jmp 0x405fc2
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 0x405fa5
mov byte [ebp - 3], 1
mov dword [ebp - 0x30], eax
jmp 0x405fc2
cmp byte [ebp - 2], 1
jne 0x405fc2
push 0x101e
call fcn.00406b87
mov dword [esp], 0x101d
call fcn.00406b87
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 0x405fdc
push 0x1019
jmp 0x406008
lea eax, [ebp - 0xc]
push 0
push eax
cmp ebx, 3
jne 0x406070
push esi
push edi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x406003
cmp dword [ebp - 0xc], esi
je 0x40608d
push 0x101a
call fcn.00406b87
pop ecx
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, eax
call fcn.00406bcc
mov bl, byte [ebp - 1]
mov esi, 0xc0000001
cmp byte [ebp - 2], 0
jne 0x40604d
test bl, bl
jne 0x40604d
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.00406a5b
push dword [ebp - 8]
call dword [sym.imp.ntdll.dll_NtClose]
push 0x101d
call fcn.00406b87
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 0x406003
mov eax, dword [ebp - 0x10]
cmp dword [ebp - 0xc], eax
jne 0x406003
xor ecx, ecx
test ebx, ebx
js 0x4060ad
cmp ebx, 1
jle 0x4060a6
cmp ebx, 2
je 0x40615d
cmp ebx, 3
jne 0x4060ad
movzx ecx, byte [edi + 1]
add ecx, 2
mov edx, dword [ebp - 0x14]
add edx, ecx
cmp ebx, 3
jne 0x406179
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 0x406131
cmp esi, 0x6a
je 0x406126
cmp esi, 0x6b
je 0x406126
cmp esi, 0x70
je 0x406126
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 0x406105
mov eax, dword [ebp - 0x10]
mov dword [ebp - 0x14], edi
imul esi, eax, 0xc
cmp ecx, esi
jae 0x40614a
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 0x406189
cmp dword [0x411ed0], 0x40b028
push 0x54
pop ecx
je 0x4060ad
mov byte [edi + 0x24], 0x80
jmp 0x4060ad
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 0x405fd5
lea eax, [ebp - 0xc]
cmp ebx, 1
jne 0x406202
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 0x4061f8
cmp dword [ebp - 0xc], 0x200
jne 0x4061f8
push esi
push esi
push 0x1800
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
je 0x405fd5
push esi
lea eax, [ebp - 0xc]
mov esi, 0x200
push eax
push esi
lea eax, [edi + 0x400]
push eax
jmp 0x406207
push 0x101b
jmp 0x406008
push 0
push eax
push esi
push edi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4061f8
cmp dword [ebp - 0xc], esi
jne 0x4061f8
xor eax, eax
xor esi, esi
sub ebx, eax
je 0x406245
sub ebx, 1
je 0x40623e
sub ebx, 1
je 0x406237
sub ebx, 1
jne 0x40624a
mov eax, 0x402f98
jmp 0x40624a
mov eax, 0x402f80
jmp 0x40624a
mov eax, 0x402f74
jmp 0x40624a
mov eax, 0x402f6c
mov bl, byte [ebp - 1]
push eax
cmp bl, 1
jne 0x406264
push 0x101f
call fcn.00406b87
pop ecx
pop ecx
push dword [ebp - 0x2c]
jmp 0x406279
cmp byte [ebp - 3], 1
jne 0x40628b
push 0x1020
call fcn.00406b87
pop ecx
pop ecx
push dword [ebp - 0x30]
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ecx, eax
call fcn.00406bcc
jmp 0x406023
push 0x101c
call fcn.00406b87
pop ecx
pop ecx
jmp 0x406023