[WININET]

- Fix sock_namelen type in FTP_Connect. Already sent to Wine.
- Fix warnings

svn path=/trunk/; revision=56761
This commit is contained in:
Thomas Faber 2012-06-20 15:10:50 +00:00
parent d0111bd3a0
commit 0eaead7945
6 changed files with 67 additions and 34 deletions

View file

@ -20,22 +20,15 @@ list(APPEND SOURCE
urlcache.c urlcache.c
utility.c utility.c
wininet_main.c wininet_main.c
rsrc.rc
version.rc
${CMAKE_CURRENT_BINARY_DIR}/wininet_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/wininet_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/wininet.def) ${CMAKE_CURRENT_BINARY_DIR}/wininet.def)
add_library(wininet SHARED add_library(wininet SHARED ${SOURCE})
${SOURCE}
rsrc.rc
version.rc)
set_module_type(wininet win32dll) set_module_type(wininet win32dll)
target_link_libraries(wininet wine ${PSEH_LIB} zlib) target_link_libraries(wininet wine ${PSEH_LIB} zlib)
add_delay_importlibs(wininet secur32 crypt32 cryptui) add_delay_importlibs(wininet secur32 crypt32 cryptui)
add_importlibs(wininet mpr shlwapi shell32 user32 advapi32 ws2_32 msvcrt kernel32 ntdll) add_importlibs(wininet mpr shlwapi shell32 user32 advapi32 ws2_32 msvcrt kernel32 ntdll)
add_cd_file(TARGET wininet DESTINATION reactos/system32 FOR all) add_cd_file(TARGET wininet DESTINATION reactos/system32 FOR all)
if(NOT MSVC)
# FIXME: http://www.cmake.org/Bug/view.php?id=12998
#allow_warnings(wininet)
set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-error")
endif()

View file

@ -2433,7 +2433,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
static const WCHAR szEmpty[] = {'\0'}; static const WCHAR szEmpty[] = {'\0'};
struct sockaddr_in socketAddr; struct sockaddr_in socketAddr;
INT nsocket = -1; INT nsocket = -1;
UINT sock_namelen; socklen_t sock_namelen;
BOOL bSuccess = FALSE; BOOL bSuccess = FALSE;
ftp_session_t *lpwfs = NULL; ftp_session_t *lpwfs = NULL;
char szaddr[INET_ADDRSTRLEN]; char szaddr[INET_ADDRSTRLEN];

View file

