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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x67c
mov eax, dword [0x4acca0]
xor eax, esp
mov dword [esp + 0x678], eax
push ebx
push esi
push edi
push 0
push 0x80
push 3
push 0
push 1
push 0x80000000
push dword [0x4afe74]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
mov dword [esp + 0x10], edi
cmp edi, 0xffffffff
jne 0x4081ae
lea eax, [edi + 0x65]
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x678]
xor ecx, esp
call fcn.0047068b
mov esp, ebp
pop ebp
ret
push 0
push 0
push 0x186a0
push edi
mov dword [esp + 0x1c], 0
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov esi, dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
lea eax, [esp + 0x48]
push 1
xorps xmm0, xmm0
push eax
movlpd qword [esp + 0x28], xmm0
push dword [esp + 0x2c]
movlpd qword [esp + 0x54], xmm0
push dword [esp + 0x2c]
push edi
call esi
test eax, eax
je 0x408203
mov ebx, dword [esp + 0x48]
mov dword [esp + 0x14], ebx
mov ebx, dword [esp + 0x4c]
mov dword [esp + 0x1c], ebx
jmp 0x40821c
xorps xmm0, xmm0
movlpd qword [esp + 0x20], xmm0
mov eax, dword [esp + 0x24]
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x20]
mov dword [esp + 0x14], eax
push 2
xorps xmm0, xmm0
lea eax, [esp + 0x44]
push eax
movlpd qword [esp + 0x28], xmm0
push dword [esp + 0x2c]
movlpd qword [esp + 0x4c], xmm0
push dword [esp + 0x2c]
push edi
call esi
test eax, eax
je 0x40824b
mov edi, dword [esp + 0x40]
mov ebx, dword [esp + 0x44]
jmp 0x408253
mov ebx, dword [esp + 0x24]
mov edi, dword [esp + 0x20]
push 0
lea eax, [esp + 0x64]
xorps xmm0, xmm0
push eax
push dword [esp + 0x24]
movlpd qword [esp + 0x6c], xmm0
push dword [esp + 0x20]
push dword [esp + 0x20]
call esi
test ebx, ebx
ja 0x40827f
jb 0x408284
cmp edi, 0x249f00
jb 0x408284
mov edi, 0x249f00
lea eax, [edi + 8]
push 1
push eax
call fcn.00474169
mov ebx, eax
add esp, 8
test ebx, ebx
je 0x40885a
push 0
lea eax, [esp + 0x24]
mov esi, ebx
push eax
push edi
push ebx
push dword [esp + 0x20]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x4082bb
call dword [sym.imp.KERNEL32.dll_GetLastError]
xor eax, eax
test edi, edi
je 0x4082f1
cmp dword [esi], 0x77777777
jne 0x4082d3
cmp dword [ebx + eax + 4], 0x12478749
je 0x4082db
inc eax
inc esi
cmp eax, edi
jb 0x4082c1
jmp 0x4082f1
sub esi, ebx
mov dword [esp + 0xc], 1
add esi, 0x186a0
mov dword [0x4afe70], esi
push ebx
call fcn.0047417f
add esp, 4
cmp dword [esp + 0xc], 0
je 0x40885a
mov ebx, dword [esp + 0x10]
push 0
push 0
push dword [0x4afe70]
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov esi, dword [sym.imp.KERNEL32.dll_ReadFile]
lea eax, [esp + 0x30]
push 0
push eax
push 0x20
push 0x4aea18
push ebx
call esi
test eax, eax
jne 0x40834d
call dword [sym.imp.KERNEL32.dll_GetLastError]
lea edi, [eax - 0x26]
neg edi
sbb edi, edi
add edi, 0x40000002
jmp 0x408863
mov eax, dword [esp + 0x30]
cmp eax, 0xffffffff
jne 0x408360
mov edi, 0x40000001
jmp 0x408863
cmp eax, 0x20
je 0x40836f
mov edi, 0x40000002
jmp 0x408863
mov ecx, dword [0x4aea24]
xor edi, edi
test ecx, ecx
je 0x40838a
mov eax, dword [0x4afe70]
add eax, 0xffffffe0
add eax, ecx
mov dword [0x4aea24], eax
imul eax, dword [0x4aea34], 0x104
push 2
add eax, 2
push eax
call fcn.00474169
add esp, 8
mov dword [esp + 0x34], eax
mov dword [0x4afe6c], eax
test eax, eax
jne 0x4083b7
lea edi, [eax + 0x66]
jmp 0x408863
xor ecx, ecx
mov dword [eax], ecx
mov dword [esp + 0x30], ecx
cmp dword [0x4aea34], ecx
jle 0x408863
push 0
lea eax, [esp + 0x58]
mov edi, 0x104
push eax
push 2
lea eax, [esp + 0x38]
push eax
push ebx
call esi
test eax, eax
je 0x408335
mov eax, dword [esp + 0x54]
cmp eax, 0xffffffff
je 0x408356
cmp eax, 2
jne 0x408365
mov ax, word [esp + 0x2c]
test ax, ax
je 0x408853
cmp ax, di
jae 0x408853
movzx esi, ax
lea eax, [esp + 0x58]
push 0
push eax
add esi, esi
lea eax, [esp + 0x70]
push esi
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x408335
mov eax, dword [esp + 0x58]
cmp eax, 0xffffffff
je 0x408356
cmp eax, esi
jne 0x408365
movzx eax, word [esp + 0x2c]
add eax, eax
cmp eax, 0x208
jae 0x408881
xor ecx, ecx
lea edx, [esp + 0x270]
mov word [esp + eax + 0x68], cx
mov ecx, dword [0x4afe68]
sub edx, ecx
movzx eax, word [ecx]
lea ecx, [ecx + 2]
mov word [ecx + edx - 2], ax
test ax, ax
jne 0x408474
lea edx, [esp + 0x68]
mov esi, edx
nop word [eax + eax]
mov ax, word [edx]
add edx, 2
test ax, ax
jne 0x408490
lea edi, [esp + 0x270]
sub edx, esi
add edi, 0xfffffffe
nop word [eax + eax]
mov ax, word [edi + 2]
add edi, 2
test ax, ax
jne 0x4084b0
mov ecx, edx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov esi, dword [esp + 0x34]
lea ecx, [esp + 0x270]
mov edx, esi
mov eax, ecx
sub edx, eax
nop dword [eax + eax]
movzx eax, word [ecx]
lea ecx, [ecx + 2]
mov word [edx + ecx - 2], ax
test ax, ax
jne 0x4084e0
mov ecx, esi
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4084f5
sub ecx, edx
xor eax, eax
sar ecx, 1
lea edx, [esp + 0x20]
push 4
lea esi, [esi + ecx*2]
mov ecx, ebx
add esi, 2
mov dword [esp + 0x38], esi
mov word [esi], ax
call fcn.00408050
mov edi, eax
add esp, 4
test edi, edi
jne 0x408863
lea ecx, [esp + 0x270]
call fcn.00407e70
test eax, eax
jne 0x40884c
push eax
push 0x80
push 2
push eax
push eax
push 0xc0000000
lea eax, [esp + 0x288]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
mov dword [esp + 0x18], ebx
cmp ebx, 0xffffffff
je 0x408845
lea eax, [esp + 0x68]
push 0x49b740
push eax
call fcn.00477bcc
add esp, 8
push 4
test eax, eax
jne 0x40876e
mov ecx, dword [esp + 0x14]
lea edx, [esp + 0x60]
call fcn.00408050
mov edi, eax
add esp, 4
mov dword [esp + 0x14], edi
test edi, edi
jne 0x40883c
push 0x8000
call fcn.0047415e
add esp, 4
mov dword [esp + 0xc], eax
test eax, eax
je 0x408651
mov ebx, dword [esp + 0x5c]
test ebx, ebx
je 0x40863c
mov ecx, dword [esp + 0x10]
mov esi, 0x8000
cmp ebx, esi
mov edx, eax
cmovb esi, ebx
push esi
sub ebx, esi
call fcn.00408050
mov edi, eax
add esp, 4
mov dword [esp + 0x14], edi
test edi, edi
jne 0x408638
push eax
lea eax, [esp + 0x64]
push eax
push esi
push dword [esp + 0x18]
push dword [esp + 0x28]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x408621
mov eax, dword [esp + 0xc]
cmp dword [esp + 0x60], esi
jne 0x408616
mov dword [esp + 0x14], edi
jmp 0x4085c4
mov edi, 0x40000004
mov dword [esp + 0x14], edi
jmp 0x40863c
call dword [sym.imp.KERNEL32.dll_GetLastError]
lea edi, [eax - 0x70]
neg edi
sbb edi, edi
add edi, 0x40000004
mov dword [esp + 0x14], edi
mov eax, dword [esp + 0xc]
push eax
call fcn.0047417f
mov ebx, dword [esp + 0x1c]
add esp, 4
test edi, edi
jne 0x40883c
mov esi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
lea ecx, [esp + 0x68]
lea edx, [ecx + 2]
nop
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x408660
sub ecx, edx
sar ecx, 1
cmp ecx, 4
jl 0x408811
lea eax, [esp + ecx*2 + 0x60]
push 0x49d354
push eax
call fcn.00477bcc
add esp, 8
test eax, eax
jne 0x408811
push eax
push eax
push eax
push ebx
call esi
mov ecx, ebx
call fcn.004080b0
push 1
push 0x8000
mov dword [esp + 0x24], eax
xor esi, esi
call fcn.00474169
mov ecx, eax
add esp, 8
mov eax, dword [esp + 0x1c]
mov dword [esp + 0xc], ecx
test eax, eax
je 0x4087dc
mov ebx, 0x8000
cmp eax, ebx
push 0
cmovb ebx, eax
lea eax, [esp + 0x44]
push eax
push ebx
push ecx
push dword [esp + 0x28]
mov dword [esp + 0x50], ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x4087ce
mov eax, dword [esp + 0x40]
cmp eax, 0xffffffff
je 0x4087d4
cmp eax, ebx
jne 0x4087d4
mov edx, dword [esp + 0xc]
shr ebx, 2
test ebx, ebx
je 0x408724
nop
mov ecx, dword [edx]
mov eax, esi
shr eax, 0x1f
add edx, 4
add eax, ecx
lea esi, [eax + esi*2]
sub ebx, 1
jne 0x408710
mov eax, dword [esp + 0x3c]
mov ebx, 0
and eax, 3
mov dword [esp + 0x48], eax
jbe 0x408757
mov edi, eax
nop dword [eax + eax]
movzx ecx, byte [ebx + edx]
mov eax, esi
shr eax, 0x1f
inc ebx
add eax, ecx
lea esi, [eax + esi*2]
cmp ebx, edi
jb 0x408740
mov edi, dword [esp + 0x14]
mov eax, dword [esp + 0x1c]
sub eax, dword [esp + 0x3c]
mov ecx, dword [esp + 0xc]
mov dword [esp + 0x1c], eax
je 0x4087d8
jmp 0x4086c6
mov esi, dword [esp + 0x14]
lea edx, [esp + 0x3c]
mov ecx, esi
call fcn.00408050
mov edi, eax
add esp, 4
test edi, edi
jne 0x40883c
push 1
push eax
push eax
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push dword [esp + 0x38]
mov esi, eax
push dword [esp + 0x14]
push ebx
call dword [sym.imp.MMFS2.dll_Ordinal_766]
mov edi, eax
mov dword [esp + 0x14], edi
test edi, edi
jne 0x40883c
push eax
push eax
mov eax, dword [esp + 0x40]
add eax, esi
mov esi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push eax
push dword [esp + 0x1c]
call esi
jmp 0x408657
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [esp + 0xc]
mov ebx, dword [esp + 0x18]
push 0x8000
push 0
push ecx
call fcn.00471d20
add esp, 0xc
push dword [esp + 0xc]
call fcn.0047417f
add esp, 4
mov eax, 0x65
cmp dword [esp + 0x20], esi
cmovne edi, eax
push 2
push 0
push 0
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ebx, dword [esp + 0x10]
test edi, edi
jne 0x408863
mov eax, dword [esp + 0x30]
inc eax
mov dword [esp + 0x30], eax
cmp eax, dword [0x4aea34]
jge 0x408863
mov esi, dword [sym.imp.KERNEL32.dll_ReadFile]
jmp 0x4083cb
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x40885f
mov edi, 0x68
jmp 0x40885f
mov edi, 0x67
jmp 0x408863
mov edi, 0x65
jmp 0x408863
mov edi, 0x65
mov ebx, dword [esp + 0x10]
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [esp + 0x684]
mov eax, edi
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.0047068b
mov esp, ebp
pop ebp
ret
call fcn.00470a95
int3