Function at 0x402220
Capabilities:
Initialize winhttp library
Prepare http request
Read http header
Receive http response
Reference http user-agent string
Set http header

Disassembly:
push 0xffffffffffffffff
push 0x40dce0
mov eax, dword fs:[0]
push eax
sub esp, 0x90
mov eax, dword [0x443064]
xor eax, esp
mov dword [esp + 0x8c], eax
push ebx
push ebp
push esi
push edi
mov eax, dword [0x443064]
xor eax, esp
push eax
lea eax, [esp + 0xa4]
mov dword fs:[0], eax
mov eax, dword [esp + 0xb4]
mov dword [esp + 0x50], eax
xor eax, eax
mov esi, edx
lea edx, [esp + 0x28]
mov dword [esp + 0x18], eax
mov dword [esp + 0x34], eax
mov dword [esp + 0x28], eax
mov dword [esp + 0x24], eax
push edx
lea eax, [esp + 0x38]
mov dword [esp + 0x4c], ecx
push eax
lea ebx, [esp + 0x2c]
lea ecx, [esp + 0x38]
lea edx, [esp + 0x20]
mov dword [esp + 0x38], 0x50
call fcn.00401ff0
xor ebx, ebx
add esp, 8
cmp eax, ebx
je 0x4026c0
mov ecx, dword [esp + 0x28]
push ecx
mov dword [esp + 0x24], ebx
call fcn.00401cc0
mov edx, dword [esp + 0x28]
add esp, 4
mov edi, eax
push edx
mov dword [esp + 0x48], edi
call fcn.00401cc0
add esp, 4
mov dword [esp + 0x2c], eax
xor eax, eax
push 0x441080
mov dword [esp + 0x92], eax
mov dword [esp + 0x96], eax
mov dword [esp + 0x9a], eax
mov dword [esp + 0x9e], eax
mov word [esp + 0xa2], ax
lea eax, [esp + 0x90]
push 0xa
push eax
mov word [esp + 0x98], bx
call fcn.00403118
add esp, 0xc
push ebx
push ebx
push ebx
push ebx
push 0x441088
call dword [sym.imp.WINHTTP.dll_WinHttpOpen]
mov ebp, eax
cmp ebp, ebx
mov dword [esp + 0x4c], ebp
je 0x40267f
mov ebx, dword [sym.imp.WINHTTP.dll_WinHttpSetOption]
push 4
lea ecx, [esp + 0x3c]
push ecx
push 0x58
push ebp
mov dword [esp + 0x48], 2
call ebx
mov edx, dword [esp + 0x30]
push 0
push edx
push edi
push ebp
call dword [sym.imp.WINHTTP.dll_WinHttpConnect]
mov ecx, eax
test ecx, ecx
mov dword [esp + 0x3c], ecx
je 0x402678
cmp dword [esp + 0x18], 0
mov eax, 0x100
mov dword [esp + 0x1c], eax
je 0x402388
mov eax, 0x800100
mov dword [esp + 0x1c], eax
push eax
mov eax, dword [esp + 0x30]
push 0
push 0
push str.HTTP_1.1
push eax
lea edx, [esp + 0xa0]
push edx
push ecx
call dword [sym.imp.WINHTTP.dll_WinHttpOpenRequest]
mov edi, eax
test edi, edi
je 0x402669
lea eax, [esp + 0x40]
push eax
lea ecx, [esp + 0x20]
push ecx
push 0x1f
push edi
mov dword [esp + 0x50], 4
call dword [sym.imp.WINHTTP.dll_WinHttpQueryOption]
or dword [esp + 0x1c], 0x3100
push 4
lea edx, [esp + 0x20]
push edx
push 0x1f
push edi
call ebx
mov ebx, dword [sym.imp.WINHTTP.dll_WinHttpAddRequestHeaders]
push 0xa0000000
push 0xffffffffffffffff
push str.User_Agent:_Mozilla_5.0__Windows_NT_10.0__Win64__x64__AppleWebKit_537.36__KHTML__like_Gecko__Chrome_121.0.0.0_Safari_537.36
push edi
call ebx
test esi, esi
je 0x402416
mov eax, dword [esi]
xor ebp, ebp
test eax, eax
je 0x402416
push 0xa0000000
push 0xffffffffffffffff
push eax
push edi
call ebx
mov eax, dword [esi + ebp*4 + 4]
add ebp, 1
test eax, eax
jne 0x402400
push 0xc350
push 0xc350
push 0xc350
push 0xc350
push edi
call dword [sym.imp.WINHTTP.dll_WinHttpSetTimeouts]
push 0
push 0
push 0
push 0
push 0
push 0
push edi
call dword [sym.imp.WINHTTP.dll_WinHttpSendRequest]
test eax, eax
je 0x40265e
push 0
push edi
call dword [sym.imp.WINHTTP.dll_WinHttpReceiveResponse]
test eax, eax
mov dword [esp + 0x18], eax
je 0x40265e
mov esi, dword [sym.imp.WINHTTP.dll_WinHttpQueryHeaders]
push 0
lea eax, [esp + 0x18]
push eax
push 0
push 0
push 0x16
push edi
mov dword [esp + 0x2c], 0
call esi
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x7a
jne 0x402516
mov ecx, dword [esp + 0x14]
add ecx, 2
push ecx
call fcn.00402c34
mov edx, dword [esp + 0x18]
add esp, 4
add edx, 2
push edx
mov ebp, eax
push 0
push ebp
call fcn.00403de0
add esp, 0xc
push 0
lea eax, [esp + 0x18]
push eax
push ebp
push 0
push 0x16
push edi
call esi
push ebp
mov dword [esp + 0x1c], eax
call fcn.00401c40
add esp, 4
mov ebx, eax
push ebx
lea ecx, [esp + 0x74]
call fcn.00401260
mov esi, dword [esp + 0x50]
push eax
mov dword [esp + 0xb0], 0
call fcn.00401ef0
lea ecx, [esp + 0x70]
mov dword [esp + 0xac], 0xffffffff
call fcn.004012a0
push ebx
call fcn.00402b57
add esp, 4
push ebp
call fcn.00402b57
add esp, 4
cmp dword [esp + 0x18], 0
mov dword [esp + 0x20], 0
je 0x402656
mov ebx, 0x10
mov edi, edi
lea ecx, [esp + 0x14]
push ecx
push edi
mov dword [esp + 0x1c], 0
call dword [sym.imp.WINHTTP.dll_WinHttpQueryDataAvailable]
test eax, eax
je 0x402633
mov eax, dword [esp + 0x14]
test eax, eax
je 0x402656
add eax, 1
push eax
call fcn.00402c34
mov ebp, eax
add esp, 4
test ebp, ebp
je 0x402649
mov edx, dword [esp + 0x14]
add edx, 1
push edx
push 0
push ebp
call fcn.00403de0
mov ecx, dword [esp + 0x20]
add esp, 0xc
lea eax, [esp + 0x20]
push eax
push ecx
push ebp
push edi
call dword [sym.imp.WINHTTP.dll_WinHttpReadData]
test eax, eax
jne 0x4025ab
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.WinHttpQueryDataAvailable_failed._Error___d_n
call fcn.00402f67
add esp, 8
cmp dword [esp + 0x20], 0
je 0x402656
mov eax, ebp
mov dword [esp + 0x6c], 0xf
mov dword [esp + 0x68], 0
mov byte [esp + 0x58], 0
lea edx, [eax + 1]
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x4025d0
sub eax, edx
push eax
push ebp
lea ecx, [esp + 0x5c]
call fcn.004013b0
mov esi, dword [esp + 0x48]
lea edx, [esp + 0x54]
push edx
mov dword [esp + 0xb0], 1
call fcn.00401ef0
mov dword [esp + 0xac], 0xffffffff
cmp dword [esp + 0x6c], ebx
jb 0x40261d
mov eax, dword [esp + 0x58]
push eax
call fcn.00402923
add esp, 4
push ebp
call fcn.00402b57
add esp, 4
cmp dword [esp + 0x14], 0
ja 0x402530
jmp 0x402656
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.WinHttpQueryDataAvailable_failed._Error___d_n
call fcn.00402f67
add esp, 8
jmp 0x402656
push str.Out_of_memory._n
call fcn.00402f67
add esp, 4
mov ecx, dword [esp + 0x18]
mov dword [esp + 0x20], ecx
push edi
call dword [sym.imp.WINHTTP.dll_WinHttpCloseHandle]
mov ebp, dword [esp + 0x4c]
mov edx, dword [esp + 0x3c]
push edx
call dword [sym.imp.WINHTTP.dll_WinHttpCloseHandle]
mov edi, dword [esp + 0x44]
push ebp
call dword [sym.imp.WINHTTP.dll_WinHttpCloseHandle]
mov eax, dword [esp + 0x2c]
push eax
call fcn.00402b57
add esp, 4
push edi
call fcn.00402b57
mov ecx, dword [esp + 0x38]
add esp, 4
push ecx
call fcn.00402b57
mov edx, dword [esp + 0x2c]
add esp, 4
push edx
call fcn.00402b57
mov eax, dword [esp + 0x28]
add esp, 4
push eax
call fcn.00402b57
mov eax, dword [esp + 0x24]
add esp, 4
mov ecx, dword [esp + 0xa4]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x8c]
xor ecx, esp
call fcn.004027ab
add esp, 0x9c
ret