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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x14
mov eax, dword [0x46400c]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
mov ebx, dword [ebp + 8]
push esi
push edi
mov edi, ecx
mov eax, dword [edi]
cmp eax, 0xffffffff
je 0x410179
test eax, eax
je 0x410179
push ecx
call fcn.00410820
mov eax, dword [ebp + 0xc]
mov esi, eax
mov ecx, eax
shr esi, 2
and ecx, 3
mov dword [edi + 4], eax
not esi
mov dword [ebp - 0x10], 3
and esi, 1
mov dword [ebp - 0xc], 0
mov edx, ecx
neg edx
push 0
sbb edx, edx
and edx, 0x40000000
or edx, 0x80000000
test al, 2
mov eax, 0
sete al
test ecx, ecx
push 0
lea eax, [eax*2 + 2]
cmove eax, dword [ebp - 0x10]
push eax
push 0
push esi
push edx
push ebx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
mov eax, dword [edi]
cmp eax, 0xffffffff
je 0x4101e9
test eax, eax
je 0x4101e9
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
or eax, 0xffffffff
test esi, esi
cmove esi, eax
mov eax, esi
mov dword [edi], esi
cmp eax, 0xffffffff
je 0x41040a
test eax, eax
je 0x41040a
mov ecx, edi
call fcn.00410020
mov ebx, dword [edi + 4]
mov esi, eax
mov eax, edx
mov dword [ebp - 0x10], eax
test bl, 0x10
je 0x410241
test bl, 1
je 0x41022c
push 0
push eax
push esi
mov ecx, edi
call fcn.004107b0
mov eax, dword [edi]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0042cf3b
mov esp, ebp
pop ebp
ret 8
test esi, esi
jne 0x4102ea
test eax, eax
jne 0x4102ea
test bl, 0xe0
setne cl
test bl, 3
setne al
test al, cl
je 0x41022c
and ebx, 0x80
or ebx, 0x100
shr ebx, 7
push 0x44e798
push ebx
call fcn.0042d302
mov esi, eax
add esp, 8
mov eax, dword [edi + 4]
test al, al
jns 0x410292
mov word [esi], 0xbbef
mov byte [esi + 2], 0xbf
jmp 0x4102a6
test al, 0x20
je 0x41029d
mov word [esi], 0xfeff
jmp 0x4102a6
test al, 0x40
je 0x4102a6
mov word [esi], 0xfffe
push 0
lea eax, [ebp - 0xc]
push eax
push ebx
push esi
push dword [edi]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x4102c6
push ecx
mov ecx, edi
call fcn.00410820
mov edi, eax
jmp 0x4102c8
mov edi, dword [edi]
test esi, esi
je 0x4102d5
push esi
call fcn.0042cfa2
add esp, 4
mov eax, edi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0042cf3b
mov esp, ebp
pop ebp
ret 8
test bl, 2
jne 0x41022c
push 0
lea eax, [ebp - 0xc]
mov word [ebp - 8], 0
push eax
push 3
lea eax, [ebp - 8]
mov byte [ebp - 6], 0
push eax
push dword [edi]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x41022c
mov al, byte [ebp - 8]
xor ecx, ecx
cmp al, 0xff
jne 0x41033a
cmp byte [ebp - 7], 0xfe
jne 0x41037b
mov eax, dword [edi + 4]
mov ecx, 2
and eax, 0xfffffe3f
or eax, 0x20
jmp 0x410378
cmp al, 0xfe
jne 0x410356
cmp byte [ebp - 7], 0xff
jne 0x41037b
mov eax, dword [edi + 4]
mov ecx, 2
and eax, 0xfffffe5f
or eax, 0x40
jmp 0x410378
cmp al, 0xef
jne 0x41037b
cmp byte [ebp - 7], 0xbb
jne 0x41037b
cmp byte [ebp - 6], 0xbf
jne 0x41037b
mov eax, dword [edi + 4]
mov ecx, 3
and eax, 0xfffffe9f
or eax, 0x80
mov dword [edi + 4], eax
mov eax, dword [edi + 4]
test al, 1
je 0x4103e1
test al, 0x60
mov ecx, edi
mov eax, dword [ebp - 0x10]
push 0
je 0x4103ba
sub esi, 2
sbb eax, 0
push eax
push esi
call fcn.004107b0
mov ecx, edi
call fcn.00410080
mov ecx, 0xffff
cmp cx, ax
jne 0x41022c
push 1
push 0xffffffffffffffff
push 0xfffffffffffffffe
jmp 0x410225
sub esi, 1
sbb eax, 0
push eax
push esi
call fcn.004107b0
mov ecx, edi
call fcn.004100f0
cmp al, 0xff
jne 0x41022c
push 1
push 0xffffffffffffffff
push 0xffffffffffffffff
jmp 0x410225
cmp ecx, dword [ebp - 0xc]
je 0x41022c
sub esp, 8
push ecx
mov ecx, edi
call fcn.00410780
mov eax, dword [edi]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0042cf3b
mov esp, ebp
pop ebp
ret 8
push ecx
mov ecx, edi
call fcn.00410820
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0042cf3b
mov esp, ebp
pop ebp
ret 8