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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x14
mov eax, dword [0x48100c]
xor eax, esp
mov dword [esp + 0x10], eax
push ebx
mov ebx, dword [ebp + 8]
push esi
push edi
mov edi, ecx
mov eax, dword [edi]
cmp eax, 0xffffffff
je 0x41185d
test eax, eax
je 0x41185d
push ecx
call fcn.00411f70
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 [esp + 0x10], 3
and esi, 1
mov dword [esp + 0x18], 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 [esp + 0x18]
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 0x4118d0
test eax, eax
je 0x4118d0
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 0x411b01
test eax, eax
je 0x411b01
mov ecx, edi
call fcn.00411700
mov ebx, dword [edi + 4]
mov esi, eax
mov eax, edx
mov dword [esp + 0x10], eax
test bl, 0x10
je 0x41192a
test bl, 1
je 0x411914
push 0
push eax
push esi
mov ecx, edi
call fcn.00411f00
mov eax, dword [edi]
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x10]
xor ecx, esp
call fcn.004310db
mov esp, ebp
pop ebp
ret 8
test esi, esi
jne 0x4119d5
test eax, eax
jne 0x4119d5
test bl, 0xe0
setne cl
test bl, 3
setne al
test al, cl
je 0x411914
and ebx, 0x80
or ebx, 0x100
shr ebx, 7
push 0x452818
push ebx
call fcn.004314b0
mov esi, eax
add esp, 8
mov eax, dword [edi + 4]
test al, al
jns 0x41197b
mov word [esi], 0xbbef
mov byte [esi + 2], 0xbf
jmp 0x41198f
test al, 0x20
je 0x411986
mov word [esi], 0xfeff
jmp 0x41198f
test al, 0x40
je 0x41198f
mov word [esi], 0xfffe
push 0
lea eax, [esp + 0x1c]
push eax
push ebx
push esi
push dword [edi]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x4119b0
push ecx
mov ecx, edi
call fcn.00411f70
mov edi, eax
jmp 0x4119b2
mov edi, dword [edi]
test esi, esi
je 0x4119bf
push esi
call fcn.0043112d
add esp, 4
mov eax, edi
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x10]
xor ecx, esp
call fcn.004310db
mov esp, ebp
pop ebp
ret 8
test bl, 2
jne 0x411914
push 0
lea eax, [esp + 0x1c]
mov word [esp + 0x18], 0
push eax
push 3
lea eax, [esp + 0x20]
mov byte [esp + 0x22], 0
push eax
push dword [edi]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x411914
mov al, byte [esp + 0x14]
xor ecx, ecx
cmp al, 0xff
jne 0x411a2b
cmp byte [esp + 0x15], 0xfe
jne 0x411a6f
mov eax, dword [edi + 4]
mov ecx, 2
and eax, 0xfffffe3f
or eax, 0x20
jmp 0x411a6c
cmp al, 0xfe
jne 0x411a48
cmp byte [esp + 0x15], 0xff
jne 0x411a6f
mov eax, dword [edi + 4]
mov ecx, 2
and eax, 0xfffffe5f
or eax, 0x40
jmp 0x411a6c
cmp al, 0xef
jne 0x411a6f
cmp byte [esp + 0x15], 0xbb
jne 0x411a6f
cmp byte [esp + 0x16], 0xbf
jne 0x411a6f
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 0x411ad6
test al, 0x60
mov ecx, edi
mov eax, dword [esp + 0x10]
push 0
je 0x411aaf
sub esi, 2
sbb eax, 0
push eax
push esi
call fcn.00411f00
mov ecx, edi
call fcn.00411760
mov ecx, 0xffff
cmp cx, ax
jne 0x411914
push 1
push 0xffffffffffffffff
push 0xfffffffffffffffe
jmp 0x41190d
sub esi, 1
sbb eax, 0
push eax
push esi
call fcn.00411f00
mov ecx, edi
call fcn.004117d0
cmp al, 0xff
jne 0x411914
push 1
push 0xffffffffffffffff
push 0xffffffffffffffff
jmp 0x41190d
cmp ecx, dword [esp + 0x18]
je 0x411914
sub esp, 8
push ecx
mov ecx, edi
call fcn.00411ed0
mov eax, dword [edi]
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x10]
xor ecx, esp
call fcn.004310db
mov esp, ebp
pop ebp
ret 8
push ecx
mov ecx, edi
call fcn.00411f70
mov ecx, dword [esp + 0x1c]
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.004310db
mov esp, ebp
pop ebp
ret 8