mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
ugly hacks to make liblastfm compile on windows
This commit is contained in:
5
thirdparty/liblastfm2/src/CMakeLists.txt
vendored
5
thirdparty/liblastfm2/src/CMakeLists.txt
vendored
@@ -78,7 +78,7 @@ if(UNIX)
|
|||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(SOURCES ${SOURCES} ws/win/WNetworkConnectionMonitor_win.cpp)
|
set(SOURCES ${SOURCES} ws/win/WNetworkConnectionMonitor_win.cpp ws/win/Pac.cpp ws/win/NdisEvents.cpp )
|
||||||
set(MOC_HEADERS ${MOC_HEADERS} ws/win/WNetworkConnectionMonitor.h)
|
set(MOC_HEADERS ${MOC_HEADERS} ws/win/WNetworkConnectionMonitor.h)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
@@ -100,9 +100,10 @@ ENDIF()
|
|||||||
target_link_libraries(tomahawk_lastfm2
|
target_link_libraries(tomahawk_lastfm2
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${QT_QTDBUS_LIBRARY}
|
${QT_QTDBUS_LIBRARY}
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(tomahawk_lastfm2 PROPERTIES COMPILE_FLAGS "-DLASTFM_OHAI_QMAKE" )
|
set_target_properties(tomahawk_lastfm2 PROPERTIES COMPILE_FLAGS "-DLASTFM_OHAI_QMAKE" )
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_link_libraries(tomahawk_lastfm2
|
target_link_libraries(tomahawk_lastfm2
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2009 Last.fm Ltd.
|
Copyright 2009 Last.fm Ltd.
|
||||||
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
||||||
|
|
||||||
This file is part of liblastfm.
|
This file is part of liblastfm.
|
||||||
@@ -34,11 +34,11 @@
|
|||||||
|
|
||||||
static struct NetworkAccessManagerInit
|
static struct NetworkAccessManagerInit
|
||||||
{
|
{
|
||||||
// We do this upfront because then our Firehose QTcpSocket will have a proxy
|
// We do this upfront because then our Firehose QTcpSocket will have a proxy
|
||||||
// set by default. As well as any plain QNetworkAcessManager stuff, and the
|
// set by default. As well as any plain QNetworkAcessManager stuff, and the
|
||||||
// scrobbler
|
// scrobbler
|
||||||
// In theory we should do this every request in case the configuration
|
// In theory we should do this every request in case the configuration
|
||||||
// changes but that is fairly unlikely use case, init? Maybe we should
|
// changes but that is fairly unlikely use case, init? Maybe we should
|
||||||
// anyway..
|
// anyway..
|
||||||
|
|
||||||
NetworkAccessManagerInit()
|
NetworkAccessManagerInit()
|
||||||
@@ -50,7 +50,7 @@ static struct NetworkAccessManagerInit
|
|||||||
// at two seconds, so that hangs startup
|
// at two seconds, so that hangs startup
|
||||||
if (!s.fAutoDetect && s.lpszProxy)
|
if (!s.fAutoDetect && s.lpszProxy)
|
||||||
{
|
{
|
||||||
QUrl url( QString::fromUtf16(s.lpszProxy) );
|
QUrl url( QString::fromUtf16((const unsigned short*)s.lpszProxy) );
|
||||||
QNetworkProxy proxy( QNetworkProxy::HttpProxy );
|
QNetworkProxy proxy( QNetworkProxy::HttpProxy );
|
||||||
proxy.setHostName( url.host() );
|
proxy.setHostName( url.host() );
|
||||||
proxy.setPort( url.port() );
|
proxy.setPort( url.port() );
|
||||||
@@ -69,10 +69,10 @@ static struct NetworkAccessManagerInit
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} init;
|
} init;
|
||||||
|
|
||||||
|
|
||||||
namespace lastfm
|
namespace lastfm
|
||||||
{
|
{
|
||||||
LASTFM_DLLEXPORT QByteArray UserAgent;
|
LASTFM_DLLEXPORT QByteArray UserAgent;
|
||||||
}
|
}
|
||||||
@@ -106,12 +106,12 @@ lastfm::NetworkAccessManager::~NetworkAccessManager()
|
|||||||
|
|
||||||
QNetworkProxy
|
QNetworkProxy
|
||||||
lastfm::NetworkAccessManager::proxy( const QNetworkRequest& request )
|
lastfm::NetworkAccessManager::proxy( const QNetworkRequest& request )
|
||||||
{
|
{
|
||||||
Q_UNUSED( request );
|
Q_UNUSED( request );
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
IeSettings s;
|
IeSettings s;
|
||||||
if (s.fAutoDetect)
|
if (s.fAutoDetect)
|
||||||
{
|
{
|
||||||
if (!m_pac) {
|
if (!m_pac) {
|
||||||
m_pac = new Pac;
|
m_pac = new Pac;
|
||||||
@@ -122,9 +122,9 @@ lastfm::NetworkAccessManager::proxy( const QNetworkRequest& request )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return m_pac->resolve( request, s.lpszAutoConfigUrl );
|
return m_pac->resolve( request, s.lpszAutoConfigUrl );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return QNetworkProxy::applicationProxy();
|
return QNetworkProxy::applicationProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ lastfm::NetworkAccessManager::createRequest( Operation op, const QNetworkRequest
|
|||||||
|
|
||||||
request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache );
|
request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache );
|
||||||
request.setRawHeader( "User-Agent", lastfm::UserAgent );
|
request.setRawHeader( "User-Agent", lastfm::UserAgent );
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
// PAC proxies can vary by domain, so we have to check everytime :(
|
// PAC proxies can vary by domain, so we have to check everytime :(
|
||||||
QNetworkProxy proxy = this->proxy( request );
|
QNetworkProxy proxy = this->proxy( request );
|
||||||
@@ -152,7 +152,7 @@ void
|
|||||||
lastfm::NetworkAccessManager::onConnectivityChanged( bool up )
|
lastfm::NetworkAccessManager::onConnectivityChanged( bool up )
|
||||||
{
|
{
|
||||||
Q_UNUSED( up );
|
Q_UNUSED( up );
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (up && m_pac) m_pac->resetFailedState();
|
if (up && m_pac) m_pac->resetFailedState();
|
||||||
#endif
|
#endif
|
||||||
|
27
thirdparty/liblastfm2/src/ws/win/ComSetup.h
vendored
27
thirdparty/liblastfm2/src/ws/win/ComSetup.h
vendored
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2009 Last.fm Ltd.
|
Copyright 2009 Last.fm Ltd.
|
||||||
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
||||||
|
|
||||||
This file is part of liblastfm.
|
This file is part of liblastfm.
|
||||||
@@ -23,12 +23,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
#include <atlbase.h>
|
//#include <boost/range/atl.hpp>
|
||||||
#include <atlcom.h>
|
//#include <atlbase.h>
|
||||||
|
//#include <atlcom.h>
|
||||||
|
#include <winable.h>
|
||||||
|
|
||||||
/** @brief WsConnectionMonitor needs Com to work as early as possible so we do this
|
/** @brief WsConnectionMonitor needs Com to work as early as possible so we do this
|
||||||
* @author <doug@last.fm>
|
* @author <doug@last.fm>
|
||||||
*/
|
*/
|
||||||
class ComSetup
|
class ComSetup
|
||||||
{
|
{
|
||||||
@@ -37,27 +38,27 @@ public:
|
|||||||
{
|
{
|
||||||
HRESULT hr = CoInitialize(0);
|
HRESULT hr = CoInitialize(0);
|
||||||
m_bComInitialised = SUCCEEDED(hr);
|
m_bComInitialised = SUCCEEDED(hr);
|
||||||
_ASSERT(m_bComInitialised);
|
//_ASSERT(m_bComInitialised);
|
||||||
if (m_bComInitialised) {
|
if (m_bComInitialised) {
|
||||||
setupSecurity();
|
setupSecurity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupSecurity()
|
void setupSecurity()
|
||||||
{
|
{
|
||||||
CSecurityDescriptor sd;
|
//CSecurityDescriptor sd;
|
||||||
sd.InitializeFromThreadToken();
|
//sd.InitializeFromThreadToken();
|
||||||
HRESULT hr = CoInitializeSecurity(sd, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
|
//HRESULT hr = CoInitializeSecurity(sd, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
|
||||||
_ASSERT(SUCCEEDED(hr));
|
//_ASSERT(SUCCEEDED(hr));
|
||||||
}
|
}
|
||||||
|
|
||||||
~ComSetup()
|
~ComSetup()
|
||||||
{
|
{
|
||||||
if (m_bComInitialised) {
|
if (m_bComInitialised) {
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_bComInitialised;
|
bool m_bComInitialised;
|
||||||
};
|
};
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2009 Last.fm Ltd.
|
Copyright 2009 Last.fm Ltd.
|
||||||
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
||||||
|
|
||||||
This file is part of liblastfm.
|
This file is part of liblastfm.
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
struct IeSettings : WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
|
struct IeSettings : WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
|
||||||
{
|
{
|
||||||
|
#ifndef WIN32
|
||||||
IeSettings()
|
IeSettings()
|
||||||
{
|
{
|
||||||
if (!WinHttpGetIEProxyConfigForCurrentUser(this)) {
|
if (!WinHttpGetIEProxyConfigForCurrentUser(this)) {
|
||||||
@@ -33,7 +34,8 @@ struct IeSettings : WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
|
|||||||
lpszAutoConfigUrl = lpszProxy = lpszProxyBypass = 0;
|
lpszAutoConfigUrl = lpszProxy = lpszProxyBypass = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
~IeSettings()
|
~IeSettings()
|
||||||
{
|
{
|
||||||
if (lpszAutoConfigUrl) GlobalFree(lpszAutoConfigUrl);
|
if (lpszAutoConfigUrl) GlobalFree(lpszAutoConfigUrl);
|
||||||
|
26
thirdparty/liblastfm2/src/ws/win/NdisEvents.cpp
vendored
26
thirdparty/liblastfm2/src/ws/win/NdisEvents.cpp
vendored
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2009 Last.fm Ltd.
|
Copyright 2009 Last.fm Ltd.
|
||||||
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
||||||
|
|
||||||
This file is part of liblastfm.
|
This file is part of liblastfm.
|
||||||
@@ -32,35 +32,37 @@ NdisEvents::NdisEvents()
|
|||||||
|
|
||||||
NdisEvents::~NdisEvents()
|
NdisEvents::~NdisEvents()
|
||||||
{
|
{
|
||||||
|
#ifndef WIN32
|
||||||
if (m_pSink)
|
if (m_pSink)
|
||||||
m_pSink->disconnect();
|
m_pSink->disconnect();
|
||||||
if (m_pServices && m_pSink)
|
#endif
|
||||||
m_pServices->CancelAsyncCall(m_pSink);
|
//if (m_pServices && m_pSink)
|
||||||
|
//m_pServices->CancelAsyncCall(m_pSink);
|
||||||
// and reference counting will take care of the WmiSink object
|
// and reference counting will take care of the WmiSink object
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
NdisEvents::registerForNdisEvents()
|
NdisEvents::registerForNdisEvents()
|
||||||
{
|
{
|
||||||
HRESULT hr = m_pLocator.CoCreateInstance(CLSID_WbemLocator);
|
HRESULT hr = 0; //m_pLocator.CoCreateInstance(CLSID_WbemLocator);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
// Connect to the root\wmi namespace with the current user.
|
// Connect to the root\wmi namespace with the current user.
|
||||||
hr = m_pLocator->ConnectServer(CComBSTR("ROOT\\WMI"), // strNetworkResource
|
hr = 0; /*m_pLocator->ConnectServer(CComBSTR("ROOT\\WMI"), // strNetworkResource
|
||||||
NULL, // strUser
|
NULL, // strUser
|
||||||
NULL, // strPassword
|
NULL, // strPassword
|
||||||
NULL, // strLocale
|
NULL, // strLocale
|
||||||
0, // lSecurityFlags
|
0, // lSecurityFlags
|
||||||
CComBSTR(""), // strAuthority
|
CComBSTR(""), // strAuthority
|
||||||
NULL, // pCtx
|
NULL, // pCtx
|
||||||
&m_pServices
|
&m_pServices
|
||||||
);
|
);*/
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
#ifndef WIN32
|
||||||
m_pSink = new WmiSink(this);
|
m_pSink = new WmiSink(this);
|
||||||
|
#endif
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
|
||||||
// other notifications we're not interested in right now include...
|
// other notifications we're not interested in right now include...
|
||||||
@@ -75,12 +77,12 @@ NdisEvents::registerForNdisEvents()
|
|||||||
// MSNdis_StatusProtocolUnbind
|
// MSNdis_StatusProtocolUnbind
|
||||||
// MSNdis_StatusMediaSpecificIndication
|
// MSNdis_StatusMediaSpecificIndication
|
||||||
|
|
||||||
CComBSTR wql("WQL");
|
/*CComBSTR wql("WQL");
|
||||||
CComBSTR query("SELECT * FROM MSNdis_StatusMediaDisconnect");
|
CComBSTR query("SELECT * FROM MSNdis_StatusMediaDisconnect");
|
||||||
hr = m_pServices->ExecNotificationQueryAsync(wql, query, 0, 0, m_pSink);
|
hr = m_pServices->ExecNotificationQueryAsync(wql, query, 0, 0, m_pSink);
|
||||||
|
|
||||||
query = "SELECT * FROM MSNdis_StatusMediaConnect";
|
query = "SELECT * FROM MSNdis_StatusMediaConnect";
|
||||||
hr = m_pServices->ExecNotificationQueryAsync(wql, query, 0, 0, m_pSink);
|
hr = m_pServices->ExecNotificationQueryAsync(wql, query, 0, 0, m_pSink);*/
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
10
thirdparty/liblastfm2/src/ws/win/NdisEvents.h
vendored
10
thirdparty/liblastfm2/src/ws/win/NdisEvents.h
vendored
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2009 Last.fm Ltd.
|
Copyright 2009 Last.fm Ltd.
|
||||||
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
||||||
|
|
||||||
This file is part of liblastfm.
|
This file is part of liblastfm.
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
#define NDIS_EVENTS_H
|
#define NDIS_EVENTS_H
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <atlbase.h>
|
//#include <atlbase.h>
|
||||||
#include <WbemCli.h>
|
//#include <WbemCli.h>
|
||||||
|
|
||||||
class NdisEvents
|
class NdisEvents
|
||||||
{
|
{
|
||||||
@@ -35,8 +35,8 @@ public:
|
|||||||
virtual void onConnectionDown(BSTR name) = 0;
|
virtual void onConnectionDown(BSTR name) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CComPtr<IWbemLocator> m_pLocator;
|
//CComPtr<IWbemLocator> m_pLocator;
|
||||||
CComPtr<IWbemServices> m_pServices;
|
//CComPtr<IWbemServices> m_pServices;
|
||||||
class WmiSink *m_pSink;
|
class WmiSink *m_pSink;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
40
thirdparty/liblastfm2/src/ws/win/Pac.cpp
vendored
40
thirdparty/liblastfm2/src/ws/win/Pac.cpp
vendored
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2009 Last.fm Ltd.
|
Copyright 2009 Last.fm Ltd.
|
||||||
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
||||||
|
|
||||||
This file is part of liblastfm.
|
This file is part of liblastfm.
|
||||||
@@ -21,8 +21,9 @@
|
|||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <atlbase.h>
|
//#include <atlbase.h>
|
||||||
#include <atlconv.h>
|
//#include <atlconv.h>
|
||||||
|
#include <winhttp.h>
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@@ -45,7 +46,7 @@ parsePacServer(const QString &s, QNetworkProxy &p)
|
|||||||
static QList<QNetworkProxy>
|
static QList<QNetworkProxy>
|
||||||
parsePacResult(const QString &pacResult)
|
parsePacResult(const QString &pacResult)
|
||||||
{
|
{
|
||||||
// msdn says: "The proxy server list contains one or more of the
|
// msdn says: "The proxy server list contains one or more of the
|
||||||
// following strings separated by semicolons or whitespace."
|
// following strings separated by semicolons or whitespace."
|
||||||
// ([<scheme>=][<scheme>"://"]<server>[":"<port>])
|
// ([<scheme>=][<scheme>"://"]<server>[":"<port>])
|
||||||
|
|
||||||
@@ -73,8 +74,10 @@ lastfm::Pac::Pac()
|
|||||||
|
|
||||||
lastfm::Pac::~Pac()
|
lastfm::Pac::~Pac()
|
||||||
{
|
{
|
||||||
|
#ifndef WIN32
|
||||||
if (m_hSession)
|
if (m_hSession)
|
||||||
WinHttpCloseHandle(m_hSession);
|
WinHttpCloseHandle(m_hSession);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkProxy
|
QNetworkProxy
|
||||||
@@ -86,42 +89,45 @@ lastfm::Pac::resolve(const QNetworkRequest &request, const wchar_t* pacUrl)
|
|||||||
if (!m_hSession)
|
if (!m_hSession)
|
||||||
{
|
{
|
||||||
QByteArray user_agent = request.rawHeader("user-agent");
|
QByteArray user_agent = request.rawHeader("user-agent");
|
||||||
m_hSession = WinHttpOpen(CA2W(user_agent), WINHTTP_ACCESS_TYPE_NO_PROXY, 0, 0, WINHTTP_FLAG_ASYNC);
|
//m_hSession = WinHttpOpen(CA2W(user_agent), WINHTTP_ACCESS_TYPE_NO_PROXY, 0, 0, WINHTTP_FLAG_ASYNC);
|
||||||
}
|
}
|
||||||
if (m_hSession)
|
if (m_hSession)
|
||||||
{
|
{
|
||||||
WINHTTP_PROXY_INFO info;
|
WINHTTP_PROXY_INFO info;
|
||||||
WINHTTP_AUTOPROXY_OPTIONS opts;
|
WINHTTP_AUTOPROXY_OPTIONS opts;
|
||||||
memset(&opts, 0, sizeof(opts));
|
memset(&opts, 0, sizeof(opts));
|
||||||
if (pacUrl)
|
if (pacUrl)
|
||||||
{
|
{
|
||||||
opts.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL;
|
//opts.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL;
|
||||||
opts.lpszAutoConfigUrl = pacUrl;
|
//opts.lpszAutoConfigUrl = pacUrl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
opts.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT;
|
//opts.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT;
|
||||||
opts.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DHCP | WINHTTP_AUTO_DETECT_TYPE_DNS_A;
|
//opts.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DHCP | WINHTTP_AUTO_DETECT_TYPE_DNS_A;
|
||||||
}
|
}
|
||||||
opts.fAutoLogonIfChallenged = TRUE;
|
opts.fAutoLogonIfChallenged = TRUE;
|
||||||
|
#ifndef WIN32
|
||||||
if (WinHttpGetProxyForUrl(m_hSession, request.url().toString().utf16(), &opts, &info)) {
|
if (WinHttpGetProxyForUrl(m_hSession, (const WCHAR*)(request.url().toString().utf16()), &opts, &info)) {
|
||||||
if (info.lpszProxy)
|
if (info.lpszProxy)
|
||||||
{
|
{
|
||||||
QList<QNetworkProxy> proxies = parsePacResult(QString::fromUtf16(info.lpszProxy));
|
QList<QNetworkProxy> proxies = parsePacResult(QString::fromUtf16((const ushort*)info.lpszProxy));
|
||||||
if (!proxies.empty())
|
if (!proxies.empty())
|
||||||
{
|
{
|
||||||
out = proxies.at(0);
|
out = proxies.at(0);
|
||||||
}
|
}
|
||||||
GlobalFree(info.lpszProxy);
|
// pay attention! casting away constness
|
||||||
|
GlobalFree((void*)info.lpszProxy);
|
||||||
}
|
}
|
||||||
if (info.lpszProxyBypass)
|
if (info.lpszProxyBypass)
|
||||||
{
|
{
|
||||||
GlobalFree(info.lpszProxyBypass);
|
// pay attention! casting away constness
|
||||||
|
GlobalFree((void*)info.lpszProxyBypass);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_bFailed = true;
|
m_bFailed = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
10
thirdparty/liblastfm2/src/ws/win/Pac.h
vendored
10
thirdparty/liblastfm2/src/ws/win/Pac.h
vendored
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2009 Last.fm Ltd.
|
Copyright 2009 Last.fm Ltd.
|
||||||
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
||||||
|
|
||||||
This file is part of liblastfm.
|
This file is part of liblastfm.
|
||||||
@@ -24,14 +24,14 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winhttp.h>
|
#include <winhttp.h>
|
||||||
class QNetworkRequest;
|
class QNetworkRequest;
|
||||||
|
|
||||||
namespace lastfm
|
namespace lastfm
|
||||||
{
|
{
|
||||||
/** @brief simple wrapper to do per url automatic proxy detection
|
/** @brief simple wrapper to do per url automatic proxy detection
|
||||||
* @author <doug@last.fm>
|
* @author <doug@last.fm>
|
||||||
*/
|
*/
|
||||||
class Pac
|
class Pac
|
||||||
{
|
{
|
||||||
HINTERNET m_hSession;
|
HINTERNET m_hSession;
|
||||||
bool m_bFailed;
|
bool m_bFailed;
|
||||||
|
|
||||||
@@ -49,4 +49,4 @@ namespace lastfm
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
4
thirdparty/liblastfm2/src/ws/win/WmiSink.h
vendored
4
thirdparty/liblastfm2/src/ws/win/WmiSink.h
vendored
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2009 Last.fm Ltd.
|
Copyright 2009 Last.fm Ltd.
|
||||||
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
- Primarily authored by Max Howell, Jono Cole and Doug Mansell
|
||||||
|
|
||||||
This file is part of liblastfm.
|
This file is part of liblastfm.
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef WMISINK_WIN_H
|
#ifndef WMISINK_WIN_H
|
||||||
#define WMISINK_WIN_H
|
#define WMISINK_WIN_H
|
||||||
|
|
||||||
#include "WbemCli.h"
|
#include "wbemcli.h"
|
||||||
|
|
||||||
// Sink object for WMI NDIS notifications
|
// Sink object for WMI NDIS notifications
|
||||||
class WmiSink : public IWbemObjectSink
|
class WmiSink : public IWbemObjectSink
|
||||||
|
Reference in New Issue
Block a user