Function at 0x4029f0
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, 0x68
mov eax, dword [0x42f008]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
mov esi, dword [ebp + 8]
push edi
xor edi, edi
mov eax, dword [esi]
mov dword [esi + 0x24], edi
test eax, eax
je 0x402a1a
cmp dword [eax], edi
je 0x402a1a
lea ecx, [edi + 3]
jmp 0x402a1c
xor ecx, ecx
test eax, eax
je 0x402a26
mov eax, dword [eax]
test eax, eax
jne 0x402a28
xor eax, eax
push 0
push 0
push eax
push ecx
push 0x7d0
call fcn.00403d90
add esp, 4
push eax
call dword [sym.imp.WINHTTP.dll_WinHttpOpen]
mov ebx, eax
mov dword [ebp - 0x60], ebx
test ebx, ebx
jne 0x402a58
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
jmp 0x402e10
movzx eax, word [esi + 0xc]
push 0
push eax
push dword [esi + 8]
push ebx
call dword [sym.imp.WINHTTP.dll_WinHttpConnect]
mov ecx, eax
mov dword [ebp - 0x68], ecx
test ecx, ecx
jne 0x402a7f
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
jmp 0x402e09
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 + 0x10]
push dword [esi + 0x14]
push ecx
call dword [sym.imp.WINHTTP.dll_WinHttpOpenRequest]
mov edx, eax
mov dword [ebp - 0x64], edx
test edx, edx
jne 0x402ab9
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
jmp 0x402e00
mov ecx, dword [esi]
test ecx, ecx
je 0x402af9
mov ebx, dword [ecx + 4]
test ebx, ebx
je 0x402af6
xor eax, eax
mov dword [ebp - 0x4c], 2
push 0
push dword [ecx + 0xc]
cmp ebx, 1
push dword [ecx + 8]
sete al
cmp ebx, 8
cmove eax, dword [ebp - 0x4c]
push eax
push 1
push edx
call dword [sym.imp.WINHTTP.dll_WinHttpSetCredentials]
test eax, eax
je 0x402dec
mov ebx, dword [ebp - 0x60]
cmp dword [esi + 4], edi
je 0x402b6a
push 4
lea eax, [ebp - 0x48]
mov dword [ebp - 0x48], 0x80
push eax
push 0x54
push ebx
call dword [sym.imp.WINHTTP.dll_WinHttpSetOption]
test eax, eax
jne 0x402b25
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
jmp 0x402df7
or dword [ebp - 0x48], 0x200
call fcn.004090c0
cmp eax, 0x6020000
jb 0x402b3f
or dword [ebp - 0x48], 0x800
push 4
lea eax, [ebp - 0x48]
push eax
push 0x54
push ebx
call dword [sym.imp.WINHTTP.dll_WinHttpSetOption]
push 4
lea eax, [ebp - 0x4c]
mov dword [ebp - 0x4c], 0x3100
push eax
push 0x1f
push dword [ebp - 0x64]
call dword [sym.imp.WINHTTP.dll_WinHttpSetOption]
test eax, eax
je 0x402b18
mov ecx, dword [esi + 0x28]
xor bl, bl
mov eax, dword [esi + 0x18]
mov dword [ebp - 0x48], eax
cmp ecx, 0xffffffff
je 0x402bc3
test eax, eax
jne 0x402bc3
cmp dword [esi + 0x14], edi
jne 0x402bc3
lea eax, [ebp - 0x50]
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_GetFileSizeEx]
test eax, eax
je 0x402dec
cmp dword [ebp - 0x4c], edi
jl 0x402bc7
mov eax, dword [ebp - 0x50]
jg 0x402ba4
test eax, eax
je 0x402bc7
push eax
push str.Range:_bytes
lea eax, [ebp - 0x44]
push str._hs_d_
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0x10
lea ecx, [ebp - 0x44]
mov bl, 1
jmp 0x402bca
mov ecx, eax
jmp 0x402bca
mov ecx, dword [ebp - 0x48]
mov eax, dword [esi + 0x20]
push 0
push eax
push eax
push dword [esi + 0x1c]
mov eax, ecx
neg eax
sbb eax, eax
push eax
push ecx
push dword [ebp - 0x64]
call dword [sym.imp.WINHTTP.dll_WinHttpSendRequest]
test eax, eax
je 0x402dec
push 0
push dword [ebp - 0x64]
call dword [sym.imp.WINHTTP.dll_WinHttpReceiveResponse]
test eax, eax
je 0x402dec
push 0
lea eax, [ebp - 0x5c]
mov dword [ebp - 0x5c], 4
push eax
lea eax, [esi + 0x24]
push eax
push 0
push 0x20000013
push dword [ebp - 0x64]
call dword [sym.imp.WINHTTP.dll_WinHttpQueryHeaders]
test eax, eax
je 0x402dec
mov ecx, dword [esi + 0x24]
lea eax, [ecx - 0xc8]
cmp eax, 0x64
jae 0x402df4
mov eax, dword [esi + 0x28]
cmp eax, 0xffffffff
jne 0x402c4c
cmp dword [esi + 0x2c], edi
je 0x402df4
test bl, bl
je 0x402c8c
cmp ecx, 0xc8
jne 0x402c8c
push 0
push 0
xorps xmm0, xmm0
movq qword [ebp - 0x50], xmm0
push dword [ebp - 0x4c]
push dword [ebp - 0x50]
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
je 0x402dec
push dword [esi + 0x28]
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
test eax, eax
je 0x402dec
xor bl, bl
push 0
lea eax, [ebp - 0x5c]
mov dword [ebp - 0x58], edi
push eax
lea eax, [ebp - 0x58]
push eax
push 0
push 0x20000005
push dword [ebp - 0x64]
call dword [sym.imp.WINHTTP.dll_WinHttpQueryHeaders]
test eax, eax
jne 0x402cbe
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x2f76
jne 0x402dec
test bl, bl
jne 0x402cd3
mov eax, dword [esi + 0x3c]
test eax, eax
je 0x402cd3
push dword [ebp - 0x58]
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 0x402dec
mov dword [ebp - 0x54], edi
xor ebx, ebx
lea ecx, [ebp - 0x54]
push ecx
push 0x10000
push eax
push dword [ebp - 0x64]
call dword [sym.imp.WINHTTP.dll_WinHttpReadData]
test eax, eax
je 0x402d3a
mov ecx, dword [ebp - 0x54]
test ecx, ecx
je 0x402d42
mov eax, dword [esi + 0x28]
xor edx, edx
mov dword [ebp - 0x48], edx
cmp eax, 0xffffffff
je 0x402d92
push edx
lea edx, [ebp - 0x48]
push edx
push ecx
push dword [ebp - 0x4c]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x402dc2
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov eax, dword [ebp - 0x58]
test eax, eax
je 0x402d7e
cmp ebx, eax
jbe 0x402d7e
mov ecx, dword [esi + 0x28]
cmp ecx, 0xffffffff
je 0x402d7e
push 1
push 0
push 0
sub ebx, eax
push ebx
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
je 0x402d76
push dword [esi + 0x28]
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
test eax, eax
jne 0x402d7e
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]
jmp 0x402df4
cmp dword [esi + 0x2c], edx
je 0x402dc8
lea eax, [ebx + ecx]
cmp eax, dword [esi + 0x30]
jae 0x402dc8
mov eax, dword [esi + 0x2c]
push ecx
push dword [ebp - 0x4c]
add eax, ebx
push eax
call fcn.004128d0
mov ecx, dword [ebp - 0x54]
add esp, 0xc
mov eax, dword [esi + 0x34]
mov edx, ecx
mov dword [ebp - 0x48], edx
test eax, eax
je 0x402dc8
add dword [eax], ecx
mov edx, dword [ebp - 0x48]
mov ecx, dword [ebp - 0x54]
mov eax, dword [esi + 0x38]
add ebx, edx
test eax, eax
je 0x402ddc
push edx
push eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
mov ecx, dword [ebp - 0x54]
test ecx, ecx
je 0x402d42
mov eax, dword [ebp - 0x4c]
jmp 0x402cf7
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov ebx, dword [ebp - 0x60]
push dword [ebp - 0x64]
call dword [sym.imp.WINHTTP.dll_WinHttpCloseHandle]
push dword [ebp - 0x68]
call dword [sym.imp.WINHTTP.dll_WinHttpCloseHandle]
push ebx
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.00411c8e
mov esp, ebp
pop ebp
ret