Function at 0x4016d0
Capabilities:
Check http status code
Clear file content
Get file size
Initialize winhttp library
Prepare http request
Read http header
Receive http response
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x7c
mov eax, dword [0x42c00c]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
mov esi, ecx
push edi
xor edi, edi
mov eax, dword [esi]
mov dword [esi + 0x20], edi
test eax, eax
je 0x4016fb
mov dword [ebp - 0x70], 3
cmp dword [eax], edi
jne 0x4016fe
mov dword [ebp - 0x70], edi
test eax, eax
je 0x401708
mov ebx, dword [eax]
test ebx, ebx
jne 0x40170a
xor ebx, ebx
push 0
lea eax, [ebp - 0x68]
mov dword [ebp - 0x68], edi
push eax
push 0x7d0
push 0x400000
call dword [sym.imp.USER32.dll_LoadStringW]
push 0
push 0
push ebx
push dword [ebp - 0x70]
push dword [ebp - 0x68]
call dword [sym.imp.WINHTTP.dll_WinHttpOpen]
mov dword [ebp - 0x70], eax
test eax, eax
jne 0x401748
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
jmp 0x401a94
push 0
push 0
push dword [esi + 8]
push eax
call dword [sym.imp.WINHTTP.dll_WinHttpConnect]
mov ecx, eax
mov dword [ebp - 0x78], ecx
test ecx, ecx
jne 0x40176c
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
jmp 0x401a8b
cmp dword [esi + 4], edi
mov edx, 0x800008
mov eax, 8
cmovne eax, edx
push eax
push 0
push 0
push 0
push dword [esi + 0xc]
push dword [esi + 0x10]
push ecx
call dword [sym.imp.WINHTTP.dll_WinHttpOpenRequest]
mov ebx, eax
mov dword [ebp - 0x74], ebx
test ebx, ebx
jne 0x4017a6
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
jmp 0x401a82
mov ecx, dword [esi]
test ecx, ecx
je 0x4017e3
mov edx, dword [ecx + 4]
test edx, edx
je 0x4017e3
xor eax, eax
mov dword [ebp - 0x4c], 2
push 0
push dword [ecx + 0xc]
cmp edx, 1
push dword [ecx + 8]
sete al
cmp edx, 8
cmove eax, dword [ebp - 0x4c]
push eax
push 1
push ebx
call dword [sym.imp.WINHTTP.dll_WinHttpSetCredentials]
test eax, eax
je 0x401a73
cmp dword [esi + 4], edi
je 0x40183e
push 4
lea eax, [ebp - 0x4c]
mov dword [ebp - 0x4c], 0x80
push eax
push 0x54
push dword [ebp - 0x70]
call dword [sym.imp.WINHTTP.dll_WinHttpSetOption]
test eax, eax
je 0x401a73
or dword [ebp - 0x4c], 0x200
lea eax, [ebp - 0x4c]
push 4
push eax
push 0x54
push dword [ebp - 0x70]
call dword [sym.imp.WINHTTP.dll_WinHttpSetOption]
push 4
lea eax, [ebp - 0x54]
mov dword [ebp - 0x54], 0x2000
push eax
push 0x1f
push ebx
call dword [sym.imp.WINHTTP.dll_WinHttpSetOption]
test eax, eax
je 0x401a73
mov ecx, dword [esi + 0x24]
mov eax, dword [esi + 0x14]
mov dword [ebp - 0x4c], eax
mov byte [ebp - 0x69], 0
cmp ecx, 0xffffffff
je 0x40189b
test eax, eax
jne 0x40189b
cmp dword [esi + 0x10], edi
jne 0x40189b
lea eax, [ebp - 0x58]
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_GetFileSizeEx]
test eax, eax
je 0x401a73
cmp dword [ebp - 0x54], edi
jl 0x40189f
mov eax, dword [ebp - 0x58]
jg 0x40187a
test eax, eax
je 0x40189f
push eax
push str.Range:_bytes
lea eax, [ebp - 0x48]
push str._hs_d_
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0x10
mov byte [ebp - 0x69], 1
lea ecx, [ebp - 0x48]
jmp 0x4018a2
mov ecx, eax
jmp 0x4018a2
mov ecx, dword [ebp - 0x4c]
mov eax, dword [esi + 0x1c]
push 0
push eax
push eax
push dword [esi + 0x18]
mov eax, ecx
neg eax
sbb eax, eax
push eax
push ecx
push ebx
call dword [sym.imp.WINHTTP.dll_WinHttpSendRequest]
test eax, eax
je 0x401a73
push 0
push ebx
call dword [sym.imp.WINHTTP.dll_WinHttpReceiveResponse]
test eax, eax
je 0x401a73
push 0
lea eax, [ebp - 0x64]
mov dword [ebp - 0x64], 4
push eax
lea eax, [esi + 0x20]
push eax
push 0
push 0x20000013
push ebx
call dword [sym.imp.WINHTTP.dll_WinHttpQueryHeaders]
test eax, eax
je 0x401a73
mov ecx, dword [esi + 0x20]
lea eax, [ecx - 0xc8]
cmp eax, 0x64
jae 0x401a7b
mov eax, dword [esi + 0x24]
cmp eax, 0xffffffff
je 0x401a7b
cmp byte [ebp - 0x69], 0
je 0x40195d
cmp ecx, 0xc8
jne 0x40195d
push 0
push 0
xorps xmm0, xmm0
movq qword [ebp - 0x58], xmm0
push dword [ebp - 0x54]
push dword [ebp - 0x58]
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
je 0x401a73
push dword [esi + 0x24]
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
test eax, eax
je 0x401a73
mov byte [ebp - 0x69], 0
push 0
lea eax, [ebp - 0x64]
mov dword [ebp - 0x60], edi
push eax
lea eax, [ebp - 0x60]
push eax
push 0
push 0x20000005
push ebx
call dword [sym.imp.WINHTTP.dll_WinHttpQueryHeaders]
test eax, eax
jne 0x40198d
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x2f76
jne 0x401a73
cmp byte [ebp - 0x69], 0
jne 0x4019a4
mov eax, dword [esi + 0x2c]
test eax, eax
je 0x4019a4
push dword [ebp - 0x60]
push eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchange]
push 0x10000
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov dword [ebp - 0x4c], eax
test eax, eax
je 0x401a73
mov dword [ebp - 0x5c], edi
xor ebx, ebx
nop dword [eax + eax]
lea ecx, [ebp - 0x5c]
push ecx
push 0x10000
push eax
push dword [ebp - 0x74]
call dword [sym.imp.WINHTTP.dll_WinHttpReadData]
test eax, eax
je 0x401a1e
push 0
lea eax, [ebp - 0x54]
push eax
push dword [ebp - 0x5c]
push dword [ebp - 0x4c]
push dword [esi + 0x24]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x401a1e
mov eax, dword [ebp - 0x54]
add ebx, eax
mov ecx, dword [esi + 0x28]
test ecx, ecx
je 0x401a14
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
cmp dword [ebp - 0x5c], edi
je 0x401a26
mov eax, dword [ebp - 0x4c]
jmp 0x4019d0
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov eax, dword [ebp - 0x60]
test eax, eax
je 0x401a5c
cmp ebx, eax
jbe 0x401a5c
push 1
push 0
push 0
sub ebx, eax
push ebx
push dword [esi + 0x24]
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
je 0x401a54
push dword [esi + 0x24]
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
test eax, eax
jne 0x401a5c
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
push dword [ebp - 0x4c]
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov ebx, dword [ebp - 0x74]
jmp 0x401a7b
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
push ebx
call dword [sym.imp.WINHTTP.dll_WinHttpCloseHandle]
push dword [ebp - 0x78]
call dword [sym.imp.WINHTTP.dll_WinHttpCloseHandle]
push dword [ebp - 0x70]
call dword [sym.imp.WINHTTP.dll_WinHttpCloseHandle]
push edi
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov ecx, dword [ebp - 4]
test edi, edi
pop edi
sete al
xor ecx, ebp
pop esi
pop ebx
call fcn.0040ed1d
mov esp, ebp
pop ebp
ret