Function at 0x473920
Capabilities:
Check if file exists
Create directory
Get file attributes
Read file on windows
Write file on windows

Disassembly:
sub esp, 0x3c0
push ebx
push ebp
push esi
mov esi, ecx
push edi
xor ebx, ebx
mov ecx, 0x24
xor eax, eax
lea edi, [esp + 0x24]
mov dword [esp + 0x20], ebx
rep stosd dword es:[edi], eax
mov ecx, 0x46
lea edi, [esp + 0xb8]
mov dword [esp + 0xb4], ebx
push 0x3f
rep stosd dword es:[edi], eax
mov edi, dword [sym.imp.MSVCRT.dll_strncpy]
lea eax, [esp + 0x28]
push str._C_opyright_2003__MetaQuotes_Software_Corp.
push eax
call edi
lea ebp, [esi + 0x58]
push 0xb
lea ecx, [esp + 0x74]
push ebp
push ecx
mov byte [esp + 0x7b], bl
call edi
add esp, 0x18
lea edx, [esp + 0xb4]
mov ecx, 0x593d48
mov byte [esp + 0x6f], bl
push edx
mov dword [esp + 0x24], 0x190
call fcn.0042f650
mov edi, dword [esp + 0x3d4]
cmp edi, 1
jne 0x4739ad
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
cmp dword [esi + 0x814], ebx
jne 0x4739d2
cmp edi, 1
jne 0x473d07
push esi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x3c0
ret 4
mov eax, dword [esi + 0x7f4]
mov dword [esi + 0x800], ebx
cmp eax, ebx
je 0x473cea
mov ecx, dword [esi + 0x858]
mov eax, dword [esi + 0x7ec]
mov edx, dword [esi + 0x808]
mov ebx, dword [sym.imp.MSVCRT.dll__snprintf]
lea edi, [esi + 0x18]
mov dword [esp + 0x7c], ecx
push edi
push 0x5965b8
mov dword [esp + 0x78], eax
mov eax, dword [esi + 0xc0]
push str._shistory_s
lea ecx, [esp + 0x1dc]
push 0x1ff
push ecx
mov dword [esp + 0x8c], edx
mov dword [esp + 0x88], eax
call ebx
add esp, 0x14
lea edx, [esp + 0x1d0]
push edx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
jne 0x473a5d
lea eax, [esp + 0x1d0]
push 0
push eax
call dword [sym.imp.KERNEL32.dll_CreateDirectoryA]
mov ecx, dword [esi + 0x7ec]
lea edx, [esp + 0x1d0]
push ecx
push ebp
push edi
push 0x5965b8
push str._shistory_s_s_d.hst
push 0x1ff
push edx
call ebx
mov ebp, dword [sym.imp.MSVCRT.dll_fopen]
lea eax, [esp + 0x1ec]
push 0x583e1c
push eax
call ebp
mov edi, eax
xor ebx, ebx
add esp, 0x24
cmp edi, ebx
je 0x473c81
push edi
push 1
lea ecx, [esp + 0x28]
push 0x94
push ecx
call dword [sym.imp.MSVCRT.dll_fwrite]
mov eax, dword [esi + 0x7f8]
add esp, 0x10
cmp eax, ebx
jle 0x473c6d
mov edx, dword [esi + 0x7f4]
mov eax, dword [esi + 0x810]
cmp eax, ebx
mov dword [esp + 0x18], ebx
mov ecx, dword [edx]
mov dword [esp + 0x14], ebx
mov dword [esp + 0x1c], ecx
jle 0x473aed
cmp eax, ecx
jge 0x473aed
mov dword [esp + 0x1c], eax
mov dword [esi + 0x810], ebx
mov eax, dword [edi + 0x10]
push eax
call dword [sym.imp.MSVCRT.dll__filelength]
mov ecx, eax
mov eax, 0xba2e8ba3
sub ecx, 0x94
push 0
mul ecx
mov ebp, edx
push 0x94
shr ebp, 5
push edi
mov dword [esp + 0x20], ebp
call dword [sym.imp.MSVCRT.dll_fseek]
mov eax, dword [esp + 0xd8]
add esp, 0x10
cmp ebp, eax
jge 0x473b39
cmp ebp, dword [esi + 0x7f8]
jl 0x473b5d
push edi
push 1
lea edx, [esp + 0x1c]
push 4
push edx
call dword [sym.imp.MSVCRT.dll_fread]
add esp, 0x10
cmp eax, 1
jne 0x473bb1
mov eax, dword [esp + 0x1c]
mov ecx, dword [esp + 0x14]
cmp ecx, eax
jne 0x473bb1
push 0
push 0x94
push edi
call dword [sym.imp.MSVCRT.dll_fseek]
mov eax, dword [esi + 0x7f8]
push edi
push 1
lea ecx, [eax + eax*4]
lea edx, [eax + ecx*2]
mov eax, dword [esi + 0x7f4]
shl edx, 2
push edx
push eax
call dword [sym.imp.MSVCRT.dll_fwrite]
mov eax, dword [esi + 0x7f8]
lea ecx, [eax + eax*4]
lea edx, [eax + ecx*2]
mov ecx, dword [edi + 0x10]
lea eax, [edx*4 + 0x94]
push eax
push ecx
call dword [sym.imp.MSVCRT.dll__chsize]
add esp, 0x24
jmp 0x473ce0
test ebp, ebp
jle 0x473c22
jmp 0x473bbb
mov ebp, dword [esp + 0x10]
mov eax, ebp
push 0
cdq
sub eax, edx
mov ebp, eax
sar ebp, 1
add ebx, ebp
lea edx, [ebx + ebx*4]
lea eax, [ebx + edx*2]
lea ecx, [eax*4 + 0x94]
push ecx
push edi
call dword [sym.imp.MSVCRT.dll_fseek]
push edi
push 1
lea edx, [esp + 0x28]
push 4
push edx
call dword [sym.imp.MSVCRT.dll_fread]
mov eax, dword [esp + 0x38]
mov ecx, dword [esp + 0x30]
add esp, 0x1c
cmp ecx, eax
jge 0x473c12
mov eax, dword [esp + 0x10]
or ecx, 0xffffffff
sub ecx, ebp
inc ebx
add eax, ecx
mov dword [esp + 0x18], ebx
mov dword [esp + 0x10], eax
jmp 0x473c16
mov dword [esp + 0x10], ebp
mov eax, dword [esp + 0x10]
mov ebx, dword [esp + 0x18]
test eax, eax
jg 0x473bb7
lea edx, [ebx + ebx*4]
push 0
lea eax, [ebx + edx*2]
lea ecx, [eax*4 + 0x94]
push ecx
push edi
call dword [sym.imp.MSVCRT.dll_fseek]
mov eax, dword [esi + 0x7f8]
mov ecx, dword [esi + 0x7f4]
push edi
push 1
lea edx, [eax + eax*4]
lea eax, [eax + edx*2]
shl eax, 2
push eax
push ecx
call dword [sym.imp.MSVCRT.dll_fwrite]
mov edx, dword [esi + 0x7f8]
lea eax, [edx + ebx]
mov dword [esi + 0x800], eax
jmp 0x473b91
mov edx, dword [edi + 0x10]
push 0x94
push edx
call dword [sym.imp.MSVCRT.dll__chsize]
add esp, 8
jmp 0x473ce0
lea eax, [esp + 0x1d0]
push 0x581698
push eax
call ebp
mov edi, eax
add esp, 8
cmp edi, ebx
je 0x473cea
mov ebx, dword [sym.imp.MSVCRT.dll_fwrite]
push edi
push 1
lea ecx, [esp + 0x28]
push 0x94
push ecx
call ebx
mov eax, dword [esi + 0x7f8]
add esp, 0x10
test eax, eax
jle 0x473cd4
mov ecx, dword [esi + 0x7f4]
lea edx, [eax + eax*4]
push edi
push 1
lea eax, [eax + edx*2]
shl eax, 2
push eax
push ecx
call ebx
add esp, 0x10
mov edx, dword [esi + 0x7f8]
mov dword [esi + 0x800], edx
push edi
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 4
mov eax, dword [esp + 0x3d4]
mov dword [esi + 0x814], 0
cmp eax, 1
jne 0x473d07
push esi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x3c0
ret 4