@ -1901,6 +1901,9 @@ static void http_release_netconn(http_request_t *req, BOOL reuse)
} }
return; return;
} }
#else
// silence unused function warning
(void)collect_connections_proc;
#endif #endif
INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_SendCallback(&req->hdr, req->hdr.dwContext,

View file

@ -27,7 +27,7 @@
#ifdef SPRINTF_CHAR #ifdef SPRINTF_CHAR
# define SPRINTF(x) strlen(sprintf/**/x) # define SPRINTF(x) strlen(sprintf/**/x)
#else #else
# define SPRINTF(x) ((size_t)sprintf x) # define SPRINTF(x) ((socklen_t)sprintf x)
#endif #endif
/* /*
@ -35,10 +35,10 @@
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/ */
static const char *inet_ntop4(const u_char *src, char *dst, size_t size); static const char *inet_ntop4(const u_char *src, char *dst, socklen_t size);
#ifdef INET6 #ifdef INET6
static const char *inet_ntop6(const u_char *src, char *dst, size_t size); static const char *inet_ntop6(const u_char *src, char *dst, socklen_t size);
#endif #endif
/* char * /* char *
@ -50,7 +50,7 @@ static const char *inet_ntop6(const u_char *src, char *dst, size_t size);
* Paul Vixie, 1996. * Paul Vixie, 1996.
*/ */
const char * const char *
inet_ntop(int af, const void *src, char *dst, size_t size) inet_ntop(int af, const void *src, char *dst, socklen_t size)
{ {
switch (af) { switch (af) {
@ -79,7 +79,7 @@ inet_ntop(int af, const void *src, char *dst, size_t size)
* Paul Vixie, 1996. * Paul Vixie, 1996.
*/ */
static const char * static const char *
inet_ntop4(const u_char *src, char *dst, size_t size) inet_ntop4(const u_char *src, char *dst, socklen_t size)
{ {
static const char fmt[] = "%u.%u.%u.%u"; static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"]; char tmp[sizeof "255.255.255.255"];
@ -100,7 +100,7 @@ inet_ntop4(const u_char *src, char *dst, size_t size)
* Paul Vixie, 1996. * Paul Vixie, 1996.
*/ */
static const char * static const char *
inet_ntop6(const u_char *src, char *dst, size_t size) inet_ntop6(const u_char *src, char *dst, socklen_t size)
{ {
/* /*
* Note that int32_t and int16_t need only be "at least" large enough * Note that int32_t and int16_t need only be "at least" large enough
@ -178,7 +178,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size)
/* /*
* Check for overflow, copy, and we're done. * Check for overflow, copy, and we're done.
*/ */
if ((size_t)(tp - tmp) > size) { if ((socklen_t)(tp - tmp) > size) {
WSASetLastError(WSAEINVAL); WSASetLastError(WSAEINVAL);
return (NULL); return (NULL);
} }

View file

@ -540,6 +540,25 @@ DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC
int sock_get_error(int) DECLSPEC_HIDDEN; int sock_get_error(int) DECLSPEC_HIDDEN;
#else #else
#define sock_get_error(x) WSAGetLastError() #define sock_get_error(x) WSAGetLastError()
const char *inet_ntop(int, const void *, char *, socklen_t);
static inline long unix_recv(int socket, void *buffer, size_t length, int flags)
{
return recv(socket, buffer, length, flags);
}
#define recv unix_recv
static inline int unix_ioctl(int filedes, long request, void *arg)
{
return ioctlsocket(filedes, request, arg);
}
#define ioctlsocket unix_ioctl
static inline int unix_getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
{
return getsockopt(socket, level, option_name, option_value, option_len);
}
#define getsockopt unix_getsockopt
#endif #endif
extern void URLCacheContainers_CreateDefaults(void) DECLSPEC_HIDDEN; extern void URLCacheContainers_CreateDefaults(void) DECLSPEC_HIDDEN;

View file

@ -1,6 +1,6 @@
--- wine-1.5.4/Wine/dlls/wininet/internet.h 2012-06-20 14:38:39 +0200 --- wine-1.5.4/dlls/wininet/internet.h 2012-06-20 14:38:39 +0200
+++ dll/win32/wininet/internet.h 2012-06-20 14:51:41 +0200 +++ dll/win32/wininet/internet.h 2012-06-20 16:49:05 +0200
@@ -536,7 +536,11 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPE @@ -536,7 +536,30 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPE
LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN; LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN;
int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN; int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN;
DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC_HIDDEN; DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC_HIDDEN;
@ -8,12 +8,31 @@
int sock_get_error(int) DECLSPEC_HIDDEN; int sock_get_error(int) DECLSPEC_HIDDEN;
+#else +#else
+#define sock_get_error(x) WSAGetLastError() +#define sock_get_error(x) WSAGetLastError()
+const char *inet_ntop(int, const void *, char *, socklen_t);
+
+static inline long unix_recv(int socket, void *buffer, size_t length, int flags)
+{
+ return recv(socket, buffer, length, flags);
+}
+#define recv unix_recv
+
+static inline int unix_ioctl(int filedes, long request, void *arg)
+{
+ return ioctlsocket(filedes, request, arg);
+}
+#define ioctlsocket unix_ioctl
+
+static inline int unix_getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
+{
+ return getsockopt(socket, level, option_name, option_value, option_len);
+}
+#define getsockopt unix_getsockopt
+#endif +#endif
extern void URLCacheContainers_CreateDefaults(void) DECLSPEC_HIDDEN; extern void URLCacheContainers_CreateDefaults(void) DECLSPEC_HIDDEN;
extern void URLCacheContainers_DeleteAll(void) DECLSPEC_HIDDEN; extern void URLCacheContainers_DeleteAll(void) DECLSPEC_HIDDEN;
--- wine-1.5.4/Wine/dlls/wininet/netconnection.c 2012-06-20 14:38:39 +0200 --- wine-1.5.4/dlls/wininet/netconnection.c 2012-06-20 14:38:39 +0200
+++ dll/win32/wininet/netconnection.c 2012-06-20 14:52:22 +0200 +++ dll/win32/wininet/netconnection.c 2012-06-20 15:50:06 +0200
@@ -523,12 +523,16 @@ DWORD create_netconn(BOOL useSSL, server @@ -523,12 +523,16 @@ DWORD create_netconn(BOOL useSSL, server
if(result == -1) if(result == -1)
{ {
@ -51,8 +70,8 @@
/****************************************************************************** /******************************************************************************
* NETCON_secure_connect * NETCON_secure_connect
--- wine-1.5.4/Wine/dlls/wininet/internet.c 2012-06-20 14:38:38 +0200 --- wine-1.5.4/dlls/wininet/internet.c 2012-06-20 14:38:38 +0200
+++ dll/win32/wininet/internet.c 2012-06-20 14:58:51 +0200 +++ dll/win32/wininet/internet.c 2012-06-20 15:50:05 +0200
@@ -292,7 +292,9 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, @@ -292,7 +292,9 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL,
if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES) if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES)
return FALSE; return FALSE;
@ -91,10 +110,8 @@
{ {
if (recv(nSocket, &lpszBuffer[nRecv], 1, 0) <= 0) if (recv(nSocket, &lpszBuffer[nRecv], 1, 0) <= 0)
{ {
Index: dll/win32/wininet/urlcache.c --- wine-1.5.4/dlls/wininet/urlcache.c 2012-06-20 14:30:41 +0200
=================================================================== +++ dll/win32/wininet/urlcache.c 2012-06-20 15:50:06 +0200
--- wine-1.5.4/Wine/dlls/wininet/urlcache.c 2012-06-20 14:30:41 +0200
+++ dll/win32/wininet/urlcache.c 2012-06-20 14:54:06 +0200
@@ -189,6 +189,8 @@ typedef struct _URLCACHECONTAINER @@ -189,6 +189,8 @@ typedef struct _URLCACHECONTAINER
/* List of all containers available */ /* List of all containers available */
@ -160,10 +177,8 @@ Index: dll/win32/wininet/urlcache.c
LIST_FOR_EACH_ENTRY(pContainer, &UrlContainers, URLCACHECONTAINER, entry) LIST_FOR_EACH_ENTRY(pContainer, &UrlContainers, URLCACHECONTAINER, entry)
{ {
/* The URL cache has prefix L"" (unlike Cookies and History) */ /* The URL cache has prefix L"" (unlike Cookies and History) */
Index: dll/win32/wininet/http.c --- wine-1.5.4/dlls/wininet/http.c 2012-06-20 15:19:57 +0200
=================================================================== +++ dll/win32/wininet/http.c 2012-06-20 16:24:11 +0200
--- wine-1.5.4/Wine/dlls/wininet/http.c 2012-06-20 14:38:38 +0200
+++ dll/win32/wininet/http.c 2012-06-20 14:49:11 +0200
@@ -73,6 +73,9 @@ @@ -73,6 +73,9 @@
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/unicode.h" #include "wine/unicode.h"
@ -218,10 +233,13 @@ Index: dll/win32/wininet/http.c
req->netconn = NULL; req->netconn = NULL;
run_collector = !collector_running; run_collector = !collector_running;
@@ -1888,6 +1901,7 @@ static void http_release_netconn(http_re @@ -1888,6 +1901,10 @@ static void http_release_netconn(http_re
} }
return; return;
} }
+#else
+ // silence unused function warning
+ (void)collect_connections_proc;
+#endif +#endif
INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_SendCallback(&req->hdr, req->hdr.dwContext,