mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-31 03:45:38 +00:00
HTTPDownloaderWinHttp: Hopefully fix issue on Windows <8.1
This commit is contained in:
parent
429ab9ffa2
commit
a8fd4d5bbd
|
@ -3,6 +3,7 @@
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "common/timer.h"
|
#include "common/timer.h"
|
||||||
|
#include <VersionHelpers.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
Log_SetChannel(HTTPDownloaderWinHttp);
|
Log_SetChannel(HTTPDownloaderWinHttp);
|
||||||
|
|
||||||
|
@ -32,8 +33,12 @@ std::unique_ptr<HTTPDownloader> HTTPDownloader::Create()
|
||||||
|
|
||||||
bool HTTPDownloaderWinHttp::Initialize()
|
bool HTTPDownloaderWinHttp::Initialize()
|
||||||
{
|
{
|
||||||
m_hSession = WinHttpOpen(StringUtil::UTF8StringToWideString(m_user_agent).c_str(),
|
// WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY is not supported before Win8.1.
|
||||||
WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, nullptr, nullptr, WINHTTP_FLAG_ASYNC);
|
const DWORD dwAccessType =
|
||||||
|
IsWindows8Point1OrGreater() ? WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY : WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
|
||||||
|
|
||||||
|
m_hSession = WinHttpOpen(StringUtil::UTF8StringToWideString(m_user_agent).c_str(), dwAccessType, nullptr, nullptr,
|
||||||
|
WINHTTP_FLAG_ASYNC);
|
||||||
if (m_hSession == NULL)
|
if (m_hSession == NULL)
|
||||||
{
|
{
|
||||||
Log_ErrorPrintf("WinHttpOpen() failed: %u", GetLastError());
|
Log_ErrorPrintf("WinHttpOpen() failed: %u", GetLastError());
|
||||||
|
|
Loading…
Reference in a new issue