Function at 0x404880
Capabilities:
Read file on windows
Write file on windows

Disassembly:
sub esp, 0xc30
push ebx
push ebp
push esi
mov esi, dword [esp + 0xc40]
push edi
push 0x41ce00
mov al, byte [esi]
push eax
call fcn.00408920
mov edi, eax
xor ebx, ebx
add esp, 8
cmp edi, ebx
jne 0x4048b7
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0xc30
ret
mov dx, word [0x419752]
lea ecx, [esp + 0x420]
push ecx
push edx
call fcn.0040be80
mov ebp, dword [sym.imp.MSVCRT.dll_fclose]
add esp, 8
cmp word [0x41dc30], bx
je 0x4049bb
cmp dword [edi + 8], 0x12
jne 0x4049ab
mov word [0x41dc30], bx
mov al, byte [esi]
mov word [esi + 0x22], bx
mov byte [esp + 0x14], bl
mov byte [esp + 0x15], 0x1a
mov byte [esp + 0x16], al
mov byte [esp + 0x17], 4
call sub.MFC42.DLL_AfxGetThread
cmp eax, ebx
je 0x40491d
mov edx, dword [eax]
mov ecx, eax
call dword [edx + 0x7c]
jmp 0x40491f
xor eax, eax
lea ecx, [esp + 0x14]
push 4
push ecx
mov ecx, eax
call fcn.00407530
mov dl, byte [esi]
push ebx
push 0x41be34
push 0x41be34
push edx
push 0x64
call fcn.00404d40
add esp, 0x14
cmp word [esi + 0x20], bx
je 0x404c58
mov edx, dword [edi + 0x24]
push edx
call fcn.00401470
add esp, 4
cmp ax, bx
jle 0x404bee
mov eax, dword [edi + 0x24]
lea ecx, [esp + 0x20]
push eax
push ecx
call fcn.004011e0
xor ecx, ecx
add esp, 8
mov cl, byte [esi]
mov eax, ecx
shl eax, 5
add eax, ecx
lea edx, [eax + eax*2]
cmp dword [edx*8 + 0x41d5fc], ebx
je 0x404b6a
mov eax, dword [esi + 0x124]
lea edx, [esp + 0x20]
movsx ecx, word [0x419750]
push eax
push 1
push ecx
push edx
jmp 0x404b94
pop edi
pop esi
pop ebp
mov eax, 0xfffffffe
pop ebx
add esp, 0xc30
ret
cmp word [esi + 0x22], bx
je 0x404945
mov eax, dword [edi + 0x24]
push eax
call fcn.00401460
add esp, 4
test ax, ax
je 0x404945
mov ecx, dword [esi + 0x124]
lea eax, [esp + 0x20]
movsx edx, word [0x419750]
push ecx
push 1
push edx
push eax
call dword [sym.imp.MSVCRT.dll_fread]
add esp, 0x10
test ax, ax
je 0x404a45
mov ecx, dword [edi + 0x24]
lea edx, [esp + 0x20]
push ecx
push edx
call fcn.00401060
add esp, 8
test ax, ax
je 0x404a2a
push ebx
push ebx
push str.Error_writing_circular_buffer
call sub.MFC42.DLL_AfxMessageBox
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0xc30
ret
inc word [esi + 0x128]
mov ecx, dword [esi + 0x18]
movsx eax, word [0x419750]
sub ecx, eax
mov dword [esi + 0x18], ecx
jmp 0x404945
mov ecx, dword [esi + 0x124]
test byte [ecx + 0xc], 0x20
je 0x404a9e
lea edx, [esp + 0x420]
push edx
call dword [sym.imp.MSVCRT.dll__errno]
mov eax, dword [eax]
push eax
call fcn.00404440
add esp, 4
push eax
call fcn.0040bdb0
lea ecx, [esp + 0x428]
push ecx
push str.error_4
call fcn.0040bdb0
mov edx, dword [esi + 0x124]
push edx
call ebp
add esp, 0x14
mov word [esi + 0x22], bx
push ebx
push ebx
push str.File_reading_failure
call sub.MFC42.DLL_AfxMessageBox
mov eax, dword [esi + 0x124]
test byte [eax + 0xc], 0x10
je 0x404945
mov ecx, dword [edi + 0x24]
mov ax, word [esi + 0x18]
lea edx, [esp + 0x20]
push ecx
push edx
push eax
call fcn.004010e0
add esp, 0xc
test ax, ax
je 0x404aea
lea ecx, [esp + 0x420]
push ecx
push str.error_2
call fcn.0040bdb0
add esp, 8
push ebx
push ebx
push str.Writing_failure
call sub.MFC42.DLL_AfxMessageBox
inc word [esi + 0x128]
mov edx, dword [edi + 0x24]
push edx
call fcn.004011a0
mov eax, dword [edi + 0x24]
push eax
call fcn.00401490
mov ecx, dword [esi + 0x124]
push ecx
call ebp
add esp, 0xc
test eax, eax
je 0x404b53
lea edx, [esp + 0x420]
push edx
call dword [sym.imp.MSVCRT.dll__errno]
mov eax, dword [eax]
push eax
call fcn.00404440
add esp, 4
push eax
call fcn.0040bdb0
lea ecx, [esp + 0x428]
push ecx
push str.error_3
call fcn.0040bdb0
add esp, 0x10
push ebx
push ebx
push str.Closing_failure
call sub.MFC42.DLL_AfxMessageBox
pop edi
pop esi
pop ebp
mov word [0x41dc30], 1
or eax, 0xffffffff
pop ebx
add esp, 0xc30
ret
lea edi, [esp + 0x20]
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
movsx eax, word [0x419750]
not ecx
dec ecx
cmp ecx, eax
jbe 0x404b85
mov ecx, eax
mov eax, dword [esi + 0x124]
push eax
push 1
push ecx
lea ecx, [esp + 0x2c]
push ecx
call dword [sym.imp.MSVCRT.dll_fwrite]
add esp, 0x10
cmp ax, 1
je 0x404be5
lea edx, [esp + 0x420]
push edx
call dword [sym.imp.MSVCRT.dll__errno]
mov eax, dword [eax]
push eax
call fcn.00404440
add esp, 4
push eax
call fcn.0040bdb0
lea ecx, [esp + 0x428]
push ecx
push str.error_10
call fcn.0040bdb0
add esp, 0x10
push ebx
push ebx
push str.Writing_failure
call sub.MFC42.DLL_AfxMessageBox
jmp 0x404c52
inc word [esi + 0x12a]
jmp 0x404c52
cmp ax, 0xfffd
jne 0x404c52
mov edx, dword [esi + 0x124]
push edx
call ebp
mov al, byte [esi]
add esp, 4
mov word [esi + 0x20], bx
mov byte [esp + 0x14], bl
mov byte [esp + 0x15], 0x1a
mov byte [esp + 0x16], al
mov byte [esp + 0x17], 4
call sub.MFC42.DLL_AfxGetThread
cmp eax, ebx
je 0x404c2a
mov edx, dword [eax]
mov ecx, eax
call dword [edx + 0x7c]
jmp 0x404c2c
xor eax, eax
lea ecx, [esp + 0x14]
push 4
push ecx
mov ecx, eax
call fcn.00407530
mov dl, byte [esi]
push ebx
push 0x41be34
push 0x41be34
push edx
push 0x64
call fcn.00404d40
add esp, 0x14
cmp word [esi + 0x20], bx
jne 0x404c7f
cmp word [esi + 0x22], bx
jne 0x404c7f
mov al, byte [esi]
lea ecx, [esp + 0x10]
push ecx
push 0x41c248
mov byte [esp + 0x18], 0x64
mov byte [esp + 0x19], al
mov byte [esp + 0x1a], bl
call fcn.00404780
add esp, 8
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0xc30
ret