Function at 0x4065d0
Capabilities:
Read file on windows

Disassembly:
sub esp, 0x84
mov eax, dword [esp + 0x88]
push ebx
push ebp
push esi
push edi
push 0x410458
push eax
call dword [sym.imp.MSVCRT.dll_fopen]
add esp, 8
mov dword [esp + 0x10], eax
test eax, eax
jne 0x40665e
mov ebp, dword [esp + 0xa0]
test ebp, ebp
je 0x406651
call dword [sym.imp.MSVCRT.dll__errno]
mov ecx, dword [eax]
push ecx
call dword [sym.imp.MSVCRT.dll_strerror]
mov esi, eax
or ecx, 0xffffffff
mov edi, esi
xor eax, eax
add esp, 4
repne scasb al, byte es:[edi]
not ecx
dec ecx
push 1
mov ebx, ecx
mov ecx, ebp
push ebx
call dword [sym.imp.MSVCP60.dll_private:_bool___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Grow_unsigned_int__bool_]
test al, al
je 0x406651
mov edi, dword [ebp + 4]
mov ecx, ebx
mov edx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, dword [ebp + 4]
mov dword [ebp + 8], ebx
mov byte [eax + ebx], 0
pop edi
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x84
ret
mov eax, dword [esp + 0xa4]
test eax, eax
je 0x406671
mov ecx, dword [eax]
mov dword [esp + 0x14], ecx
jmp 0x406679
mov dword [esp + 0x14], 0
mov ebx, dword [esp + 0x9c]
xor edx, edx
mov dword [esp + 0x1d], edx
mov eax, dword [sym.imp.MSVCP60.dll_unsigned_int_const_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::npos]
mov esi, dword [ebx + 4]
mov dword [esp + 0x21], edx
mov dword [esp + 0x25], edx
mov byte [esp + 0x1c], 0
mov dword [esp + 0x29], edx
mov word [esp + 0x2d], dx
mov byte [esp + 0x2f], dl
mov ebp, dword [eax]
test esi, esi
je 0x4066d9
mov al, byte [esi - 1]
test al, al
je 0x4066d9
cmp al, 0xff
je 0x4066d9
push 1
mov ecx, ebx
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, esi
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
push ecx
push esi
mov ecx, ebx
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_char_const___unsigned_int_]
mov eax, dword [ebx + 8]
cmp eax, ebp
jae 0x4066e2
mov ebp, eax
test ebp, ebp
jbe 0x406718
mov ecx, dword [ebx + 4]
sub eax, ebp
push eax
lea edx, [ecx + ebp]
push edx
push ecx
call dword [sym.imp.MSVCRT.dll_memmove]
mov edi, dword [ebx + 8]
add esp, 0xc
sub edi, ebp
mov ecx, ebx
push 0
push edi
call dword [sym.imp.MSVCP60.dll_private:_bool___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Grow_unsigned_int__bool_]
test al, al
je 0x406718
mov eax, dword [ebx + 4]
mov dword [ebx + 8], edi
mov byte [eax + edi], 0
mov edi, dword [esp + 0x10]
mov esi, dword [sym.imp.MSVCRT.dll_fseek]
push 2
push 0
push edi
call esi
push edi
call dword [sym.imp.MSVCRT.dll_ftell]
push 0
push 0
push edi
mov ebp, eax
call esi
add esp, 0x1c
test ebp, ebp
je 0x406793
push ebp
call sub.MFC42.DLL_operatornew
push edi
mov esi, eax
push 1
push ebp
push esi
mov dword [esp + 0x2c], esi
call dword [sym.imp.MSVCRT.dll_fread]
add esp, 0x14
mov ecx, ebx
push 1
push ebp
call dword [sym.imp.MSVCP60.dll_private:_bool___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Grow_unsigned_int__bool_]
test al, al
je 0x40678a
mov edi, dword [ebx + 4]
mov ecx, ebp
mov edx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, dword [ebx + 4]
mov esi, dword [esp + 0x18]
mov dword [ebx + 8], ebp
mov byte [eax + ebp], 0
push esi
call sub.MFC42.DLL_operatordelete
add esp, 4
lea ecx, [esp + 0x1c]
push ebp
push ecx
lea edx, [esp + 0x38]
push str._s_d_bytes
push edx
call dword [sym.imp.MSVCRT.dll_sprintf]
mov ebx, dword [esp + 0xb0]
add esp, 0x10
test ebx, ebx
je 0x406853
lea edi, [esp + 0x30]
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
mov ebp, ecx
mov ecx, ebx
call dword [sym.imp.MSVCP60.dll_public:_unsigned_int___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::max_size_void_const]
cmp eax, ebp
jae 0x4067dd
call dword [sym.imp.MSVCP60.dll_void___cdecl_std::_Xlen_void_]
mov ecx, dword [ebx + 4]
test ecx, ecx
je 0x406803
mov al, byte [ecx - 1]
test al, al
je 0x406803
cmp al, 0xff
je 0x406803
test ebp, ebp
jne 0x406829
dec al
push ebp
mov byte [ecx - 1], al
mov ecx, ebx
call dword [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Tidy_bool_]
jmp 0x406853
test ebp, ebp
jne 0x406813
push 1
mov ecx, ebx
call dword [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Tidy_bool_]
jmp 0x406853
mov eax, dword [ebx + 0xc]
cmp eax, 0x1f
ja 0x40681f
cmp eax, ebp
jae 0x406832
push 1
mov ecx, ebx
call dword [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Tidy_bool_]
push ebp
mov ecx, ebx
call dword [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::_Copy_unsigned_int_]
mov edi, dword [ebx + 4]
mov ecx, ebp
mov eax, ecx
lea esi, [esp + 0x30]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [ebx + 4]
mov dword [ebx + 8], ebp
mov byte [ecx + ebp], 0
mov edx, dword [esp + 0x10]
push edx
call dword [sym.imp.MSVCRT.dll_fclose]
mov eax, dword [esp + 0xa8]
add esp, 4
test eax, eax
je 0x406872
mov ecx, dword [esp + 0x14]
mov dword [eax], ecx
pop edi
pop esi
pop ebp
mov al, 1
pop ebx
add esp, 0x84
ret