Function at 0x403120
Capabilities:
Check if file exists
Delete file
Get file attributes
Read file on windows
Write file on windows

Disassembly:
sub esp, 0x910
mov ecx, dword [0x416534]
mov edx, dword [0x416538]
mov eax, dword [str.tempxxxx.jpg]
push ebx
push ebp
push esi
mov esi, dword [esp + 0x920]
mov dword [esp + 0x28], ecx
push edi
mov edi, dword [sym.imp.KERNEL32.dll_ReadFile]
lea ecx, [esp + 0x10]
mov dword [esp + 0x30], edx
push 0
push ecx
lea edx, [esp + 0x50]
mov dword [esp + 0x30], eax
mov al, byte [0x41653c]
push 0x1e
push edx
push esi
mov byte [esp + 0x48], al
call edi
cmp byte [esp + 0x48], 0x4d
jne 0x403238
cmp byte [esp + 0x49], 0x65
jne 0x403238
mov ebx, dword [esp + 0x928]
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
je 0x40319e
push ebx
call dword [sym.imp.KERNEL32.dll_DeleteFileA]
push 0
push 0x1001
lea eax, [esp + 0x1c]
push ebx
push eax
call sub.AVIFIL32.dll_AVIFileOpenA
test eax, eax
jne 0x403238
lea ecx, [esp + 0x10]
push eax
push ecx
lea edx, [esp + 0x9c]
push 0x8c
push edx
push esi
call edi
mov edx, dword [esp + 0x14]
lea eax, [esp + 0x94]
lea ecx, [esp + 0x1c]
push eax
push ecx
push edx
call sub.AVIFIL32.dll_AVIFileCreateStreamA
test eax, eax
jne 0x40322e
lea ecx, [esp + 0x10]
push eax
push ecx
lea edx, [esp + 0x20]
push 4
push edx
push esi
call edi
lea eax, [esp + 0x10]
push 0
push eax
lea ecx, [esp + 0x70]
push 0x2c
push ecx
push esi
call edi
mov edx, dword [esp + 0x18]
mov ecx, dword [esp + 0x1c]
lea eax, [esp + 0x68]
push edx
push eax
push 0
push ecx
call sub.AVIFIL32.dll_AVIStreamSetFormat
test eax, eax
je 0x40324c
mov edx, dword [esp + 0x1c]
push edx
call sub.AVIFIL32.dll_AVIStreamRelease
mov eax, dword [esp + 0x14]
push eax
call sub.AVIFIL32.dll_AVIFileRelease
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x910
ret
lea ecx, [esp + 0x10]
push 0
push ecx
lea edx, [esp + 0x44]
push 4
push edx
push esi
call edi
lea eax, [esp + 0x10]
push 0
push eax
lea ecx, [esp + 0x2c]
push 4
push ecx
push esi
call edi
mov edx, dword [esp + 0xbc]
push edx
push 0x40
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov ebx, eax
lea eax, [esp + 0x10]
push 0
push eax
lea ecx, [esp + 0x40]
push 4
push ecx
push esi
call edi
mov ebp, dword [esp + 0x3c]
mov eax, dword [esp + 0x24]
cmp ebp, eax
jge 0x403307
mov eax, dword [0x417dc4]
test eax, eax
je 0x4032bb
mov eax, dword [esp + 0xbc]
lea edx, [esp + 0x44]
push 0
push edx
push eax
push ebx
push esi
call edi
jmp 0x4032d9
lea ecx, [esp + 0x28]
push esi
push ecx
call fcn.004033f0
lea edx, [esp + 0x70]
push ebx
lea eax, [esp + 0x34]
push edx
push eax
call fcn.00402fe0
add esp, 0x14
mov ecx, dword [esp + 0xbc]
mov edx, dword [esp + 0x1c]
push 0
push 0
push 0x10
push ecx
push ebx
push 1
push ebp
push edx
call sub.AVIFIL32.dll_AVIStreamWrite
test eax, eax
jne 0x40336a
mov ecx, dword [esp + 0x38]
mov eax, dword [esp + 0x24]
add ebp, ecx
cmp ebp, eax
jl 0x40329d
push ebx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
push 0
push 0x80
push 2
push 0
push 0
push 0x40000000
push str.wavexxxx.wav
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebx, eax
cmp ebx, 0xffffffff
je 0x40323f
lea edx, [esp + 0x10]
push 0
push edx
lea eax, [esp + 0x20]
push 4
push eax
push esi
call edi
mov eax, dword [esp + 0x18]
test eax, eax
jle 0x4033b3
mov ebp, dword [sym.imp.KERNEL32.dll_WriteFile]
lea ecx, [esp + 0x20]
cmp eax, 0x800
push 0
push ecx
jle 0x40337e
push 0x800
jmp 0x40337f
mov eax, dword [esp + 0x1c]
push eax
call sub.AVIFIL32.dll_AVIStreamRelease
mov ecx, dword [esp + 0x14]
push ecx
jmp 0x403233
push eax
lea edx, [esp + 0x12c]
push edx
push esi
call edi
mov ecx, dword [esp + 0x20]
lea eax, [esp + 0x40]
push 0
push eax
lea edx, [esp + 0x128]
push ecx
push edx
push ebx
call ebp
mov eax, dword [esp + 0x18]
mov edx, dword [esp + 0x20]
sub eax, edx
test eax, eax
mov dword [esp + 0x18], eax
jg 0x403355
mov eax, dword [esp + 0x1c]
push eax
call sub.AVIFIL32.dll_AVIStreamRelease
mov ecx, dword [esp + 0x14]
push ecx
call sub.AVIFIL32.dll_AVIFileRelease
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebx
call edi
push esi
call edi
lea edx, [esp + 0x28]
push edx
call dword [sym.imp.KERNEL32.dll_DeleteFileA]
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x910
ret