2024-07-30 11:42:36 +00:00
|
|
|
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
|
|
|
// SPDX-License-Identifier: GPL-3.0+
|
2022-04-18 10:07:08 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/HTTPDownloader.h"
|
|
|
|
#include "common/RedtapeWindows.h"
|
|
|
|
|
|
|
|
#include <winhttp.h>
|
|
|
|
|
2023-11-06 13:23:44 +00:00
|
|
|
class HTTPDownloaderWinHttp final : public HTTPDownloader
|
2022-04-18 10:07:08 +00:00
|
|
|
{
|
2023-11-06 13:23:44 +00:00
|
|
|
public:
|
|
|
|
HTTPDownloaderWinHttp();
|
|
|
|
~HTTPDownloaderWinHttp() override;
|
|
|
|
|
2023-11-21 06:12:58 +00:00
|
|
|
bool Initialize(std::string user_agent);
|
2023-11-06 13:23:44 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
Request* InternalCreateRequest() override;
|
|
|
|
void InternalPollRequests() override;
|
|
|
|
bool StartRequest(HTTPDownloader::Request* request) override;
|
|
|
|
void CloseRequest(HTTPDownloader::Request* request) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct Request : HTTPDownloader::Request
|
2022-04-18 10:07:08 +00:00
|
|
|
{
|
2023-11-06 13:23:44 +00:00
|
|
|
std::wstring object_name;
|
|
|
|
HINTERNET hConnection = NULL;
|
|
|
|
HINTERNET hRequest = NULL;
|
|
|
|
u32 io_position = 0;
|
2022-04-18 10:07:08 +00:00
|
|
|
};
|
2023-11-06 13:23:44 +00:00
|
|
|
|
|
|
|
static void CALLBACK HTTPStatusCallback(HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus,
|
|
|
|
LPVOID lpvStatusInformation, DWORD dwStatusInformationLength);
|
|
|
|
|
2023-11-21 06:12:58 +00:00
|
|
|
static bool CheckCancelled(Request* request);
|
|
|
|
|
2023-11-06 13:23:44 +00:00
|
|
|
HINTERNET m_hSession = NULL;
|
|
|
|
};
|