1 diff -pudN e:\wine\dlls\winhttp/net.c e:\reactos\dll\win32\winhttp/net.c
2 --- e:\wine\dlls\winhttp/net.c 2016-11-16 17:36:37 +0100
3 +++ e:\reactos\dll\win32\winhttp/net.c 2016-10-13 11:15:39 +0100
4 @@ -50,6 +50,7 @@ static CRITICAL_SECTION cs_gethostbyname
7 /* translate a unix error code into a winsock error code */
9 static int sock_get_error( int err )
11 #if !defined(__MINGW32__) && !defined (_MSC_VER)
12 @@ -115,6 +116,15 @@ static int sock_get_error( int err )
17 +#define sock_get_error(x) WSAGetLastError()
19 +static inline int unix_ioctl(int filedes, long request, void *arg)
21 + return ioctlsocket(filedes, request, arg);
23 +#define ioctlsocket unix_ioctl
26 static int sock_send(int fd, const void *msg, size_t len, int flags)
28 @@ -266,6 +276,28 @@ static BOOL ensure_cred_handle(void)
33 +static BOOL winsock_initialized = FALSE;
34 +BOOL netconn_init_winsock()
38 + if (!winsock_initialized)
40 + error = WSAStartup(MAKEWORD(1, 1), &wsaData);
43 + ERR("WSAStartup failed: %d\n", error);
47 + winsock_initialized = TRUE;
49 + return winsock_initialized;
54 BOOL netconn_init( netconn_t *conn )
56 memset(conn, 0, sizeof(*conn));
57 @@ -281,6 +313,10 @@ void netconn_unload( void )
58 #ifndef HAVE_GETADDRINFO
59 DeleteCriticalSection(&cs_gethostbyname);
62 + if(winsock_initialized)
67 BOOL netconn_connected( netconn_t *conn )
68 @@ -343,11 +379,25 @@ BOOL netconn_connect( netconn_t *conn, c
69 res = sock_get_error( errno );
70 if (res == WSAEWOULDBLOCK || res == WSAEINPROGRESS)
73 + /* ReactOS: use select instead of poll */
78 + FD_SET(conn->socket, &outfd);
81 + tv.tv_usec = timeout * 1000;
83 + if (select( 0, NULL, &outfd, NULL, &tv ) > 0)
87 pfd.fd = conn->socket;
89 if (poll( &pfd, 1, timeout ) > 0)
93 res = sock_get_error( errno );
94 diff -pudN e:\wine\dlls\winhttp/request.c e:\reactos\dll\win32\winhttp/request.c
95 --- e:\wine\dlls\winhttp/request.c 2016-11-16 17:36:37 +0100
96 +++ e:\reactos\dll\win32\winhttp/request.c 2016-02-27 16:08:59 +0100
97 @@ -1258,6 +1258,7 @@ BOOL WINAPI WinHttpSendRequest( HINTERNE
102 #define ARRAYSIZE(array) (sizeof(array) / sizeof((array)[0]))
104 static const WCHAR basicW[] = {'B','a','s','i','c',0};
105 @@ -2758,8 +2759,8 @@ static void free_request( struct winhttp
106 CloseHandle( request->thread );
107 CloseHandle( request->wait );
108 CloseHandle( request->cancel );
109 - heap_free( request->proxy.lpszProxy );
110 - heap_free( request->proxy.lpszProxyBypass );
111 + heap_free( (WCHAR *)request->proxy.lpszProxy );
112 + heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
113 heap_free( request->buffer );
114 heap_free( request->verb );
115 VariantClear( &request->data );
116 @@ -3005,16 +3006,16 @@ static HRESULT WINAPI winhttp_request_Se
118 case HTTPREQUEST_PROXYSETTING_DEFAULT:
119 request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
120 - heap_free( request->proxy.lpszProxy );
121 - heap_free( request->proxy.lpszProxyBypass );
122 + heap_free( (WCHAR *)request->proxy.lpszProxy );
123 + heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
124 request->proxy.lpszProxy = NULL;
125 request->proxy.lpszProxyBypass = NULL;
128 case HTTPREQUEST_PROXYSETTING_DIRECT:
129 request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
130 - heap_free( request->proxy.lpszProxy );
131 - heap_free( request->proxy.lpszProxyBypass );
132 + heap_free( (WCHAR *)request->proxy.lpszProxy );
133 + heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
134 request->proxy.lpszProxy = NULL;
135 request->proxy.lpszProxyBypass = NULL;
137 @@ -3023,12 +3024,12 @@ static HRESULT WINAPI winhttp_request_Se
138 request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
139 if (V_VT( &proxy_server ) == VT_BSTR)
141 - heap_free( request->proxy.lpszProxy );
142 + heap_free( (WCHAR *)request->proxy.lpszProxy );
143 request->proxy.lpszProxy = strdupW( V_BSTR( &proxy_server ) );
145 if (V_VT( &bypass_list ) == VT_BSTR)
147 - heap_free( request->proxy.lpszProxyBypass );
148 + heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
149 request->proxy.lpszProxyBypass = strdupW( V_BSTR( &bypass_list ) );
152 diff -pudN e:\wine\dlls\winhttp/session.c e:\reactos\dll\win32\winhttp/session.c
153 --- e:\wine\dlls\winhttp/session.c 2016-11-16 17:36:37 +0100
154 +++ e:\reactos\dll\win32\winhttp/session.c 2016-11-17 00:14:49 +0100
155 @@ -197,6 +197,9 @@ static const object_vtbl_t session_vtbl
160 +BOOL netconn_init_winsock();
161 +#endif /* __REACTOS__ */
162 /***********************************************************************
163 * WinHttpOpen (winhttp.@)
165 @@ -204,6 +207,9 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag
168 HINTERNET handle = NULL;
170 + if (!netconn_init_winsock()) return NULL;
173 TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags);
175 @@ -230,14 +236,14 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag
176 session->access = info.dwAccessType;
177 if (info.lpszProxy && !(session->proxy_server = strdupW( info.lpszProxy )))
179 - GlobalFree( info.lpszProxy );
180 - GlobalFree( info.lpszProxyBypass );
181 + GlobalFree( (LPWSTR)info.lpszProxy );
182 + GlobalFree( (LPWSTR)info.lpszProxyBypass );
185 if (info.lpszProxyBypass && !(session->proxy_bypass = strdupW( info.lpszProxyBypass )))
187 - GlobalFree( info.lpszProxy );
188 - GlobalFree( info.lpszProxyBypass );
189 + GlobalFree( (LPWSTR)info.lpszProxy );
190 + GlobalFree( (LPWSTR)info.lpszProxyBypass );
194 @@ -610,7 +616,7 @@ static WCHAR *blob_to_str( DWORD encodin
196 static BOOL convert_sockaddr( const struct sockaddr *addr, SOCKADDR_STORAGE *addr_storage )
199 +#if !defined(__MINGW32__) && !defined(_MSC_VER)
200 switch (addr->sa_family)