Function at 0x402f8e
Capabilities:
Check if file exists
Get file attributes
Get file size
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
mov eax, dword [0x4056cc]
push ebx
xor ebx, ebx
cmp eax, 0x100
push esi
push edi
mov dword [ebp - 4], ebx
je 0x4031e0
cmp dword [ebp + 8], ebx
je 0x402fb9
cmp eax, ebx
jne 0x403046
push ebx
push 0x8000080
push 4
push ebx
push 1
push 0xc0000000
push ebx
push ebx
call fcn.00402caa
pop ecx
pop ecx
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
mov dword [ebp - 0xc], esi
je 0x4031e0
cmp dword [0x4056cc], ebx
jne 0x403046
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
cmp eax, ebx
mov dword [ebp - 8], eax
jbe 0x40302e
add eax, 4
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
cmp eax, ebx
mov dword [0x4056cc], eax
je 0x40302e
push ebx
lea ecx, [ebp - 8]
push ecx
push dword [ebp - 8]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [ebp - 8]
mov ecx, dword [0x4056cc]
mov dword [ecx + eax], ebx
cmp dword [ebp + 8], ebx
je 0x40303c
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x403046
push ebx
push ebx
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp dword [ebp + 8], ebx
jne 0x403166
mov esi, 0x40561c
lea edi, [ebp - 0x28]
mov ecx, dword [esi - 4]
cmp ecx, ebx
je 0x4030d7
test word [esi], 0x1c0
mov dword [edi], 1
jne 0x4030c9
and byte [ecx], 0xdf
mov bl, byte [ecx]
cmp bl, 0x43
jl 0x4030c7
test bl, bl
mov eax, ecx
je 0x403081
inc eax
cmp byte [eax], 0
jne 0x40307b
sub eax, ecx
cmp eax, 3
jbe 0x4030c7
cmp eax, 0x60
ja 0x4030c7
mov edx, dword [esi]
and edx, 0x23e
cmp edx, 0x3e
mov dword [edi], eax
jge 0x4030c1
test byte [0x4056c9], 2
je 0x4030aa
cmp bl, 0x5c
je 0x4030c3
push 0
lea edx, [ebp - 8]
push edx
inc eax
push eax
push ecx
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
add dword [ebp - 4], eax
jmp 0x4030c7
jle 0x4030c7
or dword [ebp - 4], 1
xor ebx, ebx
add esi, 8
add edi, 4
cmp esi, 0x405644
jbe 0x403057
cmp dword [ebp - 4], ebx
je 0x40315b
mov edi, dword [0x4056cc]
cmp edi, ebx
je 0x403152
mov al, byte [edi]
test al, al
je 0x403152
mov esi, edi
mov dword [ebp - 0x10], esi
inc esi
cmp byte [esi], 0
jne 0x4030f1
mov dword [ebp - 0x10], esi
sub esi, edi
mov dword [ebp + 8], 0x405618
lea ebx, [ebp - 0x28]
mov eax, dword [ebp + 8]
mov eax, dword [eax]
test eax, eax
je 0x40312f
cmp dword [ebx], esi
jne 0x40311f
push edi
push eax
call dword [sym.imp.KERNEL32.dll_lstrcmpiA]
test eax, eax
je 0x40314a
add dword [ebp + 8], 8
add ebx, 4
cmp dword [ebp + 8], 0x405640
jbe 0x403106
push 0
lea eax, [ebp - 8]
push eax
inc esi
push esi
push edi
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
add dword [ebp - 4], eax
cmp dword [ebp - 4], 0x48
jge 0x403152
mov eax, dword [ebp - 0x10]
lea edi, [eax + 1]
jmp 0x4030e6
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x4031e0
mov esi, dword [0x4056cc]
cmp esi, ebx
mov edi, dword [sym.imp.USER32.dll_AppendMenuA]
je 0x4031cf
mov al, byte [esi]
test al, al
je 0x4031cf
cmp al, 0x5c
je 0x40318e
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
jne 0x403197
jmp 0x4031bd
test byte [0x4056c9], 2
jne 0x4031bd
mov eax, dword [ebp - 4]
push esi
add eax, 0x8700
push eax
push ebx
push dword [ebp + 8]
call edi
add dword [ebp - 4], eax
cmp dword [ebp - 4], 0x28
jge 0x4031ca
mov eax, dword [0x4056fc]
add eax, 0xfffffffd
cmp dword [ebp - 4], eax
jge 0x4031ca
mov al, byte [esi]
inc esi
test al, al
jne 0x4031bd
mov al, byte [esi]
test al, al
jne 0x40317c
cmp dword [ebp - 4], ebx
jne 0x4031e0
push 0x40508b
push 0x8310
push 1
push dword [ebp + 8]
call edi
pop edi
pop esi
pop ebx
leave
ret