mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 20:30:01 +00:00
wininet: Add support for retrieving the proxy automatic configuration URL on Mac OS X.
This commit is contained in:
parent
5b56624a1b
commit
89d40b3de1
@ -3,7 +3,7 @@ MODULE = wininet.dll
|
||||
IMPORTLIB = wininet
|
||||
IMPORTS = mpr shlwapi shell32 user32 advapi32
|
||||
DELAYIMPORTS = secur32 crypt32 cryptui
|
||||
EXTRALIBS = $(SOCKET_LIBS) $(Z_LIBS)
|
||||
EXTRALIBS = $(CORESERVICES_LIBS) $(SOCKET_LIBS) $(Z_LIBS)
|
||||
|
||||
C_SRCS = \
|
||||
cookie.c \
|
||||
|
@ -56,6 +56,15 @@
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef HAVE_CORESERVICES_CORESERVICES_H
|
||||
#define GetCurrentThread MacGetCurrentThread
|
||||
#define LoadResource MacLoadResource
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#undef GetCurrentThread
|
||||
#undef LoadResource
|
||||
#undef DPRINTF
|
||||
#endif
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
@ -2389,6 +2398,33 @@ BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer,
|
||||
return res == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static BOOL get_proxy_autoconfig_url( char *buf, DWORD buflen )
|
||||
{
|
||||
#ifdef HAVE_CORESERVICES_CORESERVICES_H
|
||||
CFDictionaryRef settings = CFNetworkCopySystemProxySettings();
|
||||
const void *ref;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (!settings) return FALSE;
|
||||
|
||||
if (!(ref = CFDictionaryGetValue( settings, kCFNetworkProxiesProxyAutoConfigURLString )))
|
||||
{
|
||||
CFRelease( settings );
|
||||
return FALSE;
|
||||
}
|
||||
if (CFStringGetCString( ref, buf, buflen, kCFStringEncodingASCII ))
|
||||
{
|
||||
TRACE( "returning %s\n", debugstr_a(buf) );
|
||||
ret = TRUE;
|
||||
}
|
||||
CFRelease( settings );
|
||||
return ret;
|
||||
#else
|
||||
FIXME( "no support on this platform\n" );
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL unicode)
|
||||
{
|
||||
/* FIXME: This function currently handles more options than it should. Options requiring
|
||||
@ -2472,16 +2508,20 @@ static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL u
|
||||
}
|
||||
|
||||
case INTERNET_OPTION_PER_CONNECTION_OPTION: {
|
||||
char url[INTERNET_MAX_URL_LENGTH + 1];
|
||||
INTERNET_PER_CONN_OPTION_LISTW *con = buffer;
|
||||
INTERNET_PER_CONN_OPTION_LISTA *conA = buffer;
|
||||
DWORD res = ERROR_SUCCESS, i;
|
||||
proxyinfo_t pi;
|
||||
BOOL have_url;
|
||||
LONG ret;
|
||||
|
||||
TRACE("Getting global proxy info\n");
|
||||
if((ret = INTERNET_LoadProxySettings(&pi)))
|
||||
return ret;
|
||||
|
||||
have_url = get_proxy_autoconfig_url(url, sizeof(url));
|
||||
|
||||
FIXME("INTERNET_OPTION_PER_CONNECTION_OPTION stub\n");
|
||||
|
||||
if (*size < sizeof(INTERNET_PER_CONN_OPTION_LISTW)) {
|
||||
@ -2499,6 +2539,9 @@ static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL u
|
||||
optionW->Value.dwValue = PROXY_TYPE_PROXY;
|
||||
else
|
||||
optionW->Value.dwValue = PROXY_TYPE_DIRECT;
|
||||
if (have_url)
|
||||
/* native includes PROXY_TYPE_DIRECT even if PROXY_TYPE_PROXY is set */
|
||||
optionW->Value.dwValue |= PROXY_TYPE_DIRECT|PROXY_TYPE_AUTO_PROXY_URL;
|
||||
break;
|
||||
|
||||
case INTERNET_PER_CONN_PROXY_SERVER:
|
||||
@ -2516,7 +2559,18 @@ static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL u
|
||||
break;
|
||||
|
||||
case INTERNET_PER_CONN_AUTOCONFIG_URL:
|
||||
if (!have_url)
|
||||
optionW->Value.pszValue = NULL;
|
||||
else if (unicode)
|
||||
optionW->Value.pszValue = heap_strdupAtoW(url);
|
||||
else
|
||||
optionA->Value.pszValue = heap_strdupA(url);
|
||||
break;
|
||||
|
||||
case INTERNET_PER_CONN_AUTODISCOVERY_FLAGS:
|
||||
optionW->Value.dwValue = AUTO_PROXY_FLAG_ALWAYS_DETECT;
|
||||
break;
|
||||
|
||||
case INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL:
|
||||
case INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS:
|
||||
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME:
|
||||
|
Loading…
Reference in New Issue
Block a user