[WININET]
[reactos.git] / reactos / dll / win32 / wininet / wininet_ros.diff
1 diff -pudN e:\wine\dlls\wininet/http.c e:\reactos\dll\win32\wininet/http.c
2 --- e:\wine\dlls\wininet/http.c 2015-07-14 15:44:36.040192300 +0100
3 +++ e:\reactos\dll\win32\wininet/http.c 2015-07-20 14:37:24.319646400 +0100
4 @@ -143,6 +118,7 @@ static const WCHAR emptyW[] = {0};
5
6 #define COLLECT_TIME 60000
7
8 +#undef ARRAYSIZE
9 #define ARRAYSIZE(array) (sizeof(array)/sizeof((array)[0]))
10
11 struct HttpAuthInfo
12 @@ -229,7 +205,13 @@ void server_release(server_t *server)
13 if(InterlockedDecrement(&server->ref))
14 return;
15
16 +#ifdef __REACTOS__
17 + EnterCriticalSection(&connection_pool_cs);
18 +#endif
19 list_remove(&server->entry);
20 +#ifdef __REACTOS__
21 + LeaveCriticalSection(&connection_pool_cs);
22 +#endif
23
24 if(server->cert_chain)
25 CertFreeCertificateChain(server->cert_chain);
26 @@ -311,7 +293,11 @@ BOOL collect_connections(collect_type_t
27 BOOL remaining = FALSE;
28 DWORD64 now;
29
30 +#ifdef __REACTOS__
31 + now = GetTickCount();
32 +#else
33 now = GetTickCount64();
34 +#endif
35
36 LIST_FOR_EACH_ENTRY_SAFE(server, server_safe, &connection_pool, server_t, entry) {
37 LIST_FOR_EACH_ENTRY_SAFE(netconn, netconn_safe, &server->conn_pool, netconn_t, pool_entry) {
38 @@ -1973,13 +1959,14 @@ static void http_release_netconn(http_re
39 if(!is_valid_netconn(req->netconn))
40 return;
41
42 +#ifndef __REACTOS__
43 if(reuse && req->netconn->keep_alive) {
44 BOOL run_collector;
45
46 EnterCriticalSection(&connection_pool_cs);
47
48 list_add_head(&req->netconn->server->conn_pool, &req->netconn->pool_entry);
49 - req->netconn->keep_until = GetTickCount64() + COLLECT_TIME;
50 + req->netconn->keep_until = (DWORD64)GetTickCount() + COLLECT_TIME;
51 req->netconn = NULL;
52
53 run_collector = !collector_running;
54 @@ -2007,6 +1994,10 @@ static void http_release_netconn(http_re
55 }
56 return;
57 }
58 +#else
59 + /* Silence unused function warning */
60 + (void)collect_connections_proc;
61 +#endif
62
63 INTERNET_SendCallback(&req->hdr, req->hdr.dwContext,
64 INTERNET_STATUS_CLOSING_CONNECTION, 0, 0);
65 diff -pudN e:\wine\dlls\wininet/internet.c e:\reactos\dll\win32\wininet/internet.c
66 --- e:\wine\dlls\wininet/internet.c 2015-04-12 18:21:54.309796800 +0100
67 +++ e:\reactos\dll\win32\wininet/internet.c 2015-07-20 14:38:19.188784800 +0100
68 @@ -1033,6 +996,9 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR l
69 {
70 appinfo_t *lpwai = NULL;
71
72 +#ifdef __REACTOS__
73 + init_winsock();
74 +#endif
75 if (TRACE_ON(wininet)) {
76 #define FE(x) { x, #x }
77 static const wininet_flag_info access_type[] = {
78
79 diff -pudN e:\wine\dlls\wininet/urlcache.c e:\reactos\dll\win32\wininet/urlcache.c
80 --- e:\wine\dlls\wininet/urlcache.c 2015-07-14 15:44:36.059193400 +0100
81 +++ e:\reactos\dll\win32\wininet/urlcache.c 2015-07-20 14:40:55.736738800 +0100
82 @@ -202,6 +179,8 @@ typedef struct
83
84 /* List of all containers available */
85 static struct list UrlContainers = LIST_INIT(UrlContainers);
86 +/* ReactOS r54992 */
87 +BOOL bDefaultContainersAdded = FALSE;
88
89 static inline char *heap_strdupWtoUTF8(LPCWSTR str)
90 {
91 @@ -752,6 +731,8 @@ static void cache_containers_init(void)
92 static const WCHAR UrlSuffix[] = {'C','o','n','t','e','n','t','.','I','E','5',0};
93 static const WCHAR HistorySuffix[] = {'H','i','s','t','o','r','y','.','I','E','5',0};
94 static const WCHAR CookieSuffix[] = {0};
95 + /* ReactOS r50916 */
96 + static const WCHAR UserProfile[] = {'U','S','E','R','P','R','O','F','I','L','E',0};
97 static const struct
98 {
99 int nFolder; /* CSIDL_* constant */
100 @@ -766,6 +747,13 @@ static void cache_containers_init(void)
101 };
102 DWORD i;
103
104 + /* ReactOS r50916 */
105 + if (GetEnvironmentVariableW(UserProfile, NULL, 0) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)
106 + {
107 + TRACE("Environment variable 'USERPROFILE' does not exist!\n");
108 + return;
109 + }
110 +
111 for (i = 0; i < sizeof(DefaultContainerData) / sizeof(DefaultContainerData[0]); i++)
112 {
113 WCHAR wszCachePath[MAX_PATH];
114 @@ -816,6 +804,10 @@ static void cache_containers_init(void)
115 cache_containers_add(DefaultContainerData[i].cache_prefix, wszCachePath,
116 DefaultContainerData[i].default_entry_type, wszMutexName);
117 }
118 +
119 +#ifdef __REACTOS__
120 + bDefaultContainersAdded = TRUE;
121 +#endif
122 }
123
124 static void cache_containers_free(void)
125 @@ -835,6 +827,12 @@ static DWORD cache_containers_find(const
126 if(!url)
127 return ERROR_INVALID_PARAMETER;
128
129 +#ifdef __REACTOS__
130 + /* ReactOS r54992 */
131 + if (!bDefaultContainersAdded)
132 + cache_containers_init();
133 +#endif
134 +
135 LIST_FOR_EACH_ENTRY(container, &UrlContainers, cache_container, entry)
136 {
137 int prefix_len = strlen(container->cache_prefix);
138 @@ -861,6 +859,12 @@ static BOOL cache_containers_enum(char *
139 if (search_pattern && index > 0)
140 return FALSE;
141
142 +#ifdef __REACTOS__
143 + /* ReactOS r54992 */
144 + if (!bDefaultContainersAdded)
145 + cache_containers_init();
146 +#endif
147 +
148 LIST_FOR_EACH_ENTRY(container, &UrlContainers, cache_container, entry)
149 {
150 if (search_pattern)
151 @@ -4018,7 +4022,9 @@ BOOL init_urlcache(void)
152 return FALSE;
153 }
154
155 +#ifndef __REACTOS__
156 cache_containers_init();
157 +#endif
158 return TRUE;
159 }
160