Commit 120244ae authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Build without -DWINE_NO_LONG_TYPES.

parent 3c695e3c
EXTRADEFS = -DWINE_NO_LONG_TYPES
MODULE = winhttp.dll MODULE = winhttp.dll
IMPORTLIB = winhttp IMPORTLIB = winhttp
IMPORTS = uuid jsproxy user32 advapi32 ws2_32 IMPORTS = uuid jsproxy user32 advapi32 ws2_32
......
...@@ -48,7 +48,7 @@ static ULONG_PTR max_handles; ...@@ -48,7 +48,7 @@ static ULONG_PTR max_handles;
struct object_header *addref_object( struct object_header *hdr ) struct object_header *addref_object( struct object_header *hdr )
{ {
ULONG refs = InterlockedIncrement( &hdr->refs ); ULONG refs = InterlockedIncrement( &hdr->refs );
TRACE("%p -> refcount = %d\n", hdr, refs); TRACE( "%p -> refcount = %lu\n", hdr, refs );
return hdr; return hdr;
} }
...@@ -64,21 +64,21 @@ struct object_header *grab_object( HINTERNET hinternet ) ...@@ -64,21 +64,21 @@ struct object_header *grab_object( HINTERNET hinternet )
LeaveCriticalSection( &handle_cs ); LeaveCriticalSection( &handle_cs );
TRACE("handle 0x%lx -> %p\n", handle, hdr); TRACE( "handle %Ix -> %p\n", handle, hdr );
return hdr; return hdr;
} }
void release_object( struct object_header *hdr ) void release_object( struct object_header *hdr )
{ {
ULONG refs = InterlockedDecrement( &hdr->refs ); ULONG refs = InterlockedDecrement( &hdr->refs );
TRACE("object %p refcount = %d\n", hdr, refs); TRACE( "object %p refcount = %lu\n", hdr, refs );
if (!refs) if (!refs)
{ {
if (hdr->type == WINHTTP_HANDLE_TYPE_REQUEST) close_connection( (struct request *)hdr ); if (hdr->type == WINHTTP_HANDLE_TYPE_REQUEST) close_connection( (struct request *)hdr );
send_callback( hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, &hdr->handle, sizeof(HINTERNET) ); send_callback( hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, &hdr->handle, sizeof(HINTERNET) );
TRACE("destroying object %p\n", hdr); TRACE( "destroying object %p\n", hdr );
hdr->vtbl->destroy( hdr ); hdr->vtbl->destroy( hdr );
} }
} }
...@@ -134,7 +134,7 @@ BOOL free_handle( HINTERNET hinternet ) ...@@ -134,7 +134,7 @@ BOOL free_handle( HINTERNET hinternet )
if (handles[handle]) if (handles[handle])
{ {
hdr = handles[handle]; hdr = handles[handle];
TRACE("destroying handle 0x%lx for object %p\n", handle + 1, hdr); TRACE( "destroying handle %Ix for object %p\n", handle + 1, hdr );
handles[handle] = NULL; handles[handle] = NULL;
ret = TRUE; ret = TRUE;
} }
......
...@@ -36,7 +36,7 @@ static int sock_send(int fd, const void *msg, size_t len, WSAOVERLAPPED *ovr) ...@@ -36,7 +36,7 @@ static int sock_send(int fd, const void *msg, size_t len, WSAOVERLAPPED *ovr)
{ {
WSABUF wsabuf; WSABUF wsabuf;
DWORD size; DWORD size;
DWORD err; int err;
wsabuf.len = len; wsabuf.len = len;
wsabuf.buf = (void *)msg; wsabuf.buf = (void *)msg;
...@@ -47,7 +47,7 @@ static int sock_send(int fd, const void *msg, size_t len, WSAOVERLAPPED *ovr) ...@@ -47,7 +47,7 @@ static int sock_send(int fd, const void *msg, size_t len, WSAOVERLAPPED *ovr)
return size; return size;
} }
err = WSAGetLastError(); err = WSAGetLastError();
if (!(ovr && err == WSA_IO_PENDING)) WARN( "send error %u\n", err ); if (!(ovr && err == WSA_IO_PENDING)) WARN( "send error %d\n", err );
return -1; return -1;
} }
...@@ -56,7 +56,7 @@ static int sock_recv(int fd, void *msg, size_t len, int flags) ...@@ -56,7 +56,7 @@ static int sock_recv(int fd, void *msg, size_t len, int flags)
int ret; int ret;
do do
{ {
if ((ret = recv(fd, msg, len, flags)) == -1) WARN("recv error %u\n", WSAGetLastError()); if ((ret = recv(fd, msg, len, flags)) == -1) WARN( "recv error %d\n", WSAGetLastError() );
} }
while(ret == -1 && WSAGetLastError() == WSAEINTR); while(ret == -1 && WSAGetLastError() == WSAEINTR);
return ret; return ret;
...@@ -154,7 +154,7 @@ static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD secu ...@@ -154,7 +154,7 @@ static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD secu
} }
else else
err = ERROR_WINHTTP_SECURE_CHANNEL_ERROR; err = ERROR_WINHTTP_SECURE_CHANNEL_ERROR;
TRACE("returning %08x\n", err); TRACE( "returning %#lx\n", err );
return err; return err;
} }
...@@ -201,7 +201,7 @@ DWORD netconn_create( struct hostdata *host, const struct sockaddr_storage *sock ...@@ -201,7 +201,7 @@ DWORD netconn_create( struct hostdata *host, const struct sockaddr_storage *sock
if ((conn->socket = WSASocketW( sockaddr->ss_family, SOCK_STREAM, 0, NULL, 0, WSA_FLAG_OVERLAPPED )) == -1) if ((conn->socket = WSASocketW( sockaddr->ss_family, SOCK_STREAM, 0, NULL, 0, WSA_FLAG_OVERLAPPED )) == -1)
{ {
ret = WSAGetLastError(); ret = WSAGetLastError();
WARN("unable to create socket (%u)\n", ret); WARN( "unable to create socket (%lu)\n", ret );
free( conn ); free( conn );
return ret; return ret;
} }
...@@ -243,7 +243,7 @@ DWORD netconn_create( struct hostdata *host, const struct sockaddr_storage *sock ...@@ -243,7 +243,7 @@ DWORD netconn_create( struct hostdata *host, const struct sockaddr_storage *sock
if (ret) if (ret)
{ {
WARN("unable to connect to host (%u)\n", ret); WARN( "unable to connect to host (%lu)\n", ret );
closesocket( conn->socket ); closesocket( conn->socket );
free( conn ); free( conn );
return ret; return ret;
...@@ -296,7 +296,7 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur ...@@ -296,7 +296,7 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur
if(out_buf.cbBuffer) { if(out_buf.cbBuffer) {
assert(status == SEC_I_CONTINUE_NEEDED); assert(status == SEC_I_CONTINUE_NEEDED);
TRACE("sending %u bytes\n", out_buf.cbBuffer); TRACE( "sending %lu bytes\n", out_buf.cbBuffer );
size = sock_send(conn->socket, out_buf.pvBuffer, out_buf.cbBuffer, NULL); size = sock_send(conn->socket, out_buf.pvBuffer, out_buf.cbBuffer, NULL);
if(size != out_buf.cbBuffer) { if(size != out_buf.cbBuffer) {
...@@ -343,13 +343,13 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur ...@@ -343,13 +343,13 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur
break; break;
} }
TRACE("recv %lu bytes\n", size); TRACE( "recv %Iu bytes\n", size );
in_bufs[0].cbBuffer += size; in_bufs[0].cbBuffer += size;
in_bufs[0].pvBuffer = read_buf; in_bufs[0].pvBuffer = read_buf;
status = InitializeSecurityContextW(cred_handle, &ctx, hostname, isc_req_flags, 0, 0, &in_desc, status = InitializeSecurityContextW(cred_handle, &ctx, hostname, isc_req_flags, 0, 0, &in_desc,
0, NULL, &out_desc, &attrs, NULL); 0, NULL, &out_desc, &attrs, NULL);
TRACE("InitializeSecurityContext ret %08x\n", status); TRACE( "InitializeSecurityContext ret %#lx\n", status );
if(status == SEC_E_OK) { if(status == SEC_E_OK) {
if(in_bufs[1].BufferType == SECBUFFER_EXTRA) if(in_bufs[1].BufferType == SECBUFFER_EXTRA)
...@@ -366,7 +366,7 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur ...@@ -366,7 +366,7 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur
res = netconn_verify_cert(cert, hostname, security_flags, check_revocation); res = netconn_verify_cert(cert, hostname, security_flags, check_revocation);
CertFreeCertificateContext(cert); CertFreeCertificateContext(cert);
if(res != ERROR_SUCCESS) { if(res != ERROR_SUCCESS) {
WARN("cert verify failed: %u\n", res); WARN( "cert verify failed: %lu\n", res );
break; break;
} }
}else { }else {
...@@ -390,7 +390,7 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur ...@@ -390,7 +390,7 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur
free(read_buf); free(read_buf);
if(status != SEC_E_OK || res != ERROR_SUCCESS) { if(status != SEC_E_OK || res != ERROR_SUCCESS) {
WARN("Failed to initialize security context: %08x\n", status); WARN( "Failed to initialize security context: %#lx\n", status );
free(conn->ssl_read_buf); free(conn->ssl_read_buf);
conn->ssl_read_buf = NULL; conn->ssl_read_buf = NULL;
free(conn->ssl_write_buf); free(conn->ssl_write_buf);
...@@ -420,12 +420,11 @@ static DWORD send_ssl_chunk( struct netconn *conn, const void *msg, size_t size, ...@@ -420,12 +420,11 @@ static DWORD send_ssl_chunk( struct netconn *conn, const void *msg, size_t size,
memcpy( bufs[1].pvBuffer, msg, size ); memcpy( bufs[1].pvBuffer, msg, size );
if ((res = EncryptMessage(&conn->ssl_ctx, 0, &buf_desc, 0)) != SEC_E_OK) if ((res = EncryptMessage(&conn->ssl_ctx, 0, &buf_desc, 0)) != SEC_E_OK)
{ {
WARN("EncryptMessage failed: %08x\n", res); WARN( "EncryptMessage failed: %#lx\n", res );
return res; return res;
} }
if (sock_send( conn->socket, conn->ssl_write_buf, if (sock_send( conn->socket, conn->ssl_write_buf, bufs[0].cbBuffer + bufs[1].cbBuffer + bufs[2].cbBuffer, ovr ) < 1)
bufs[0].cbBuffer + bufs[1].cbBuffer + bufs[2].cbBuffer, ovr ) < 1)
{ {
WARN("send failed\n"); WARN("send failed\n");
return WSAGetLastError(); return WSAGetLastError();
...@@ -531,7 +530,7 @@ static DWORD read_ssl_chunk( struct netconn *conn, void *buf, SIZE_T buf_size, S ...@@ -531,7 +530,7 @@ static DWORD read_ssl_chunk( struct netconn *conn, void *buf, SIZE_T buf_size, S
continue; continue;
default: default:
WARN("failed: %08x\n", res); WARN( "failed: %#lx\n", res );
return res; return res;
} }
} while (res != SEC_E_OK); } while (res != SEC_E_OK);
...@@ -601,7 +600,7 @@ DWORD netconn_recv( struct netconn *conn, void *buf, size_t len, int flags, int ...@@ -601,7 +600,7 @@ DWORD netconn_recv( struct netconn *conn, void *buf, size_t len, int flags, int
SIZE_T cread = 0; SIZE_T cread = 0;
if ((res = read_ssl_chunk( conn, (BYTE *)buf + size, len - size, &cread, &eof ))) if ((res = read_ssl_chunk( conn, (BYTE *)buf + size, len - size, &cread, &eof )))
{ {
WARN("read_ssl_chunk failed: %u\n", res); WARN( "read_ssl_chunk failed: %lu\n", res );
if (!size) return res; if (!size) return res;
break; break;
} }
...@@ -614,7 +613,7 @@ DWORD netconn_recv( struct netconn *conn, void *buf, size_t len, int flags, int ...@@ -614,7 +613,7 @@ DWORD netconn_recv( struct netconn *conn, void *buf, size_t len, int flags, int
} while (!size || ((flags & MSG_WAITALL) && size < len)); } while (!size || ((flags & MSG_WAITALL) && size < len));
TRACE("received %ld bytes\n", size); TRACE( "received %Iu bytes\n", size );
*recvd = size; *recvd = size;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -634,7 +633,7 @@ DWORD netconn_set_timeout( struct netconn *netconn, BOOL send, int value ) ...@@ -634,7 +633,7 @@ DWORD netconn_set_timeout( struct netconn *netconn, BOOL send, int value )
if (setsockopt( netconn->socket, SOL_SOCKET, opt, (void *)&value, sizeof(value) ) == -1) if (setsockopt( netconn->socket, SOL_SOCKET, opt, (void *)&value, sizeof(value) ) == -1)
{ {
DWORD err = WSAGetLastError(); DWORD err = WSAGetLastError();
WARN("setsockopt failed (%u)\n", err ); WARN( "setsockopt failed (%lu)\n", err );
return err; return err;
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -654,7 +653,7 @@ BOOL netconn_is_alive( struct netconn *netconn ) ...@@ -654,7 +653,7 @@ BOOL netconn_is_alive( struct netconn *netconn )
while (!netconn->peek_msg && !(err = read_ssl_chunk( netconn, NULL, 0, &size, &eof )) && !eof) while (!netconn->peek_msg && !(err = read_ssl_chunk( netconn, NULL, 0, &size, &eof )) && !eof)
; ;
TRACE("Checking secure connection, err %d.\n", err); TRACE( "checking secure connection, err %lu\n", err );
if (netconn->peek_msg || err == WSAEWOULDBLOCK) if (netconn->peek_msg || err == WSAEWOULDBLOCK)
{ {
...@@ -772,6 +771,6 @@ int netconn_get_cipher_strength( struct netconn *conn ) ...@@ -772,6 +771,6 @@ int netconn_get_cipher_strength( struct netconn *conn )
if (!conn->secure) return 0; if (!conn->secure) return 0;
res = QueryContextAttributesW(&conn->ssl_ctx, SECPKG_ATTR_CONNECTION_INFO, (void*)&conn_info); res = QueryContextAttributesW(&conn->ssl_ctx, SECPKG_ATTR_CONNECTION_INFO, (void*)&conn_info);
if(res != SEC_E_OK) if(res != SEC_E_OK)
WARN("QueryContextAttributesW failed: %08x\n", res); WARN( "QueryContextAttributesW failed: %#lx\n", res );
return res == SEC_E_OK ? conn_info.dwCipherStrength : 0; return res == SEC_E_OK ? conn_info.dwCipherStrength : 0;
} }
...@@ -170,7 +170,7 @@ static DWORD parse_port( const WCHAR *str, DWORD len, INTERNET_PORT *ret ) ...@@ -170,7 +170,7 @@ static DWORD parse_port( const WCHAR *str, DWORD len, INTERNET_PORT *ret )
/*********************************************************************** /***********************************************************************
* WinHttpCrackUrl (winhttp.@) * WinHttpCrackUrl (winhttp.@)
*/ */
BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONENTSW uc ) BOOL WINAPI WinHttpCrackUrl( const WCHAR *url, DWORD len, DWORD flags, URL_COMPONENTSW *uc )
{ {
WCHAR *p, *q, *r, *url_transformed = NULL; WCHAR *p, *q, *r, *url_transformed = NULL;
INTERNET_SCHEME scheme_number = 0; INTERNET_SCHEME scheme_number = 0;
...@@ -178,7 +178,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -178,7 +178,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
BOOL overflow = FALSE; BOOL overflow = FALSE;
DWORD err; DWORD err;
TRACE("%s, %d, %x, %p\n", debugstr_wn(url, len), len, flags, uc); TRACE( "%s, %lu, %#lx, %p\n", debugstr_wn(url, len), len, flags, uc );
if (!url || !uc || uc->dwStructSize != sizeof(*uc)) if (!url || !uc || uc->dwStructSize != sizeof(*uc))
{ {
...@@ -427,12 +427,12 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len ) ...@@ -427,12 +427,12 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
/*********************************************************************** /***********************************************************************
* WinHttpCreateUrl (winhttp.@) * WinHttpCreateUrl (winhttp.@)
*/ */
BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDWORD required ) BOOL WINAPI WinHttpCreateUrl( URL_COMPONENTS *uc, DWORD flags, WCHAR *url, DWORD *required )
{ {
DWORD len, len_escaped; DWORD len, len_escaped;
INTERNET_SCHEME scheme; INTERNET_SCHEME scheme;
TRACE("%p, 0x%08x, %p, %p\n", uc, flags, url, required); TRACE( "%p, %#lx, %p, %p\n", uc, flags, url, required );
if (!uc || uc->dwStructSize != sizeof(URL_COMPONENTS) || !required) if (!uc || uc->dwStructSize != sizeof(URL_COMPONENTS) || !required)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment