Function at 0x402040
Capabilities:
Check http status code
Create http request
Get common file path
Read data from internet
Receive data

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x538f3c
mov eax, dword fs:[0]
push eax
mov eax, 0x16e8
call fcn.00510c30
mov eax, dword [0x58d140]
xor eax, ebp
mov dword [ebp - 0x14], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov eax, dword [ebp + 8]
mov ebx, edx
mov edi, ecx
mov dword [ebp - 0x156c], eax
mov dword [ebp - 0x157c], ebx
call fcn.0040e25e
xor ecx, ecx
xor esi, esi
cmp eax, esi
setne cl
cmp ecx, esi
jne 0x4020a1
push 0x80004005
call fcn.00401670
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [ebp - 0x159c], eax
mov dword [ebp - 0x1598], esi
mov dword [ebp - 0x1594], esi
mov dword [ebp - 0x1590], esi
push edi
lea ecx, [ebp - 0x1588]
mov dword [ebp - 4], esi
call fcn.00405f00
push 0x56802c
lea ecx, [ebp - 0x1584]
mov byte [ebp - 4], 1
call fcn.00405e40
mov byte [ebp - 4], 2
mov eax, dword [edi]
cmp dword [eax - 0xc], esi
jl 0x4021b5
push str..com_
push eax
call fcn.0050eae8
add esp, 8
cmp eax, esi
je 0x4021b5
mov ecx, dword [edi]
sub eax, ecx
sar eax, 1
mov esi, eax
cmp esi, 0xffffffff
je 0x4021b3
mov eax, dword [ecx - 0xc]
sub eax, esi
sub eax, 4
push eax
lea ecx, [ebp - 0x1568]
push ecx
mov ecx, edi
call fcn.00402f60
push eax
lea ecx, [ebp - 0x1584]
mov byte [ebp - 4], 3
call fcn.00401600
mov byte [ebp - 4], 2
mov eax, dword [ebp - 0x1568]
add eax, 0xfffffff0
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x40216b
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
add esi, 4
push esi
lea ecx, [ebp - 0x1568]
push ecx
mov ecx, edi
call fcn.00402fe0
push eax
lea ecx, [ebp - 0x1588]
mov byte [ebp - 4], 4
call fcn.00401600
mov byte [ebp - 4], 2
mov eax, dword [ebp - 0x1568]
add eax, 0xfffffff0
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x4021b3
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
xor esi, esi
push 0x56802c
lea ecx, [ebp - 0x1580]
call fcn.00405e40
mov byte [ebp - 4], 5
mov eax, dword [edi]
push 0x2f
push eax
call fcn.0050eb48
add esp, 8
cmp eax, esi
je 0x402232
mov ecx, dword [edi]
sub eax, ecx
sar eax, 1
mov edx, eax
cmp edx, 0xffffffff
je 0x402232
mov eax, dword [ecx - 0xc]
sub eax, edx
dec eax
push eax
lea ecx, [ebp - 0x1568]
push ecx
mov ecx, edi
call fcn.00402f60
push eax
lea ecx, [ebp - 0x1580]
mov byte [ebp - 4], 6
call fcn.00401600
mov byte [ebp - 4], 5
mov eax, dword [ebp - 0x1568]
add eax, 0xfffffff0
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x402232
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea ecx, [ebp - 0x564]
push ecx
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
cmp eax, 0x104
ja 0x402a05
cmp eax, esi
je 0x402a05
lea edx, [ebp - 0x35c]
push edx
push esi
push 0x56802c
lea eax, [ebp - 0x564]
push eax
call dword [sym.imp.KERNEL32.dll_GetTempFileNameW]
cmp eax, esi
je 0x402990
lea ecx, [ebp - 0x35c]
push ecx
lea ecx, [ebp - 0x1574]
call fcn.00405e40
push 0x5679e4
push str..tmp
lea ecx, [ebp - 0x1574]
mov byte [ebp - 4], 0xa
call fcn.00402bd0
lea edx, [ebp - 0x1580]
push edx
lea eax, [ebp - 0x1574]
push eax
lea ecx, [ebp - 0x1568]
push ecx
call fcn.00403070
add esp, 0xc
push eax
lea ecx, [ebp - 0x1574]
mov byte [ebp - 4], 0xb
call fcn.00401600
mov byte [ebp - 4], 0xa
mov eax, dword [ebp - 0x1568]
add eax, 0xfffffff0
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x4022f7
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea ecx, [ebp - 0x1574]
push ecx
lea ecx, [ebp - 0x1568]
call fcn.00405f00
lea edx, [ebp - 0x1568]
mov byte [ebp - 4], 0xc
mov ecx, dword [ebp - 0x156c]
push edx
call fcn.00401600
mov byte [ebp - 4], 0xa
mov eax, dword [ebp - 0x1568]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x402345
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 5
mov eax, dword [ebp - 0x1574]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40236b
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
push esi
push esi
push esi
push esi
push str.AirInstaller
call dword [sym.imp.WININET.dll_InternetOpenW]
mov ebx, eax
mov dword [ebp - 0x1578], ebx
test ebx, ebx
jne 0x4024e1
push 0x5679e8
lea ecx, [ebp - 0x156c]
call fcn.00405e40
mov byte [ebp - 4], 0x10
mov eax, dword [eax]
mov ecx, dword [eax - 0xc]
push ecx
mov ecx, dword [ebp - 0x157c]
push eax
call fcn.00405870
mov byte [ebp - 4], 5
mov eax, dword [ebp - 0x156c]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x4023d6
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
push 0x56802c
lea ecx, [ebp - 0x1568]
call fcn.00405e40
mov esi, eax
mov bl, 0x11
push str.Upgrader_DownloadFileTemp___Connection_Failed.
lea ecx, [ebp - 0x156c]
mov byte [ebp - 4], bl
call fcn.00405e40
push esi
push eax
lea ecx, [ebp - 0x159c]
push ecx
mov edi, 1
mov byte [ebp - 4], 0x12
call fcn.00406e60
mov byte [ebp - 4], bl
mov eax, dword [ebp - 0x156c]
add eax, 0xfffffff0
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x402439
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 5
mov eax, dword [ebp - 0x1568]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40245f
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 2
mov eax, dword [ebp - 0x1580]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x402485
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 1
mov eax, dword [ebp - 0x1584]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x4024ab
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 0
mov eax, dword [ebp - 0x1588]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x4024d1
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea esi, [ebp - 0x159c]
call fcn.00401f90
jmp 0x402b7c
mov edi, dword [edi]
mov eax, dword [edi - 0xc]
push eax
push edi
call dword [sym.imp.OLEAUT32.dll_SysReAllocStringLen]
test eax, eax
jne 0x4024f7
call fcn.00401580
push 0
push 0x84400100
push 0
push 0
push eax
push ebx
call dword [sym.imp.WININET.dll_InternetOpenUrlW]
mov edi, eax
mov dword [ebp - 0x1574], edi
test edi, edi
jne 0x40262e
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0xa
lea ecx, [ebp - 0x34]
push ecx
push eax
call fcn.0052af9e
add esp, 0xc
lea edx, [ebp - 0x34]
push edx
lea ecx, [ebp - 0x1574]
call fcn.004057d0
mov esi, eax
push str._Failed_to_open_URL_Error:
lea ecx, [ebp - 0x1568]
mov byte [ebp - 4], 0x13
call fcn.00405e40
push esi
push eax
lea eax, [ebp - 0x156c]
push eax
mov byte [ebp - 4], 0x14
call fcn.00403070
add esp, 0xc
mov byte [ebp - 4], 0x15
mov eax, dword [eax]
mov ecx, dword [eax - 0xc]
push ecx
mov ecx, dword [ebp - 0x157c]
push eax
call fcn.00405870
lea ecx, [ebp - 0x156c]
call fcn.004016e0
lea ecx, [ebp - 0x1568]
call fcn.004016e0
lea ecx, [ebp - 0x1574]
mov byte [ebp - 4], 5
call fcn.004016e0
lea ecx, [ebp - 0x34]
push ecx
lea ecx, [ebp - 0x1568]
call fcn.004057d0
mov esi, eax
push str.Upgrader_DownloadFileTemp___Failed_to_open_URL_Error:
lea ecx, [ebp - 0x156c]
mov byte [ebp - 4], 0x16
call fcn.00405e40
push esi
push eax
lea edx, [ebp - 0x159c]
push edx
mov edi, 1
mov byte [ebp - 4], 0x17
call fcn.00406e60
lea ecx, [ebp - 0x156c]
call fcn.004016e0
lea ecx, [ebp - 0x1568]
call fcn.004016e0
push ebx
call dword [sym.imp.WININET.dll_InternetCloseHandle]
lea ecx, [ebp - 0x1580]
call fcn.004016e0
lea ecx, [ebp - 0x1584]
call fcn.004016e0
lea ecx, [ebp - 0x1588]
call fcn.004016e0
lea esi, [ebp - 0x159c]
call fcn.00401f90
jmp 0x402b7c
mov ebx, dword [ebp - 0x156c]
mov eax, dword [ebx]
push 0x10
push eax
lea eax, [ebp - 0x16f4]
push eax
call fcn.004036b0
mov byte [ebp - 4], 0x18
cmp dword [ebp - 0x169c], 0
je 0x40265d
lea esi, [ebp - 0x16f4]
call fcn.004037c0
mov eax, dword [ebx]
push 0x2a
push eax
lea ecx, [ebp - 0x164c]
push ecx
call fcn.004036b0
mov byte [ebp - 4], 0x19
cmp dword [ebp - 0x15f4], 0
je 0x402712
push 0
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov esi, dword [sym.imp.WININET.dll_InternetReadFile]
lea edx, [ebp - 0x1568]
push edx
push 0x1000
lea eax, [ebp - 0x1564]
push eax
push edi
mov dword [ebp - 0x1568], 0
call esi
test eax, eax
je 0x4026eb
mov eax, dword [ebp - 0x1568]
test eax, eax
je 0x4026eb
push 0
push eax
lea ecx, [ebp - 0x1564]
push ecx
lea edx, [ebp - 0x164c]
push edx
call fcn.00403190
lea eax, [ebp - 0x1568]
push eax
push 0x1000
lea ecx, [ebp - 0x1564]
push ecx
push edi
call esi
test eax, eax
jne 0x4026b1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0xa
lea edx, [ebp - 0x34]
push edx
push eax
call fcn.0052af9e
add esp, 0xc
lea esi, [ebp - 0x164c]
call fcn.004037c0
mov bl, 1
jmp 0x4027a6
push str._DownloadFile___failed_to_write_to_file.
lea ecx, [ebp - 0x1568]
xor bl, bl
call fcn.00405e40
mov byte [ebp - 4], 0x1a
mov eax, dword [eax]
mov ecx, dword [eax - 0xc]
push ecx
mov ecx, dword [ebp - 0x157c]
push eax
call fcn.00405870
lea ecx, [ebp - 0x1568]
mov byte [ebp - 4], 0x19
call fcn.004016e0
push 0x56802c
lea ecx, [ebp - 0x1570]
call fcn.00405e40
mov esi, eax
push str.Upgrader_DownloadFileTemp___failed_to_write_to_file.
lea ecx, [ebp - 0x1568]
mov byte [ebp - 4], 0x1b
call fcn.00405e40
push esi
push eax
lea eax, [ebp - 0x159c]
push eax
mov edi, 1
mov byte [ebp - 4], 0x1c
call fcn.00406e60
lea ecx, [ebp - 0x1568]
call fcn.004016e0
lea ecx, [ebp - 0x1570]
mov byte [ebp - 4], 0x19
call fcn.004016e0
mov edi, dword [ebp - 0x1574]
push 0
lea ecx, [ebp - 0x15a0]
push ecx
lea edx, [ebp - 0x154]
push edx
push 0x13
push edi
mov dword [ebp - 0x15a0], 0x100
call dword [sym.imp.WININET.dll_HttpQueryInfoW]
test eax, eax
je 0x40286c
lea edi, [ebp - 0x154]
lea esi, [ebp - 0x54]
call fcn.00402ba0
mov eax, esi
push eax
call fcn.0050eadd
add esp, 4
cmp eax, 0x194
jne 0x402809
push str._DownloadFile___failed_404.
lea ecx, [ebp - 0x1570]
xor bl, bl
call fcn.00405e40
mov byte [ebp - 4], 0x1d
jmp 0x402845
cmp eax, 0x1f6
jne 0x402828
push str._DownloadFile___failed_502.
lea ecx, [ebp - 0x1570]
xor bl, bl
call fcn.00405e40
mov byte [ebp - 4], 0x1e
jmp 0x402845
cmp eax, 0x1f8
jne 0x402866
push str._DownloadFile___failed_504.
lea ecx, [ebp - 0x1570]
xor bl, bl
call fcn.00405e40
mov byte [ebp - 4], 0x1f
mov eax, dword [eax]
mov ecx, dword [eax - 0xc]
push ecx
mov ecx, dword [ebp - 0x157c]
push eax
call fcn.00405870
lea ecx, [ebp - 0x1570]
mov byte [ebp - 4], 0x19
call fcn.004016e0
mov edi, dword [ebp - 0x1574]
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
push edi
call esi
mov ecx, dword [ebp - 0x1578]
push ecx
call esi
mov esi, dword [ebp - 0x156c]
call fcn.00405f90
test al, al
jne 0x40293f
push str._DownloadFile___copy_file_failed.
lea ecx, [ebp - 0x1578]
xor bl, bl
call fcn.00405e40
mov edi, dword [ebp - 0x157c]
mov byte [ebp - 4], 0x20
mov eax, dword [eax]
mov ecx, dword [eax - 0xc]
push ecx
push eax
mov ecx, edi
call fcn.00405870
lea ecx, [ebp - 0x1578]
mov byte [ebp - 4], 0x19
call fcn.004016e0
push edi
lea ecx, [ebp - 0x156c]
call fcn.00405f00
push esi
lea edx, [ebp - 0x156c]
push edx
lea eax, [ebp - 0x1570]
push eax
mov byte [ebp - 4], 0x21
call fcn.00403070
add esp, 0xc
mov esi, eax
push str.Upgrader_DownloadFileTemp___copy_file_failed.
lea ecx, [ebp - 0x1578]
mov byte [ebp - 4], 0x22
call fcn.00405e40
push esi
push eax
lea ecx, [ebp - 0x159c]
push ecx
mov edi, 1
mov byte [ebp - 4], 0x23
call fcn.00406e60
lea ecx, [ebp - 0x1578]
call fcn.004016e0
lea ecx, [ebp - 0x1570]
call fcn.004016e0
lea ecx, [ebp - 0x156c]
call fcn.004016e0
lea ecx, [ebp - 0x164c]
mov byte [ebp - 4], 0x18
call fcn.00401fc0
lea ecx, [ebp - 0x16f4]
mov byte [ebp - 4], 5
call fcn.00401fc0
lea ecx, [ebp - 0x1580]
call fcn.004016e0
lea ecx, [ebp - 0x1584]
call fcn.004016e0
lea ecx, [ebp - 0x1588]
call fcn.004016e0
lea esi, [ebp - 0x159c]
call fcn.00401f90
mov al, bl
jmp 0x402b7e
push str._DownloadFile___failed_to_get_temp_file.
lea ecx, [ebp - 0x1578]
call fcn.00405e40
mov byte [ebp - 4], 0xd
mov eax, dword [eax]
mov ecx, dword [eax - 0xc]
push ecx
push eax
mov ecx, ebx
call fcn.00405870
mov byte [ebp - 4], 5
mov eax, dword [ebp - 0x1578]
add eax, 0xfffffff0
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x4029d8
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
push 0x56802c
lea ecx, [ebp - 0x1570]
call fcn.00405e40
mov esi, eax
mov bl, 0xe
push str.Upgrader_DownloadFileTemp___failed_to_get_temp_file.
lea ecx, [ebp - 0x1578]
mov byte [ebp - 4], bl
call fcn.00405e40
mov byte [ebp - 4], 0xf
jmp 0x402a78
push str._DownloadFile___failed_to_get_temp_path.
lea ecx, [ebp - 0x1578]
call fcn.00405e40
mov byte [ebp - 4], 7
mov eax, dword [eax]
mov ecx, dword [eax - 0xc]
push ecx
push eax
mov ecx, ebx
call fcn.00405870
mov byte [ebp - 4], 5
mov eax, dword [ebp - 0x1578]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x402a4d
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
push 0x56802c
lea ecx, [ebp - 0x1570]
call fcn.00405e40
mov esi, eax
mov bl, 8
push str.Upgrader_DownloadFileTemp___get_temp_path_failed.
lea ecx, [ebp - 0x1578]
mov byte [ebp - 4], bl
call fcn.00405e40
mov byte [ebp - 4], 9
push esi
push eax
lea ecx, [ebp - 0x159c]
push ecx
mov edi, 1
call fcn.00406e60
mov byte [ebp - 4], bl
mov eax, dword [ebp - 0x1578]
add eax, 0xfffffff0
or ecx, 0xffffffff
lea edx, [eax + 0xc]
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x402ab0
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 5
mov eax, dword [ebp - 0x1570]
add eax, 0xfffffff0
or edx, 0xffffffff
lea ecx, [eax + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x402ad6
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 2
mov eax, dword [ebp - 0x1580]
add eax, 0xfffffff0
or edx, 0xffffffff
lea ecx, [eax + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x402afc
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 1
mov eax, dword [ebp - 0x1584]
add eax, 0xfffffff0
or edx, 0xffffffff
lea ecx, [eax + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x402b22
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 0
mov eax, dword [ebp - 0x1588]
add eax, 0xfffffff0
or edx, 0xffffffff
lea ecx, [eax + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x402b48
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea ebx, [ebp - 0x1598]
mov dword [ebp - 4], 0xffffffff
call fcn.004044d0
mov eax, dword [ebp - 0x159c]
add eax, 0xfffffff0
or edx, 0xffffffff
lea ecx, [eax + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x402b7c
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
xor al, al
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x14]
xor ecx, ebp
call fcn.0050e0a7
mov esp, ebp
pop ebp
ret 4