Function at 0x4046a0
Capabilities:
Check if file exists
Read file on windows
Set file attributes
Write file on windows

Disassembly:
sub esp, 8
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x20]
mov dword [esp + 0x14], ecx
push edi
mov dword [esp + 0x14], 0
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
cmp eax, 1
jne 0x4046cf
push 0x80
push edi
call dword [sym.imp.KERNEL32.dll_SetFileAttributesW]
push 0
push 0x80
push 2
push 0
push 1
push 0x40000000
push edi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
jne 0x404715
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push edi
push str.CreateSomFile:_CreateError__FileName:__s___x_
push 0x41a040
call fcn.0040c930
add esp, 0x10
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 8
ret 0x18
mov ebp, dword [esp + 0x28]
lea edi, [ebp + 0x10]
push edi
call sub.MFC42u.DLL_operatornew
mov ecx, edi
mov ebx, eax
mov edx, ecx
xor eax, eax
mov edi, ebx
push 0
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
mov eax, dword [esp + 0x2c]
mov edi, dword [esp + 0x24]
push eax
push edi
call dword [sym.imp.MSVCRT.dll_fseek]
add esp, 0x10
test eax, eax
je 0x404764
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 8
ret 0x18
push edi
push ebp
push 1
push ebx
call dword [sym.imp.MSVCRT.dll_fread]
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
add esp, 0x10
lea ecx, [esp + 0x10]
mov byte [ebx + ebp], 0
push 0
push ecx
push 0xa
push str.SCDSSS02
push esi
call edi
test eax, eax
jne 0x4047bb
mov edx, dword [esp + 0x20]
push edx
push str.CreateSomFile:_WriteError_HEADER_FileName:__s_
push 0x41a040
call fcn.0040c930
add esp, 0xc
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 8
ret 0x18
mov ecx, dword [esp + 0x2c]
lea eax, [esp + 0x10]
push 0
push eax
push 0x10
push ecx
push esi
call edi
test eax, eax
jne 0x4047fa
mov edx, dword [esp + 0x20]
push edx
push str.CreateSomFile:_WriteError_HEADER_SIZE_FileName:__s_
push 0x41a040
call fcn.0040c930
add esp, 0xc
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 8
ret 0x18
mov ecx, dword [esp + 0x30]
lea eax, [esp + 0x10]
push 0
push eax
push 0x10
push ecx
push esi
call edi
test eax, eax
jne 0x404839
mov edx, dword [esp + 0x20]
push edx
push str.CreateSomFile:_WriteError_Key_FileName:__s_
push 0x41a040
call fcn.0040c930
add esp, 0xc
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 8
ret 0x18
lea eax, [esp + 0x10]
push 0
push eax
push ebp
push ebx
push esi
call edi
test eax, eax
jne 0x404873
mov ecx, dword [esp + 0x20]
push ecx
push str.CreateSomFile:_WriteError_Data_FileName:__s_
push 0x41a040
call fcn.0040c930
add esp, 0xc
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 8
ret 0x18
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebx
call sub.MFC42u.DLL_operatordelete
mov edx, dword [esp + 0x18]
mov esi, dword [esp + 0x24]
add edx, 4
push esi
push edx
call dword [sym.imp.MSVCRT.dll_wcscpy]
add esp, 0xc
push esi
push str.CreateSomFile:_Success__FileName:__s_
push 0x41a040
call fcn.0040c930
add esp, 0xc
mov eax, 1
pop edi
pop esi
pop ebp
pop ebx
add esp, 8
ret 0x18