Function at 0x404240
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x42ae79
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0xc0
mov al, byte [ebp + 0xb]
push ebx
push esi
push edi
mov edi, ecx
mov dword [ebp - 0x10], esp
push 0
lea ecx, [ebp - 0x60]
mov dword [ebp - 0x34], edi
mov byte [ebp - 0x60], al
call dword [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Tidy_bool_]
mov esi, dword [ebp + 8]
push 0x436408
push esi
mov dword [ebp - 4], 0
call dword [sym.imp.MSVCP60.dll_bool___cdecl_std::operator_class_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char___const___char_const__]
mov ecx, dword [sym.imp.MSVCP60.dll_unsigned_int_const_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::npos]
add esp, 8
test al, al
mov edx, dword [ecx]
push edx
push 0
je 0x4042a8
lea eax, [edi + 0x18]
push eax
jmp 0x4042a9
push esi
lea ecx, [ebp - 0x60]
call dword [sym.imp.MSVCP60.dll_public:_class_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char______thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::assign_class_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char___const___unsigned_int__unsigned_int_]
mov eax, dword [ebp - 0x5c]
mov byte [ebp - 4], 1
test eax, eax
jne 0x4042c2
mov eax, dword [sym.imp.MSVCP60.dll_char_const__private:_static_char_const____cdecl_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Nullstr_void_::_2::_C]
push 0
push 0x80
push 2
push 0
push 1
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebx, eax
cmp ebx, 0xffffffff
mov dword [ebp - 0x40], ebx
jne 0x4042fa
lea eax, [ebp - 0x3c]
push 0x42f338
push eax
mov dword [ebp - 0x3c], str.open_file_error
call sub.MSVCRT.dll__CxxThrowException
push 0
push 0
push 0x18
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
lea ecx, [ebp - 0xcc]
call fcn.004138b0
mov eax, dword [edi + 8]
mov dword [ebp - 0x50], eax
mov esi, dword [eax]
mov dword [ebp - 0x14], 0
cmp esi, eax
je 0x404418
mov ecx, dword [esi + 0xc]
lea edx, [ebp - 0x18]
mov dword [ebp - 0x18], ecx
push 4
push edx
lea ecx, [ebp - 0xcc]
call fcn.004138e0
lea eax, [ebp + 8]
push 0
push eax
lea ecx, [ebp - 0x18]
push 4
push ecx
push ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x40436c
lea edx, [ebp - 0x24]
push 0x42f338
push edx
mov dword [ebp - 0x24], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
cmp dword [ebp + 8], 4
jae 0x404387
lea eax, [ebp - 0x44]
push 0x42f338
push eax
mov dword [ebp - 0x44], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
mov edi, dword [esi + 0x10]
push 0x15
push edi
lea ecx, [ebp - 0xcc]
call fcn.004138e0
lea ecx, [ebp + 8]
push 0
push ecx
push 0x15
push edi
push ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x4043c1
lea edx, [ebp - 0x2c]
push 0x42f338
push edx
mov dword [ebp - 0x2c], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
cmp dword [ebp + 8], 0x15
jae 0x4043dc
lea eax, [ebp - 0x4c]
push 0x42f338
push eax
mov dword [ebp - 0x4c], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
mov eax, dword [esi + 8]
mov ecx, dword [0x43648c]
cmp eax, ecx
je 0x4043f3
mov esi, eax
mov eax, dword [esi]
cmp eax, ecx
jne 0x4043e9
jmp 0x404406
mov eax, dword [esi + 4]
cmp esi, dword [eax + 8]
jne 0x4043ff
mov esi, eax
jmp 0x4043f3
cmp dword [esi + 8], eax
je 0x404406
mov esi, eax
mov eax, dword [ebp - 0x14]
mov edi, dword [ebp - 0x34]
inc eax
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x50]
jmp 0x404321
push 0
push 0
push 0
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov esi, dword [sym.imp.KERNEL32.dll_WriteFile]
lea ecx, [ebp + 8]
push 0
push ecx
lea edx, [ebp - 0x14]
push 4
push edx
push ebx
call esi
test eax, eax
jne 0x404453
lea eax, [ebp - 0x1c]
push 0x42f338
push eax
mov dword [ebp - 0x1c], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
cmp dword [ebp + 8], 4
jae 0x40446e
lea ecx, [ebp - 0x48]
push 0x42f338
push ecx
mov dword [ebp - 0x48], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
lea edx, [ebp + 8]
push 0
push edx
add edi, 0x14
push 4
push edi
push ebx
call esi
test eax, eax
jne 0x404496
lea eax, [ebp - 0x20]
push 0x42f338
push eax
mov dword [ebp - 0x20], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
cmp dword [ebp + 8], 4
jae 0x4044b1
lea ecx, [ebp - 0x28]
push 0x42f338
push ecx
mov dword [ebp - 0x28], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
lea edx, [ebp - 0x74]
lea ecx, [ebp - 0xcc]
push edx
call fcn.00413990
lea eax, [ebp + 8]
push 0
push eax
lea ecx, [ebp - 0x74]
push 0x10
push ecx
push ebx
call esi
test eax, eax
jne 0x4044e8
lea edx, [ebp - 0x30]
push 0x42f338
push edx
mov dword [ebp - 0x30], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
cmp dword [ebp + 8], 0x10
jae 0x404503
lea eax, [ebp - 0x38]
push 0x42f338
push eax
mov dword [ebp - 0x38], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x5c]
test ecx, ecx
je 0x404540
mov al, byte [ecx - 1]
test al, al
je 0x404536
cmp al, 0xff
je 0x404536
dec al
mov byte [ecx - 1], al
mov al, 1
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 4
dec ecx
push ecx
call sub.MFC42.DLL_operatordelete
add esp, 4
mov al, 1
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 4