Function at 0x408040
Capabilities:
Get file size
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x440570
mov eax, dword fs:[0]
push eax
sub esp, 0x3c
mov eax, dword [0x4557ec]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
push str.launcher.exe
lea eax, [ebp + 0xc]
push eax
lea ecx, [ebp - 0x40]
push ecx
mov dword [ebp - 4], 0
call fcn.004093c0
mov eax, dword [eax]
add esp, 0xc
push 0
push 0x80
push 3
push 0
push 0
push SysReAllocStringLen
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
mov eax, dword [ebp - 0x40]
add eax, 0xfffffff0
mov dword [ebp - 0x34], esi
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x4080c6
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
cmp esi, 0xffffffff
jne 0x4080d1
push esi
jmp 0x408416
push 0
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov ebx, eax
lea ecx, [ebx + 1]
push ecx
mov dword [ebp - 0x38], ebx
call fcn.004096cc
add esp, 4
push 0
lea edx, [ebp - 0x44]
push edx
mov edi, eax
push ebx
push edi
push esi
mov dword [ebp - 0x20], edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40840c
mov esi, 0x30d40
mov byte [edi + ebx], 0
mov dword [ebp - 0x1c], 0x696c435c
mov dword [ebp - 0x18], 0x5c746e65
mov word [ebp - 0x14], 0
mov byte [ebp - 0x12], 0
mov dword [ebp - 0x24], 0
cmp ebx, esi
jbe 0x408175
mov edx, 0xb
lea eax, [ebp - 0x1c]
lea ecx, [esi + edi]
mov edi, edi
mov ebx, dword [ecx]
cmp ebx, dword [eax]
jne 0x40816a
sub edx, 4
add eax, 4
add ecx, 4
cmp edx, 4
jae 0x408140
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x40816a
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x40816a
mov al, byte [eax + 2]
cmp al, byte [ecx + 2]
je 0x408172
inc esi
cmp esi, dword [ebp - 0x38]
jb 0x408133
jmp 0x408175
mov dword [ebp - 0x24], esi
call fcn.00410c36
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x40818f
push 0x80004005
call fcn.00401bd0
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
lea edi, [eax + 0x10]
mov dword [ebp - 0x2c], edi
mov byte [ebp - 4], 1
call fcn.00410c36
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x4081bc
push 0x80004005
call fcn.00401bd0
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [ebp - 0x28], eax
mov ecx, dword [ebp + 8]
push ecx
lea edx, [ebp - 0x28]
push 0x44a254
push edx
mov byte [ebp - 4], 2
call fcn.00403eb0
push 0x449fc8
lea eax, [ebp - 0x28]
push eax
lea ecx, [ebp - 0x30]
push ecx
call fcn.004093c0
add esp, 0x18
mov byte [ebp - 4], 3
mov eax, dword [eax]
lea esi, [eax - 0x10]
lea ebx, [edi - 0x10]
cmp esi, ebx
je 0x4082a1
cmp dword [ebx + 0xc], 0
jl 0x408291
mov ecx, dword [esi]
cmp ecx, dword [ebx]
jne 0x408291
mov edx, dword [ecx]
mov eax, dword [edx + 0x10]
call eax
cmp dword [esi + 0xc], 0
lea ecx, [esi + 0xc]
jl 0x40823b
cmp eax, dword [esi]
jne 0x40823b
mov edi, esi
mov edx, 1
lock xadd dword [ecx], edx
jmp 0x408270
mov ecx, dword [esi + 4]
mov edx, dword [eax]
mov edx, dword [edx]
push 1
push ecx
mov ecx, eax
call edx
mov edi, eax
test edi, edi
jne 0x408254
call fcn.00401ae0
mov eax, dword [esi + 4]
mov dword [edi + 4], eax
mov eax, dword [esi + 4]
inc eax
push eax
add esi, 0x10
push esi
push eax
lea ecx, [edi + 0x10]
push ecx
call fcn.0042c38b
add esp, 0x10
lea eax, [ebx + 0xc]
or edx, 0xffffffff
lock xadd dword [eax], edx
dec edx
test edx, edx
jg 0x408289
mov ecx, dword [ebx]
mov eax, dword [ecx]
mov edx, dword [eax + 4]
push ebx
call edx
add edi, 0x10
mov dword [ebp - 0x2c], edi
jmp 0x4082a1
mov ecx, dword [eax - 0xc]
push ecx
push eax
lea ecx, [ebp - 0x2c]
call fcn.00401c20
mov edi, dword [ebp - 0x2c]
mov byte [ebp - 4], 2
mov eax, dword [ebp - 0x30]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x4082c4
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
cmp dword [ebp + 8], 0xa
mov eax, dword [ebp - 0x24]
mov cx, word [edi]
mov ebx, dword [ebp - 0x20]
jl 0x4082e1
mov word [eax + ebx + 6], cx
mov dl, byte [edi + 2]
mov byte [eax + ebx + 8], dl
jmp 0x4082e9
mov edx, dword [ebp - 0x20]
mov word [eax + edx + 7], cx
push str.launcher
lea eax, [ebp + 0xc]
push eax
lea ecx, [ebp - 0x3c]
push ecx
call fcn.004093c0
lea edx, [ebp - 0x28]
push edx
push eax
lea eax, [ebp - 0x24]
push eax
mov byte [ebp - 4], 4
call fcn.004092b0
push str..exe
push eax
lea ecx, [ebp - 0x30]
push ecx
mov byte [ebp - 4], 5
call fcn.004093c0
mov eax, dword [eax]
add esp, 0x24
push 0
push 0x80
push 2
push 0
push 0
push 0xc0000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
mov eax, dword [ebp - 0x30]
add eax, 0xfffffff0
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x40835f
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 4
mov eax, dword [ebp - 0x24]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x408382
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 2
mov eax, dword [ebp - 0x3c]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x4083a5
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
cmp esi, 0xffffffff
je 0x4083bc
mov edx, dword [ebp - 0x38]
push 0
lea ecx, [ebp - 0x48]
push ecx
push edx
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov byte [ebp - 4], 1
mov eax, dword [ebp - 0x28]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x4083e6
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea eax, [edi - 0x10]
mov byte [ebp - 4], 0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x408406
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov esi, dword [ebp - 0x34]
mov edi, dword [ebp - 0x20]
push edi
call fcn.004096d7
add esp, 4
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [ebp - 4], 0xffffffff
mov eax, dword [ebp + 0xc]
add eax, 0xfffffff0
or edx, 0xffffffff
lea ecx, [eax + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x408442
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0042c37c
mov esp, ebp
pop ebp
ret