Function at 0x4037e0
Capabilities:
Check if file exists
Delete file
Get common file path
Get file attributes
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
mov eax, 0x1314
call fcn.0040e7a0
mov eax, dword [0x418110]
push ebx
push esi
push edi
mov edi, dword [ebp + 0x14]
test edi, edi
mov dword [esp + 0x131c], eax
mov esi, ecx
je 0x403836
cmp dword [0x418040], 0xffffffff
jne 0x403836
push edi
call fcn.004019c0
test eax, eax
je 0x403836
push 0
push 0
push 4
push 0
push 3
push 0x40000000
push edi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [0x418040], eax
cmp dword [esi + 0xe8], 0xffffffff
jne 0x40398f
lea ebx, [esi + 0xf8]
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
je 0x403859
test al, 0x10
jne 0x4038a3
push ebx
mov ecx, esi
call fcn.004018e0
test eax, eax
jne 0x4038a3
push ebx
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
test eax, eax
je 0x403bf2
push str.TSLOG
push ebx
push str._s_S_
push 0x104
push ebx
call dword [sym.imp.MSVCR71.dll__snprintf]
add esp, 0x14
push ebx
mov ecx, esi
call fcn.004018e0
test eax, eax
je 0x403bf2
xor eax, eax
mov word [esp + 0x10], 0
mov ecx, 0x81
lea edi, [esp + 0x12]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
mov eax, dword [esi + 0xec]
push 0
lea ecx, [esp + 0x14]
inc eax
push ecx
push eax
mov ecx, esi
mov dword [esi + 0xec], eax
call fcn.00403110
mov edx, dword [esi + 0x23c]
push 0
push 0
push 2
push 0
inc edx
push 3
mov dword [esi + 0x23c], edx
push 0x40000000
lea edx, [esp + 0x28]
push edx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
mov dword [esi + 0xe8], eax
jne 0x40398f
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x70
je 0x403a8b
cmp eax, 5
jne 0x403bf2
push ebx
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
test eax, eax
je 0x403bf2
push str.TSLOG
push ebx
push str._sTSLOG_S_
push 0x104
push ebx
call dword [sym.imp.MSVCR71.dll__snprintf]
mov ecx, dword [esi + 0xec]
add esp, 0x14
push 0
lea eax, [esp + 0x14]
push eax
push ecx
mov ecx, esi
call fcn.00403110
push 0
push 0
push 2
push 0
push 3
push 0x40000000
lea edx, [esp + 0x28]
push edx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
mov dword [esi + 0xe8], eax
je 0x403bf2
mov ebx, dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov byte [esp + 0x218], 0
xor eax, eax
push 0
mov ecx, 0x43f
lea edi, [esp + 0x21d]
rep stosd dword es:[edi], eax
push 0
push 0
stosw word es:[edi], ax
push 0
push 0xffffffffffffffff
stosb byte es:[edi], al
mov edi, dword [ebp + 0xc]
push edi
push 0
push 0x3a8
mov dword [esp + 0x2c], 0
call ebx
test eax, eax
jle 0x403bf2
cmp eax, 0x10ff
jg 0x403bf2
push 0
push 0
push eax
lea eax, [esp + 0x224]
push eax
push 0xffffffffffffffff
push edi
push 0
push 0x3a8
call ebx
mov edi, eax
test edi, edi
jbe 0x403bf2
dec edi
cmp edi, 0x1000
jbe 0x403a13
mov edi, 0x1000
mov eax, dword [0x418040]
cmp eax, 0xffffffff
mov ebx, dword [sym.imp.KERNEL32.dll_WriteFile]
je 0x403a5f
push 2
push 0
push 0
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [0x418040]
push 0
lea ecx, [esp + 0x10]
push ecx
push edi
lea edx, [esp + 0x224]
push edx
push eax
call ebx
mov ecx, dword [0x418040]
push ecx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [0x418040], 0xffffffff
mov ecx, dword [esi + 0xe8]
push 0
lea edx, [esp + 0x10]
push edx
push edi
lea eax, [esp + 0x224]
push eax
push ecx
call ebx
test eax, eax
jne 0x403ac1
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x70
jne 0x403bf2
push str.C:TSLOG_CONFIGTSLOG.ini
push 0x410edc
push str.FileLog
push str.Output
mov dword [esi + 0x2c], 0
call dword [sym.imp.KERNEL32.dll_WritePrivateProfileStringW]
mov ecx, dword [esp + 0x131c]
call fcn.0040e783
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0x10
mov eax, dword [esi + 0x23c]
mov ecx, dword [0x418148]
cmp ecx, eax
jae 0x403adf
mov ecx, esi
mov dword [0x418148], eax
call fcn.00402f70
jmp 0x403ae6
jbe 0x403ae6
mov dword [0x418148], eax
cmp dword [ebp + 8], 6
je 0x403afe
mov eax, dword [esi + 0xf4]
mov edx, dword [esp + 0xc]
add eax, edx
mov dword [esi + 0xf4], eax
mov eax, dword [esi + 0xdc]
mov ecx, dword [esi + 0xf4]
shl eax, 0xa
cmp ecx, eax
jb 0x403bf2
mov ecx, dword [esi + 0xe8]
xor ebx, ebx
push ecx
mov dword [esi + 0xf4], ebx
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
mov edx, dword [esi + 0xe8]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
mov ecx, 0x82
lea edi, [esp + 0x10]
rep stosd dword es:[edi], eax
mov eax, dword [esi + 0xec]
mov ecx, dword [esi + 0xe0]
cmp eax, ecx
jl 0x403b70
push ebx
sub eax, ecx
lea edx, [esp + 0x14]
push edx
inc eax
push eax
mov ecx, esi
call fcn.00403110
lea eax, [esp + 0x10]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
mov edx, dword [esi + 0xec]
xor eax, eax
mov ecx, 0x82
lea edi, [esp + 0x10]
rep stosd dword es:[edi], eax
lea ecx, [esp + 0x10]
push ecx
push ebx
push edx
mov ecx, esi
call fcn.00403110
mov ecx, dword [esi + 0xec]
inc ecx
mov eax, ecx
cmp eax, 0x3e7
mov dword [esi + 0xec], ecx
jl 0x403bad
mov dword [esi + 0xec], ebx
mov eax, dword [esi + 0x23c]
push ebx
push ebx
push 2
push ebx
inc eax
push 3
mov dword [esi + 0x23c], eax
push 0x40000000
lea eax, [esp + 0x28]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ecx, dword [esi + 0x23c]
mov dword [esi + 0xe8], eax
mov dword [0x418148], ecx
cmp dword [esi + 0xe8], ebx
je 0x403bf2
mov ecx, esi
call fcn.00402f70
mov ecx, dword [esp + 0x131c]
call fcn.0040e783
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0x10