File: HTTPDownloaderWinHTTP.h

package info (click to toggle)
pcsx2 2.6.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 89,232 kB
  • sloc: cpp: 386,254; ansic: 79,847; python: 1,216; perl: 391; javascript: 92; sh: 85; asm: 58; makefile: 20; xml: 13
file content (40 lines) | stat: -rw-r--r-- 1,017 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-FileCopyrightText: 2002-2025 PCSX2 Dev Team
// SPDX-License-Identifier: GPL-3.0+

#pragma once

#include "common/HTTPDownloader.h"
#include "common/RedtapeWindows.h"

#include <winhttp.h>

class HTTPDownloaderWinHttp final : public HTTPDownloader
{
public:
	HTTPDownloaderWinHttp();
	~HTTPDownloaderWinHttp() override;

	bool Initialize(std::string user_agent);

protected:
	Request* InternalCreateRequest() override;
	void InternalPollRequests() override;
	bool StartRequest(HTTPDownloader::Request* request) override;
	void CloseRequest(HTTPDownloader::Request* request) override;

private:
	struct Request : HTTPDownloader::Request
	{
		std::wstring object_name;
		HINTERNET hConnection = NULL;
		HINTERNET hRequest = NULL;
		u32 io_position = 0;
	};

	static void CALLBACK HTTPStatusCallback(HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus,
		LPVOID lpvStatusInformation, DWORD dwStatusInformationLength);

	static bool CheckCancelled(Request* request);

	HINTERNET m_hSession = NULL;
};