Function at 0x40fae0
Capabilities:
Delete file

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x24c
mov eax, dword [0x42c004]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0xc]
push ebx
push esi
mov esi, dword [ebp + 8]
mov ebx, ecx
push edi
push 0x2f
push ebx
mov dword [ebp - 0x23c], edx
mov dword [ebp - 0x248], eax
call dword [sym.imp.VCRUNTIME140.dll_strrchr]
mov edi, eax
add esp, 8
test edi, edi
jne 0x40fb3d
push str.ERROR:_cant_get_local_filename_for_firmware_ipsw_n
call fcn.004035a0
add esp, 4
lea eax, [edi - 2]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
inc edi
lea eax, [ebp - 0x118]
push edi
test esi, esi
je 0x40fb5a
push esi
push str._s__s
push eax
call fcn.00406ee0
add esp, 0x10
jmp 0x40fb68
push 0x4240d8
push eax
call fcn.00406ee0
add esp, 0xc
lea eax, [ebp - 0x118]
push eax
lea eax, [ebp - 0x220]
push str._s.lock
push eax
call fcn.00406ee0
add esp, 0xc
lea eax, [ebp - 0x220]
push 0
push 0x80
push 4
push 0
push 3
push 0xc0000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebp - 0x238], eax
cmp eax, 0xffffffff
jne 0x40fbc3
lea eax, [ebp - 0x220]
push eax
push str.ERROR:_could_not_open_or_create_lockfile__s_n
call fcn.00403610
add esp, 8
jmp 0x40fc1b
lea ecx, [ebp - 0x234]
mov dword [ebp - 0x22c], 0
push ecx
push 0
push 1
push 0
push 2
push eax
mov dword [ebp - 0x228], 0
call dword [sym.imp.KERNEL32.dll_LockFileEx]
test eax, eax
jne 0x40fc2f
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR:_cant_lock_file__error__d_n
call fcn.00403610
add esp, 8
push dword [ebp - 0x238]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [ebp - 0x238], 0xffffffff
lea eax, [ebp - 0x220]
push eax
push str.WARNING:_Could_not_lock_file__s_n
call fcn.004035a0
add esp, 8
lea eax, [ebp - 0x118]
mov dword [ebp - 0x244], 0
xorps xmm0, xmm0
mov dword [ebp - 8], 0
push 0x41e700
push eax
movups xmmword [ebp - 0x18], xmm0
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fopen]
add esp, 8
mov dword [ebp - 0x240], eax
test eax, eax
je 0x40fcf7
mov edx, dword [ebp - 0x23c]
lea ecx, [ebp - 0x18]
mov esi, 0x10
mov eax, dword [ecx]
cmp eax, dword [edx]
jne 0x40fc91
add ecx, 4
add edx, 4
sub esi, 4
jae 0x40fc78
mov esi, dword [ebp - 0x240]
jmp 0x40fcdf
lea eax, [ebp - 0x118]
push eax
push str.Verifying__s..._n
call fcn.00403550
mov esi, dword [ebp - 0x240]
add esp, 8
mov edx, dword [ebp - 0x23c]
mov ecx, esi
call fcn.0040f9d0
test eax, eax
je 0x40fcc8
push str.Checksum_matches._n
call fcn.00403550
jmp 0x40fcdc
push str.Checksum_does_not_match._n
call fcn.00403550
mov dword [ebp - 0x244], 1
add esp, 4
push esi
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
xor esi, esi
add esp, 4
cmp dword [ebp - 0x244], esi
je 0x40fe2b
push 0xa
push str.protected:
push ebx
call dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_strncmp]
add esp, 0xc
test eax, eax
jne 0x40fd24
push edi
push str.ERROR:_Cant_download__s_because_it_needs_a_purchase._n
call fcn.004035a0
add esp, 8
mov esi, 0xfffffffd
jmp 0x40fe43
mov edi, dword [sym.imp.api_ms_win_crt_filesystem_l1_1_0.dll_remove]
lea eax, [ebp - 0x118]
push eax
call edi
add esp, 4
push ebx
push str.Downloading_firmware___s__n
call fcn.00403550
push 1
lea edx, [ebp - 0x118]
mov ecx, ebx
call fcn.004050b0
mov ebx, dword [ebp - 0x23c]
lea edx, [ebp - 0x18]
add esp, 0xc
mov ecx, ebx
mov esi, 0x10
mov eax, dword [ecx]
cmp eax, dword [edx]
jne 0x40fd78
add ecx, 4
add edx, 4
sub esi, 4
jae 0x40fd63
xor eax, eax
jmp 0x40fd9d
cmp al, byte [edx]
jne 0x40fd98
mov al, byte [ecx + 1]
cmp al, byte [edx + 1]
jne 0x40fd98
mov al, byte [ecx + 2]
cmp al, byte [edx + 2]
jne 0x40fd98
mov al, byte [ecx + 3]
cmp al, byte [edx + 3]
jne 0x40fd98
xor eax, eax
jmp 0x40fd9d
sbb eax, eax
or eax, 1
xor esi, esi
test eax, eax
je 0x40fe2b
lea eax, [ebp - 0x118]
push eax
push str._nVerifying__s..._n
call fcn.00403550
lea eax, [ebp - 0x118]
push 0x41e700
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fopen]
mov esi, eax
add esp, 0x10
test esi, esi
je 0x40fecc
mov edx, ebx
mov ecx, esi
call fcn.0040f9d0
test eax, eax
je 0x40fdff
push str.Checksum_matches._n
call fcn.00403550
add esp, 4
push esi
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
add esp, 4
xor esi, esi
jmp 0x40fe27
push str.ERROR:_File_download_failed__checksum_mismatch_._n
call fcn.004035a0
add esp, 4
push esi
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
add esp, 4
lea eax, [ebp - 0x118]
push eax
call edi
add esp, 4
mov esi, 0xfffffffc
test esi, esi
jne 0x40fe43
lea eax, [ebp - 0x118]
push eax
call dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll__strdup]
mov ecx, dword [ebp - 0x248]
add esp, 4
mov dword [ecx], eax
mov eax, dword [ebp - 0x238]
cmp eax, 0xffffffff
je 0x40fea5
lea ecx, [ebp - 0x234]
mov dword [ebp - 0x22c], 0
push ecx
push 0
push 1
push 0
push eax
mov dword [ebp - 0x228], 0
call dword [sym.imp.KERNEL32.dll_UnlockFileEx]
test eax, eax
jne 0x40feea
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR:_cant_unlock_file__error__d_n
call fcn.00403610
mov eax, dword [sym.imp.KERNEL32.dll_CloseHandle]
add esp, 8
push dword [ebp - 0x238]
call eax
mov dword [ebp - 0x238], 0xffffffff
lea eax, [ebp - 0x220]
push eax
push str.WARNING:_Could_not_unlock_file__s_n
call fcn.004035a0
add esp, 8
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0041c84a
mov esp, ebp
pop ebp
ret
lea eax, [ebp - 0x118]
push eax
push str.ERROR:_Cant_open__s_for_checksum_verification_n
call fcn.004035a0
add esp, 8
mov esi, 0xfffffffb
jmp 0x40fe43
push dword [ebp - 0x238]
mov eax, dword [sym.imp.KERNEL32.dll_CloseHandle]
call eax
mov ecx, dword [ebp - 4]
mov eax, esi
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0041c84a
mov esp, ebp
pop ebp
ret