Function at 0x405ca1
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 0x405cbb
mov esi, dword [edi + 0x14]
mov ecx, dword [edi + 8]
test ecx, ecx
je 0x405cd8
call fcn.004077c4
push esi
push eax
push 0x1011
call fcn.00406b94
add esp, 0xc
jmp 0x405ce5
push esi
push 0x1012
call fcn.00406b94
pop ecx
pop ecx
push 0x101d
call fcn.00406b94
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 0x405d5c
push 0x1013
call fcn.00406b94
pop ecx
push esi
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ecx, eax
call fcn.00406be0
jmp 0x406029
lea eax, [ebp - 0x24]
mov ecx, edi
push eax
push 0x401080
call fcn.00407719
mov esi, eax
test esi, esi
jns 0x405d90
push 0x1014
call fcn.00406b94
pop ecx
push esi
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ecx, eax
call fcn.00406be0
jmp 0x406015
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.00406a57
test esi, esi
jns 0x405dec
push 0x1015
jmp 0x405d77
mov ecx, dword [ebp - 0x28]
lea eax, [ebp - 0x10]
push eax
lea edx, [ebp - 0x30]
call fcn.004058c7
push dword [ebp - 0x28]
mov esi, eax
call dword [sym.imp.ntdll.dll_NtClose]
test esi, esi
jns 0x405e14
push 0x1016
jmp 0x405d77
mov ebx, dword [ebp - 0x30]
mov ecx, 0x200
mov edx, dword [0x411f00]
cmp ebx, 1
jne 0x405e43
mov edi, dword [ebp - 0x10]
cmp edi, ecx
je 0x405e5a
push 0x108b
call fcn.00406b94
pop ecx
mov esi, 0xc0000001
jmp 0x406015
cmp ebx, 3
jne 0x405e57
cmp edx, 0x40b00c
jne 0x405e57
push 0x108c
jmp 0x405e33
mov edi, dword [ebp - 0x10]
mov eax, ebx
sub eax, 0
je 0x405e95
sub eax, 1
je 0x405e8b
sub eax, 1
je 0x405e81
sub eax, 1
je 0x405e77
push 0x1017
jmp 0x405e33
mov eax, dword [edx + 0x10]
mov ecx, 0x600
jmp 0x405e97
mov eax, dword [edx + 8]
mov ecx, 0x2000
jmp 0x405e97
mov eax, dword [edx + 4]
mov ecx, 0x600
jmp 0x405e97
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 0x405eb3
sub esi, edx
add esi, edi
mov dword [ebp - 0x20], esi
cmp ebx, 3
jne 0x405ebe
imul esi, edi, 0x18
mov dword [ebp - 0x20], esi
lea ecx, [esi + edi]
call fcn.00406a3f
mov dword [ebp - 0x24], eax
test eax, eax
jne 0x405ee2
push 0x1018
call fcn.00406b94
pop ecx
mov esi, 0xc000009a
jmp 0x406015
push 0
push edi
push 0
push eax
call fcn.0040a9c0
mov edi, dword [ebp - 0x24]
test eax, eax
je 0x405ef9
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 0x405f3d
cmp byte [ebp - 4], 0
jne 0x405f39
mov byte [ebp - 1], 1
mov dword [ebp - 0x2c], eax
jmp 0x405f82
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 0x405f65
mov byte [ebp - 3], 1
mov dword [ebp - 0x30], eax
jmp 0x405f82
cmp byte [ebp - 2], 1
jne 0x405f82
push 0x101e
call fcn.00406b94
mov dword [esp], 0x101d
call fcn.00406b94
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 0x405f9c
push 0x1019
jmp 0x405fc8
lea eax, [ebp - 0xc]
push 0
push eax
cmp ebx, 3
jne 0x406032
push esi
push edi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x405fc3
cmp dword [ebp - 0xc], esi
je 0x40604f
push 0x101a
call fcn.00406b94
pop ecx
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, eax
call fcn.00406be0
mov bl, byte [ebp - 1]
mov esi, 0xc0000001
cmp byte [ebp - 2], 0
jne 0x40600d
test bl, bl
jne 0x40600d
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.00406a57
push dword [ebp - 8]
call dword [sym.imp.ntdll.dll_NtClose]
push 0x101d
call fcn.00406b94
pop ecx
pop edi
mov eax, esi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push dword [ebp - 0x10]
push edi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x405fc3
mov eax, dword [ebp - 0x10]
cmp dword [ebp - 0xc], eax
jne 0x405fc3
xor ecx, ecx
test ebx, ebx
js 0x40606f
cmp ebx, 1
jle 0x406068
cmp ebx, 2
je 0x40611f
cmp ebx, 3
jne 0x40606f
movzx ecx, byte [edi + 1]
add ecx, 2
cmp ebx, 3
jne 0x406132
mov eax, 0x200
sub eax, ecx
push eax
mov eax, dword [ebp - 0x14]
add eax, ecx
push eax
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 0x4060f3
cmp esi, 0x6a
je 0x4060e8
cmp esi, 0x6b
je 0x4060e8
cmp esi, 0x70
je 0x4060e8
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 0x4060c7
mov eax, dword [ebp - 0x10]
mov dword [ebp - 0x14], edi
imul esi, eax, 0xc
cmp ecx, esi
jae 0x40610c
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 0x406147
cmp dword [0x411f00], 0x40b220
push 0x54
pop ecx
je 0x406132
mov byte [edi + 0x24], 0x80
mov eax, dword [ebp - 0x18]
sub eax, ecx
push eax
mov eax, dword [ebp - 0x14]
add eax, ecx
push eax
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 0x405f95
lea eax, [ebp - 0xc]
cmp ebx, 1
jne 0x4061c0
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 0x4061b6
cmp dword [ebp - 0xc], 0x200
jne 0x4061b6
push esi
push esi
push 0x1800
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
je 0x405f95
push esi
lea eax, [ebp - 0xc]
mov esi, 0x200
push eax
push esi
lea eax, [edi + 0x400]
push eax
jmp 0x4061c5
push 0x101b
jmp 0x405fc8
push 0
push eax
push esi
push edi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4061b6
cmp dword [ebp - 0xc], esi
jne 0x4061b6
xor eax, eax
xor esi, esi
sub ebx, eax
je 0x406203
sub ebx, 1
je 0x4061fc
sub ebx, 1
je 0x4061f5
sub ebx, 1
jne 0x406208
mov eax, 0x4011f0
jmp 0x406208
mov eax, 0x4011d8
jmp 0x406208
mov eax, 0x4011cc
jmp 0x406208
mov eax, 0x4011c4
mov bl, byte [ebp - 1]
push eax
cmp bl, 1
jne 0x406222
push 0x101f
call fcn.00406b94
pop ecx
pop ecx
push dword [ebp - 0x2c]
jmp 0x406237
cmp byte [ebp - 3], 1
jne 0x406249
push 0x1020
call fcn.00406b94
pop ecx
pop ecx
push dword [ebp - 0x30]
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ecx, eax
call fcn.00406be0
jmp 0x405fe3
push 0x101c
call fcn.00406b94
pop ecx
pop ecx
jmp 0x405fe3