mirror of
https://github.com/reactos/reactos.git
synced 2024-11-18 21:13:52 +00:00
527f2f9057
* Create a branch for some evul shell experiments. svn path=/branches/shell-experiments/; revision=61927
216 lines
7.9 KiB
Diff
216 lines
7.9 KiB
Diff
diff -prudN e:\Wine\dlls\winhttp/net.c e:\reactos-clean\dll\win32\winhttp/net.c
|
|
--- e:\Wine\dlls\winhttp/net.c 2013-03-16 11:54:52.602606100 +0100
|
|
+++ e:\reactos-clean\dll\win32\winhttp/net.c 2013-05-21 20:25:32.595598100 +0100
|
|
@@ -73,6 +77,7 @@ static CRITICAL_SECTION cs_gethostbyname
|
|
#endif
|
|
|
|
/* translate a unix error code into a winsock error code */
|
|
+#ifndef __REACTOS__
|
|
static int sock_get_error( int err )
|
|
{
|
|
#if !defined(__MINGW32__) && !defined (_MSC_VER)
|
|
@@ -138,6 +143,15 @@ static int sock_get_error( int err )
|
|
#endif
|
|
return err;
|
|
}
|
|
+#else
|
|
+#define sock_get_error(x) WSAGetLastError()
|
|
+
|
|
+static inline int unix_ioctl(int filedes, long request, void *arg)
|
|
+{
|
|
+ return ioctlsocket(filedes, request, arg);
|
|
+}
|
|
+#define ioctlsocket unix_ioctl
|
|
+#endif
|
|
|
|
static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD security_flags )
|
|
{
|
|
@@ -344,11 +358,17 @@ BOOL netconn_connect( netconn_t *conn, c
|
|
res = sock_get_error( errno );
|
|
if (res == WSAEWOULDBLOCK || res == WSAEINPROGRESS)
|
|
{
|
|
- struct pollfd pfd;
|
|
+ // ReactOS: use select instead of poll
|
|
+ fd_set outfd;
|
|
+ struct timeval tv;
|
|
|
|
- pfd.fd = conn->socket;
|
|
- pfd.events = POLLOUT;
|
|
- if (poll( &pfd, 1, timeout ) > 0)
|
|
+ FD_ZERO(&outfd);
|
|
+ FD_SET(conn->socket, &outfd);
|
|
+
|
|
+ tv.tv_sec = 0;
|
|
+ tv.tv_usec = timeout * 1000;
|
|
+
|
|
+ if (select( 0, NULL, &outfd, NULL, &tv ) > 0)
|
|
ret = TRUE;
|
|
else
|
|
res = sock_get_error( errno );
|
|
@@ -442,7 +462,7 @@ BOOL netconn_secure_connect( netconn_t *
|
|
read_buf_size += 1024;
|
|
}
|
|
|
|
- size = recv(conn->socket, read_buf+in_bufs[0].cbBuffer, read_buf_size-in_bufs[0].cbBuffer, 0);
|
|
+ size = recv(conn->socket, (char *)(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;
|
|
@@ -754,7 +774,8 @@ BOOL netconn_query_data_available( netco
|
|
|
|
BOOL netconn_get_next_line( netconn_t *conn, char *buffer, DWORD *buflen )
|
|
{
|
|
- struct pollfd pfd;
|
|
+ // ReactOS: use select instead of poll
|
|
+ fd_set infd;
|
|
BOOL ret = FALSE;
|
|
DWORD recvd = 0;
|
|
|
|
@@ -786,19 +807,21 @@ BOOL netconn_get_next_line( netconn_t *c
|
|
return ret;
|
|
}
|
|
|
|
- pfd.fd = conn->socket;
|
|
- pfd.events = POLLIN;
|
|
+ FD_ZERO(&infd);
|
|
+ FD_SET(conn->socket, &infd);
|
|
+
|
|
while (recvd < *buflen)
|
|
{
|
|
- int timeout, res;
|
|
- struct timeval tv;
|
|
+ int res;
|
|
+ struct timeval tv, *ptv;
|
|
socklen_t len = sizeof(tv);
|
|
|
|
if ((res = getsockopt( conn->socket, SOL_SOCKET, SO_RCVTIMEO, (void*)&tv, &len ) != -1))
|
|
- timeout = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
|
+ ptv = &tv;
|
|
else
|
|
- timeout = -1;
|
|
- if (poll( &pfd, 1, timeout ) > 0)
|
|
+ ptv = NULL;
|
|
+
|
|
+ if (select( 0, &infd, NULL, NULL, ptv ) > 0)
|
|
{
|
|
if ((res = recv( conn->socket, &buffer[recvd], 1, 0 )) <= 0)
|
|
{
|
|
diff -prudN e:\Wine\dlls\winhttp/request.c e:\reactos-clean\dll\win32\winhttp/request.c
|
|
--- e:\Wine\dlls\winhttp/request.c 2013-03-16 11:54:52.603606700 +0100
|
|
+++ e:\reactos-clean\dll\win32\winhttp/request.c 2013-05-21 20:05:12.642413600 +0100
|
|
@@ -2254,8 +2260,8 @@ static void free_request( struct winhttp
|
|
CloseHandle( request->thread );
|
|
CloseHandle( request->wait );
|
|
CloseHandle( request->cancel );
|
|
- heap_free( request->proxy.lpszProxy );
|
|
- heap_free( request->proxy.lpszProxyBypass );
|
|
+ heap_free( (WCHAR *)request->proxy.lpszProxy );
|
|
+ heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
|
|
heap_free( request->buffer );
|
|
heap_free( request->verb );
|
|
VariantClear( &request->data );
|
|
@@ -2446,16 +2452,16 @@ static HRESULT WINAPI winhttp_request_Se
|
|
{
|
|
case HTTPREQUEST_PROXYSETTING_DEFAULT:
|
|
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
|
|
- heap_free( request->proxy.lpszProxy );
|
|
- heap_free( request->proxy.lpszProxyBypass );
|
|
+ heap_free( (WCHAR *)request->proxy.lpszProxy );
|
|
+ heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
|
|
request->proxy.lpszProxy = NULL;
|
|
request->proxy.lpszProxyBypass = NULL;
|
|
break;
|
|
|
|
case HTTPREQUEST_PROXYSETTING_DIRECT:
|
|
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
|
|
- heap_free( request->proxy.lpszProxy );
|
|
- heap_free( request->proxy.lpszProxyBypass );
|
|
+ heap_free( (WCHAR *)request->proxy.lpszProxy );
|
|
+ heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
|
|
request->proxy.lpszProxy = NULL;
|
|
request->proxy.lpszProxyBypass = NULL;
|
|
break;
|
|
@@ -2464,12 +2470,12 @@ static HRESULT WINAPI winhttp_request_Se
|
|
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
|
|
if (V_VT( &proxy_server ) == VT_BSTR)
|
|
{
|
|
- heap_free( request->proxy.lpszProxy );
|
|
+ heap_free( (WCHAR *)request->proxy.lpszProxy );
|
|
request->proxy.lpszProxy = strdupW( V_BSTR( &proxy_server ) );
|
|
}
|
|
if (V_VT( &bypass_list ) == VT_BSTR)
|
|
{
|
|
- heap_free( request->proxy.lpszProxyBypass );
|
|
+ heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
|
|
request->proxy.lpszProxyBypass = strdupW( V_BSTR( &bypass_list ) );
|
|
}
|
|
break;
|
|
diff -prudN e:\Wine\dlls\winhttp/rsrc.rc e:\reactos-clean\dll\win32\winhttp/rsrc.rc
|
|
--- e:\Wine\dlls\winhttp/rsrc.rc 2011-11-24 17:55:02.335439900 +0100
|
|
+++ e:\reactos-clean\dll\win32\winhttp/rsrc.rc 2012-07-20 21:40:58.173741700 +0100
|
|
@@ -16,6 +16,12 @@
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
*/
|
|
|
|
+/* @makedep: winhttp_tlb.tlb */
|
|
+1 TYPELIB winhttp_tlb.tlb
|
|
+
|
|
+/* @makedep: winhttp_tlb.rgs */
|
|
+1 WINE_REGISTRY winhttp_tlb.rgs
|
|
+
|
|
/* @makedep: pac.js */
|
|
pac.js 40 "pac.js"
|
|
|
|
diff -prudN e:\Wine\dlls\winhttp/session.c e:\reactos-clean\dll\win32\winhttp/session.c
|
|
--- e:\Wine\dlls\winhttp/session.c 2013-03-16 11:54:52.604607400 +0100
|
|
+++ e:\reactos-clean\dll\win32\winhttp/session.c 2013-05-21 20:19:52.231665900 +0100
|
|
@@ -100,6 +100,9 @@ static void session_destroy( object_head
|
|
heap_free( session->proxy_username );
|
|
heap_free( session->proxy_password );
|
|
heap_free( session );
|
|
+#ifdef __REACTOS__
|
|
+ WSACleanup();
|
|
+#endif
|
|
}
|
|
|
|
static BOOL session_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen )
|
|
@@ -211,6 +214,11 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag
|
|
{
|
|
session_t *session;
|
|
HINTERNET handle = NULL;
|
|
+#ifdef __REACTOS__
|
|
+ WSADATA wsaData;
|
|
+ int error = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
|
+ if (error) ERR("WSAStartup failed: %d\n", error);
|
|
+#endif
|
|
|
|
TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags);
|
|
|
|
@@ -237,14 +245,14 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag
|
|
session->access = info.dwAccessType;
|
|
if (info.lpszProxy && !(session->proxy_server = strdupW( info.lpszProxy )))
|
|
{
|
|
- GlobalFree( info.lpszProxy );
|
|
- GlobalFree( info.lpszProxyBypass );
|
|
+ GlobalFree( (LPWSTR)info.lpszProxy );
|
|
+ GlobalFree( (LPWSTR)info.lpszProxyBypass );
|
|
goto end;
|
|
}
|
|
if (info.lpszProxyBypass && !(session->proxy_bypass = strdupW( info.lpszProxyBypass )))
|
|
{
|
|
- GlobalFree( info.lpszProxy );
|
|
- GlobalFree( info.lpszProxyBypass );
|
|
+ GlobalFree( (LPWSTR)info.lpszProxy );
|
|
+ GlobalFree( (LPWSTR)info.lpszProxyBypass );
|
|
goto end;
|
|
}
|
|
}
|
|
@@ -594,7 +602,7 @@ static WCHAR *blob_to_str( DWORD encodin
|
|
|
|
static BOOL convert_sockaddr( const struct sockaddr *addr, SOCKADDR_STORAGE *addr_storage )
|
|
{
|
|
-#ifndef __MINGW32__
|
|
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
|
|
switch (addr->sa_family)
|
|
{
|
|
case AF_INET:
|