Function at 0x405910
Capabilities:
Check if file exists
Encode data using xor
Read file on windows
Write file on windows

Disassembly:
sub esp, 0x444
push ebx
push ebp
push esi
mov esi, dword [esp + 0x454]
push edi
push esi
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x4059ef
xor ebp, ebp
xor ebx, ebx
push ebp
push 0x80
push 3
push ebp
push 1
push SysReAllocString
push esi
mov dword [esp + 0x2c], ebx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
je 0x4059ef
mov edi, dword [sym.imp.KERNEL32.dll_ReadFile]
lea eax, [esp + 0x18]
push ebp
push eax
lea ecx, [esp + 0x24]
push 0x25
push ecx
push esi
mov dword [esp + 0x2c], ebp
call edi
test eax, eax
je 0x4059d7
cmp dword [esp + 0x18], 0x25
jne 0x4059d7
cmp byte [esp + 0x20], 0x25
jne 0x4059d7
mov eax, dword [esp + 0x21]
test eax, eax
jbe 0x4059d7
lea edx, [eax + eax*8]
lea ecx, [eax + edx*2]
lea edx, [eax + ecx*4]
shl edx, 2
push edx
call fcn.00455403
add esp, 4
mov dword [esp + 0x10], eax
test eax, eax
je 0x4059d3
lea eax, [esp + 0x18]
push ebx
push eax
mov eax, dword [esp + 0x29]
lea ecx, [eax + eax*8]
lea edx, [eax + ecx*2]
mov ecx, dword [esp + 0x18]
lea eax, [eax + edx*4]
shl eax, 2
push eax
push ecx
push esi
call edi
test eax, eax
je 0x4059d3
mov ebp, 1
mov ebx, dword [esp + 0x10]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test ebp, ebp
jne 0x4059fc
test ebx, ebx
je 0x4059ef
push ebx
call fcn.004535f0
add esp, 4
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x444
ret
mov eax, dword [esp + 0x21]
mov dword [esp + 0x14], 0
test eax, eax
jbe 0x405b75
mov ecx, dword [esp + 0x10]
lea esi, [ebx + 8]
lea ebx, [esp + 0x44]
sub ebx, ecx
sub ebx, 8
mov ebp, dword [esi - 8]
mov ecx, dword [esp + 0x39]
mov eax, dword [esp + 0x14]
xor ebp, ecx
xor ebp, eax
mov eax, esi
mov ecx, 0x4b
mov edx, dword [eax]
add eax, 4
xor edx, ebp
dec ecx
mov dword [eax - 4], edx
jne 0x405a36
mov dx, word [0x47a15c]
mov ecx, 0x81
xor eax, eax
lea edi, [esp + 0x46]
mov word [esp + 0x44], dx
mov word [esp + 0x24c], dx
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
mov ecx, 0x81
xor eax, eax
lea edi, [esp + 0x24e]
mov edx, esi
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
lea ecx, [esp + 0x24c]
mov edi, 0x104
lea eax, [esp + 0x24c]
sub edx, ecx
mov cx, word [edx + eax]
test cx, cx
je 0x405aa3
mov word [eax], cx
add eax, 2
dec edi
jne 0x405a8f
jmp 0x405aa7
test edi, edi
jne 0x405aaa
sub eax, 2
lea edx, [esp + 0x44]
mov word [eax], 0
push edx
push esi
call fcn.0044d260
add esp, 8
test eax, eax
mov eax, dword [esi - 8]
je 0x405aff
test eax, eax
jne 0x405af9
mov edx, 0x96
mov eax, esi
mov cx, word [ebx + eax]
test cx, cx
je 0x405aeb
mov word [eax], cx
add eax, 2
dec edx
jne 0x405acf
sub eax, 2
mov word [eax], 0
jmp 0x405b2e
test edx, edx
jne 0x405af2
sub eax, 2
mov word [eax], 0
jmp 0x405b2e
lea eax, [esp + 0x44]
jmp 0x405b1a
test eax, eax
jne 0x405b13
push esi
call dword [sym.imp.KERNEL32.dll_lstrlenW]
lea edx, [eax + eax + 6]
mov dword [esi - 4], edx
jmp 0x405b3c
lea eax, [esp + 0x24c]
push eax
push str.___s
push 0x12c
push esi
call fcn.00401c00
add esp, 0x10
push esi
call dword [sym.imp.KERNEL32.dll_lstrlenW]
lea ecx, [eax + eax + 6]
mov dword [esi - 4], ecx
mov eax, esi
mov ecx, 0x4b
mov edx, dword [eax]
add eax, 4
xor edx, ebp
dec ecx
mov dword [eax - 4], edx
jne 0x405b43
mov eax, dword [esp + 0x14]
mov ecx, dword [esp + 0x21]
inc eax
sub ebx, 0x134
add esi, 0x134
cmp eax, ecx
mov dword [esp + 0x14], eax
jb 0x405a20
mov ebx, dword [esp + 0x10]
mov edx, dword [esp + 0x45c]
push 0
push 0x80
push 2
push 0
push 0
push 0x40000000
push edx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
je 0x4059ef
push 0
push 0
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
lea eax, [esp + 0x14]
push 0
push eax
lea ecx, [esp + 0x24]
push 0x25
push ecx
push esi
call edi
mov eax, dword [esp + 0x21]
lea edx, [esp + 0x14]
push 0
push edx
lea ecx, [eax + eax*8]
lea edx, [eax + ecx*2]
lea eax, [eax + edx*4]
shl eax, 2
push eax
push ebx
push esi
call edi
push ebx
call fcn.004535f0
add esp, 4
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x444
ret