ReactOS 0.4.15-dev-7681-g776c3a3
urlcache.c
Go to the documentation of this file.
1/*
2 * URL Cache Tests
3 *
4 * Copyright 2008 Robert Shearman for CodeWeavers
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#define NONAMELESSUNION
22#define NONAMELESSSTRUCT
23
24#include <stdarg.h>
25#include <stdio.h>
26#include <stdlib.h>
27
28#include "windef.h"
29#include "winbase.h"
30#include "winnls.h"
31#include "wininet.h"
32#include "winineti.h"
33#include "shlobj.h"
34
35#include "wine/test.h"
36
37static const char test_url[] = "http://urlcachetest.winehq.org/index.html";
38static const WCHAR test_urlW[] = {'h','t','t','p',':','/','/','u','r','l','c','a','c','h','e','t','e','s','t','.',
39 'w','i','n','e','h','q','.','o','r','g','/','i','n','d','e','x','.','h','t','m','l',0};
40static const char test_url1[] = "Visited: user@http://urlcachetest.winehq.org/index.html";
41static const char test_hash_collisions1[] = "Visited: http://winehq.org/doc0.html";
42static const char test_hash_collisions2[] = "Visited: http://winehq.org/doc75651909.html";
43
44static BOOL (WINAPI *pDeleteUrlCacheEntryA)(LPCSTR);
45static BOOL (WINAPI *pUnlockUrlCacheEntryFileA)(LPCSTR,DWORD);
46
47static char filenameA[MAX_PATH + 1];
48static char filenameA1[MAX_PATH + 1];
49static BOOL old_ie = FALSE;
51
52static void check_cache_entry_infoA(const char *returnedfrom, INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo)
53{
54 ok(lpCacheEntryInfo->dwStructSize == sizeof(*lpCacheEntryInfo), "%s: dwStructSize was %d\n", returnedfrom, lpCacheEntryInfo->dwStructSize);
55 ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_url), "%s: lpszSourceUrlName should be %s instead of %s\n", returnedfrom, test_url, lpCacheEntryInfo->lpszSourceUrlName);
56 ok(!strcmp(lpCacheEntryInfo->lpszLocalFileName, filenameA), "%s: lpszLocalFileName should be %s instead of %s\n", returnedfrom, filenameA, lpCacheEntryInfo->lpszLocalFileName);
57 ok(!strcmp(lpCacheEntryInfo->lpszFileExtension, "html"), "%s: lpszFileExtension should be html instead of %s\n", returnedfrom, lpCacheEntryInfo->lpszFileExtension);
58}
59
61{
62 BOOL ret;
63 HANDLE hEnumHandle;
64 BOOL found = FALSE;
65 DWORD cbCacheEntryInfo;
66 DWORD cbCacheEntryInfoSaved;
67 INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
68
69 cbCacheEntryInfo = 0;
70 SetLastError(0xdeadbeef);
71 hEnumHandle = FindFirstUrlCacheEntryA(NULL, NULL, &cbCacheEntryInfo);
72 ok(!hEnumHandle, "FindFirstUrlCacheEntry should have failed\n");
73 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "FindFirstUrlCacheEntry should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
74 lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo * sizeof(char));
75 cbCacheEntryInfoSaved = cbCacheEntryInfo;
76 hEnumHandle = FindFirstUrlCacheEntryA(NULL, lpCacheEntryInfo, &cbCacheEntryInfo);
77 ok(hEnumHandle != NULL, "FindFirstUrlCacheEntry failed with error %d\n", GetLastError());
78 while (TRUE)
79 {
80 if (!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_url))
81 {
82 found = TRUE;
83 ret = TRUE;
84 break;
85 }
86 SetLastError(0xdeadbeef);
87 cbCacheEntryInfo = cbCacheEntryInfoSaved;
88 ret = FindNextUrlCacheEntryA(hEnumHandle, lpCacheEntryInfo, &cbCacheEntryInfo);
89 if (!ret)
90 {
92 {
93 lpCacheEntryInfo = HeapReAlloc(GetProcessHeap(), 0, lpCacheEntryInfo, cbCacheEntryInfo);
94 cbCacheEntryInfoSaved = cbCacheEntryInfo;
95 ret = FindNextUrlCacheEntryA(hEnumHandle, lpCacheEntryInfo, &cbCacheEntryInfo);
96 }
97 }
98 if (!ret)
99 break;
100 }
101 ok(ret, "FindNextUrlCacheEntry failed with error %d\n", GetLastError());
102 ok(found, "Committed url cache entry not found during enumeration\n");
103
104 ret = FindCloseUrlCache(hEnumHandle);
105 ok(ret, "FindCloseUrlCache failed with error %d\n", GetLastError());
106 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
107}
108
110{
111 BOOL ret;
112 DWORD cbCacheEntryInfo, cbRedirectUrl;
113 INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
114
115 SetLastError(0xdeadbeef);
117 ok(!ret, "GetUrlCacheEntryInfoEx with NULL URL and NULL args should have failed\n");
119 "GetUrlCacheEntryInfoEx with NULL URL and NULL args should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
120
121 cbCacheEntryInfo = sizeof(INTERNET_CACHE_ENTRY_INFOA);
122 SetLastError(0xdeadbeef);
123 ret = GetUrlCacheEntryInfoExA("", NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
124 ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
126 "GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %d\n", GetLastError());
127
129 ok(ret, "GetUrlCacheEntryInfoEx with NULL args failed with error %d\n", GetLastError());
130
131 cbCacheEntryInfo = 0;
132 SetLastError(0xdeadbeef);
133 ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
134 ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
136 "GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
137
138 lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
139
140 SetLastError(0xdeadbeef);
141 ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
142 ok(ret == ie10_cache, "GetUrlCacheEntryInfoEx returned %x\n", ret);
144 "GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %d\n", GetLastError());
145
146 /* Unicode version of function seems to ignore 0x200 flag */
147 ret = GetUrlCacheEntryInfoExW(test_urlW, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
148 ok(ret || broken(old_ie && !ret), "GetUrlCacheEntryInfoExW failed with error %d\n", GetLastError());
149
150 ret = GetUrlCacheEntryInfoExA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
151 ok(ret, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
152
153 if (ret) check_cache_entry_infoA("GetUrlCacheEntryInfoEx", lpCacheEntryInfo);
154
155 lpCacheEntryInfo->CacheEntryType |= 0x10000000; /* INSTALLED_CACHE_ENTRY */
157 ok(ret, "SetUrlCacheEntryInfoA failed with error %d\n", GetLastError());
158
159 SetLastError(0xdeadbeef);
160 ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
161 ok(ret, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
162
163 cbCacheEntryInfo = 100000;
164 SetLastError(0xdeadbeef);
165 ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
166 ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
167 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
168
169 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
170
171 /* Querying the redirect URL fails with ERROR_INVALID_PARAMETER */
172 SetLastError(0xdeadbeef);
173 ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, &cbRedirectUrl, NULL, 0);
174 ok(!ret, "GetUrlCacheEntryInfoEx should have failed\n");
176 "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
177 SetLastError(0xdeadbeef);
178 ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, &cbRedirectUrl, NULL, 0);
179 ok(!ret, "GetUrlCacheEntryInfoEx should have failed\n");
181 "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
182}
183
185{
186 BOOL ret;
187 DWORD cbCacheEntryInfo;
188
189 cbCacheEntryInfo = 0;
190 SetLastError(0xdeadbeef);
191 ret = RetrieveUrlCacheEntryFileA(NULL, NULL, &cbCacheEntryInfo, 0);
192 ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
193 ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
194
195 if (0)
196 {
197 /* Crashes on Win9x, NT4 and W2K */
198 SetLastError(0xdeadbeef);
200 ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
201 ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
202 }
203
204 SetLastError(0xdeadbeef);
205 cbCacheEntryInfo = 100000;
206 ret = RetrieveUrlCacheEntryFileA(NULL, NULL, &cbCacheEntryInfo, 0);
207 ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
208 ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
209}
210
212{
213 static const char uncached_url[] =
214 "What's the airspeed velocity of an unladen swallow?";
215 BOOL ret;
216 FILETIME ft;
217 DWORD size;
219 ULARGE_INTEGER exp_time;
220
221 /* The function returns TRUE when the output time is NULL or the tested URL
222 * is NULL.
223 */
225 ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
226 ft.dwLowDateTime = 0xdeadbeef;
227 ft.dwHighDateTime = 0xbaadf00d;
229 ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
230 ok(ft.dwLowDateTime == 0xdeadbeef && ft.dwHighDateTime == 0xbaadf00d,
231 "expected time to be unchanged, got (%u,%u)\n",
234 ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
235
236 /* The return value should indicate whether the URL is expired,
237 * and the filetime indicates the last modified time, but a cache entry
238 * with a zero expire time is "not expired".
239 */
240 ft.dwLowDateTime = 0xdeadbeef;
241 ft.dwHighDateTime = 0xbaadf00d;
243 ok(!ret, "expected FALSE\n");
245 "expected time (0,0), got (%u,%u)\n",
247
248 /* Same behavior with bogus flags. */
249 ft.dwLowDateTime = 0xdeadbeef;
250 ft.dwHighDateTime = 0xbaadf00d;
251 ret = IsUrlCacheEntryExpiredA(test_url, 0xffffffff, &ft);
252 ok(!ret, "expected FALSE\n");
254 "expected time (0,0), got (%u,%u)\n",
256
257 /* Set the expire time to a point in the past.. */
259 ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
261 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
264 ok(ret, "GetUrlCacheEntryInfo failed: %d\n", GetLastError());
265 GetSystemTimeAsFileTime(&info->ExpireTime);
266 exp_time.u.LowPart = info->ExpireTime.dwLowDateTime;
267 exp_time.u.HighPart = info->ExpireTime.dwHighDateTime;
268 exp_time.QuadPart -= 10 * 60 * (ULONGLONG)10000000;
269 info->ExpireTime.dwLowDateTime = exp_time.u.LowPart;
270 info->ExpireTime.dwHighDateTime = exp_time.u.HighPart;
272 ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
273 ft.dwLowDateTime = 0xdeadbeef;
274 ft.dwHighDateTime = 0xbaadf00d;
275 /* and the entry should be expired. */
277 ok(ret, "expected TRUE\n");
278 /* The modified time returned is 0. */
280 "expected time (0,0), got (%u,%u)\n",
282 /* Set the expire time to a point in the future.. */
283 exp_time.QuadPart += 20 * 60 * (ULONGLONG)10000000;
284 info->ExpireTime.dwLowDateTime = exp_time.u.LowPart;
285 info->ExpireTime.dwHighDateTime = exp_time.u.HighPart;
287 ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
288 ft.dwLowDateTime = 0xdeadbeef;
289 ft.dwHighDateTime = 0xbaadf00d;
290 /* and the entry should no longer be expired. */
292 ok(!ret, "expected FALSE\n");
293 /* The modified time returned is still 0. */
295 "expected time (0,0), got (%u,%u)\n",
297 /* Set the modified time... */
298 GetSystemTimeAsFileTime(&info->LastModifiedTime);
300 ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
301 /* and the entry should still be unexpired.. */
303 ok(!ret, "expected FALSE\n");
304 /* but the modified time returned is the last modified time just set. */
305 ok(ft.dwLowDateTime == info->LastModifiedTime.dwLowDateTime &&
306 ft.dwHighDateTime == info->LastModifiedTime.dwHighDateTime,
307 "expected time (%u,%u), got (%u,%u)\n",
308 info->LastModifiedTime.dwLowDateTime,
309 info->LastModifiedTime.dwHighDateTime,
312
313 /* An uncached URL is implicitly expired, but with unknown time. */
314 ft.dwLowDateTime = 0xdeadbeef;
315 ft.dwHighDateTime = 0xbaadf00d;
316 ret = IsUrlCacheEntryExpiredA(uncached_url, 0, &ft);
317 ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
319 "expected time (0,0), got (%u,%u)\n",
321}
322
324{
325 HANDLE file;
326
329 ok_(__FILE__,l)(file != INVALID_HANDLE_VALUE,
330 "expected file to exist, CreateFile failed with error %d\n",
331 GetLastError());
333}
334
335#define check_file_exists(f) _check_file_exists(__LINE__, f)
336
338{
339 HANDLE file;
340
343 ok_(__FILE__,l)(file == INVALID_HANDLE_VALUE,
344 "expected file not to exist\n");
347}
348
349#define check_file_not_exists(f) _check_file_not_exists(__LINE__, f)
350
352{
353 HANDLE file;
354 DWORD written;
355 BOOL ret;
356
360 ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed with error %d\n", GetLastError());
361
362 ret = WriteFile(file, data, len, &written, NULL);
363 ok(ret, "WriteFile failed with error %d\n", GetLastError());
364
366}
367
368static void test_urlcacheA(void)
369{
370 static char long_url[300] = "http://www.winehq.org/";
371 static char ok_header[] = "HTTP/1.0 200 OK\r\n\r\n";
372 BOOL ret;
374 BYTE zero_byte = 0;
375 INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
376 INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo2;
377 DWORD cbCacheEntryInfo;
378 static const FILETIME filetime_zero;
380 int len;
381
382 ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
383 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
384
386 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
389
390 ok(lstrcmpiA(filenameA, filenameA1), "expected a different file name\n");
391
393
394 ret = CommitUrlCacheEntryA(test_url1, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
395 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
396 cbCacheEntryInfo = 0;
397 ret = GetUrlCacheEntryInfoA(test_url1, NULL, &cbCacheEntryInfo);
398 ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
400 "GetUrlCacheEntryInfo should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
401 lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
402 ret = GetUrlCacheEntryInfoA(test_url1, lpCacheEntryInfo, &cbCacheEntryInfo);
403 ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
404 ok(!memcmp(&lpCacheEntryInfo->ExpireTime, &filetime_zero, sizeof(FILETIME)),
405 "expected zero ExpireTime\n");
406 ok(!memcmp(&lpCacheEntryInfo->LastModifiedTime, &filetime_zero, sizeof(FILETIME)),
407 "expected zero LastModifiedTime\n");
409 broken(lpCacheEntryInfo->CacheEntryType == NORMAL_CACHE_ENTRY /* NT4/W2k */),
410 "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x\n",
411 lpCacheEntryInfo->CacheEntryType);
412 ok(!U(*lpCacheEntryInfo).dwExemptDelta, "expected dwExemptDelta 0, got %d\n",
413 U(*lpCacheEntryInfo).dwExemptDelta);
414
415 /* Make sure there is a notable change in timestamps */
416 Sleep(1000);
417
418 /* A subsequent commit with a different time/type doesn't change most of the entry */
421 (LPBYTE)ok_header, strlen(ok_header), NULL, NULL);
422 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
423 cbCacheEntryInfo = 0;
424 ret = GetUrlCacheEntryInfoA(test_url1, NULL, &cbCacheEntryInfo);
425 ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
427 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
428 lpCacheEntryInfo2 = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
429 ret = GetUrlCacheEntryInfoA(test_url1, lpCacheEntryInfo2, &cbCacheEntryInfo);
430 ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
431 /* but it does change the time.. */
432 ok(memcmp(&lpCacheEntryInfo2->ExpireTime, &filetime_zero, sizeof(FILETIME)),
433 "expected positive ExpireTime\n");
434 ok(memcmp(&lpCacheEntryInfo2->LastModifiedTime, &filetime_zero, sizeof(FILETIME)),
435 "expected positive LastModifiedTime\n");
437 broken(lpCacheEntryInfo2->CacheEntryType == NORMAL_CACHE_ENTRY /* NT4/W2k */),
438 "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x\n",
439 lpCacheEntryInfo2->CacheEntryType);
440 /* and set the headers. */
441 ok(lpCacheEntryInfo2->dwHeaderInfoSize == 19,
442 "expected headers size 19, got %d\n",
443 lpCacheEntryInfo2->dwHeaderInfoSize);
444 /* Hit rate gets incremented by 1 */
445 ok((lpCacheEntryInfo->dwHitRate + 1) == lpCacheEntryInfo2->dwHitRate,
446 "HitRate not incremented by one on commit\n");
447 /* Last access time should be updated */
448 ok(!(lpCacheEntryInfo->LastAccessTime.dwHighDateTime == lpCacheEntryInfo2->LastAccessTime.dwHighDateTime &&
449 lpCacheEntryInfo->LastAccessTime.dwLowDateTime == lpCacheEntryInfo2->LastAccessTime.dwLowDateTime),
450 "Last accessed time was not updated by commit\n");
451 /* File extension should be unset */
452 ok(lpCacheEntryInfo2->lpszFileExtension == NULL,
453 "Fileextension isn't unset: %s\n",
454 lpCacheEntryInfo2->lpszFileExtension);
455 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
456 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo2);
457
458 ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
459 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
460
461 cbCacheEntryInfo = 0;
462 SetLastError(0xdeadbeef);
463 ret = RetrieveUrlCacheEntryFileA(test_url, NULL, &cbCacheEntryInfo, 0);
464 ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
466 "RetrieveUrlCacheEntryFile should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
467
468 lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
469 ret = RetrieveUrlCacheEntryFileA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, 0);
470 ok(ret, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
471
472 if (ret) check_cache_entry_infoA("RetrieveUrlCacheEntryFile", lpCacheEntryInfo);
473
474 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
475
476 cbCacheEntryInfo = 0;
477 SetLastError(0xdeadbeef);
478 ret = RetrieveUrlCacheEntryFileA(test_url1, NULL, &cbCacheEntryInfo, 0);
479 ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
481 "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_DATA instead of %d\n", GetLastError());
482
483 if (pUnlockUrlCacheEntryFileA)
484 {
485 ret = pUnlockUrlCacheEntryFileA(test_url, 0);
486 ok(ret, "UnlockUrlCacheEntryFileA failed with error %d\n", GetLastError());
487 }
488
489 /* test Find*UrlCacheEntry functions */
491
495
496 if (pDeleteUrlCacheEntryA)
497 {
498 ret = pDeleteUrlCacheEntryA(test_url);
499 ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
500 ret = pDeleteUrlCacheEntryA(test_url1);
501 ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
502 }
503
504 SetLastError(0xdeadbeef);
506 ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "local file should no longer exist\n");
507
508 /* Creating two entries with the same URL */
509 ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
510 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
511
513 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
514
515 ok(lstrcmpiA(filenameA, filenameA1), "expected a different file name\n");
516
521
522 ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero,
523 filetime_zero, NORMAL_CACHE_ENTRY, (LPBYTE)ok_header,
524 strlen(ok_header), "html", NULL);
525 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
529 filetime_zero, COOKIE_CACHE_ENTRY, NULL, 0, "html", NULL);
530 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
531 /* By committing the same URL a second time, the prior entry is
532 * overwritten...
533 */
534 cbCacheEntryInfo = 0;
535 SetLastError(0xdeadbeef);
536 ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
537 ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
539 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
540 lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
541 ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
542 ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
543 /* with the previous entry type retained.. */
544 ok(lpCacheEntryInfo->CacheEntryType & NORMAL_CACHE_ENTRY,
545 "expected cache entry type NORMAL_CACHE_ENTRY, got %d (0x%08x)\n",
546 lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
547 /* and the headers overwritten.. */
548 ok(!lpCacheEntryInfo->dwHeaderInfoSize, "expected headers size 0, got %d\n",
549 lpCacheEntryInfo->dwHeaderInfoSize);
550 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
551 /* and the previous filename shouldn't exist. */
554
555 if (pDeleteUrlCacheEntryA)
556 {
557 ret = pDeleteUrlCacheEntryA(test_url);
558 ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
561 /* Just in case, clean up files */
564 }
565
566 /* Check whether a retrieved cache entry can be deleted before it's
567 * unlocked:
568 */
569 ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
570 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
571 ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
572 NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
573 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
574
575 cbCacheEntryInfo = 0;
576 SetLastError(0xdeadbeef);
577 ret = RetrieveUrlCacheEntryFileA(test_url, NULL, &cbCacheEntryInfo, 0);
578 ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
580 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
581
582 lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
583 ret = RetrieveUrlCacheEntryFileA(test_url, lpCacheEntryInfo,
584 &cbCacheEntryInfo, 0);
585 ok(ret, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
586
587 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
588
589 if (pDeleteUrlCacheEntryA)
590 {
591 ret = pDeleteUrlCacheEntryA(test_url);
592 ok(!ret, "Expected failure\n");
594 "Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
596 }
597
598 lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
599 memset(lpCacheEntryInfo, 0, cbCacheEntryInfo);
600 ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
601 ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
602 ok(lpCacheEntryInfo->CacheEntryType & 0x400000,
603 "CacheEntryType hasn't PENDING_DELETE_CACHE_ENTRY set, (flags %08x)\n",
604 lpCacheEntryInfo->CacheEntryType);
605 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
606
607 if (pUnlockUrlCacheEntryFileA)
608 {
610 ret = pUnlockUrlCacheEntryFileA(test_url, 0);
611 ok(ret, "UnlockUrlCacheEntryFileA failed: %d\n", GetLastError());
612 /* By unlocking the already-deleted cache entry, the file associated
613 * with it is deleted..
614 */
616 /* (just in case, delete file) */
618 }
619 if (pDeleteUrlCacheEntryA)
620 {
621 /* and a subsequent deletion should fail. */
622 ret = pDeleteUrlCacheEntryA(test_url);
623 ok(!ret, "Expected failure\n");
625 "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
626 }
627
628 /* Test whether preventing a file from being deleted causes
629 * DeleteUrlCacheEntryA to fail.
630 */
631 ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
632 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
633
636
637 ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero,
638 filetime_zero, NORMAL_CACHE_ENTRY, (LPBYTE)ok_header,
639 strlen(ok_header), "html", NULL);
640 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
644 ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA failed: %d\n",
645 GetLastError());
646 if (pDeleteUrlCacheEntryA)
647 {
648 /* DeleteUrlCacheEntryA should succeed.. */
649 ret = pDeleteUrlCacheEntryA(test_url);
650 ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
651 }
653 if (pDeleteUrlCacheEntryA)
654 {
655 /* and a subsequent deletion should fail.. */
656 ret = pDeleteUrlCacheEntryA(test_url);
657 ok(!ret, "Expected failure\n");
659 "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
660 }
661 /* and the file should be untouched. */
664
665 /* Try creating a sticky entry. Unlike non-sticky entries, the filename
666 * must have been set already.
667 */
668 SetLastError(0xdeadbeef);
669 ret = CommitUrlCacheEntryA(test_url, NULL, filetime_zero, filetime_zero,
670 STICKY_CACHE_ENTRY, (LPBYTE)ok_header, strlen(ok_header), "html",
671 NULL);
672 ok(ret == ie10_cache, "CommitUrlCacheEntryA returned %x\n", ret);
674 "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
675 SetLastError(0xdeadbeef);
676 ret = CommitUrlCacheEntryA(test_url, NULL, filetime_zero, filetime_zero,
678 (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
679 ok(ret == ie10_cache, "CommitUrlCacheEntryA returned %x\n", ret);
681 "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
682
683 ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
684 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
686 ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
688 (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
689 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
690 cbCacheEntryInfo = 0;
691 SetLastError(0xdeadbeef);
692 ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
693 ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
695 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
696 lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
697 ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
698 ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
700 "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
701 lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
702 ok(U(*lpCacheEntryInfo).dwExemptDelta == 86400,
703 "expected dwExemptDelta 86400, got %d\n",
704 U(*lpCacheEntryInfo).dwExemptDelta);
705 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
706 if (pDeleteUrlCacheEntryA)
707 {
708 ret = pDeleteUrlCacheEntryA(test_url);
709 ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
710 /* When explicitly deleting the cache entry, the file is also deleted */
712 }
713 /* Test once again, setting the exempt delta via SetUrlCacheEntryInfo */
714 ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
715 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
717 ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
719 (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
720 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
721 cbCacheEntryInfo = 0;
722 SetLastError(0xdeadbeef);
723 ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
724 ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
726 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
727 lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
728 ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
729 ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
731 "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
732 lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
733 ok(U(*lpCacheEntryInfo).dwExemptDelta == 86400,
734 "expected dwExemptDelta 86400, got %d\n",
735 U(*lpCacheEntryInfo).dwExemptDelta);
736 U(*lpCacheEntryInfo).dwExemptDelta = 0;
737 ret = SetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo,
739 ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
740 ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
741 ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
742 ok(!U(*lpCacheEntryInfo).dwExemptDelta, "expected dwExemptDelta 0, got %d\n",
743 U(*lpCacheEntryInfo).dwExemptDelta);
744 /* See whether a sticky cache entry has the flag cleared once the exempt
745 * delta is meaningless.
746 */
748 "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
749 lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
750
751 /* Recommit of Url entry keeps dwExemptDelta */
752 U(*lpCacheEntryInfo).dwExemptDelta = 8600;
753 ret = SetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo,
755 ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
756
758 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
760
761 ret = CommitUrlCacheEntryA(test_url, filenameA1, filetime_zero, filetime_zero,
763 (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
764 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
765
766 ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
767 ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
768 ok(U(*lpCacheEntryInfo).dwExemptDelta == 8600 || (ie10_cache && U(*lpCacheEntryInfo).dwExemptDelta == 86400),
769 "expected dwExemptDelta 8600, got %d\n", U(*lpCacheEntryInfo).dwExemptDelta);
770
771 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
772
773 if (pDeleteUrlCacheEntryA)
774 {
775 ret = pDeleteUrlCacheEntryA(test_url);
776 ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
778 }
779
780 /* Test if files with identical hash keys are handled correctly */
781 ret = CommitUrlCacheEntryA(test_hash_collisions1, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
782 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
783 ret = CommitUrlCacheEntryA(test_hash_collisions2, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
784 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
785
786 cbCacheEntryInfo = 0;
788 ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
790 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
791 lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
792 ret = GetUrlCacheEntryInfoA(test_hash_collisions1, lpCacheEntryInfo, &cbCacheEntryInfo);
793 ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
795 "got incorrect entry: %s\n", lpCacheEntryInfo->lpszSourceUrlName);
796 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
797
798 cbCacheEntryInfo = 0;
800 ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
802 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
803 lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
804 ret = GetUrlCacheEntryInfoA(test_hash_collisions2, lpCacheEntryInfo, &cbCacheEntryInfo);
805 ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
807 "got incorrect entry: %s\n", lpCacheEntryInfo->lpszSourceUrlName);
808 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
809
810 if (pDeleteUrlCacheEntryA) {
811 ret = pDeleteUrlCacheEntryA(test_hash_collisions1);
812 ok(ret, "DeleteUrlCacheEntry failed: %d\n", GetLastError());
813 ret = pDeleteUrlCacheEntryA(test_hash_collisions2);
814 ok(ret, "DeleteUrlCacheEntry failed: %d\n", GetLastError());
815 }
816
817 len = strlen(long_url);
818 memset(long_url+len, 'a', sizeof(long_url)-len);
819 long_url[sizeof(long_url)-1] = 0;
820 ret = CreateUrlCacheEntryA(long_url, 0, NULL, filenameA, 0);
821 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
824
825 ret = CreateUrlCacheEntryA(long_url, 0, "extension", filenameA, 0);
826 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
829
830 long_url[250] = 0;
831 ret = CreateUrlCacheEntryA(long_url, 0, NULL, filenameA, 0);
832 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
835
836 ret = CreateUrlCacheEntryA(long_url, 0, "extension", filenameA, 0);
837 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
840}
841
842static void test_urlcacheW(void)
843{
844 static struct test_data
845 {
846 DWORD err;
847 WCHAR url[128];
848 char encoded_url[128];
849 WCHAR extension[32];
850 WCHAR header_info[128];
851 }urls[] = {
852 {
853 0, {'h','t','t','p',':','/','/','T','.','p','l','/','t',0},
854 "http://T.pl/t", {0}, {0}
855 },
856 {
857 0, {'w','w','w','.','T','.','p','l','/','t',0},
858 "www.T.pl/t", {0}, {0}
859 },
860 {
861 0, {'h','t','t','p',':','/','/','w','w','w','.','t','e','s','t',0x15b,0x107,
862 '.','o','r','g','/','t','e','s','t','.','h','t','m','l',0},
863 "http://www.xn--test-ota71c.org/test.html", {'t','x','t',0}, {0}
864 },
865 {
866 0, {'w','w','w','.','T','e','s','t',0x15b,0x107,'.','o','r','g',
867 '/','t','e','s','t','.','h','t','m','l',0},
868 "www.Test\xc5\x9b\xc4\x87.org/test.html", {'a',0x106,'a',0}, {'b',0x106,'b',0}
869 },
870 {
871 0, {'H','t','t','p','s',':','/','/',0x15b,0x15b,0x107,'/','t',0x107,'/',
872 't','e','s','t','?','a','=','%','2','0',0x106,0},
873 "Https://xn--4da1oa/t\xc4\x87/test?a=%20\xc4\x86", {'a',0x15b,'a',0}, {'b',0x15b,'b',0}
874 },
875 {
876 12005, {'h','t','t','p','s',':','/','/','/','/',0x107,'.','o','r','g','/','t','e','s','t',0},
877 "", {0}, {0}
878 },
879 {
880 0, {'C','o','o','k','i','e',':',' ','u','s','e','r','@','t','e','s','t','.','o','r','g','/',0},
881 "Cookie: user@test.org/", {0}, {0}
882 }
883 };
884 static const FILETIME filetime_zero;
885
886 WCHAR bufW[MAX_PATH];
887 DWORD i;
888 BOOL ret;
889
890 if(old_ie) {
891 win_skip("urlcache unicode functions\n");
892 return;
893 }
894
895 for(i=0; i<ARRAY_SIZE(urls); i++) {
896 INTERNET_CACHE_ENTRY_INFOA *entry_infoA;
897 INTERNET_CACHE_ENTRY_INFOW *entry_infoW;
898 DWORD size;
899
900 SetLastError(0xdeadbeef);
901 ret = CreateUrlCacheEntryW(urls[i].url, 0, NULL, bufW, 0);
902 if(urls[i].err != 0) {
903 ok(!ret, "%d) CreateUrlCacheEntryW succeeded\n", i);
904 ok(urls[i].err == GetLastError(), "%d) GetLastError() = %d\n", i, GetLastError());
905 continue;
906 }
907 ok(ret, "%d) CreateUrlCacheEntryW failed: %d\n", i, GetLastError());
908
909 /* dwHeaderSize is ignored, pass 0 to prove it */
910 ret = CommitUrlCacheEntryW(urls[i].url, bufW, filetime_zero, filetime_zero,
911 NORMAL_CACHE_ENTRY, urls[i].header_info, 0, urls[i].extension, NULL);
912 ok(ret, "%d) CommitUrlCacheEntryW failed: %d\n", i, GetLastError());
913
914 SetLastError(0xdeadbeef);
915 size = 0;
918 "%d) GetLastError() = %d\n", i, GetLastError());
919 entry_infoW = HeapAlloc(GetProcessHeap(), 0, size);
920 ret = GetUrlCacheEntryInfoW(urls[i].url, entry_infoW, &size);
921 ok(ret, "%d) GetUrlCacheEntryInfoW failed: %d\n", i, GetLastError());
922
923 ret = GetUrlCacheEntryInfoA(urls[i].encoded_url, NULL, &size);
925 "%d) GetLastError() = %d\n", i, GetLastError());
926 entry_infoA = HeapAlloc(GetProcessHeap(), 0, size);
927 ret = GetUrlCacheEntryInfoA(urls[i].encoded_url, entry_infoA, &size);
928 ok(ret, "%d) GetUrlCacheEntryInfoA failed: %d\n", i, GetLastError());
929
930 ok(entry_infoW->dwStructSize == entry_infoA->dwStructSize,
931 "%d) entry_infoW->dwStructSize = %d, expected %d\n",
932 i, entry_infoW->dwStructSize, entry_infoA->dwStructSize);
933 ok(!lstrcmpW(urls[i].url, entry_infoW->lpszSourceUrlName),
934 "%d) entry_infoW->lpszSourceUrlName = %s\n",
935 i, wine_dbgstr_w(entry_infoW->lpszSourceUrlName));
936 ok(!lstrcmpA(urls[i].encoded_url, entry_infoA->lpszSourceUrlName),
937 "%d) entry_infoA->lpszSourceUrlName = %s\n",
938 i, entry_infoA->lpszSourceUrlName);
939 ok(entry_infoW->CacheEntryType == entry_infoA->CacheEntryType,
940 "%d) entry_infoW->CacheEntryType = %x, expected %x\n",
941 i, entry_infoW->CacheEntryType, entry_infoA->CacheEntryType);
942 ok(entry_infoW->dwUseCount == entry_infoA->dwUseCount,
943 "%d) entry_infoW->dwUseCount = %d, expected %d\n",
944 i, entry_infoW->dwUseCount, entry_infoA->dwUseCount);
945 ok(entry_infoW->dwHitRate == entry_infoA->dwHitRate,
946 "%d) entry_infoW->dwHitRate = %d, expected %d\n",
947 i, entry_infoW->dwHitRate, entry_infoA->dwHitRate);
948 ok(entry_infoW->dwSizeLow == entry_infoA->dwSizeLow,
949 "%d) entry_infoW->dwSizeLow = %d, expected %d\n",
950 i, entry_infoW->dwSizeLow, entry_infoA->dwSizeLow);
951 ok(entry_infoW->dwSizeHigh == entry_infoA->dwSizeHigh,
952 "%d) entry_infoW->dwSizeHigh = %d, expected %d\n",
953 i, entry_infoW->dwSizeHigh, entry_infoA->dwSizeHigh);
954 ok(!memcmp(&entry_infoW->LastModifiedTime, &entry_infoA->LastModifiedTime, sizeof(FILETIME)),
955 "%d) entry_infoW->LastModifiedTime is incorrect\n", i);
956 ok(!memcmp(&entry_infoW->ExpireTime, &entry_infoA->ExpireTime, sizeof(FILETIME)),
957 "%d) entry_infoW->ExpireTime is incorrect\n", i);
958 ok(!memcmp(&entry_infoW->LastAccessTime, &entry_infoA->LastAccessTime, sizeof(FILETIME)),
959 "%d) entry_infoW->LastAccessTime is incorrect\n", i);
960 ok(!memcmp(&entry_infoW->LastSyncTime, &entry_infoA->LastSyncTime, sizeof(FILETIME)),
961 "%d) entry_infoW->LastSyncTime is incorrect\n", i);
962
963 MultiByteToWideChar(CP_ACP, 0, entry_infoA->lpszLocalFileName, -1, bufW, MAX_PATH);
964 ok(!lstrcmpW(entry_infoW->lpszLocalFileName, bufW),
965 "%d) entry_infoW->lpszLocalFileName = %s, expected %s\n",
966 i, wine_dbgstr_w(entry_infoW->lpszLocalFileName), wine_dbgstr_w(bufW));
967
968 if(!urls[i].header_info[0]) {
969 ok(!entry_infoW->lpHeaderInfo, "entry_infoW->lpHeaderInfo != NULL\n");
970 }else {
971 ok(!lstrcmpW((WCHAR*)entry_infoW->lpHeaderInfo, urls[i].header_info),
972 "%d) entry_infoW->lpHeaderInfo = %s\n",
973 i, wine_dbgstr_w((WCHAR*)entry_infoW->lpHeaderInfo));
974 }
975
976 if(!urls[i].extension[0]) {
977 ok(!entry_infoW->lpszFileExtension || (ie10_cache && !entry_infoW->lpszFileExtension[0]),
978 "%d) entry_infoW->lpszFileExtension = %s\n",
979 i, wine_dbgstr_w(entry_infoW->lpszFileExtension));
980 }else {
981 MultiByteToWideChar(CP_ACP, 0, entry_infoA->lpszFileExtension, -1, bufW, MAX_PATH);
982 ok(!lstrcmpW(entry_infoW->lpszFileExtension, bufW) ||
983 (ie10_cache && !lstrcmpW(entry_infoW->lpszFileExtension, urls[i].extension)),
984 "%d) entry_infoW->lpszFileExtension = %s, expected %s\n",
985 i, wine_dbgstr_w(entry_infoW->lpszFileExtension), wine_dbgstr_w(bufW));
986 }
987
988 HeapFree(GetProcessHeap(), 0, entry_infoW);
989 HeapFree(GetProcessHeap(), 0, entry_infoA);
990
991 if(pDeleteUrlCacheEntryA) {
992 ret = pDeleteUrlCacheEntryA(urls[i].encoded_url);
993 ok(ret, "%d) DeleteUrlCacheEntryW failed: %d\n", i, GetLastError());
994 }
995 }
996}
997
998static void test_FindCloseUrlCache(void)
999{
1000 BOOL r;
1001 DWORD err;
1002
1003 SetLastError(0xdeadbeef);
1005 err = GetLastError();
1006 ok(0 == r, "expected 0, got %d\n", r);
1007 ok(ERROR_INVALID_HANDLE == err, "expected %d, got %d\n", ERROR_INVALID_HANDLE, err);
1008}
1009
1010static void test_GetDiskInfoA(void)
1011{
1012 BOOL ret;
1015 char path[MAX_PATH], *p;
1016
1018 if ((p = strchr(path, '\\'))) *++p = 0;
1019
1021 ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1022
1024 ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1025
1027 ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1028
1030 ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1031
1032 SetLastError(0xdeadbeef);
1033 strcpy(p, "\\non\\existing\\path");
1035 error = GetLastError();
1036 ok(!ret ||
1037 broken(old_ie && ret), /* < IE7 */
1038 "GetDiskInfoA succeeded\n");
1040 broken(old_ie && error == 0xdeadbeef), /* < IE7 */
1041 "got %u expected ERROR_PATH_NOT_FOUND\n", error);
1042
1043 SetLastError(0xdeadbeef);
1045 error = GetLastError();
1046 ok(!ret, "GetDiskInfoA succeeded\n");
1047 ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", error);
1048}
1049
1050static BOOL cache_entry_exists(const char *url)
1051{
1052 static char buf[10000];
1053 DWORD size = sizeof(buf);
1054 BOOL ret;
1055
1056 ret = GetUrlCacheEntryInfoA(url, (void*)buf, &size);
1057 ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND, "GetUrlCacheEntryInfoA returned %x (%u)\n", ret, GetLastError());
1058
1059 return ret;
1060}
1061
1062static void test_trailing_slash(void)
1063{
1064 char filename[MAX_PATH];
1065 BYTE zero_byte = 0;
1066 BOOL ret;
1067
1068 static const FILETIME filetime_zero;
1069 static char url_with_slash[] = "http://testing.cache.com/";
1070
1071
1072 ret = CreateUrlCacheEntryA(url_with_slash, 0, "html", filename, 0);
1073 ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
1074
1076
1077 ret = CommitUrlCacheEntryA("Visited: http://testing.cache.com/", NULL, filetime_zero, filetime_zero,
1078 NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
1079 ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
1080
1081 ok(cache_entry_exists("Visited: http://testing.cache.com/"), "cache entry does not exist\n");
1082 ok(!cache_entry_exists("Visited: http://testing.cache.com"), "cache entry exists\n");
1083
1084 ret = DeleteUrlCacheEntryA("Visited: http://testing.cache.com/");
1085 ok(ret, "DeleteCacheEntryA failed\n");
1087}
1088
1089static void get_cache_path(DWORD flags, char path[MAX_PATH], char path_win8[MAX_PATH])
1090{
1091 BOOL ret;
1092 int folder = -1;
1093 const char *suffix = "";
1094 const char *suffix_win8 = "";
1095
1096 switch (flags)
1097 {
1098 case 0:
1101 suffix = "\\Content.IE5\\";
1102 suffix_win8 = "\\IE\\";
1103 break;
1104
1107 suffix = "\\";
1108 suffix_win8 = "\\";
1109 break;
1110
1113 suffix = "\\History.IE5\\";
1114 suffix_win8 = "\\History.IE5\\";
1115 break;
1116
1117 default:
1118 ok(0, "unexpected flags %#x\n", flags);
1119 break;
1120 }
1121
1123 ok(ret, "SHGetSpecialFolderPath error %u\n", GetLastError());
1124
1125 strcpy(path_win8, path);
1126 strcat(path_win8, suffix_win8);
1127
1128 strcat(path, suffix);
1129}
1130
1132{
1134 struct
1135 {
1137 DWORD dwStructSize;
1138 DWORD flags;
1139 BOOL ret;
1140 DWORD error;
1141 } td[] =
1142 {
1143#if 0 /* crashes under Vista */
1145#endif
1146 { &info, 0, 0, TRUE },
1147 { &info, sizeof(info) - 1, 0, TRUE },
1148 { &info, sizeof(info) + 1, 0, TRUE },
1155 };
1156 int i;
1157 BOOL ret;
1158
1159 for (i = 0; i < ARRAY_SIZE(td); i++)
1160 {
1161 if (td[i].info)
1162 {
1163 memset(&info, 0, sizeof(*td[i].info));
1164 info.dwStructSize = td[i].dwStructSize;
1165 }
1166
1167 SetLastError(0xdeadbeef);
1169 ok(ret == td[i].ret, "%d: expected %d, got %d\n", i, td[i].ret, ret);
1170 if (!ret)
1171 ok(GetLastError() == td[i].error, "%d: expected %u, got %u\n", i, td[i].error, GetLastError());
1172 else
1173 {
1174 char path[MAX_PATH], path_win8[MAX_PATH];
1175
1176 get_cache_path(td[i].flags, path, path_win8);
1177
1178 ok(info.dwStructSize == td[i].dwStructSize, "got %u\n", info.dwStructSize);
1179 ok(!lstrcmpA(info.CachePath, path) || !lstrcmpA(info.CachePath, path_win8),
1180 "%d: expected %s or %s, got %s\n", i, path, path_win8, info.CachePath);
1181 }
1182 }
1183}
1184
1185START_TEST(urlcache)
1186{
1187 HMODULE hdll;
1188 hdll = GetModuleHandleA("wininet.dll");
1189
1190 if(!GetProcAddress(hdll, "InternetGetCookieExW")) {
1191 win_skip("Too old IE (older than 6.0)\n");
1192 return;
1193 }
1194 if(!GetProcAddress(hdll, "InternetGetSecurityInfoByURL")) /* < IE7 */
1195 old_ie = TRUE;
1196
1197 if(GetProcAddress(hdll, "CreateUrlCacheEntryExW")) {
1198 trace("Running tests on IE10 or newer\n");
1199 ie10_cache = TRUE;
1200 }
1201
1202 pDeleteUrlCacheEntryA = (void*)GetProcAddress(hdll, "DeleteUrlCacheEntryA");
1203 pUnlockUrlCacheEntryFileA = (void*)GetProcAddress(hdll, "UnlockUrlCacheEntryFileA");
1210}
#define broken(x)
Definition: _sntprintf.h:21
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define ARRAY_SIZE(A)
Definition: main.h:33
#define U(x)
Definition: wordpad.c:45
r l[0]
Definition: byte_order.h:168
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2283
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
BOOL WINAPI SHGetSpecialFolderPathA(HWND hwndOwner, LPSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:3048
INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR lpszUrlSearchPattern, LPINTERNET_CACHE_ENTRY_INFOA lpFirstCacheEntryInfo, LPDWORD lpdwFirstCacheEntryInfoBufferSize)
Definition: urlcache.c:3469
BOOL WINAPI GetUrlCacheEntryInfoA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize)
Definition: urlcache.c:1888
BOOL WINAPI FindCloseUrlCache(HANDLE hEnumHandle)
Definition: urlcache.c:3659
BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName)
Definition: urlcache.c:3298
BOOL WINAPI IsUrlCacheEntryExpiredA(LPCSTR url, DWORD dwFlags, FILETIME *pftLastModified)
Definition: urlcache.c:3978
BOOL WINAPI CreateUrlCacheEntryA(LPCSTR lpszUrlName, DWORD dwExpectedFileSize, LPCSTR lpszFileExtension, LPSTR lpszFileName, DWORD dwReserved)
Definition: urlcache.c:2796
BOOL WINAPI GetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize)
Definition: urlcache.c:2012
BOOL WINAPI GetUrlCacheEntryInfoExA(LPCSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufSize, LPSTR lpszReserved, LPDWORD lpdwReserved, LPVOID lpReserved, DWORD dwFlags)
Definition: urlcache.c:1869
BOOL WINAPI FindNextUrlCacheEntryA(HANDLE hEnumHandle, LPINTERNET_CACHE_ENTRY_INFOA lpNextCacheEntryInfo, LPDWORD lpdwNextCacheEntryInfoBufferSize)
Definition: urlcache.c:3629
BOOL WINAPI GetUrlCacheEntryInfoExW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufSize, LPWSTR lpszReserved, LPDWORD lpdwReserved, LPVOID lpReserved, DWORD dwFlags)
Definition: urlcache.c:1982
BOOL WINAPI CreateUrlCacheEntryW(LPCWSTR lpszUrlName, DWORD dwExpectedFileSize, LPCWSTR lpszFileExtension, LPWSTR lpszFileName, DWORD dwReserved)
Definition: urlcache.c:2815
BOOL WINAPI CommitUrlCacheEntryA(LPCSTR lpszUrlName, LPCSTR lpszLocalFileName, FILETIME ExpireTime, FILETIME LastModifiedTime, DWORD CacheEntryType, LPBYTE lpHeaderInfo, DWORD dwHeaderSize, LPCSTR lpszFileExtension, LPCSTR lpszOriginalUrl)
Definition: urlcache.c:3063
BOOL WINAPI GetDiskInfoA(PCSTR path, PDWORD cluster_size, PDWORDLONG free, PDWORDLONG total)
Definition: urlcache.c:4062
BOOL WINAPI CommitUrlCacheEntryW(LPCWSTR lpszUrlName, LPCWSTR lpszLocalFileName, FILETIME ExpireTime, FILETIME LastModifiedTime, DWORD CacheEntryType, LPWSTR lpHeaderInfo, DWORD dwHeaderSize, LPCWSTR lpszFileExtension, LPCWSTR lpszOriginalUrl)
Definition: urlcache.c:3085
BOOL WINAPI SetUrlCacheEntryInfoA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, DWORD dwFieldControl)
Definition: urlcache.c:2023
BOOL WINAPI GetUrlCacheConfigInfoA(LPINTERNET_CACHE_CONFIG_INFOA info, LPDWORD size, DWORD flags)
Definition: urlcache.c:3857
BOOL WINAPI RetrieveUrlCacheEntryFileA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize, DWORD dwReserved)
Definition: urlcache.c:2173
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
time_t now
Definition: finger.c:65
size_t total
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned long long DWORDLONG
Definition: intsafe.h:93
const char * filename
Definition: ioapi.h:137
#define wine_dbgstr_w
Definition: kernel32.h:34
static int zero_byte(mpg123_handle *fr)
Definition: libmpg123.c:763
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
__u8 cluster_size
Definition: mkdosfs.c:4
#define error(str)
Definition: mkdosfs.c:1605
#define CREATE_ALWAYS
Definition: disk.h:72
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static const WCHAR url[]
Definition: encode.c:1432
#define check_file_not_exists(f)
Definition: urlcache.c:349
static void get_cache_path(DWORD flags, char path[MAX_PATH], char path_win8[MAX_PATH])
Definition: urlcache.c:1089
static void test_trailing_slash(void)
Definition: urlcache.c:1062
static void test_GetUrlCacheEntryInfoExA(void)
Definition: urlcache.c:109
static void test_GetUrlCacheConfigInfo(void)
Definition: urlcache.c:1131
static BOOL ie10_cache
Definition: urlcache.c:50
static const char test_hash_collisions2[]
Definition: urlcache.c:42
static char filenameA[MAX_PATH+1]
Definition: urlcache.c:47
static void _check_file_not_exists(LONG l, LPCSTR filename)
Definition: urlcache.c:337
static void test_FindCloseUrlCache(void)
Definition: urlcache.c:998
static void check_cache_entry_infoA(const char *returnedfrom, INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo)
Definition: urlcache.c:52
static void test_IsUrlCacheEntryExpiredA(void)
Definition: urlcache.c:211
static const char test_url1[]
Definition: urlcache.c:40
static void test_urlcacheA(void)
Definition: urlcache.c:368
static const WCHAR test_urlW[]
Definition: urlcache.c:38
static void test_urlcacheW(void)
Definition: urlcache.c:842
static char filenameA1[MAX_PATH+1]
Definition: urlcache.c:48
static const char test_url[]
Definition: urlcache.c:37
static void test_RetrieveUrlCacheEntryA(void)
Definition: urlcache.c:184
static BOOL cache_entry_exists(const char *url)
Definition: urlcache.c:1050
static void _check_file_exists(LONG l, LPCSTR filename)
Definition: urlcache.c:323
static void test_find_url_cache_entriesA(void)
Definition: urlcache.c:60
static void create_and_write_file(LPCSTR filename, void *data, DWORD len)
Definition: urlcache.c:351
static void test_GetDiskInfoA(void)
Definition: urlcache.c:1010
#define check_file_exists(f)
Definition: urlcache.c:335
static const char test_hash_collisions1[]
Definition: urlcache.c:41
static BOOL old_ie
Definition: urlcache.c:49
_In_ HANDLE hFile
Definition: mswsock.h:90
#define BOOL
Definition: nt_native.h:43
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define DWORD
Definition: nt_native.h:44
#define GENERIC_WRITE
Definition: nt_native.h:90
long LONG
Definition: pedump.c:60
#define err(...)
#define win_skip
Definition: test.h:160
#define memset(x, y, z)
Definition: compat.h:39
static PVOID hdll
Definition: shimdbg.c:126
#define CSIDL_INTERNET_CACHE
Definition: shlobj.h:2122
#define CSIDL_COOKIES
Definition: shlobj.h:2123
#define CSIDL_HISTORY
Definition: shlobj.h:2124
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
Definition: wininet.h:2104
DWORD dwUseCount
Definition: wininet.h:2109
DWORD dwSizeHigh
Definition: wininet.h:2112
LPSTR lpszFileExtension
Definition: wininet.h:2120
FILETIME LastAccessTime
Definition: wininet.h:2115
LPSTR lpszLocalFileName
Definition: wininet.h:2107
DWORD dwHitRate
Definition: wininet.h:2110
DWORD CacheEntryType
Definition: wininet.h:2108
DWORD dwStructSize
Definition: wininet.h:2105
DWORD dwHeaderInfoSize
Definition: wininet.h:2119
LPSTR lpszSourceUrlName
Definition: wininet.h:2106
FILETIME LastSyncTime
Definition: wininet.h:2116
FILETIME LastModifiedTime
Definition: wininet.h:2113
DWORD dwSizeLow
Definition: wininet.h:2111
FILETIME ExpireTime
Definition: wininet.h:2114
Definition: wininet.h:2127
DWORD CacheEntryType
Definition: wininet.h:2131
FILETIME LastSyncTime
Definition: wininet.h:2139
FILETIME LastModifiedTime
Definition: wininet.h:2136
LPWSTR lpszSourceUrlName
Definition: wininet.h:2129
FILETIME LastAccessTime
Definition: wininet.h:2138
DWORD dwHitRate
Definition: wininet.h:2133
LPBYTE lpHeaderInfo
Definition: wininet.h:2141
DWORD dwSizeHigh
Definition: wininet.h:2135
DWORD dwSizeLow
Definition: wininet.h:2134
DWORD dwStructSize
Definition: wininet.h:2128
LPWSTR lpszFileExtension
Definition: wininet.h:2143
FILETIME ExpireTime
Definition: wininet.h:2137
DWORD dwUseCount
Definition: wininet.h:2132
LPWSTR lpszLocalFileName
Definition: wininet.h:2130
struct _ULARGE_INTEGER::@4136 u
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
Definition: fci.c:127
Definition: fci.c:116
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
unsigned char * LPBYTE
Definition: typedefs.h:53
uint64_t ULONGLONG
Definition: typedefs.h:67
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WINAPI
Definition: msvc.h:6
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define ERROR_INVALID_DATA
Definition: winerror.h:116
struct _INTERNET_CACHE_ENTRY_INFOA INTERNET_CACHE_ENTRY_INFOA
#define COOKIE_CACHE_ENTRY
Definition: wininet.h:2090
#define URLHISTORY_CACHE_ENTRY
Definition: wininet.h:2091
#define CACHE_ENTRY_EXPTIME_FC
Definition: wininet.h:2296
#define CACHE_ENTRY_EXEMPT_DELTA_FC
Definition: wininet.h:2300
#define CACHE_ENTRY_ATTRIBUTE_FC
Definition: wininet.h:2293
#define NORMAL_CACHE_ENTRY
Definition: wininet.h:2087
#define STICKY_CACHE_ENTRY
Definition: wininet.h:2088
#define CACHE_ENTRY_MODTIME_FC
Definition: wininet.h:2295
#define CACHE_CONFIG_CONTENT_PATHS_FC
Definition: winineti.h:101
#define CACHE_CONFIG_HISTORY_PATHS_FC
Definition: winineti.h:103
#define CACHE_CONFIG_COOKIES_PATHS_FC
Definition: winineti.h:102
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193