Function at 0x409560
Capabilities:
Read file on windows
Terminate process
Write file on windows

Disassembly:
sub esp, 0xc
push ebx
push ebp
push esi
push edi
mov esi, ecx
mov byte [esp + 0x12], 0
mov byte [esp + 0x13], 0
call fcn.00407980
test eax, eax
mov dword [esp + 0x14], eax
jne 0x409592
mov dword [esi + 0x1a9c], 7
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
lea eax, [esi + 0x4bb8]
lea edi, [esi + 0x4bbc]
push eax
mov ecx, edi
call sub.MFC42u.DLL_CString::operator
push str.khsimulator.exe
mov ecx, edi
call sub.MFC42u.DLL_CString::Find
cmp eax, 0xffffffff
jne 0x4095bf
push 1
call dword [sym.imp.MSVCRT.dll_exit]
push str.HMI0.HMI.SIM
push str.khsimulator.exe
mov ecx, edi
call sub.MFC42u.DLL_CString::Replace
mov edi, dword [edi]
push 0x41a0f8
push edi
call dword [sym.imp.MSVCRT.dll__wfopen]
mov ebp, eax
add esp, 8
test ebp, ebp
jne 0x4095f9
mov dword [esi + 0x1a9c], 7
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
mov ebx, dword [esi + 0x1c28]
push 1
push ebx
call dword [sym.imp.MSVCRT.dll_calloc]
add esp, 8
mov edi, eax
test edi, edi
push 0
jne 0x409624
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
push 1
call dword [sym.imp.MSVCRT.dll_exit]
mov eax, dword [esi + 0x1c2c]
mov ecx, dword [esp + 0x18]
push eax
push ecx
call dword [sym.imp.MSVCRT.dll_fseek]
mov edx, dword [esp + 0x20]
push edx
push ebx
push 1
push edi
call dword [sym.imp.MSVCRT.dll_fread]
add esp, 0x1c
mov dword [esp + 0x18], 0
test ebx, ebx
jle 0x40968a
mov eax, dword [esp + 0x18]
push ebp
push 1
lea edx, [esp + 0x1a]
mov cl, byte [eax + edi]
push 1
push edx
mov byte [esp + 0x22], cl
call dword [sym.imp.MSVCRT.dll_fwrite]
mov al, byte [ebp + 0xc]
add esp, 0x10
test al, 0x20
jne 0x4097b5
mov eax, dword [esp + 0x18]
inc eax
cmp eax, ebx
mov dword [esp + 0x18], eax
jl 0x409654
push ebp
call dword [sym.imp.MSVCRT.dll_fclose]
push edi
call dword [sym.imp.MSVCRT.dll_free]
add esp, 8
lea edi, [esi + 0x4bc0]
lea eax, [esi + 0x4bb8]
mov ecx, edi
push eax
call sub.MFC42u.DLL_CString::operator
push str.khsimulator.exe
mov ecx, edi
call sub.MFC42u.DLL_CString::Find
cmp eax, 0xffffffff
jne 0x4096c8
push 1
call dword [sym.imp.MSVCRT.dll_exit]
push str.RECIPE.RCP.SIM
push str.khsimulator.exe
mov ecx, edi
call sub.MFC42u.DLL_CString::Replace
mov edi, dword [edi]
push 0x41a0f8
push edi
call dword [sym.imp.MSVCRT.dll__wfopen]
mov ebp, eax
add esp, 8
test ebp, ebp
jne 0x409702
mov dword [esi + 0x1a9c], 7
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
mov ebx, dword [esi + 0x1c70]
push 1
push ebx
mov dword [esp + 0x20], ebx
call dword [sym.imp.MSVCRT.dll_calloc]
add esp, 8
mov edi, eax
test edi, edi
push 0
jne 0x409731
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
push 1
call dword [sym.imp.MSVCRT.dll_exit]
mov ecx, dword [esi + 0x1c74]
mov edx, dword [esp + 0x18]
push ecx
push edx
call dword [sym.imp.MSVCRT.dll_fseek]
mov eax, dword [esp + 0x20]
push eax
push ebx
push 1
push edi
call dword [sym.imp.MSVCRT.dll_fread]
mov eax, dword [esp + 0x34]
add esp, 0x1c
xor ebx, ebx
test eax, eax
jle 0x409789
mov cl, byte [ebx + edi]
push ebp
push 1
lea edx, [esp + 0x1a]
push 1
push edx
mov byte [esp + 0x22], cl
call dword [sym.imp.MSVCRT.dll_fwrite]
mov al, byte [ebp + 0xc]
add esp, 0x10
test al, 0x20
jne 0x4097b5
mov eax, dword [esp + 0x18]
inc ebx
cmp ebx, eax
jl 0x40975f
mov ebx, dword [sym.imp.MSVCRT.dll_fclose]
push ebp
call ebx
push edi
call dword [sym.imp.MSVCRT.dll_free]
mov ecx, dword [esp + 0x1c]
push ecx
call ebx
add esp, 0xc
mov dword [esi + 0x1a9c], 0
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
mov ebx, dword [sym.imp.MSVCRT.dll_fclose]
push ebp
call ebx
mov eax, dword [esp + 0x18]
push eax
call ebx
push edi
call dword [sym.imp.MSVCRT.dll_free]
add esp, 0xc
mov dword [esi + 0x1a9c], 5
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret