[WININET][PSDK]

- Better mark ROS-specific changes
- Make wininet_ros.diff sensible
- Update wininet.h
See issue #7117 for more details.

svn path=/trunk/; revision=56758
This commit is contained in:
Thomas Faber 2012-06-20 12:24:12 +00:00
parent f0c893c3f6
commit cbe36a0d88
7 changed files with 95 additions and 50 deletions

View file

@ -71,6 +71,7 @@
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/unicode.h" #include "wine/unicode.h"
// ReactOS
#include "inet_ntop.c" #include "inet_ntop.c"
WINE_DEFAULT_DEBUG_CHANNEL(wininet); WINE_DEFAULT_DEBUG_CHANNEL(wininet);

View file

@ -292,6 +292,10 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES) if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES)
return FALSE; return FALSE;
#ifndef __REACTOS__
URLCacheContainers_CreateDefaults();
#endif
WININET_hModule = hinstDLL; WININET_hModule = hinstDLL;
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:
@ -3595,6 +3599,7 @@ LPSTR INTERNET_GetResponseBuffer(void)
LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen) LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen)
{ {
// ReactOS: use select instead of poll
fd_set infd; fd_set infd;
struct timeval tv; struct timeval tv;
BOOL bSuccess = FALSE; BOOL bSuccess = FALSE;

View file

@ -528,7 +528,11 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPEC_HIDDEN;
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, int value) DECLSPEC_HIDDEN; DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, int value) DECLSPEC_HIDDEN;
#ifndef __REACTOS__
int sock_get_error(int) DECLSPEC_HIDDEN;
#else
#define sock_get_error(x) WSAGetLastError() #define sock_get_error(x) WSAGetLastError()
#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;

View file

@ -587,7 +587,7 @@ void NETCON_unload(void)
#endif #endif
} }
#if 0 #ifndef __REACTOS__
/* translate a unix error code into a winsock one */ /* translate a unix error code into a winsock one */
int sock_get_error( int err ) int sock_get_error( int err )
{ {

View file

@ -182,6 +182,7 @@ typedef struct _URLCACHECONTAINER
/* List of all containers available */ /* List of all containers available */
static struct list UrlContainers = LIST_INIT(UrlContainers); static struct list UrlContainers = LIST_INIT(UrlContainers);
// ReactOS r54992
BOOL bDefaultContainersAdded = FALSE; BOOL bDefaultContainersAdded = FALSE;
static DWORD URLCache_CreateHashTable(LPURLCACHE_HEADER pHeader, HASH_CACHEFILE_ENTRY *pPrevHash, HASH_CACHEFILE_ENTRY **ppHash); static DWORD URLCache_CreateHashTable(LPURLCACHE_HEADER pHeader, HASH_CACHEFILE_ENTRY *pPrevHash, HASH_CACHEFILE_ENTRY **ppHash);
@ -519,6 +520,7 @@ void URLCacheContainers_CreateDefaults(void)
static const WCHAR HistoryPrefix[] = {'V','i','s','i','t','e','d',':',0}; static const WCHAR HistoryPrefix[] = {'V','i','s','i','t','e','d',':',0};
static const WCHAR CookieSuffix[] = {0}; static const WCHAR CookieSuffix[] = {0};
static const WCHAR CookiePrefix[] = {'C','o','o','k','i','e',':',0}; static const WCHAR CookiePrefix[] = {'C','o','o','k','i','e',':',0};
// ReactOS r50916
static const WCHAR UserProfile[] = {'U','S','E','R','P','R','O','F','I','L','E',0}; static const WCHAR UserProfile[] = {'U','S','E','R','P','R','O','F','I','L','E',0};
static const struct static const struct
{ {
@ -533,6 +535,7 @@ void URLCacheContainers_CreateDefaults(void)
}; };
DWORD i; DWORD i;
// ReactOS r50916
if (GetEnvironmentVariableW(UserProfile, NULL, 0) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) if (GetEnvironmentVariableW(UserProfile, NULL, 0) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)
{ {
TRACE("Environment variable 'USERPROFILE' does not exist!\n"); TRACE("Environment variable 'USERPROFILE' does not exist!\n");
@ -592,6 +595,7 @@ static DWORD URLCacheContainers_FindContainerW(LPCWSTR lpwszUrl, URLCACHECONTAIN
if(!lpwszUrl) if(!lpwszUrl)
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
// ReactOS r54992
if (!bDefaultContainersAdded) if (!bDefaultContainersAdded)
URLCacheContainers_CreateDefaults(); URLCacheContainers_CreateDefaults();
@ -633,6 +637,7 @@ static BOOL URLCacheContainers_Enum(LPCWSTR lpwszSearchPattern, DWORD dwIndex, U
if (lpwszSearchPattern && dwIndex > 0) if (lpwszSearchPattern && dwIndex > 0)
return FALSE; return FALSE;
// ReactOS r54992
if (!bDefaultContainersAdded) if (!bDefaultContainersAdded)
URLCacheContainers_CreateDefaults(); URLCacheContainers_CreateDefaults();
@ -1539,6 +1544,7 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR lpszCachePath, DWORD dwSize, DWORD dwSize
return FALSE; return FALSE;
} }
// ReactOS r54992
if (!bDefaultContainersAdded) if (!bDefaultContainersAdded)
URLCacheContainers_CreateDefaults(); URLCacheContainers_CreateDefaults();

View file

@ -1,59 +1,53 @@
--- wine-1.3.4/dlls/wininet/internet.h 2010-10-01 14:46:44.000000000 -0400 --- wine-1.3.21/dlls/wininet/internet.h 2012-06-20 13:23:07 +0200
+++ dll/win32/wininet/internet.h 2010-10-09 15:34:13.000000000 -0400 +++ dll/win32/wininet/internet.h 2012-06-20 13:58:16 +0200
@@ -462,7 +462,7 @@ @@ -528,7 +528,11 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPE
LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection); LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN;
int NETCON_GetCipherStrength(WININET_NETCONNECTION *connection); int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN;
DWORD NETCON_set_timeout(WININET_NETCONNECTION *connection, BOOL send, int value); DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, int value) DECLSPEC_HIDDEN;
-int sock_get_error(int); +#ifndef __REACTOS__
int sock_get_error(int) DECLSPEC_HIDDEN;
+#else
+#define sock_get_error(x) WSAGetLastError() +#define sock_get_error(x) WSAGetLastError()
+#endif
extern void URLCacheContainers_CreateDefaults(void); extern void URLCacheContainers_CreateDefaults(void) DECLSPEC_HIDDEN;
extern void URLCacheContainers_DeleteAll(void); extern void URLCacheContainers_DeleteAll(void) DECLSPEC_HIDDEN;
--- wine-1.3.4/dlls/wininet/http.c 2010-10-01 14:46:44.000000000 -0400 --- wine-1.3.21/dlls/wininet/netconnection.c 2012-06-20 13:23:07 +0200
+++ dll/win32/wininet/http.c 2010-10-09 15:28:29.000000000 -0400 +++ dll/win32/wininet/netconnection.c 2012-06-20 13:40:10 +0200
@@ -69,6 +69,8 @@ @@ -587,6 +587,7 @@ void NETCON_unload(void)
#include "wine/exception.h" #endif
#include "wine/unicode.h"
+#include "inet_ntop.c"
+
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
static const WCHAR g_szHttp1_0[] = {'H','T','T','P','/','1','.','0',0};
--- wine-1.3.4/dlls/wininet/netconnection.c 2010-10-01 14:46:44.000000000 -0400
+++ dll/win32/wininet/netconnection.c 2010-10-09 15:33:53.000000000 -0400
@@ -547,6 +547,7 @@
return TRUE;
} }
+#if 0 +#ifndef __REACTOS__
/* translate a unix error code into a winsock one */ /* translate a unix error code into a winsock one */
int sock_get_error( int err ) int sock_get_error( int err )
{ {
@@ -613,6 +614,7 @@ @@ -653,6 +654,7 @@ int sock_get_error( int err )
#endif #endif
return err; return err;
} }
+#endif +#endif
/****************************************************************************** /******************************************************************************
* NETCON_create * NETCON_secure_connect
--- wine-1.3.4/dlls/wininet/internet.c 2010-10-01 14:46:44.000000000 -0400 --- wine-1.3.21/dlls/wininet/internet.c 2012-06-20 13:23:07 +0200
+++ dll/win32/wininet/internet.c 2010-10-09 15:33:04.000000000 -0400 +++ dll/win32/wininet/internet.c 2012-06-20 13:39:47 +0200
@@ -292,8 +292,6 @@ @@ -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;
- URLCacheContainers_CreateDefaults(); +#ifndef __REACTOS__
- URLCacheContainers_CreateDefaults();
+#endif
WININET_hModule = hinstDLL; WININET_hModule = hinstDLL;
case DLL_THREAD_ATTACH: @@ -3597,19 +3599,23 @@ LPSTR INTERNET_GetResponseBuffer(void)
@@ -3569,19 +3567,22 @@
LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen) LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen)
{ {
- struct pollfd pfd; - struct pollfd pfd;
+ // ReactOS: use select instead of poll
+ fd_set infd; + fd_set infd;
+ struct timeval tv; + struct timeval tv;
BOOL bSuccess = FALSE; BOOL bSuccess = FALSE;
@ -78,28 +72,31 @@
{ {
Index: dll/win32/wininet/urlcache.c Index: dll/win32/wininet/urlcache.c
=================================================================== ===================================================================
--- dll/win32/wininet/urlcache.c (revision 50814) --- wine-1.3.21/dlls/wininet/urlcache.c 2012-06-20 13:23:07 +0200
+++ dll/win32/wininet/urlcache.c (working copy) +++ dll/win32/wininet/urlcache.c 2012-06-20 13:41:43 +0200
@@ -182,6 +182,7 @@ @@ -182,6 +182,8 @@ typedef struct _URLCACHECONTAINER
/* List of all containers available */ /* List of all containers available */
static struct list UrlContainers = LIST_INIT(UrlContainers); static struct list UrlContainers = LIST_INIT(UrlContainers);
+// ReactOS r54992
+BOOL bDefaultContainersAdded = FALSE; +BOOL bDefaultContainersAdded = FALSE;
static DWORD URLCache_CreateHashTable(LPURLCACHE_HEADER pHeader, HASH_CACHEFILE_ENTRY *pPrevHash, HASH_CACHEFILE_ENTRY **ppHash); static DWORD URLCache_CreateHashTable(LPURLCACHE_HEADER pHeader, HASH_CACHEFILE_ENTRY *pPrevHash, HASH_CACHEFILE_ENTRY **ppHash);
@@ -527,6 +528,7 @@ @@ -518,6 +520,8 @@ void URLCacheContainers_CreateDefaults(v
static const WCHAR HistoryPrefix[] = {'V','i','s','i','t','e','d',':',0}; static const WCHAR HistoryPrefix[] = {'V','i','s','i','t','e','d',':',0};
static const WCHAR CookieSuffix[] = {0}; static const WCHAR CookieSuffix[] = {0};
static const WCHAR CookiePrefix[] = {'C','o','o','k','i','e',':',0}; static const WCHAR CookiePrefix[] = {'C','o','o','k','i','e',':',0};
+ // ReactOS r50916
+ static const WCHAR UserProfile[] = {'U','S','E','R','P','R','O','F','I','L','E',0}; + static const WCHAR UserProfile[] = {'U','S','E','R','P','R','O','F','I','L','E',0};
static const struct static const struct
{ {
int nFolder; /* CSIDL_* constant */ int nFolder; /* CSIDL_* constant */
@@ -540,6 +542,12 @@ @@ -531,6 +535,13 @@ void URLCacheContainers_CreateDefaults(v
}; };
DWORD i; DWORD i;
+ // ReactOS r50916
+ if (GetEnvironmentVariableW(UserProfile, NULL, 0) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) + if (GetEnvironmentVariableW(UserProfile, NULL, 0) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)
+ { + {
+ TRACE("Environment variable 'USERPROFILE' does not exist!\n"); + TRACE("Environment variable 'USERPROFILE' does not exist!\n");
@ -109,30 +106,33 @@ Index: dll/win32/wininet/urlcache.c
for (i = 0; i < sizeof(DefaultContainerData) / sizeof(DefaultContainerData[0]); i++) for (i = 0; i < sizeof(DefaultContainerData) / sizeof(DefaultContainerData[0]); i++)
{ {
WCHAR wszCachePath[MAX_PATH]; WCHAR wszCachePath[MAX_PATH];
@@ -584,6 +592,9 @@ @@ -584,6 +595,10 @@ static DWORD URLCacheContainers_FindCont
if(!lpwszUrl) if(!lpwszUrl)
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
+ // ReactOS r54992
+ if (!bDefaultContainersAdded) + if (!bDefaultContainersAdded)
+ URLCacheContainers_CreateDefaults(); + URLCacheContainers_CreateDefaults();
+ +
LIST_FOR_EACH_ENTRY(pContainer, &UrlContainers, URLCACHECONTAINER, entry) LIST_FOR_EACH_ENTRY(pContainer, &UrlContainers, URLCACHECONTAINER, entry)
{ {
int prefix_len = strlenW(pContainer->cache_prefix); int prefix_len = strlenW(pContainer->cache_prefix);
@@ -622,6 +633,9 @@ @@ -622,6 +637,10 @@ static BOOL URLCacheContainers_Enum(LPCW
if (lpwszSearchPattern && dwIndex > 0) if (lpwszSearchPattern && dwIndex > 0)
return FALSE; return FALSE;
+ // ReactOS r54992
+ if (!bDefaultContainersAdded) + if (!bDefaultContainersAdded)
+ URLCacheContainers_CreateDefaults(); + URLCacheContainers_CreateDefaults();
+ +
LIST_FOR_EACH_ENTRY(pContainer, &UrlContainers, URLCACHECONTAINER, entry) LIST_FOR_EACH_ENTRY(pContainer, &UrlContainers, URLCACHECONTAINER, entry)
{ {
if (lpwszSearchPattern) if (lpwszSearchPattern)
@@ -1525,6 +1539,9 @@ @@ -1525,6 +1544,10 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR l
return FALSE; return FALSE;
} }
+ // ReactOS r54992
+ if (!bDefaultContainersAdded) + if (!bDefaultContainersAdded)
+ URLCacheContainers_CreateDefaults(); + URLCacheContainers_CreateDefaults();
+ +
@ -141,15 +141,26 @@ Index: dll/win32/wininet/urlcache.c
/* 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 Index: dll/win32/wininet/http.c
=================================================================== ===================================================================
--- dll/win32/wininet/http.c (revision 54234) --- wine-1.3.21/dlls/wininet/http.c 2012-06-20 13:37:39 +0200
+++ dll/win32/wininet/http.c (working copy) +++ dll/win32/wininet/http.c 2012-06-20 13:52:44 +0200
@@ -245,8 +245,17 @@ @@ -71,6 +71,9 @@
#include "wine/exception.h"
#include "wine/unicode.h"
+// ReactOS
+#include "inet_ntop.c"
+
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
static const WCHAR g_szHttp1_0[] = {'H','T','T','P','/','1','.','0',0};
@@ -243,8 +246,17 @@ void server_release(server_t *server)
if(InterlockedDecrement(&server->ref)) if(InterlockedDecrement(&server->ref))
return; return;
+#ifndef __REACTOS__ +#ifndef __REACTOS__
if(!server->ref) if(!server->ref)
server->keep_until = (DWORD64)GetTickCount() + COLLECT_TIME; - server->keep_until = GetTickCount64() + COLLECT_TIME;
+ server->keep_until = (DWORD64)GetTickCount() + COLLECT_TIME;
+#else +#else
+ EnterCriticalSection(&connection_pool_cs); + EnterCriticalSection(&connection_pool_cs);
+ list_remove(&server->entry); + list_remove(&server->entry);
@ -161,7 +172,16 @@ Index: dll/win32/wininet/http.c
} }
static server_t *get_server(const WCHAR *name, INTERNET_PORT port) static server_t *get_server(const WCHAR *name, INTERNET_PORT port)
@@ -1861,6 +1870,7 @@ @@ -290,7 +302,7 @@ BOOL collect_connections(BOOL collect_al
BOOL remaining = FALSE;
DWORD64 now;
- now = GetTickCount64();
+ now = GetTickCount();
LIST_FOR_EACH_ENTRY_SAFE(server, server_safe, &connection_pool, server_t, entry) {
LIST_FOR_EACH_ENTRY_SAFE(netconn, netconn_safe, &server->conn_pool, netconn_t, pool_entry) {
@@ -1859,13 +1871,14 @@ static void http_release_netconn(http_re
if(!req->netconn) if(!req->netconn)
return; return;
@ -169,7 +189,15 @@ Index: dll/win32/wininet/http.c
if(reuse && req->netconn->keep_alive) { if(reuse && req->netconn->keep_alive) {
BOOL run_collector; BOOL run_collector;
@@ -1893,6 +1903,7 @@ EnterCriticalSection(&connection_pool_cs);
list_add_head(&req->netconn->server->conn_pool, &req->netconn->pool_entry);
- req->netconn->keep_until = GetTickCount64() + COLLECT_TIME;
+ req->netconn->keep_until = (DWORD64)GetTickCount() + COLLECT_TIME;
req->netconn = NULL;
run_collector = !collector_running;
@@ -1893,6 +1906,7 @@ static void http_release_netconn(http_re
} }
return; return;
} }

View file

@ -687,7 +687,7 @@ INTERNETAPI INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(HINTERNET
#define INTERNET_STATE_IDLE 0x00000100 #define INTERNET_STATE_IDLE 0x00000100
#define INTERNET_STATE_BUSY 0x00000200 #define INTERNET_STATE_BUSY 0x00000200
#define INTERNET_INVALID_STATUS_CALLBACK ((INTERNET_STATUS_CALLBACK)(-1L)) #define INTERNET_INVALID_STATUS_CALLBACK ((INTERNET_STATUS_CALLBACK)(-1))
#define FTP_TRANSFER_TYPE_UNKNOWN 0x00000000 #define FTP_TRANSFER_TYPE_UNKNOWN 0x00000000
#define FTP_TRANSFER_TYPE_ASCII 0x00000001 #define FTP_TRANSFER_TYPE_ASCII 0x00000001
@ -1496,6 +1496,7 @@ INTERNETAPI DWORD WINAPI PrivacyGetZonePreferenceW(DWORD,DWORD,LPDWORD,LPWSTR,LP
#define EDITED_CACHE_ENTRY 0x00000008 #define EDITED_CACHE_ENTRY 0x00000008
#define COOKIE_CACHE_ENTRY 0x00100000 #define COOKIE_CACHE_ENTRY 0x00100000
#define URLHISTORY_CACHE_ENTRY 0x00200000 #define URLHISTORY_CACHE_ENTRY 0x00200000
#define DELETED_CACHE_ENTRY 0x00400000
#define TRACK_OFFLINE_CACHE_ENTRY 0x00000010 #define TRACK_OFFLINE_CACHE_ENTRY 0x00000010
#define TRACK_ONLINE_CACHE_ENTRY 0x00000020 #define TRACK_ONLINE_CACHE_ENTRY 0x00000020
#define SPARSE_CACHE_ENTRY 0x00010000 #define SPARSE_CACHE_ENTRY 0x00010000