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

Disassembly:
sub esp, 0x510
mov eax, dword [0x41b38c]
push ebx
push ebp
mov ebp, dword [sym.imp.KERNEL32.dll_lstrcpyA]
add eax, 0x548
push esi
lea ecx, [esp + 0x18]
push eax
push ecx
call ebp
lea edx, [esp + 0x18]
push edx
call fcn.0040c6d0
mov ebx, dword [sym.imp.KERNEL32.dll_lstrcatA]
add esp, 4
lea eax, [esp + 0x18]
push str.WININIT.INI
push eax
call ebx
lea ecx, [esp + 0x18]
push ecx
push 0
push 0
push 0
call dword [sym.imp.KERNEL32.dll_WritePrivateProfileStringA]
push 0
push 0x80
push 4
push 0
push 1
lea edx, [esp + 0x2c]
push 0xc0000000
push edx
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
mov dword [esp + 0x14], esi
jne 0x4019c5
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x510
ret
mov eax, dword [esp + 0x524]
push edi
mov edi, dword [sym.imp.KERNEL32.dll_GetShortPathNameA]
test eax, eax
je 0x4019e9
lea ecx, [esp + 0x120]
push 0x104
push ecx
push eax
call edi
jmp 0x4019f8
lea edx, [esp + 0x120]
push 0x418148
push edx
call ebp
lea eax, [esp + 0x120]
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov ecx, dword [esp + 0x524]
lea eax, [esp + eax + 0x120]
push 0x104
mov byte [eax], 0x3d
inc eax
push eax
push ecx
call edi
lea edx, [esp + 0x120]
push 0x418078
push edx
call ebx
push 0
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov ebx, eax
push 1
lea eax, [ebx + 0x228]
push eax
call fcn.0040d97d
add esp, 8
lea ecx, [esp + 0x10]
mov ebp, eax
push 0
push ecx
push ebx
push ebp
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov al, byte [ebp]
mov edi, ebp
test al, al
je 0x401a9e
push 9
push str._replace__r_n
push edi
call fcn.0040d8d0
add esp, 0xc
test eax, eax
je 0x401b02
mov al, byte [edi + 1]
inc edi
test al, al
jne 0x401a67
cmp edi, ebp
jbe 0x401a9e
mov al, byte [edi - 1]
cmp al, 0xa
je 0x401a9e
cmp al, 0xd
je 0x401a9e
mov byte [edi], 0xd
inc edi
mov byte [edi], 0xa
inc edi
mov ebx, dword [sym.imp.KERNEL32.dll_lstrcpyA]
push str._replace__r_n
push edi
call ebx
lea eax, [esp + 0x120]
add edi, 0xb
push eax
push edi
call ebx
lea ecx, [esp + 0x120]
push ecx
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov ebx, eax
sub edi, ebp
add ebx, edi
push 0
push 0
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
lea edx, [esp + 0x10]
push 0
push edx
push ebx
push ebp
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x510
ret
mov al, byte [edi + 9]
add edi, 9
test al, al
je 0x401b1c
cmp al, 0xa
je 0x401b1c
cmp al, 0xd
je 0x401b1c
mov al, byte [edi + 1]
inc edi
test al, al
jne 0x401b0c
mov al, byte [edi]
cmp al, 0xa
je 0x401b26
cmp al, 0xd
jne 0x401b29
inc edi
jmp 0x401b1c
lea edx, [esp + 0x120]
push edx
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov esi, eax
mov eax, ebp
sub eax, edi
mov dword [esp + 0x14], esi
add eax, ebx
lea ecx, [esi + edi]
push eax
push edi
push ecx
call fcn.0040d590
mov ecx, esi
lea esi, [esp + 0x12c]
mov edx, ecx
add esp, 0xc
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
mov eax, edx
and ecx, 3
add ebx, eax
rep movsb byte es:[edi], byte [esi]
mov esi, dword [esp + 0x18]
jmp 0x401ace