Author: akhaldi
Date: Thu Sep 25 15:10:02 2014
New Revision: 64273
URL:
http://svn.reactos.org/svn/reactos?rev=64273&view=rev
Log:
[WINHTTP]
* Sync with Wine 1.7.27.
CORE-8540
Removed:
trunk/reactos/dll/win32/winhttp/pac.js
Modified:
trunk/reactos/dll/win32/winhttp/CMakeLists.txt
trunk/reactos/dll/win32/winhttp/net.c
trunk/reactos/dll/win32/winhttp/request.c
trunk/reactos/dll/win32/winhttp/rsrc.rc
trunk/reactos/dll/win32/winhttp/session.c
trunk/reactos/dll/win32/winhttp/url.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/winhttp/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/CMakeLis…
==============================================================================
--- trunk/reactos/dll/win32/winhttp/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/winhttp/CMakeLists.txt [iso-8859-1] Thu Sep 25 15:10:02 2014
@@ -27,7 +27,7 @@
set_module_type(winhttp win32dll)
target_link_libraries(winhttp uuid wine)
add_delay_importlibs(winhttp oleaut32 ole32 crypt32 secur32)
-add_importlibs(winhttp user32 advapi32 ws2_32 msvcrt kernel32 ntdll)
+add_importlibs(winhttp user32 advapi32 ws2_32 jsproxy msvcrt kernel32 ntdll)
add_dependencies(winhttp stdole2) # wininet_tlb.tlb needs stdole2.tlb
add_pch(winhttp winhttp_private.h SOURCE)
add_cd_file(TARGET winhttp DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/win32/winhttp/net.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/net.c?re…
==============================================================================
--- trunk/reactos/dll/win32/winhttp/net.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/winhttp/net.c [iso-8859-1] Thu Sep 25 15:10:02 2014
@@ -126,6 +126,28 @@
#define ioctlsocket unix_ioctl
#endif
+static int sock_send(int fd, const void *msg, size_t len, int flags)
+{
+ int ret;
+ do
+ {
+ ret = send(fd, msg, len, flags);
+ }
+ while(ret == -1 && errno == EINTR);
+ return ret;
+}
+
+static int sock_recv(int fd, void *msg, size_t len, int flags)
+{
+ int ret;
+ do
+ {
+ ret = recv(fd, msg, len, flags);
+ }
+ while(ret == -1 && errno == EINTR);
+ return ret;
+}
+
static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD
security_flags )
{
HCERTSTORE store = cert->hCertStore;
@@ -331,7 +353,7 @@
res = sock_get_error( errno );
if (res == WSAEWOULDBLOCK || res == WSAEINPROGRESS)
{
- // ReactOS: use select instead of poll
+ /* ReactOS: use select instead of poll */
fd_set outfd;
struct timeval tv;
@@ -396,7 +418,7 @@
TRACE("sending %u bytes\n", out_buf.cbBuffer);
- size = send(conn->socket, out_buf.pvBuffer, out_buf.cbBuffer, 0);
+ size = sock_send(conn->socket, out_buf.pvBuffer, out_buf.cbBuffer, 0);
if(size != out_buf.cbBuffer) {
ERR("send failed\n");
res = ERROR_WINHTTP_SECURE_CHANNEL_ERROR;
@@ -435,7 +457,7 @@
read_buf_size += 1024;
}
- size = recv(conn->socket, (char *)(read_buf+in_bufs[0].cbBuffer),
read_buf_size-in_bufs[0].cbBuffer, 0);
+ size = sock_recv(conn->socket, read_buf+in_bufs[0].cbBuffer,
read_buf_size-in_bufs[0].cbBuffer, 0);
if(size < 1) {
WARN("recv error\n");
status = ERROR_WINHTTP_SECURE_CHANNEL_ERROR;
@@ -481,6 +503,7 @@
}
}
+ heap_free(read_buf);
if(status != SEC_E_OK || res != ERROR_SUCCESS) {
WARN("Failed to initialize security context failed: %08x\n", status);
@@ -516,7 +539,7 @@
return FALSE;
}
- if(send(conn->socket, conn->ssl_buf,
bufs[0].cbBuffer+bufs[1].cbBuffer+bufs[2].cbBuffer, 0) < 1) {
+ if(sock_send(conn->socket, conn->ssl_buf,
bufs[0].cbBuffer+bufs[1].cbBuffer+bufs[2].cbBuffer, 0) < 1) {
WARN("send failed\n");
return FALSE;
}
@@ -546,7 +569,7 @@
return TRUE;
}
- if ((*sent = send( conn->socket, msg, len, 0 )) == -1)
+ if ((*sent = sock_send( conn->socket, msg, len, 0 )) == -1)
{
set_last_error( sock_get_error( errno ) );
return FALSE;
@@ -572,7 +595,7 @@
heap_free(conn->extra_buf);
conn->extra_buf = NULL;
}else {
- buf_len = recv(conn->socket, conn->ssl_buf+conn->extra_len,
ssl_buf_size-conn->extra_len, 0);
+ buf_len = sock_recv(conn->socket, conn->ssl_buf+conn->extra_len,
ssl_buf_size-conn->extra_len, 0);
if(buf_len < 0) {
WARN("recv failed\n");
return FALSE;
@@ -604,7 +627,7 @@
case SEC_E_INCOMPLETE_MESSAGE:
assert(buf_len < ssl_buf_size);
- size = recv(conn->socket, conn->ssl_buf+buf_len, ssl_buf_size-buf_len,
0);
+ size = sock_recv(conn->socket, conn->ssl_buf+buf_len,
ssl_buf_size-buf_len, 0);
if(size < 1)
return FALSE;
@@ -697,7 +720,7 @@
*recvd = size;
return TRUE;
}
- if ((*recvd = recv( conn->socket, buf, len, flags )) == -1)
+ if ((*recvd = sock_recv( conn->socket, buf, len, flags )) == -1)
{
set_last_error( sock_get_error( errno ) );
return FALSE;
Removed: trunk/reactos/dll/win32/winhttp/pac.js
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/pac.js?r…
==============================================================================
--- trunk/reactos/dll/win32/winhttp/pac.js [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/winhttp/pac.js (removed)
@@ -1,244 +0,0 @@
-/*
- * Copyright 2011 Hans Leidekker for CodeWeavers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- *
- * Based on nsProxyAutoConfig.js from
mozilla.org.
- */
-
-function myIpAddress() {
- try {
- return dns_resolve('');
- } catch (e) {
- return '127.0.0.1';
- }
-}
-
-function dnsResolve(host) {
- try {
- return dns_resolve(host);
- } catch (e) {
- return null;
- }
-}
-
-function dnsDomainIs(host, domain) {
- return (host.length >= domain.length &&
- host.substring(host.length - domain.length) == domain);
-}
-
-function dnsDomainLevels(host) {
- return host.split('.').length-1;
-}
-
-function convert_addr(ipchars) {
- var bytes = ipchars.split('.');
- var result = ((bytes[0] & 0xff) << 24) |
- ((bytes[1] & 0xff) << 16) |
- ((bytes[2] & 0xff) << 8) |
- (bytes[3] & 0xff);
- return result;
-}
-
-function isInNet(ipaddr, pattern, maskstr) {
- var test = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(ipaddr);
- if (test == null) {
- ipaddr = dnsResolve(ipaddr);
- if (ipaddr == null)
- return false;
- } else if (test[1] > 255 || test[2] > 255 ||
- test[3] > 255 || test[4] > 255) {
- return false; // not an IP address
- }
- var host = convert_addr(ipaddr);
- var pat = convert_addr(pattern);
- var mask = convert_addr(maskstr);
- return ((host & mask) == (pat & mask));
-}
-
-function isPlainHostName(host) {
- return (host.search('\\.') == -1);
-}
-
-function isResolvable(host) {
- var ip = dnsResolve(host);
- return (ip != null);
-}
-
-function localHostOrDomainIs(host, hostdom) {
- return (host == hostdom) ||
- (hostdom.lastIndexOf(host + '.', 0) == 0);
-}
-
-function shExpMatch(url, pattern) {
- pattern = pattern.replace(/\./g, '\\.');
- pattern = pattern.replace(/\*/g, '.*');
- pattern = pattern.replace(/\?/g, '.');
- var newRe = new RegExp('^'+pattern+'$');
- return newRe.test(url);
-}
-
-var wdays = {SUN: 0, MON: 1, TUE: 2, WED: 3, THU: 4, FRI: 5, SAT: 6};
-var months = {JAN: 0, FEB: 1, MAR: 2, APR: 3, MAY: 4, JUN: 5, JUL: 6, AUG: 7, SEP: 8,
OCT: 9, NOV: 10, DEC: 11};
-
-function weekdayRange() {
- function getDay(weekday) {
- if (weekday in wdays) {
- return wdays[weekday];
- }
- return -1;
- }
- var date = new Date();
- var argc = arguments.length;
- var wday;
- if (argc < 1)
- return false;
- if (arguments[argc - 1] == 'GMT') {
- argc--;
- wday = date.getUTCDay();
- } else {
- wday = date.getDay();
- }
- var wd1 = getDay(arguments[0]);
- var wd2 = (argc == 2) ? getDay(arguments[1]) : wd1;
- return (wd1 == -1 || wd2 == -1) ? false
- : (wd1 <= wday && wday <= wd2);
-}
-
-function dateRange() {
- function getMonth(name) {
- if (name in months) {
- return months[name];
- }
- return -1;
- }
- var date = new Date();
- var argc = arguments.length;
- if (argc < 1) {
- return false;
- }
- var isGMT = (arguments[argc - 1] == 'GMT');
-
- if (isGMT) {
- argc--;
- }
- // function will work even without explicit handling of this case
- if (argc == 1) {
- var tmp = parseInt(arguments[0]);
- if (isNaN(tmp)) {
- return ((isGMT ? date.getUTCMonth() : date.getMonth()) ==
getMonth(arguments[0]));
- } else if (tmp < 32) {
- return ((isGMT ? date.getUTCDate() : date.getDate()) == tmp);
- } else {
- return ((isGMT ? date.getUTCFullYear() : date.getFullYear()) == tmp);
- }
- }
- var year = date.getFullYear();
- var date1, date2;
- date1 = new Date(year, 0, 1, 0, 0, 0);
- date2 = new Date(year, 11, 31, 23, 59, 59);
- var adjustMonth = false;
- for (var i = 0; i < (argc >> 1); i++) {
- var tmp = parseInt(arguments[i]);
- if (isNaN(tmp)) {
- var mon = getMonth(arguments[i]);
- date1.setMonth(mon);
- } else if (tmp < 32) {
- adjustMonth = (argc <= 2);
- date1.setDate(tmp);
- } else {
- date1.setFullYear(tmp);
- }
- }
- for (var i = (argc >> 1); i < argc; i++) {
- var tmp = parseInt(arguments[i]);
- if (isNaN(tmp)) {
- var mon = getMonth(arguments[i]);
- date2.setMonth(mon);
- } else if (tmp < 32) {
- date2.setDate(tmp);
- } else {
- date2.setFullYear(tmp);
- }
- }
- if (adjustMonth) {
- date1.setMonth(date.getMonth());
- date2.setMonth(date.getMonth());
- }
- if (isGMT) {
- var tmp = date;
- tmp.setFullYear(date.getUTCFullYear());
- tmp.setMonth(date.getUTCMonth());
- tmp.setDate(date.getUTCDate());
- tmp.setHours(date.getUTCHours());
- tmp.setMinutes(date.getUTCMinutes());
- tmp.setSeconds(date.getUTCSeconds());
- date = tmp;
- }
- return ((date1 <= date) && (date <= date2));
-}
-
-function timeRange() {
- var argc = arguments.length;
- var date = new Date();
- var isGMT= false;
-
- if (argc < 1) {
- return false;
- }
- if (arguments[argc - 1] == 'GMT') {
- isGMT = true;
- argc--;
- }
-
- var hour = isGMT ? date.getUTCHours() : date.getHours();
- var date1, date2;
- date1 = new Date();
- date2 = new Date();
-
- if (argc == 1) {
- return (hour == arguments[0]);
- } else if (argc == 2) {
- return ((arguments[0] <= hour) && (hour <= arguments[1]));
- } else {
- switch (argc) {
- case 6:
- date1.setSeconds(arguments[2]);
- date2.setSeconds(arguments[5]);
- case 4:
- var middle = argc >> 1;
- date1.setHours(arguments[0]);
- date1.setMinutes(arguments[1]);
- date2.setHours(arguments[middle]);
- date2.setMinutes(arguments[middle + 1]);
- if (middle == 2) {
- date2.setSeconds(59);
- }
- break;
- default:
- throw 'timeRange: bad number of arguments'
- }
- }
-
- if (isGMT) {
- date.setFullYear(date.getUTCFullYear());
- date.setMonth(date.getUTCMonth());
- date.setDate(date.getUTCDate());
- date.setHours(date.getUTCHours());
- date.setMinutes(date.getUTCMinutes());
- date.setSeconds(date.getUTCSeconds());
- }
- return ((date1 <= date) && (date <= date2));
-}
Modified: trunk/reactos/dll/win32/winhttp/request.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/request.…
==============================================================================
--- trunk/reactos/dll/win32/winhttp/request.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/winhttp/request.c [iso-8859-1] Thu Sep 25 15:10:02 2014
@@ -2241,6 +2241,8 @@
request->read_chunked = FALSE;
request->read_chunked_eof = FALSE;
}
+ else heap_free( hostname );
+
if (!(ret = add_host_header( request, WINHTTP_ADDREQ_FLAG_REPLACE ))) goto end;
if (!(ret = open_connection( request ))) goto end;
@@ -2269,7 +2271,6 @@
ret = TRUE;
end:
- if (!ret) heap_free( hostname );
heap_free( location );
return ret;
}
@@ -2981,7 +2982,7 @@
path[uc.dwUrlPathLength + uc.dwExtraInfoLength] = 0;
if (!(verb = strdupW( method ))) goto error;
- if (V_BOOL( &async )) flags |= WINHTTP_FLAG_ASYNC;
+ if (V_VT( &async ) == VT_BOOL && V_BOOL( &async )) flags |=
WINHTTP_FLAG_ASYNC;
if (!(hsession = WinHttpOpen( user_agentW, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, NULL,
NULL, flags )))
{
err = get_last_error();
@@ -3341,7 +3342,7 @@
{
sa = V_ARRAY( &data );
if ((hr = SafeArrayAccessData( sa, (void **)&ptr )) != S_OK) return hr;
- if ((hr = SafeArrayGetUBound( sa, 1, &size ) != S_OK))
+ if ((hr = SafeArrayGetUBound( sa, 1, &size )) != S_OK)
{
SafeArrayUnaccessData( sa );
return hr;
Modified: trunk/reactos/dll/win32/winhttp/rsrc.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/rsrc.rc?…
==============================================================================
--- trunk/reactos/dll/win32/winhttp/rsrc.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/winhttp/rsrc.rc [iso-8859-1] Thu Sep 25 15:10:02 2014
@@ -22,9 +22,6 @@
/* @makedep: winhttp_tlb.rgs */
1 WINE_REGISTRY winhttp_tlb.rgs
-/* @makedep: pac.js */
-pac.js 40 "pac.js"
-
#define WINE_FILEDESCRIPTION_STR "Wine HTTP Library"
#define WINE_FILENAME_STR "winhttp.dll"
#define WINE_FILEVERSION_MAJOR 5
Modified: trunk/reactos/dll/win32/winhttp/session.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/session.…
==============================================================================
--- trunk/reactos/dll/win32/winhttp/session.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/winhttp/session.c [iso-8859-1] Thu Sep 25 15:10:02 2014
@@ -27,9 +27,6 @@
#define DEFAULT_CONNECT_TIMEOUT 20000
#define DEFAULT_SEND_TIMEOUT 30000
#define DEFAULT_RECEIVE_TIMEOUT 30000
-
-static const WCHAR global_funcsW[] =
{'g','l','o','b','a','l','_','f','u','n','c','s',0};
-static const WCHAR dns_resolveW[] =
{'d','n','s','_','r','e','s','o','l','v','e',0};
void set_last_error( DWORD error )
{
@@ -1247,15 +1244,6 @@
return FALSE;
}
-static void printf_addr( const WCHAR *fmt, WCHAR *buf, struct sockaddr_in *addr )
-{
- sprintfW( buf, fmt,
- (unsigned int)(ntohl( addr->sin_addr.s_addr ) >> 24 & 0xff),
- (unsigned int)(ntohl( addr->sin_addr.s_addr ) >> 16 & 0xff),
- (unsigned int)(ntohl( addr->sin_addr.s_addr ) >> 8 & 0xff),
- (unsigned int)(ntohl( addr->sin_addr.s_addr ) & 0xff) );
-}
-
static int reverse_lookup( const struct addrinfo *ai, char *hostname, size_t len )
{
int ret = -1;
@@ -1287,12 +1275,42 @@
return ret;
}
+static BOOL get_system_proxy_autoconfig_url( char *buf, DWORD buflen )
+{
+#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >=
MAC_OS_X_VERSION_10_6
+ 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
+}
+
+#define INTERNET_MAX_URL_LENGTH 2084
+
/***********************************************************************
* WinHttpDetectAutoProxyConfigUrl (winhttp.@)
*/
BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url )
{
BOOL ret = FALSE;
+ char system_url[INTERNET_MAX_URL_LENGTH + 1];
TRACE("0x%08x, %p\n", flags, url);
@@ -1300,6 +1318,14 @@
{
set_last_error( ERROR_INVALID_PARAMETER );
return FALSE;
+ }
+ if (get_system_proxy_autoconfig_url( system_url, sizeof(system_url) ))
+ {
+ WCHAR *urlW;
+
+ if (!(urlW = strdupAW( system_url ))) return FALSE;
+ *url = urlW;
+ return TRUE;
}
if (flags & WINHTTP_AUTO_DETECT_TYPE_DHCP)
{
@@ -1611,281 +1637,9 @@
return ret;
}
-static HRESULT WINAPI dispex_QueryInterface(
- IDispatchEx *iface, REFIID riid, void **ppv )
-{
- *ppv = NULL;
-
- if (IsEqualGUID( riid, &IID_IUnknown ) ||
- IsEqualGUID( riid, &IID_IDispatch ) ||
- IsEqualGUID( riid, &IID_IDispatchEx ))
- *ppv = iface;
- else
- return E_NOINTERFACE;
-
- return S_OK;
-}
-
-static ULONG WINAPI dispex_AddRef(
- IDispatchEx *iface )
-{
- return 2;
-}
-
-static ULONG WINAPI dispex_Release(
- IDispatchEx *iface )
-{
- return 1;
-}
-
-static HRESULT WINAPI dispex_GetTypeInfoCount(
- IDispatchEx *iface, UINT *info )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI dispex_GetTypeInfo(
- IDispatchEx *iface, UINT info, LCID lcid, ITypeInfo **type_info )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI dispex_GetIDsOfNames(
- IDispatchEx *iface, REFIID riid, LPOLESTR *names, UINT count, LCID lcid, DISPID *id
)
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI dispex_Invoke(
- IDispatchEx *iface, DISPID member, REFIID riid, LCID lcid, WORD flags,
- DISPPARAMS *params, VARIANT *result, EXCEPINFO *excep, UINT *err )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI dispex_DeleteMemberByName(
- IDispatchEx *iface, BSTR name, DWORD flags )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI dispex_DeleteMemberByDispID(
- IDispatchEx *iface, DISPID id )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI dispex_GetMemberProperties(
- IDispatchEx *iface, DISPID id, DWORD flags_fetch, DWORD *flags )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI dispex_GetMemberName(
- IDispatchEx *iface, DISPID id, BSTR *name )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI dispex_GetNextDispID(
- IDispatchEx *iface, DWORD flags, DISPID id, DISPID *next )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI dispex_GetNameSpaceParent(
- IDispatchEx *iface, IUnknown **unk )
-{
- return E_NOTIMPL;
-}
-
-#define DISPID_GLOBAL_DNSRESOLVE 0x1000
-
-static HRESULT WINAPI dispex_GetDispID(
- IDispatchEx *iface, BSTR name, DWORD flags, DISPID *id )
-{
- if (!strcmpW( name, dns_resolveW ))
- {
- *id = DISPID_GLOBAL_DNSRESOLVE;
- return S_OK;
- }
- return DISP_E_UNKNOWNNAME;
-}
-
-static HRESULT dns_resolve( const WCHAR *hostname, VARIANT *result )
-{
-#ifdef HAVE_GETADDRINFO
- static const WCHAR fmtW[] =
{'%','u','.','%','u','.','%','u','.','%','u',0};
- WCHAR addr[16];
- struct addrinfo *ai, *elem;
- char *hostnameA;
- int res;
-
- if (hostname[0])
- hostnameA = strdupWA( hostname );
- else
- hostnameA = get_computer_name( ComputerNamePhysicalDnsFullyQualified );
-
- if (!hostnameA) return E_OUTOFMEMORY;
- res = getaddrinfo( hostnameA, NULL, NULL, &ai );
- heap_free( hostnameA );
- if (res) return S_FALSE;
-
- elem = ai;
- while (elem && elem->ai_family != AF_INET) elem = elem->ai_next;
- if (!elem)
- {
- freeaddrinfo( ai );
- return S_FALSE;
- }
- printf_addr( fmtW, addr, (struct sockaddr_in *)elem->ai_addr );
- freeaddrinfo( ai );
- V_VT( result ) = VT_BSTR;
- V_BSTR( result ) = SysAllocString( addr );
- return S_OK;
-#else
- FIXME("getaddrinfo not found at build time\n");
- return S_FALSE;
-#endif
-}
-
-static HRESULT WINAPI dispex_InvokeEx(
- IDispatchEx *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
- VARIANT *result, EXCEPINFO *exep, IServiceProvider *caller )
-{
- if (id == DISPID_GLOBAL_DNSRESOLVE)
- {
- if (params->cArgs != 1) return DISP_E_BADPARAMCOUNT;
- if (V_VT(¶ms->rgvarg[0]) != VT_BSTR) return DISP_E_BADVARTYPE;
- return dns_resolve( V_BSTR(¶ms->rgvarg[0]), result );
- }
- return DISP_E_MEMBERNOTFOUND;
-}
-
-static const IDispatchExVtbl dispex_vtbl =
-{
- dispex_QueryInterface,
- dispex_AddRef,
- dispex_Release,
- dispex_GetTypeInfoCount,
- dispex_GetTypeInfo,
- dispex_GetIDsOfNames,
- dispex_Invoke,
- dispex_GetDispID,
- dispex_InvokeEx,
- dispex_DeleteMemberByName,
- dispex_DeleteMemberByDispID,
- dispex_GetMemberProperties,
- dispex_GetMemberName,
- dispex_GetNextDispID,
- dispex_GetNameSpaceParent
-};
-
-static IDispatchEx global_dispex = { &dispex_vtbl };
-
-static HRESULT WINAPI site_QueryInterface(
- IActiveScriptSite *iface, REFIID riid, void **ppv )
-{
- *ppv = NULL;
-
- if (IsEqualGUID( &IID_IUnknown, riid ))
- *ppv = iface;
- else if (IsEqualGUID( &IID_IActiveScriptSite, riid ))
- *ppv = iface;
- else
- return E_NOINTERFACE;
-
- IUnknown_AddRef( (IUnknown *)*ppv );
- return S_OK;
-}
-
-static ULONG WINAPI site_AddRef(
- IActiveScriptSite *iface )
-{
- return 2;
-}
-
-static ULONG WINAPI site_Release(
- IActiveScriptSite *iface )
-{
- return 1;
-}
-
-static HRESULT WINAPI site_GetLCID(
- IActiveScriptSite *iface, LCID *lcid )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI site_GetItemInfo(
- IActiveScriptSite *iface, LPCOLESTR name, DWORD mask,
- IUnknown **item, ITypeInfo **type_info )
-{
- if (!strcmpW( name, global_funcsW ) && mask == SCRIPTINFO_IUNKNOWN)
- {
- *item = (IUnknown *)&global_dispex;
- return S_OK;
- }
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI site_GetDocVersionString(
- IActiveScriptSite *iface, BSTR *version )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI site_OnScriptTerminate(
- IActiveScriptSite *iface, const VARIANT *result, const EXCEPINFO *info )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI site_OnStateChange(
- IActiveScriptSite *iface, SCRIPTSTATE state )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI site_OnScriptError(
- IActiveScriptSite *iface, IActiveScriptError *error )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI site_OnEnterScript(
- IActiveScriptSite *iface )
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI site_OnLeaveScript(
- IActiveScriptSite *iface )
-{
- return E_NOTIMPL;
-}
-
-static const IActiveScriptSiteVtbl site_vtbl =
-{
- site_QueryInterface,
- site_AddRef,
- site_Release,
- site_GetLCID,
- site_GetItemInfo,
- site_GetDocVersionString,
- site_OnScriptTerminate,
- site_OnStateChange,
- site_OnScriptError,
- site_OnEnterScript,
- site_OnLeaveScript
-};
-
-static IActiveScriptSite script_site = { &site_vtbl };
-
-static BOOL parse_script_result( VARIANT result, WINHTTP_PROXY_INFO *info )
-{
- static const WCHAR proxyW[] =
{'P','R','O','X','Y'};
- const WCHAR *p;
+static BOOL parse_script_result( const char *result, WINHTTP_PROXY_INFO *info )
+{
+ const char *p;
WCHAR *q;
int len;
@@ -1893,18 +1647,17 @@
info->lpszProxy = NULL;
info->lpszProxyBypass = NULL;
- if (V_VT( &result ) != VT_BSTR) return TRUE;
- TRACE("%s\n", debugstr_w( V_BSTR( &result ) ));
-
- p = V_BSTR( &result );
+ TRACE("%s\n", debugstr_a( result ));
+
+ p = result;
while (*p == ' ') p++;
- len = strlenW( p );
- if (len >= 5 && !memicmpW( p, proxyW, sizeof(proxyW)/sizeof(WCHAR) ))
+ len = strlen( p );
+ if (len >= 5 && !strncasecmp( p, "PROXY",
sizeof("PROXY") - 1 ))
{
p += 5;
while (*p == ' ') p++;
if (!*p || *p == ';') return TRUE;
- if (!(info->lpszProxy = q = strdupW( p ))) return FALSE;
+ if (!(info->lpszProxy = q = strdupAW( p ))) return FALSE;
info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
for (; *q; q++)
{
@@ -1918,128 +1671,7 @@
return TRUE;
}
-static BSTR include_pac_utils( BSTR script )
-{
- static const WCHAR pacjsW[] =
{'p','a','c','.','j','s',0};
- HMODULE hmod = GetModuleHandleA( "winhttp.dll" );
- HRSRC rsrc;
- DWORD size;
- const char *data;
- BSTR ret;
- int len;
-
- if (!(rsrc = FindResourceW( hmod, pacjsW, (LPCWSTR)40 ))) return NULL;
- size = SizeofResource( hmod, rsrc );
- data = LoadResource( hmod, rsrc );
-
- len = MultiByteToWideChar( CP_ACP, 0, data, size, NULL, 0 );
- if (!(ret = SysAllocStringLen( NULL, len + SysStringLen( script ) + 1 ))) return
NULL;
- MultiByteToWideChar( CP_ACP, 0, data, size, ret, len );
- ret[len] = 0;
- strcatW( ret, script );
- return ret;
-}
-
-#ifdef _WIN64
-#define IActiveScriptParse_Release IActiveScriptParse64_Release
-#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
-#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
-#else
-#define IActiveScriptParse_Release IActiveScriptParse32_Release
-#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
-#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
-#endif
-
-static BOOL run_script( const BSTR script, const WCHAR *url, WINHTTP_PROXY_INFO *info )
-{
- static const WCHAR jscriptW[] =
{'J','S','c','r','i','p','t',0};
- static const WCHAR findproxyW[] =
{'F','i','n','d','P','r','o','x','y','F','o','r','U','R','L',0};
- IActiveScriptParse *parser = NULL;
- IActiveScript *engine = NULL;
- IDispatch *dispatch = NULL;
- BOOL ret = FALSE;
- CLSID clsid;
- DISPID dispid;
- BSTR func = NULL, hostname = NULL, full_script = NULL;
- URL_COMPONENTSW uc;
- VARIANT args[2], result;
- DISPPARAMS params;
- HRESULT hr, init;
-
- memset( &uc, 0, sizeof(uc) );
- uc.dwStructSize = sizeof(uc);
- if (!WinHttpCrackUrl( url, 0, 0, &uc )) return FALSE;
- if (!(hostname = SysAllocStringLen( NULL, uc.dwHostNameLength + 1 ))) return FALSE;
- memcpy( hostname, uc.lpszHostName, uc.dwHostNameLength * sizeof(WCHAR) );
- hostname[uc.dwHostNameLength] = 0;
-
- init = CoInitialize( NULL );
- hr = CLSIDFromProgID( jscriptW, &clsid );
- if (hr != S_OK) goto done;
-
- hr = CoCreateInstance( &clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
- &IID_IActiveScript, (void **)&engine );
- if (hr != S_OK) goto done;
-
- hr = IActiveScript_QueryInterface( engine, &IID_IActiveScriptParse, (void
**)&parser );
- if (hr != S_OK) goto done;
-
- hr = IActiveScriptParse_InitNew( parser );
- if (hr != S_OK) goto done;
-
- hr = IActiveScript_SetScriptSite( engine, &script_site );
- if (hr != S_OK) goto done;
-
- hr = IActiveScript_AddNamedItem( engine, global_funcsW, SCRIPTITEM_GLOBALMEMBERS );
- if (hr != S_OK) goto done;
-
- if (!(full_script = include_pac_utils( script ))) goto done;
-
- hr = IActiveScriptParse_ParseScriptText( parser, full_script, NULL, NULL, NULL, 0, 0,
0, NULL, NULL );
- if (hr != S_OK) goto done;
-
- hr = IActiveScript_SetScriptState( engine, SCRIPTSTATE_STARTED );
- if (hr != S_OK) goto done;
-
- hr = IActiveScript_GetScriptDispatch( engine, NULL, &dispatch );
- if (hr != S_OK) goto done;
-
- if (!(func = SysAllocString( findproxyW ))) goto done;
- hr = IDispatch_GetIDsOfNames( dispatch, &IID_NULL, &func, 1,
LOCALE_SYSTEM_DEFAULT, &dispid );
- if (hr != S_OK) goto done;
-
- V_VT( &args[0] ) = VT_BSTR;
- V_BSTR( &args[0] ) = hostname;
- V_VT( &args[1] ) = VT_BSTR;
- V_BSTR( &args[1] ) = SysAllocString( url );
-
- params.rgvarg = args;
- params.rgdispidNamedArgs = NULL;
- params.cArgs = 2;
- params.cNamedArgs = 0;
- hr = IDispatch_Invoke( dispatch, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD,
- ¶ms, &result, NULL, NULL );
- VariantClear( &args[1] );
- if (hr != S_OK)
- {
- WARN("script failed 0x%08x\n", hr);
- goto done;
- }
- ret = parse_script_result( result, info );
-
-done:
- SysFreeString( full_script );
- SysFreeString( hostname );
- SysFreeString( func );
- if (dispatch) IDispatch_Release( dispatch );
- if (parser) IActiveScriptParse_Release( parser );
- if (engine) IActiveScript_Release( engine );
- if (SUCCEEDED( init )) CoUninitialize();
- if (!ret) set_last_error( ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT );
- return ret;
-}
-
-static BSTR download_script( const WCHAR *url )
+static char *download_script( const WCHAR *url, DWORD *out_size )
{
static const WCHAR typeW[] = {'*','/','*',0};
static const WCHAR *acceptW[] = {typeW, NULL};
@@ -2048,8 +1680,8 @@
URL_COMPONENTSW uc;
DWORD status, size = sizeof(status), offset, to_read, bytes_read, flags = 0;
char *tmp, *buffer = NULL;
- BSTR script = NULL;
- int len;
+
+ *out_size = 0;
memset( &uc, 0, sizeof(uc) );
uc.dwStructSize = sizeof(uc);
@@ -2078,6 +1710,7 @@
if (!bytes_read) break;
to_read -= bytes_read;
offset += bytes_read;
+ *out_size += bytes_read;
if (!to_read)
{
to_read = size;
@@ -2086,19 +1719,51 @@
buffer = tmp;
}
}
- len = MultiByteToWideChar( CP_ACP, 0, buffer, offset, NULL, 0 );
- if (!(script = SysAllocStringLen( NULL, len ))) goto done;
- MultiByteToWideChar( CP_ACP, 0, buffer, offset, script, len );
- script[len] = 0;
done:
WinHttpCloseHandle( req );
WinHttpCloseHandle( con );
WinHttpCloseHandle( ses );
- heap_free( buffer );
heap_free( hostname );
- if (!script) set_last_error( ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT );
- return script;
+ if (!buffer) set_last_error( ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT );
+ return buffer;
+}
+
+struct AUTO_PROXY_SCRIPT_BUFFER
+{
+ DWORD dwStructSize;
+ LPSTR lpszScriptBuffer;
+ DWORD dwScriptBufferSize;
+};
+
+BOOL WINAPI InternetDeInitializeAutoProxyDll(LPSTR, DWORD);
+BOOL WINAPI InternetGetProxyInfo(LPCSTR, DWORD, LPSTR, DWORD, LPSTR *, LPDWORD);
+BOOL WINAPI InternetInitializeAutoProxyDll(DWORD, LPSTR, LPSTR, void *, struct
AUTO_PROXY_SCRIPT_BUFFER *);
+
+static BOOL run_script( char *script, DWORD size, const WCHAR *url, WINHTTP_PROXY_INFO
*info )
+{
+ BOOL ret;
+ char *result, *urlA;
+ DWORD len_result;
+ struct AUTO_PROXY_SCRIPT_BUFFER buffer;
+
+ buffer.dwStructSize = sizeof(buffer);
+ buffer.lpszScriptBuffer = script;
+ buffer.dwScriptBufferSize = size;
+
+ if (!(urlA = strdupWA( url ))) return FALSE;
+ if (!(ret = InternetInitializeAutoProxyDll( 0, NULL, NULL, NULL, &buffer )))
+ {
+ heap_free( urlA );
+ return FALSE;
+ }
+ if ((ret = InternetGetProxyInfo( urlA, strlen(urlA), NULL, 0, &result,
&len_result )))
+ {
+ ret = parse_script_result( result, info );
+ heap_free( result );
+ }
+ heap_free( urlA );
+ return InternetDeInitializeAutoProxyDll( NULL, 0 );
}
/***********************************************************************
@@ -2110,7 +1775,8 @@
WCHAR *detected_pac_url = NULL;
const WCHAR *pac_url;
session_t *session;
- BSTR script;
+ char *script;
+ DWORD size;
BOOL ret = FALSE;
TRACE("%p, %s, %p, %p\n", hsession, debugstr_w(url), options, info);
@@ -2143,9 +1809,11 @@
if (options->dwFlags & WINHTTP_AUTOPROXY_CONFIG_URL) pac_url =
options->lpszAutoConfigUrl;
else pac_url = detected_pac_url;
- if (!(script = download_script( pac_url ))) goto done;
- ret = run_script( script, url, info );
- SysFreeString( script );
+ if ((script = download_script( pac_url, &size )))
+ {
+ ret = run_script( script, size, url, info );
+ heap_free( script );
+ }
done:
GlobalFree( detected_pac_url );
Modified: trunk/reactos/dll/win32/winhttp/url.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/url.c?re…
==============================================================================
--- trunk/reactos/dll/win32/winhttp/url.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/winhttp/url.c [iso-8859-1] Thu Sep 25 15:10:02 2014
@@ -23,6 +23,12 @@
static BOOL set_component( WCHAR **str, DWORD *str_len, WCHAR *value, DWORD len, DWORD
flags )
{
+ if (*str && !*str_len)
+ {
+ set_last_error( ERROR_INVALID_PARAMETER );
+ return FALSE;
+ }
+ if (!*str_len) return TRUE;
if (!*str)
{
if (len && *str_len && (flags & (ICU_DECODE|ICU_ESCAPE)))
@@ -160,6 +166,7 @@
{
BOOL ret = FALSE;
WCHAR *p, *q, *r, *url_decoded = NULL, *url_escaped = NULL;
+ INTERNET_SCHEME scheme = 0;
TRACE("%s, %d, %x, %p\n", debugstr_w(url), len, flags, uc);
@@ -193,8 +200,8 @@
set_last_error( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
return FALSE;
}
- if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) uc->nScheme =
INTERNET_SCHEME_HTTP;
- else if (p - url == 5 && !strncmpiW( url, scheme_https, 5 )) uc->nScheme =
INTERNET_SCHEME_HTTPS;
+ if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) scheme =
INTERNET_SCHEME_HTTP;
+ else if (p - url == 5 && !strncmpiW( url, scheme_https, 5 )) scheme =
INTERNET_SCHEME_HTTPS;
else
{
set_last_error( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
@@ -238,8 +245,8 @@
else
{
if (!(set_component( &uc->lpszHostName, &uc->dwHostNameLength,
p, q - p, flags ))) goto exit;
- if (uc->nScheme == INTERNET_SCHEME_HTTP) uc->nPort =
INTERNET_DEFAULT_HTTP_PORT;
- if (uc->nScheme == INTERNET_SCHEME_HTTPS) uc->nPort =
INTERNET_DEFAULT_HTTPS_PORT;
+ if (scheme == INTERNET_SCHEME_HTTP) uc->nPort =
INTERNET_DEFAULT_HTTP_PORT;
+ if (scheme == INTERNET_SCHEME_HTTPS) uc->nPort =
INTERNET_DEFAULT_HTTPS_PORT;
}
if ((r = memchrW( q, '?', len - (q - url) )))
@@ -264,8 +271,8 @@
else
{
if (!(set_component( &uc->lpszHostName, &uc->dwHostNameLength,
p, len - (p - url), flags ))) goto exit;
- if (uc->nScheme == INTERNET_SCHEME_HTTP) uc->nPort =
INTERNET_DEFAULT_HTTP_PORT;
- if (uc->nScheme == INTERNET_SCHEME_HTTPS) uc->nPort =
INTERNET_DEFAULT_HTTPS_PORT;
+ if (scheme == INTERNET_SCHEME_HTTP) uc->nPort =
INTERNET_DEFAULT_HTTP_PORT;
+ if (scheme == INTERNET_SCHEME_HTTPS) uc->nPort =
INTERNET_DEFAULT_HTTPS_PORT;
}
if (!(set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, (WCHAR
*)url + len, 0, flags ))) goto exit;
if (!(set_component( &uc->lpszExtraInfo, &uc->dwExtraInfoLength,
(WCHAR *)url + len, 0, flags ))) goto exit;
@@ -281,6 +288,7 @@
debugstr_wn( uc->lpszExtraInfo, uc->dwExtraInfoLength ));
exit:
+ if (ret) uc->nScheme = scheme;
heap_free( url_decoded );
heap_free( url_escaped );
return ret;
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Thu Sep 25 15:10:02 2014
@@ -210,7 +210,7 @@
reactos/dll/win32/windowscodecsext # Synced to Wine-1.7.17
reactos/dll/win32/winemp3.acm # Synced to Wine-1.7.17
reactos/dll/win32/wing32 # Out of sync
-reactos/dll/win32/winhttp # Synced to Wine-1.7.17
+reactos/dll/win32/winhttp # Synced to Wine-1.7.27
reactos/dll/win32/wininet # Synced to Wine-1.7.17
reactos/dll/win32/winmm # Forked at Wine-20050628
reactos/dll/win32/winmm/midimap # Forked at Wine-20050628