Function at 0x405370
Capabilities:
Create thread

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
mov eax, 0x1018
call fcn.0041d5c0
mov eax, dword [0x42c004]
xor eax, esp
mov dword [esp + 0x1014], eax
push esi
push edi
mov edi, ecx
mov dword [esp + 0x14], 0
test edi, edi
jne 0x4053c2
push str.ERROR:_Invalid_FDR_client_n
call fcn.004035a0
add esp, 4
or eax, 0xffffffff
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push 0x4e20
lea eax, [esp + 0x18]
push eax
push 2
lea eax, [esp + 0x1c]
push eax
push dword [edi]
call dword [sym.imp.imobiledevice.dll_idevice_connection_receive_timeout]
add esp, 0x14
test eax, eax
jne 0x4057a8
cmp dword [esp + 0x14], 2
je 0x405411
push edi
push str.FDR__p_timeout_waiting_for_command_n
call fcn.00403610
add esp, 8
xor eax, eax
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
mov ax, word [esp + 0x10]
cmp ax, 1
jne 0x405550
push edi
push str.FDR__p_got_sync_message_n
call fcn.00403610
lea eax, [esp + 0x14]
mov dword [esp + 0x14], 0
push eax
push 0x1000
lea eax, [esp + 0x28]
push eax
push dword [edi]
call dword [sym.imp.imobiledevice.dll_idevice_connection_receive]
add esp, 0x18
test eax, eax
jne 0x40552a
cmp dword [esp + 0xc], 2
jne 0x40552a
mov ecx, dword [edi + 4]
lea eax, [esp + 8]
push eax
mov edx, 1
call fcn.00405220
add esp, 4
test eax, eax
je 0x40549f
push str.ERROR:_Failed_to_connect_to_FDR_port_n
call fcn.004035a0
add esp, 4
or edi, 0xffffffff
mov eax, edi
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push str.FDR_connected_in_reply_to_sync_message__starting_command_thread_n
call fcn.00403610
mov esi, dword [esp + 0xc]
add esp, 4
push 0
push 0
push esi
push 0x4057e0
push 0
push 0
call dword [sym.imp.KERNEL32.dll_CreateThread]
test eax, eax
jne 0x405512
push str.ERROR:_Failed_to_start_FDR_command_thread_n
or edi, 0xffffffff
call fcn.004035a0
add esp, 4
test esi, esi
je 0x40553a
mov eax, dword [esi]
test eax, eax
je 0x4054f2
push eax
mov dword [esi], 0
call dword [sym.imp.imobiledevice.dll_idevice_disconnect]
add esp, 4
push esi
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
mov eax, edi
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
xor edi, edi
mov eax, edi
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push str.ERROR:_Unexpected_data_from_FDR_n
call fcn.004035a0
add esp, 4
or edi, 0xffffffff
mov eax, edi
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
mov ecx, 0x105
cmp ax, cx
jne 0x405583
push edi
push str.FDR__p_got_proxy_message_n
call fcn.00403610
add esp, 8
mov ecx, edi
call fcn.004060c0
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
mov ecx, 0xbbaa
cmp ax, cx
jne 0x40577e
push edi
push str.FDR__p_got_plist_message_n
call fcn.00403610
add esp, 8
lea edx, [esp + 8]
mov ecx, edi
call fcn.00405860
test eax, eax
je 0x4055d3
push edi
push str.ERROR:_FDR__p_could_not_receive_plist_command._n
call fcn.004035a0
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push str.Command
push dword [esp + 0xc]
call dword [sym.imp.plist.dll_plist_dict_get_item]
mov esi, eax
add esp, 8
test esi, esi
je 0x40574f
push esi
call dword [sym.imp.plist.dll_plist_get_node_type]
add esp, 4
cmp eax, 3
jne 0x40574f
lea eax, [esp + 0xc]
mov dword [esp + 0xc], 0
push eax
push esi
call dword [sym.imp.plist.dll_plist_get_string_val]
push dword [esp + 0x10]
call dword [sym.imp.plist.dll_plist_free]
mov esi, dword [esp + 0x18]
add esp, 0xc
test esi, esi
jne 0x405650
push edi
push str.FDR__p_received_empty_plist_command_n
call fcn.00403550
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
mov ecx, str.Ping
mov eax, esi
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x405677
test dl, dl
je 0x405673
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x405677
add eax, 2
add ecx, 2
test dl, dl
jne 0x405657
xor eax, eax
jmp 0x40567c
sbb eax, eax
or eax, 1
test eax, eax
jne 0x40571c
call dword [sym.imp.plist.dll_plist_new_dict]
push 1
mov dword [esp + 0xc], eax
call dword [sym.imp.plist.dll_plist_new_bool]
add esp, 4
push eax
push str.Pong
push dword [esp + 0x10]
call dword [sym.imp.plist.dll_plist_dict_set_item]
mov edx, dword [esp + 0x14]
add esp, 0xc
mov ecx, edi
call fcn.00405970
push dword [esp + 8]
mov esi, eax
call dword [sym.imp.plist.dll_plist_free]
add esp, 4
test esi, esi
je 0x4056f9
push edi
push str.ERROR:_FDR__p_could_not_send_Ping_command_reply._n
call fcn.004035a0
push dword [esp + 0x14]
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 0xc
or eax, 0xffffffff
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push dword [esp + 0xc]
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
xor eax, eax
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push esi
push edi
push str.WARNING:_FDR__p_received_unknown_plist_command:__s_n
call fcn.004035a0
add esp, 0xc
push dword [esp + 0xc]
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
or eax, 0xffffffff
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push edi
push str.ERROR:_FDR__p_Could_not_find_Command_in_plist_command_n
call fcn.004035a0
push dword [esp + 0x10]
call dword [sym.imp.plist.dll_plist_free]
add esp, 0xc
or eax, 0xffffffff
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
push 2
movzx eax, ax
push eax
push edi
push str.WARNING:_FDR__p_received_unknown_packet__x_of_size__u_n
call fcn.004035a0
add esp, 0x10
xor eax, eax
pop edi
pop esi
mov ecx, dword [esp + 0x1014]
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
cmp dword [edi], 0
je 0x4057c2
push 2
push dword [esp + 0x18]
push eax
push edi
push str.ERROR:_Unable_to_receive_message_from_FDR__p___d_.__u__u_bytes_n
call fcn.004035a0
add esp, 0x14
mov ecx, dword [esp + 0x101c]
or eax, 0xffffffff
pop edi
pop esi
xor ecx, esp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret