2024-09-01 12:08:31 +00:00
|
|
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
|
|
|
// SPDX-License-Identifier: PolyForm-Strict-1.0.0
|
2022-12-04 11:03:45 +00:00
|
|
|
|
2021-02-21 08:30:58 +00:00
|
|
|
#pragma once
|
|
|
|
#include "http_downloader.h"
|
|
|
|
|
|
|
|
#include "common/windows_headers.h"
|
|
|
|
|
|
|
|
#include <winhttp.h>
|
|
|
|
|
|
|
|
class HTTPDownloaderWinHttp final : public HTTPDownloader
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
HTTPDownloaderWinHttp();
|
|
|
|
~HTTPDownloaderWinHttp() override;
|
|
|
|
|
2023-11-24 05:54:43 +00:00
|
|
|
bool Initialize(std::string user_agent);
|
2021-02-21 08:30:58 +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
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
|
|
|
HINTERNET m_hSession = NULL;
|
|
|
|
};
|