Function at 0x40a220
Capabilities:
Clear file content
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x42b052
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x48
mov al, byte [ebp + 0xf]
push ebx
push esi
push edi
mov esi, ecx
mov dword [ebp - 0x10], esp
push 0
lea ecx, [ebp - 0x54]
mov dword [ebp - 4], 0
mov byte [ebp - 0x54], 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 edi, dword [ebp + 8]
push 0x4373e8
push edi
mov byte [ebp - 4], 1
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 0x40a286
lea eax, [esi + 4]
push eax
jmp 0x40a287
push edi
lea ecx, [ebp - 0x54]
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 - 0x50]
test eax, eax
jne 0x40a29c
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 edi, eax
cmp edi, 0xffffffff
mov dword [ebp - 0x40], edi
jne 0x40a2d4
lea eax, [ebp - 0x1c]
push 0x42f348
push eax
mov dword [ebp - 0x1c], str.open_file_error_n
call sub.MSVCRT.dll__CxxThrowException
push edi
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
mov bl, byte [ebp + 0xc]
test bl, bl
je 0x40a2e7
mov eax, dword [esi + 0x24]
jmp 0x40a2ea
mov eax, dword [esi + 0x34]
lea ecx, [ebp - 0x14]
push 0
push ecx
lea edx, [ebp - 0x18]
push 4
push edx
push edi
mov dword [ebp - 0x18], eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x40a319
lea eax, [ebp - 0x20]
push 0x42f348
push eax
mov dword [ebp - 0x20], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
cmp dword [ebp - 0x14], 4
jae 0x40a334
lea ecx, [ebp - 0x24]
push 0x42f348
push ecx
mov dword [ebp - 0x24], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
test bl, bl
jne 0x40a381
mov ebx, dword [sym.imp.KERNEL32.dll_WriteFile]
lea edx, [ebp - 0x14]
push 0
push edx
lea eax, [esi + 0x14]
push 4
push eax
push edi
call ebx
test eax, eax
jne 0x40a366
lea ecx, [ebp - 0x28]
push 0x42f348
push ecx
mov dword [ebp - 0x28], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
cmp dword [ebp - 0x14], 4
jae 0x40a391
lea edx, [ebp - 0x2c]
push 0x42f348
push edx
mov dword [ebp - 0x2c], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
mov eax, dword [esi + 0x1c]
mov ebx, dword [sym.imp.KERNEL32.dll_WriteFile]
mov dword [ebp + 0xc], eax
mov esi, dword [eax]
jmp 0x40a399
mov eax, dword [esi + 0x2c]
mov dword [ebp + 0xc], eax
mov esi, dword [eax]
cmp esi, dword [ebp + 0xc]
je 0x40a450
mov eax, dword [esi + 0xc]
lea ecx, [ebp - 0x14]
push 0
push ecx
lea edx, [ebp + 8]
push 4
push edx
push edi
mov dword [ebp + 8], eax
call ebx
test eax, eax
jne 0x40a3d0
lea eax, [ebp - 0x30]
push 0x42f348
push eax
mov dword [ebp - 0x30], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
cmp dword [ebp - 0x14], 4
jae 0x40a3eb
lea ecx, [ebp - 0x34]
push 0x42f348
push ecx
mov dword [ebp - 0x34], str.Write_error_n
call sub.MSVCRT.dll__CxxThrowException
lea ecx, [ebp - 0x3c]
call dword [sym.imp.MSVCP60.dll_public:_void___thiscall_std::_Lockit::constructor_void_]
mov eax, dword [esi + 8]
mov ecx, dword [0x437464]
cmp eax, ecx
mov byte [ebp - 4], 2
je 0x40a42b
lea ecx, [ebp - 0x38]
mov esi, eax
call dword [sym.imp.MSVCP60.dll_public:_void___thiscall_std::_Lockit::constructor_void_]
mov ecx, dword [0x437464]
mov eax, dword [esi]
cmp eax, ecx
je 0x40a420
mov esi, eax
jmp 0x40a416
lea ecx, [ebp - 0x38]
call dword [sym.imp.MSVCP60.dll_public:_void___thiscall_std::_Lockit::destructor_void_]
jmp 0x40a43e
mov eax, dword [esi + 4]
cmp esi, dword [eax + 8]
jne 0x40a437
mov esi, eax
jmp 0x40a42b
cmp dword [esi + 8], eax
je 0x40a43e
mov esi, eax
lea ecx, [ebp - 0x3c]
mov byte [ebp - 4], 1
call dword [sym.imp.MSVCP60.dll_public:_void___thiscall_std::_Lockit::destructor_void_]
jmp 0x40a399
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x50]
test ecx, ecx
je 0x40a48d
mov al, byte [ecx - 1]
test al, al
je 0x40a483
cmp al, 0xff
je 0x40a483
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 8
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 8