Function at 0x4059e0
Capabilities:
Initialize winhttp library
Prepare http request
Read http header
Receive http response
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x418c34
mov eax, dword fs:[0]
push eax
sub esp, 0xd4
mov eax, dword [0x4231e0]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov esi, dword [ebp + 8]
mov edi, dword [ebp + 0xc]
push 0
push 0
push 0
push 1
push 0x41a670
call dword [sym.imp.WINHTTP.dll_WinHttpOpen]
mov ebx, eax
mov dword [ebp - 0x90], ebx
test ebx, ebx
mov dword [ebp - 4], 0
setne al
test al, al
jne 0x405a67
mov dword [ebp - 0x74], str.Error_opening_session
lea eax, [ebp - 0x74]
push eax
lea ecx, [ebp - 0x80]
call fcn.00409193
mov dword [ebp - 0x80], vtable.std::runtime_error.0
push 0x42127c
lea eax, [ebp - 0x80]
push eax
call fcn.00407e03
push 0x3c
lea eax, [ebp - 0xe0]
push 0
push eax
call fcn.00408990
add esp, 0xc
mov dword [ebp - 0xe0], 0x3c
lea eax, [ebp - 0xe0]
mov dword [ebp - 0xcc], 0xffffffff
mov dword [ebp - 0xb0], 0xffffffff
push eax
push 0
push 0
push esi
call dword [sym.imp.WINHTTP.dll_WinHttpCrackUrl]
test eax, eax
jne 0x405ab7
mov dword [ebp - 0x74], str.Error_parsing_url
jmp 0x405a46
mov eax, dword [ebp - 0xd4]
cmp eax, 1
je 0x405ad3
cmp eax, 2
je 0x405ad6
mov dword [ebp - 0x74], str.Unsupported_scheme
jmp 0x405a46
cmp eax, 2
mov ecx, dword [ebp - 0xd0]
sete byte [ebp - 0x81]
mov eax, dword [ebp - 0xcc]
xor edx, edx
push dword [ebp - 0x90]
mov dword [ebp - 0x2c], 7
mov dword [ebp - 0x30], 0
lea eax, [ecx + eax*2]
mov word [ebp - 0x40], dx
push eax
push ecx
lea ecx, [ebp - 0x40]
call fcn.004056c0
mov ecx, dword [ebp - 0xb4]
xor edx, edx
mov eax, dword [ebp - 0xb0]
push dword [ebp - 0x90]
mov byte [ebp - 4], 1
mov dword [ebp - 0x44], 7
lea eax, [ecx + eax*2]
mov dword [ebp - 0x48], 0
push eax
push ecx
lea ecx, [ebp - 0x58]
mov word [ebp - 0x58], dx
call fcn.004056c0
cmp dword [ebp - 0x2c], 8
lea eax, [ebp - 0x40]
push 0
push dword [ebp - 0xc8]
cmovae eax, dword [ebp - 0x40]
push eax
push ebx
call dword [sym.imp.WINHTTP.dll_WinHttpConnect]
mov dword [ebp - 0x9c], eax
test eax, eax
mov byte [ebp - 4], 3
setne cl
test cl, cl
jne 0x405b81
mov dword [ebp - 0x74], str.Connection_failed
jmp 0x405a46
xor edx, edx
mov ecx, 0x800000
cmp byte [ebp - 0x81], dl
cmovne edx, ecx
cmp dword [ebp - 0x44], 8
push edx
push 0
push 0
push 0
lea ecx, [ebp - 0x58]
cmovae ecx, dword [ebp - 0x58]
push ecx
push 0x41a6dc
push eax
call dword [sym.imp.WINHTTP.dll_WinHttpOpenRequest]
mov esi, eax
mov dword [ebp - 0xa0], esi
test esi, esi
mov byte [ebp - 4], 4
setne al
test al, al
jne 0x405bd1
mov dword [ebp - 0x74], str.Request_failed
jmp 0x405a46
push 0
push 0
push 0
push 0
push 0
push 0
push esi
call dword [sym.imp.WINHTTP.dll_WinHttpSendRequest]
test eax, eax
jne 0x405bf4
mov dword [ebp - 0x74], str.Send_failed
jmp 0x405a46
push 0
push esi
call dword [sym.imp.WINHTTP.dll_WinHttpReceiveResponse]
test eax, eax
jne 0x405c0d
mov dword [ebp - 0x74], str.Receive_failed
jmp 0x405a46
push 0
lea eax, [ebp - 0x98]
mov dword [ebp - 0x94], 0
push eax
lea eax, [ebp - 0x94]
mov dword [ebp - 0x98], 4
push eax
push 0
push 0x20000013
push esi
call dword [sym.imp.WINHTTP.dll_WinHttpQueryHeaders]
test eax, eax
jne 0x405c4f
mov dword [ebp - 0x74], str.Parsing_reply_failed
jmp 0x405a46
mov ecx, dword [ebp - 0x94]
lea eax, [ecx - 0xc8]
cmp eax, 0x63
ja 0x405e45
mov dword [ebp - 0x80], 0
mov dword [ebp - 0x7c], 0
mov dword [ebp - 0x78], 0
push 0
push 0x80
push 2
push 0
push 0
push 0x40000000
push edi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
mov dword [ebp - 0xa4], edi
mov byte [ebp - 4], 8
cmp edi, 0xffffffff
jne 0x405cd0
mov dword [ebp - 0x74], str.Failed_to_open_destination_file
lea eax, [ebp - 0x74]
push eax
lea ecx, [ebp - 0x1c]
call fcn.00409193
mov dword [ebp - 0x1c], vtable.std::runtime_error.0
lea eax, [ebp - 0x1c]
push 0x42127c
jmp 0x405a61
lea eax, [ebp - 0x8c]
mov dword [ebp - 0x8c], 0
push eax
push esi
call dword [sym.imp.WINHTTP.dll_WinHttpQueryDataAvailable]
test eax, eax
je 0x405e30
mov ecx, dword [ebp - 0x8c]
test ecx, ecx
je 0x405d62
mov eax, dword [ebp - 0x7c]
mov edx, dword [ebp - 0x80]
sub eax, edx
cmp ecx, eax
jbe 0x405d18
push ecx
lea ecx, [ebp - 0x80]
call fcn.00406150
mov ecx, dword [ebp - 0x8c]
mov edx, dword [ebp - 0x80]
lea eax, [ebp - 0x8c]
push eax
push ecx
push edx
push esi
call dword [sym.imp.WINHTTP.dll_WinHttpReadData]
test eax, eax
je 0x405e1b
push 0
lea eax, [ebp - 0x74]
mov dword [ebp - 0x74], 0
push eax
push dword [ebp - 0x8c]
push dword [ebp - 0x80]
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x405e06
cmp dword [ebp - 0x8c], 0
jne 0x405cd0
test edi, edi
je 0x405d6d
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 0x80]
test eax, eax
je 0x405d7d
push eax
call fcn.004075f1
add esp, 4
mov edi, dword [sym.imp.WINHTTP.dll_WinHttpCloseHandle]
test esi, esi
je 0x405d8a
push esi
call edi
mov eax, dword [ebp - 0x9c]
test eax, eax
je 0x405d97
push eax
call edi
cmp dword [ebp - 0x44], 8
jb 0x405da8
push dword [ebp - 0x58]
call fcn.004075f1
add esp, 4
xor eax, eax
mov dword [ebp - 0x44], 7
cmp dword [ebp - 0x2c], 8
mov dword [ebp - 0x48], 0
mov word [ebp - 0x58], ax
jb 0x405dcd
push dword [ebp - 0x40]
call fcn.004075f1
add esp, 4
xor eax, eax
mov dword [ebp - 0x2c], 7
mov dword [ebp - 0x30], 0
mov word [ebp - 0x40], ax
test ebx, ebx
je 0x405de8
push ebx
call edi
mov al, 1
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.00407df4
mov esp, ebp
pop ebp
ret
mov dword [ebp - 0x88], str.Failed_to_write_destination_file
lea eax, [ebp - 0x88]
jmp 0x405cad
mov dword [ebp - 0x88], str.Reading_data_failed
lea eax, [ebp - 0x88]
jmp 0x405cad
mov dword [ebp - 0x88], str.Query_data_failed
lea eax, [ebp - 0x88]
jmp 0x405cad
mov dword [ebp - 0x14], 0xf
mov dword [ebp - 0x18], 0
mov byte [ebp - 0x28], 0
lea eax, [ebp - 0x28]
mov byte [ebp - 4], 5
push eax
push ecx
lea eax, [ebp - 0x70]
push eax
call fcn.004058c0
add esp, 0xc
cmp dword [eax + 0x14], 0x10
mov byte [ebp - 4], 6
jb 0x405e78
mov eax, dword [eax]
mov dword [ebp - 0x88], eax
lea ecx, [ebp - 0x80]
lea eax, [ebp - 0x88]
push eax
call fcn.00409193
cmp dword [ebp - 0x5c], 0x10
mov dword [ebp - 0x80], vtable.std::runtime_error.0
mov byte [ebp - 4], 5
jb 0x405ea9
push dword [ebp - 0x70]
call fcn.004075f1
add esp, 4
mov dword [ebp - 0x80], vtable.mailru::HttpError.0
push 0x4212d0
jmp 0x405a5e