ReactOS  0.4.13-dev-99-g7e18b6d
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 #include <stdarg.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winnls.h"
28 #include "wininet.h"
29 #include "winineti.h"
30 
31 #include "wine/test.h"
32 
33 static const char test_url[] = "http://urlcachetest.winehq.org/index.html";
34 static const WCHAR test_urlW[] = {'h','t','t','p',':','/','/','u','r','l','c','a','c','h','e','t','e','s','t','.',
35  'w','i','n','e','h','q','.','o','r','g','/','i','n','d','e','x','.','h','t','m','l',0};
36 static const char test_url1[] = "Visited: user@http://urlcachetest.winehq.org/index.html";
37 static const char test_hash_collisions1[] = "Visited: http://winehq.org/doc0.html";
38 static const char test_hash_collisions2[] = "Visited: http://winehq.org/doc75651909.html";
39 
40 static BOOL (WINAPI *pDeleteUrlCacheEntryA)(LPCSTR);
41 static BOOL (WINAPI *pUnlockUrlCacheEntryFileA)(LPCSTR,DWORD);
42 
43 static char filenameA[MAX_PATH + 1];
44 static char filenameA1[MAX_PATH + 1];
45 static BOOL old_ie = FALSE;
47 
48 static void check_cache_entry_infoA(const char *returnedfrom, INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo)
49 {
50  ok(lpCacheEntryInfo->dwStructSize == sizeof(*lpCacheEntryInfo), "%s: dwStructSize was %d\n", returnedfrom, lpCacheEntryInfo->dwStructSize);
51  ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_url), "%s: lpszSourceUrlName should be %s instead of %s\n", returnedfrom, test_url, lpCacheEntryInfo->lpszSourceUrlName);
52  ok(!strcmp(lpCacheEntryInfo->lpszLocalFileName, filenameA), "%s: lpszLocalFileName should be %s instead of %s\n", returnedfrom, filenameA, lpCacheEntryInfo->lpszLocalFileName);
53  ok(!strcmp(lpCacheEntryInfo->lpszFileExtension, "html"), "%s: lpszFileExtension should be html instead of %s\n", returnedfrom, lpCacheEntryInfo->lpszFileExtension);
54 }
55 
57 {
58  BOOL ret;
59  HANDLE hEnumHandle;
60  BOOL found = FALSE;
61  DWORD cbCacheEntryInfo;
62  DWORD cbCacheEntryInfoSaved;
63  INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
64 
65  cbCacheEntryInfo = 0;
66  SetLastError(0xdeadbeef);
67  hEnumHandle = FindFirstUrlCacheEntryA(NULL, NULL, &cbCacheEntryInfo);
68  ok(!hEnumHandle, "FindFirstUrlCacheEntry should have failed\n");
69  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "FindFirstUrlCacheEntry should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
70  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo * sizeof(char));
71  cbCacheEntryInfoSaved = cbCacheEntryInfo;
72  hEnumHandle = FindFirstUrlCacheEntryA(NULL, lpCacheEntryInfo, &cbCacheEntryInfo);
73  ok(hEnumHandle != NULL, "FindFirstUrlCacheEntry failed with error %d\n", GetLastError());
74  while (TRUE)
75  {
76  if (!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_url))
77  {
78  found = TRUE;
79  ret = TRUE;
80  break;
81  }
82  SetLastError(0xdeadbeef);
83  cbCacheEntryInfo = cbCacheEntryInfoSaved;
84  ret = FindNextUrlCacheEntryA(hEnumHandle, lpCacheEntryInfo, &cbCacheEntryInfo);
85  if (!ret)
86  {
88  {
89  lpCacheEntryInfo = HeapReAlloc(GetProcessHeap(), 0, lpCacheEntryInfo, cbCacheEntryInfo);
90  cbCacheEntryInfoSaved = cbCacheEntryInfo;
91  ret = FindNextUrlCacheEntryA(hEnumHandle, lpCacheEntryInfo, &cbCacheEntryInfo);
92  }
93  }
94  if (!ret)
95  break;
96  }
97  ok(ret, "FindNextUrlCacheEntry failed with error %d\n", GetLastError());
98  ok(found, "Committed url cache entry not found during enumeration\n");
99 
100  ret = FindCloseUrlCache(hEnumHandle);
101  ok(ret, "FindCloseUrlCache failed with error %d\n", GetLastError());
102  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
103 }
104 
106 {
107  BOOL ret;
108  DWORD cbCacheEntryInfo, cbRedirectUrl;
109  INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
110 
111  SetLastError(0xdeadbeef);
113  ok(!ret, "GetUrlCacheEntryInfoEx with NULL URL and NULL args should have failed\n");
115  "GetUrlCacheEntryInfoEx with NULL URL and NULL args should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
116 
117  cbCacheEntryInfo = sizeof(INTERNET_CACHE_ENTRY_INFOA);
118  SetLastError(0xdeadbeef);
119  ret = GetUrlCacheEntryInfoExA("", NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
120  ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
122  "GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %d\n", GetLastError());
123 
125  ok(ret, "GetUrlCacheEntryInfoEx with NULL args failed with error %d\n", GetLastError());
126 
127  cbCacheEntryInfo = 0;
128  SetLastError(0xdeadbeef);
129  ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
130  ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
132  "GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
133 
134  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
135 
136  SetLastError(0xdeadbeef);
137  ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
138  ok(ret == ie10_cache, "GetUrlCacheEntryInfoEx returned %x\n", ret);
140  "GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %d\n", GetLastError());
141 
142  /* Unicode version of function seems to ignore 0x200 flag */
143  ret = GetUrlCacheEntryInfoExW(test_urlW, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
144  ok(ret || broken(old_ie && !ret), "GetUrlCacheEntryInfoExW failed with error %d\n", GetLastError());
145 
146  ret = GetUrlCacheEntryInfoExA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
147  ok(ret, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
148 
149  if (ret) check_cache_entry_infoA("GetUrlCacheEntryInfoEx", lpCacheEntryInfo);
150 
151  lpCacheEntryInfo->CacheEntryType |= 0x10000000; /* INSTALLED_CACHE_ENTRY */
153  ok(ret, "SetUrlCacheEntryInfoA failed with error %d\n", GetLastError());
154 
155  SetLastError(0xdeadbeef);
156  ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
157  ok(ret, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
158 
159  cbCacheEntryInfo = 100000;
160  SetLastError(0xdeadbeef);
161  ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
162  ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
163  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
164 
165  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
166 
167  /* Querying the redirect URL fails with ERROR_INVALID_PARAMETER */
168  SetLastError(0xdeadbeef);
169  ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, &cbRedirectUrl, NULL, 0);
170  ok(!ret, "GetUrlCacheEntryInfoEx should have failed\n");
172  "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
173  SetLastError(0xdeadbeef);
174  ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, &cbRedirectUrl, NULL, 0);
175  ok(!ret, "GetUrlCacheEntryInfoEx should have failed\n");
177  "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
178 }
179 
181 {
182  BOOL ret;
183  DWORD cbCacheEntryInfo;
184 
185  cbCacheEntryInfo = 0;
186  SetLastError(0xdeadbeef);
187  ret = RetrieveUrlCacheEntryFileA(NULL, NULL, &cbCacheEntryInfo, 0);
188  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
189  ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
190 
191  if (0)
192  {
193  /* Crashes on Win9x, NT4 and W2K */
194  SetLastError(0xdeadbeef);
196  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
197  ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
198  }
199 
200  SetLastError(0xdeadbeef);
201  cbCacheEntryInfo = 100000;
202  ret = RetrieveUrlCacheEntryFileA(NULL, NULL, &cbCacheEntryInfo, 0);
203  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
204  ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
205 }
206 
208 {
209  static const char uncached_url[] =
210  "What's the airspeed velocity of an unladen swallow?";
211  BOOL ret;
212  FILETIME ft;
213  DWORD size;
215  ULARGE_INTEGER exp_time;
216 
217  /* The function returns TRUE when the output time is NULL or the tested URL
218  * is NULL.
219  */
221  ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
222  ft.dwLowDateTime = 0xdeadbeef;
223  ft.dwHighDateTime = 0xbaadf00d;
224  ret = IsUrlCacheEntryExpiredA(NULL, 0, &ft);
225  ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
226  ok(ft.dwLowDateTime == 0xdeadbeef && ft.dwHighDateTime == 0xbaadf00d,
227  "expected time to be unchanged, got (%u,%u)\n",
230  ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
231 
232  /* The return value should indicate whether the URL is expired,
233  * and the filetime indicates the last modified time, but a cache entry
234  * with a zero expire time is "not expired".
235  */
236  ft.dwLowDateTime = 0xdeadbeef;
237  ft.dwHighDateTime = 0xbaadf00d;
239  ok(!ret, "expected FALSE\n");
240  ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
241  "expected time (0,0), got (%u,%u)\n",
243 
244  /* Same behavior with bogus flags. */
245  ft.dwLowDateTime = 0xdeadbeef;
246  ft.dwHighDateTime = 0xbaadf00d;
247  ret = IsUrlCacheEntryExpiredA(test_url, 0xffffffff, &ft);
248  ok(!ret, "expected FALSE\n");
249  ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
250  "expected time (0,0), got (%u,%u)\n",
252 
253  /* Set the expire time to a point in the past.. */
255  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
257  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
260  ok(ret, "GetUrlCacheEntryInfo failed: %d\n", GetLastError());
261  GetSystemTimeAsFileTime(&info->ExpireTime);
262  exp_time.u.LowPart = info->ExpireTime.dwLowDateTime;
263  exp_time.u.HighPart = info->ExpireTime.dwHighDateTime;
264  exp_time.QuadPart -= 10 * 60 * (ULONGLONG)10000000;
265  info->ExpireTime.dwLowDateTime = exp_time.u.LowPart;
266  info->ExpireTime.dwHighDateTime = exp_time.u.HighPart;
268  ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
269  ft.dwLowDateTime = 0xdeadbeef;
270  ft.dwHighDateTime = 0xbaadf00d;
271  /* and the entry should be expired. */
273  ok(ret, "expected TRUE\n");
274  /* The modified time returned is 0. */
275  ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
276  "expected time (0,0), got (%u,%u)\n",
278  /* Set the expire time to a point in the future.. */
279  exp_time.QuadPart += 20 * 60 * (ULONGLONG)10000000;
280  info->ExpireTime.dwLowDateTime = exp_time.u.LowPart;
281  info->ExpireTime.dwHighDateTime = exp_time.u.HighPart;
283  ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
284  ft.dwLowDateTime = 0xdeadbeef;
285  ft.dwHighDateTime = 0xbaadf00d;
286  /* and the entry should no longer be expired. */
288  ok(!ret, "expected FALSE\n");
289  /* The modified time returned is still 0. */
290  ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
291  "expected time (0,0), got (%u,%u)\n",
293  /* Set the modified time... */
294  GetSystemTimeAsFileTime(&info->LastModifiedTime);
296  ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
297  /* and the entry should still be unexpired.. */
299  ok(!ret, "expected FALSE\n");
300  /* but the modified time returned is the last modified time just set. */
301  ok(ft.dwLowDateTime == info->LastModifiedTime.dwLowDateTime &&
302  ft.dwHighDateTime == info->LastModifiedTime.dwHighDateTime,
303  "expected time (%u,%u), got (%u,%u)\n",
304  info->LastModifiedTime.dwLowDateTime,
305  info->LastModifiedTime.dwHighDateTime,
308 
309  /* An uncached URL is implicitly expired, but with unknown time. */
310  ft.dwLowDateTime = 0xdeadbeef;
311  ft.dwHighDateTime = 0xbaadf00d;
312  ret = IsUrlCacheEntryExpiredA(uncached_url, 0, &ft);
313  ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
314  ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
315  "expected time (0,0), got (%u,%u)\n",
317 }
318 
320 {
321  HANDLE file;
322 
325  ok_(__FILE__,l)(file != INVALID_HANDLE_VALUE,
326  "expected file to exist, CreateFile failed with error %d\n",
327  GetLastError());
328  CloseHandle(file);
329 }
330 
331 #define check_file_exists(f) _check_file_exists(__LINE__, f)
332 
334 {
335  HANDLE file;
336 
339  ok_(__FILE__,l)(file == INVALID_HANDLE_VALUE,
340  "expected file not to exist\n");
341  if (file != INVALID_HANDLE_VALUE)
342  CloseHandle(file);
343 }
344 
345 #define check_file_not_exists(f) _check_file_not_exists(__LINE__, f)
346 
348 {
349  HANDLE file;
350  DWORD written;
351  BOOL ret;
352 
356  ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed with error %d\n", GetLastError());
357 
358  ret = WriteFile(file, data, len, &written, NULL);
359  ok(ret, "WriteFile failed with error %d\n", GetLastError());
360 
361  CloseHandle(file);
362 }
363 
364 static void test_urlcacheA(void)
365 {
366  static char long_url[300] = "http://www.winehq.org/";
367  static char ok_header[] = "HTTP/1.0 200 OK\r\n\r\n";
368  BOOL ret;
369  HANDLE hFile;
370  BYTE zero_byte = 0;
371  INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
372  INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo2;
373  DWORD cbCacheEntryInfo;
374  static const FILETIME filetime_zero;
375  FILETIME now;
376  int len;
377 
378  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
379  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
380 
381  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
382  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
385 
386  ok(lstrcmpiA(filenameA, filenameA1), "expected a different file name\n");
387 
389 
390  ret = CommitUrlCacheEntryA(test_url1, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
391  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
392  cbCacheEntryInfo = 0;
393  ret = GetUrlCacheEntryInfoA(test_url1, NULL, &cbCacheEntryInfo);
394  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
396  "GetUrlCacheEntryInfo should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
397  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
398  ret = GetUrlCacheEntryInfoA(test_url1, lpCacheEntryInfo, &cbCacheEntryInfo);
399  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
400  ok(!memcmp(&lpCacheEntryInfo->ExpireTime, &filetime_zero, sizeof(FILETIME)),
401  "expected zero ExpireTime\n");
402  ok(!memcmp(&lpCacheEntryInfo->LastModifiedTime, &filetime_zero, sizeof(FILETIME)),
403  "expected zero LastModifiedTime\n");
405  broken(lpCacheEntryInfo->CacheEntryType == NORMAL_CACHE_ENTRY /* NT4/W2k */),
406  "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x\n",
407  lpCacheEntryInfo->CacheEntryType);
408  ok(!U(*lpCacheEntryInfo).dwExemptDelta, "expected dwExemptDelta 0, got %d\n",
409  U(*lpCacheEntryInfo).dwExemptDelta);
410 
411  /* Make sure there is a notable change in timestamps */
412  Sleep(1000);
413 
414  /* A subsequent commit with a different time/type doesn't change most of the entry */
417  (LPBYTE)ok_header, strlen(ok_header), NULL, NULL);
418  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
419  cbCacheEntryInfo = 0;
420  ret = GetUrlCacheEntryInfoA(test_url1, NULL, &cbCacheEntryInfo);
421  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
423  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
424  lpCacheEntryInfo2 = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
425  ret = GetUrlCacheEntryInfoA(test_url1, lpCacheEntryInfo2, &cbCacheEntryInfo);
426  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
427  /* but it does change the time.. */
428  ok(memcmp(&lpCacheEntryInfo2->ExpireTime, &filetime_zero, sizeof(FILETIME)),
429  "expected positive ExpireTime\n");
430  ok(memcmp(&lpCacheEntryInfo2->LastModifiedTime, &filetime_zero, sizeof(FILETIME)),
431  "expected positive LastModifiedTime\n");
433  broken(lpCacheEntryInfo2->CacheEntryType == NORMAL_CACHE_ENTRY /* NT4/W2k */),
434  "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x\n",
435  lpCacheEntryInfo2->CacheEntryType);
436  /* and set the headers. */
437  ok(lpCacheEntryInfo2->dwHeaderInfoSize == 19,
438  "expected headers size 19, got %d\n",
439  lpCacheEntryInfo2->dwHeaderInfoSize);
440  /* Hit rate gets incremented by 1 */
441  ok((lpCacheEntryInfo->dwHitRate + 1) == lpCacheEntryInfo2->dwHitRate,
442  "HitRate not incremented by one on commit\n");
443  /* Last access time should be updated */
444  ok(!(lpCacheEntryInfo->LastAccessTime.dwHighDateTime == lpCacheEntryInfo2->LastAccessTime.dwHighDateTime &&
445  lpCacheEntryInfo->LastAccessTime.dwLowDateTime == lpCacheEntryInfo2->LastAccessTime.dwLowDateTime),
446  "Last accessed time was not updated by commit\n");
447  /* File extension should be unset */
448  ok(lpCacheEntryInfo2->lpszFileExtension == NULL,
449  "Fileextension isn't unset: %s\n",
450  lpCacheEntryInfo2->lpszFileExtension);
451  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
452  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo2);
453 
454  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
455  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
456 
457  cbCacheEntryInfo = 0;
458  SetLastError(0xdeadbeef);
459  ret = RetrieveUrlCacheEntryFileA(test_url, NULL, &cbCacheEntryInfo, 0);
460  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
462  "RetrieveUrlCacheEntryFile should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
463 
464  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
465  ret = RetrieveUrlCacheEntryFileA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, 0);
466  ok(ret, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
467 
468  if (ret) check_cache_entry_infoA("RetrieveUrlCacheEntryFile", lpCacheEntryInfo);
469 
470  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
471 
472  cbCacheEntryInfo = 0;
473  SetLastError(0xdeadbeef);
474  ret = RetrieveUrlCacheEntryFileA(test_url1, NULL, &cbCacheEntryInfo, 0);
475  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
477  "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_DATA instead of %d\n", GetLastError());
478 
479  if (pUnlockUrlCacheEntryFileA)
480  {
481  ret = pUnlockUrlCacheEntryFileA(test_url, 0);
482  ok(ret, "UnlockUrlCacheEntryFileA failed with error %d\n", GetLastError());
483  }
484 
485  /* test Find*UrlCacheEntry functions */
487 
491 
492  if (pDeleteUrlCacheEntryA)
493  {
494  ret = pDeleteUrlCacheEntryA(test_url);
495  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
496  ret = pDeleteUrlCacheEntryA(test_url1);
497  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
498  }
499 
500  SetLastError(0xdeadbeef);
502  ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "local file should no longer exist\n");
503 
504  /* Creating two entries with the same URL */
505  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
506  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
507 
508  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
509  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
510 
511  ok(lstrcmpiA(filenameA, filenameA1), "expected a different file name\n");
512 
517 
518  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero,
519  filetime_zero, NORMAL_CACHE_ENTRY, (LPBYTE)ok_header,
520  strlen(ok_header), "html", NULL);
521  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
524  ret = CommitUrlCacheEntryA(test_url, filenameA1, filetime_zero,
525  filetime_zero, COOKIE_CACHE_ENTRY, NULL, 0, "html", NULL);
526  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
527  /* By committing the same URL a second time, the prior entry is
528  * overwritten...
529  */
530  cbCacheEntryInfo = 0;
531  SetLastError(0xdeadbeef);
532  ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
533  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
535  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
536  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
537  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
538  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
539  /* with the previous entry type retained.. */
540  ok(lpCacheEntryInfo->CacheEntryType & NORMAL_CACHE_ENTRY,
541  "expected cache entry type NORMAL_CACHE_ENTRY, got %d (0x%08x)\n",
542  lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
543  /* and the headers overwritten.. */
544  ok(!lpCacheEntryInfo->dwHeaderInfoSize, "expected headers size 0, got %d\n",
545  lpCacheEntryInfo->dwHeaderInfoSize);
546  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
547  /* and the previous filename shouldn't exist. */
550 
551  if (pDeleteUrlCacheEntryA)
552  {
553  ret = pDeleteUrlCacheEntryA(test_url);
554  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
557  /* Just in case, clean up files */
560  }
561 
562  /* Check whether a retrieved cache entry can be deleted before it's
563  * unlocked:
564  */
565  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
566  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
567  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
568  NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
569  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
570 
571  cbCacheEntryInfo = 0;
572  SetLastError(0xdeadbeef);
573  ret = RetrieveUrlCacheEntryFileA(test_url, NULL, &cbCacheEntryInfo, 0);
574  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
576  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
577 
578  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
579  ret = RetrieveUrlCacheEntryFileA(test_url, lpCacheEntryInfo,
580  &cbCacheEntryInfo, 0);
581  ok(ret, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
582 
583  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
584 
585  if (pDeleteUrlCacheEntryA)
586  {
587  ret = pDeleteUrlCacheEntryA(test_url);
588  ok(!ret, "Expected failure\n");
590  "Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
592  }
593 
594  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
595  memset(lpCacheEntryInfo, 0, cbCacheEntryInfo);
596  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
597  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
598  ok(lpCacheEntryInfo->CacheEntryType & 0x400000,
599  "CacheEntryType hasn't PENDING_DELETE_CACHE_ENTRY set, (flags %08x)\n",
600  lpCacheEntryInfo->CacheEntryType);
601  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
602 
603  if (pUnlockUrlCacheEntryFileA)
604  {
606  ret = pUnlockUrlCacheEntryFileA(test_url, 0);
607  ok(ret, "UnlockUrlCacheEntryFileA failed: %d\n", GetLastError());
608  /* By unlocking the already-deleted cache entry, the file associated
609  * with it is deleted..
610  */
612  /* (just in case, delete file) */
614  }
615  if (pDeleteUrlCacheEntryA)
616  {
617  /* and a subsequent deletion should fail. */
618  ret = pDeleteUrlCacheEntryA(test_url);
619  ok(!ret, "Expected failure\n");
621  "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
622  }
623 
624  /* Test whether preventing a file from being deleted causes
625  * DeleteUrlCacheEntryA to fail.
626  */
627  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
628  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
629 
632 
633  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero,
634  filetime_zero, NORMAL_CACHE_ENTRY, (LPBYTE)ok_header,
635  strlen(ok_header), "html", NULL);
636  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
640  ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA failed: %d\n",
641  GetLastError());
642  if (pDeleteUrlCacheEntryA)
643  {
644  /* DeleteUrlCacheEntryA should succeed.. */
645  ret = pDeleteUrlCacheEntryA(test_url);
646  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
647  }
649  if (pDeleteUrlCacheEntryA)
650  {
651  /* and a subsequent deletion should fail.. */
652  ret = pDeleteUrlCacheEntryA(test_url);
653  ok(!ret, "Expected failure\n");
655  "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
656  }
657  /* and the file should be untouched. */
660 
661  /* Try creating a sticky entry. Unlike non-sticky entries, the filename
662  * must have been set already.
663  */
664  SetLastError(0xdeadbeef);
665  ret = CommitUrlCacheEntryA(test_url, NULL, filetime_zero, filetime_zero,
666  STICKY_CACHE_ENTRY, (LPBYTE)ok_header, strlen(ok_header), "html",
667  NULL);
668  ok(ret == ie10_cache, "CommitUrlCacheEntryA returned %x\n", ret);
670  "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
671  SetLastError(0xdeadbeef);
672  ret = CommitUrlCacheEntryA(test_url, NULL, filetime_zero, filetime_zero,
674  (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
675  ok(ret == ie10_cache, "CommitUrlCacheEntryA returned %x\n", ret);
677  "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
678 
679  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
680  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
682  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
684  (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
685  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
686  cbCacheEntryInfo = 0;
687  SetLastError(0xdeadbeef);
688  ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
689  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
691  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
692  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
693  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
694  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
696  "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
697  lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
698  ok(U(*lpCacheEntryInfo).dwExemptDelta == 86400,
699  "expected dwExemptDelta 86400, got %d\n",
700  U(*lpCacheEntryInfo).dwExemptDelta);
701  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
702  if (pDeleteUrlCacheEntryA)
703  {
704  ret = pDeleteUrlCacheEntryA(test_url);
705  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
706  /* When explicitly deleting the cache entry, the file is also deleted */
708  }
709  /* Test once again, setting the exempt delta via SetUrlCacheEntryInfo */
710  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
711  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
713  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
715  (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
716  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
717  cbCacheEntryInfo = 0;
718  SetLastError(0xdeadbeef);
719  ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
720  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
722  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
723  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
724  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
725  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
727  "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
728  lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
729  ok(U(*lpCacheEntryInfo).dwExemptDelta == 86400,
730  "expected dwExemptDelta 86400, got %d\n",
731  U(*lpCacheEntryInfo).dwExemptDelta);
732  U(*lpCacheEntryInfo).dwExemptDelta = 0;
733  ret = SetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo,
735  ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
736  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
737  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
738  ok(!U(*lpCacheEntryInfo).dwExemptDelta, "expected dwExemptDelta 0, got %d\n",
739  U(*lpCacheEntryInfo).dwExemptDelta);
740  /* See whether a sticky cache entry has the flag cleared once the exempt
741  * delta is meaningless.
742  */
744  "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
745  lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
746 
747  /* Recommit of Url entry keeps dwExemptDelta */
748  U(*lpCacheEntryInfo).dwExemptDelta = 8600;
749  ret = SetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo,
751  ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
752 
753  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
754  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
756 
757  ret = CommitUrlCacheEntryA(test_url, filenameA1, filetime_zero, filetime_zero,
759  (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
760  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
761 
762  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
763  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
764  ok(U(*lpCacheEntryInfo).dwExemptDelta == 8600 || (ie10_cache && U(*lpCacheEntryInfo).dwExemptDelta == 86400),
765  "expected dwExemptDelta 8600, got %d\n", U(*lpCacheEntryInfo).dwExemptDelta);
766 
767  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
768 
769  if (pDeleteUrlCacheEntryA)
770  {
771  ret = pDeleteUrlCacheEntryA(test_url);
772  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
774  }
775 
776  /* Test if files with identical hash keys are handled correctly */
777  ret = CommitUrlCacheEntryA(test_hash_collisions1, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
778  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
779  ret = CommitUrlCacheEntryA(test_hash_collisions2, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
780  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
781 
782  cbCacheEntryInfo = 0;
783  ret = GetUrlCacheEntryInfoA(test_hash_collisions1, NULL, &cbCacheEntryInfo);
784  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
786  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
787  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
788  ret = GetUrlCacheEntryInfoA(test_hash_collisions1, lpCacheEntryInfo, &cbCacheEntryInfo);
789  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
790  ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_hash_collisions1),
791  "got incorrect entry: %s\n", lpCacheEntryInfo->lpszSourceUrlName);
792  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
793 
794  cbCacheEntryInfo = 0;
795  ret = GetUrlCacheEntryInfoA(test_hash_collisions2, NULL, &cbCacheEntryInfo);
796  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
798  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
799  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
800  ret = GetUrlCacheEntryInfoA(test_hash_collisions2, lpCacheEntryInfo, &cbCacheEntryInfo);
801  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
802  ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_hash_collisions2),
803  "got incorrect entry: %s\n", lpCacheEntryInfo->lpszSourceUrlName);
804  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
805 
806  if (pDeleteUrlCacheEntryA) {
807  ret = pDeleteUrlCacheEntryA(test_hash_collisions1);
808  ok(ret, "DeleteUrlCacheEntry failed: %d\n", GetLastError());
809  ret = pDeleteUrlCacheEntryA(test_hash_collisions2);
810  ok(ret, "DeleteUrlCacheEntry failed: %d\n", GetLastError());
811  }
812 
813  len = strlen(long_url);
814  memset(long_url+len, 'a', sizeof(long_url)-len);
815  long_url[sizeof(long_url)-1] = 0;
816  ret = CreateUrlCacheEntryA(long_url, 0, NULL, filenameA, 0);
817  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
820 
821  ret = CreateUrlCacheEntryA(long_url, 0, "extension", filenameA, 0);
822  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
825 
826  long_url[250] = 0;
827  ret = CreateUrlCacheEntryA(long_url, 0, NULL, filenameA, 0);
828  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
831 
832  ret = CreateUrlCacheEntryA(long_url, 0, "extension", filenameA, 0);
833  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
836 }
837 
838 static void test_urlcacheW(void)
839 {
840  static struct test_data
841  {
842  DWORD err;
843  WCHAR url[128];
844  char encoded_url[128];
845  WCHAR extension[32];
846  WCHAR header_info[128];
847  }urls[] = {
848  {
849  0, {'h','t','t','p',':','/','/','T','.','p','l','/','t',0},
850  "http://T.pl/t", {0}, {0}
851  },
852  {
853  0, {'w','w','w','.','T','.','p','l','/','t',0},
854  "www.T.pl/t", {0}, {0}
855  },
856  {
857  0, {'h','t','t','p',':','/','/','w','w','w','.','t','e','s','t',0x15b,0x107,
858  '.','o','r','g','/','t','e','s','t','.','h','t','m','l',0},
859  "http://www.xn--test-ota71c.org/test.html", {'t','x','t',0}, {0}
860  },
861  {
862  0, {'w','w','w','.','T','e','s','t',0x15b,0x107,'.','o','r','g',
863  '/','t','e','s','t','.','h','t','m','l',0},
864  "www.Test\xc5\x9b\xc4\x87.org/test.html", {'a',0x106,'a',0}, {'b',0x106,'b',0}
865  },
866  {
867  0, {'H','t','t','p','s',':','/','/',0x15b,0x15b,0x107,'/','t',0x107,'/',
868  't','e','s','t','?','a','=','%','2','0',0x106,0},
869  "Https://xn--4da1oa/t\xc4\x87/test?a=%20\xc4\x86", {'a',0x15b,'a',0}, {'b',0x15b,'b',0}
870  },
871  {
872  12005, {'h','t','t','p','s',':','/','/','/','/',0x107,'.','o','r','g','/','t','e','s','t',0},
873  "", {0}, {0}
874  },
875  {
876  0, {'C','o','o','k','i','e',':',' ','u','s','e','r','@','h','t','t','p',
877  ':','/','/','t',0x15b,0x107,'.','o','r','g','/',0},
878  "Cookie: user@http://t\xc5\x9b\xc4\x87.org/", {0}, {0}
879  }
880  };
881  static const FILETIME filetime_zero;
882 
883  WCHAR bufW[MAX_PATH];
884  DWORD i;
885  BOOL ret;
886 
887  if(old_ie) {
888  win_skip("urlcache unicode functions\n");
889  return;
890  }
891 
892  if(ie10_cache) {
893  if(!MultiByteToWideChar(CP_ACP, 0, urls[6].encoded_url, -1,
894  urls[6].url, sizeof(urls[6].url)/sizeof(WCHAR)))
895  urls[6].url[0] = 0;
896 
897  trace("converted url in test 6: %s\n", wine_dbgstr_w(urls[6].url));
898  }
899 
900  for(i=0; i<sizeof(urls)/sizeof(*urls); i++) {
901  INTERNET_CACHE_ENTRY_INFOA *entry_infoA;
902  INTERNET_CACHE_ENTRY_INFOW *entry_infoW;
903  DWORD size;
904 
905  if(!urls[i].url[0]) {
906  win_skip("No UTF16 version of url (%d)\n", i);
907  continue;
908  }
909 
910  SetLastError(0xdeadbeef);
911  ret = CreateUrlCacheEntryW(urls[i].url, 0, NULL, bufW, 0);
912  if(urls[i].err != 0) {
913  ok(!ret, "%d) CreateUrlCacheEntryW succeeded\n", i);
914  ok(urls[i].err == GetLastError(), "%d) GetLastError() = %d\n", i, GetLastError());
915  continue;
916  }
917  ok(ret, "%d) CreateUrlCacheEntryW failed: %d\n", i, GetLastError());
918 
919  /* dwHeaderSize is ignored, pass 0 to prove it */
920  ret = CommitUrlCacheEntryW(urls[i].url, bufW, filetime_zero, filetime_zero,
921  NORMAL_CACHE_ENTRY, urls[i].header_info, 0, urls[i].extension, NULL);
922  ok(ret, "%d) CommitUrlCacheEntryW failed: %d\n", i, GetLastError());
923 
924  SetLastError(0xdeadbeef);
925  size = 0;
926  ret = GetUrlCacheEntryInfoW(urls[i].url, NULL, &size);
928  "%d) GetLastError() = %d\n", i, GetLastError());
929  entry_infoW = HeapAlloc(GetProcessHeap(), 0, size);
930  ret = GetUrlCacheEntryInfoW(urls[i].url, entry_infoW, &size);
931  ok(ret, "%d) GetUrlCacheEntryInfoW failed: %d\n", i, GetLastError());
932 
933  ret = GetUrlCacheEntryInfoA(urls[i].encoded_url, NULL, &size);
935  "%d) GetLastError() = %d\n", i, GetLastError());
937  win_skip("ANSI version of url is incorrect\n");
938  continue;
939  }
940  entry_infoA = HeapAlloc(GetProcessHeap(), 0, size);
941  ret = GetUrlCacheEntryInfoA(urls[i].encoded_url, entry_infoA, &size);
942  ok(ret, "%d) GetUrlCacheEntryInfoA failed: %d\n", i, GetLastError());
943 
944  ok(entry_infoW->dwStructSize == entry_infoA->dwStructSize,
945  "%d) entry_infoW->dwStructSize = %d, expected %d\n",
946  i, entry_infoW->dwStructSize, entry_infoA->dwStructSize);
947  ok(!lstrcmpW(urls[i].url, entry_infoW->lpszSourceUrlName),
948  "%d) entry_infoW->lpszSourceUrlName = %s\n",
949  i, wine_dbgstr_w(entry_infoW->lpszSourceUrlName));
950  ok(!lstrcmpA(urls[i].encoded_url, entry_infoA->lpszSourceUrlName),
951  "%d) entry_infoA->lpszSourceUrlName = %s\n",
952  i, entry_infoA->lpszSourceUrlName);
953  ok(entry_infoW->CacheEntryType == entry_infoA->CacheEntryType,
954  "%d) entry_infoW->CacheEntryType = %x, expected %x\n",
955  i, entry_infoW->CacheEntryType, entry_infoA->CacheEntryType);
956  ok(entry_infoW->dwUseCount == entry_infoA->dwUseCount,
957  "%d) entry_infoW->dwUseCount = %d, expected %d\n",
958  i, entry_infoW->dwUseCount, entry_infoA->dwUseCount);
959  ok(entry_infoW->dwHitRate == entry_infoA->dwHitRate,
960  "%d) entry_infoW->dwHitRate = %d, expected %d\n",
961  i, entry_infoW->dwHitRate, entry_infoA->dwHitRate);
962  ok(entry_infoW->dwSizeLow == entry_infoA->dwSizeLow,
963  "%d) entry_infoW->dwSizeLow = %d, expected %d\n",
964  i, entry_infoW->dwSizeLow, entry_infoA->dwSizeLow);
965  ok(entry_infoW->dwSizeHigh == entry_infoA->dwSizeHigh,
966  "%d) entry_infoW->dwSizeHigh = %d, expected %d\n",
967  i, entry_infoW->dwSizeHigh, entry_infoA->dwSizeHigh);
968  ok(!memcmp(&entry_infoW->LastModifiedTime, &entry_infoA->LastModifiedTime, sizeof(FILETIME)),
969  "%d) entry_infoW->LastModifiedTime is incorrect\n", i);
970  ok(!memcmp(&entry_infoW->ExpireTime, &entry_infoA->ExpireTime, sizeof(FILETIME)),
971  "%d) entry_infoW->ExpireTime is incorrect\n", i);
972  ok(!memcmp(&entry_infoW->LastAccessTime, &entry_infoA->LastAccessTime, sizeof(FILETIME)),
973  "%d) entry_infoW->LastAccessTime is incorrect\n", i);
974  ok(!memcmp(&entry_infoW->LastSyncTime, &entry_infoA->LastSyncTime, sizeof(FILETIME)),
975  "%d) entry_infoW->LastSyncTime is incorrect\n", i);
976 
977  MultiByteToWideChar(CP_ACP, 0, entry_infoA->lpszLocalFileName, -1, bufW, MAX_PATH);
978  ok(!lstrcmpW(entry_infoW->lpszLocalFileName, bufW),
979  "%d) entry_infoW->lpszLocalFileName = %s, expected %s\n",
980  i, wine_dbgstr_w(entry_infoW->lpszLocalFileName), wine_dbgstr_w(bufW));
981 
982  if(!urls[i].header_info[0]) {
983  ok(!entry_infoW->lpHeaderInfo, "entry_infoW->lpHeaderInfo != NULL\n");
984  }else {
985  ok(!lstrcmpW((WCHAR*)entry_infoW->lpHeaderInfo, urls[i].header_info),
986  "%d) entry_infoW->lpHeaderInfo = %s\n",
987  i, wine_dbgstr_w((WCHAR*)entry_infoW->lpHeaderInfo));
988  }
989 
990  if(!urls[i].extension[0]) {
991  ok(!entry_infoW->lpszFileExtension || (ie10_cache && !entry_infoW->lpszFileExtension[0]),
992  "%d) entry_infoW->lpszFileExtension = %s\n",
993  i, wine_dbgstr_w(entry_infoW->lpszFileExtension));
994  }else {
995  MultiByteToWideChar(CP_ACP, 0, entry_infoA->lpszFileExtension, -1, bufW, MAX_PATH);
996  ok(!lstrcmpW(entry_infoW->lpszFileExtension, bufW) ||
997  (ie10_cache && !lstrcmpW(entry_infoW->lpszFileExtension, urls[i].extension)),
998  "%d) entry_infoW->lpszFileExtension = %s, expected %s\n",
999  i, wine_dbgstr_w(entry_infoW->lpszFileExtension), wine_dbgstr_w(bufW));
1000  }
1001 
1002  HeapFree(GetProcessHeap(), 0, entry_infoW);
1003  HeapFree(GetProcessHeap(), 0, entry_infoA);
1004 
1005  if(pDeleteUrlCacheEntryA) {
1006  ret = pDeleteUrlCacheEntryA(urls[i].encoded_url);
1007  ok(ret, "%d) DeleteUrlCacheEntryW failed: %d\n", i, GetLastError());
1008  }
1009  }
1010 }
1011 
1012 static void test_FindCloseUrlCache(void)
1013 {
1014  BOOL r;
1015  DWORD err;
1016 
1017  SetLastError(0xdeadbeef);
1019  err = GetLastError();
1020  ok(0 == r, "expected 0, got %d\n", r);
1021  ok(ERROR_INVALID_HANDLE == err, "expected %d, got %d\n", ERROR_INVALID_HANDLE, err);
1022 }
1023 
1024 static void test_GetDiskInfoA(void)
1025 {
1026  BOOL ret;
1028  DWORDLONG free, total;
1029  char path[MAX_PATH], *p;
1030 
1032  if ((p = strchr(path, '\\'))) *++p = 0;
1033 
1034  ret = GetDiskInfoA(path, &cluster_size, &free, &total);
1035  ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1036 
1038  ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1039 
1041  ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1042 
1044  ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1045 
1046  SetLastError(0xdeadbeef);
1047  strcpy(p, "\\non\\existing\\path");
1049  error = GetLastError();
1050  ok(!ret ||
1051  broken(old_ie && ret), /* < IE7 */
1052  "GetDiskInfoA succeeded\n");
1054  broken(old_ie && error == 0xdeadbeef), /* < IE7 */
1055  "got %u expected ERROR_PATH_NOT_FOUND\n", error);
1056 
1057  SetLastError(0xdeadbeef);
1059  error = GetLastError();
1060  ok(!ret, "GetDiskInfoA succeeded\n");
1061  ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", error);
1062 }
1063 
1064 static BOOL cache_entry_exists(const char *url)
1065 {
1066  static char buf[10000];
1067  DWORD size = sizeof(buf);
1068  BOOL ret;
1069 
1070  ret = GetUrlCacheEntryInfoA(url, (void*)buf, &size);
1071  ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND, "GetUrlCacheEntryInfoA returned %x (%u)\n", ret, GetLastError());
1072 
1073  return ret;
1074 }
1075 
1076 static void test_trailing_slash(void)
1077 {
1078  char filename[MAX_PATH];
1079  BYTE zero_byte = 0;
1080  BOOL ret;
1081 
1082  static const FILETIME filetime_zero;
1083  static char url_with_slash[] = "http://testing.cache.com/";
1084 
1085 
1086  ret = CreateUrlCacheEntryA(url_with_slash, 0, "html", filename, 0);
1087  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
1088 
1090 
1091  ret = CommitUrlCacheEntryA("Visited: http://testing.cache.com/", NULL, filetime_zero, filetime_zero,
1092  NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
1093  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
1094 
1095  ok(cache_entry_exists("Visited: http://testing.cache.com/"), "cache entry does not exist\n");
1096  ok(!cache_entry_exists("Visited: http://testing.cache.com"), "cache entry exists\n");
1097 
1098  ret = DeleteUrlCacheEntryA("Visited: http://testing.cache.com/");
1099  ok(ret, "DeleteCacheEntryA failed\n");
1101 }
1102 
1103 START_TEST(urlcache)
1104 {
1105  HMODULE hdll;
1106  hdll = GetModuleHandleA("wininet.dll");
1107 
1108  if(!GetProcAddress(hdll, "InternetGetCookieExW")) {
1109  win_skip("Too old IE (older than 6.0)\n");
1110  return;
1111  }
1112  if(!GetProcAddress(hdll, "InternetGetSecurityInfoByURL")) /* < IE7 */
1113  old_ie = TRUE;
1114 
1115  if(GetProcAddress(hdll, "CreateUrlCacheEntryExW")) {
1116  trace("Running tests on IE10 or newer\n");
1117  ie10_cache = TRUE;
1118  }
1119 
1120  pDeleteUrlCacheEntryA = (void*)GetProcAddress(hdll, "DeleteUrlCacheEntryA");
1121  pUnlockUrlCacheEntryFileA = (void*)GetProcAddress(hdll, "UnlockUrlCacheEntryFileA");
1122  test_urlcacheA();
1123  test_urlcacheW();
1127 }
BOOL WINAPI CreateUrlCacheEntryW(LPCWSTR lpszUrlName, DWORD dwExpectedFileSize, LPCWSTR lpszFileExtension, LPWSTR lpszFileName, DWORD dwReserved)
Definition: urlcache.c:2826
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static DWORD
Definition: urlcache.c:41
#define CACHE_ENTRY_EXPTIME_FC
Definition: wininet.h:2295
static const WCHAR test_urlW[]
Definition: urlcache.c:34
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define trace(...)
Definition: kmt_test.h:217
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define TRUE
Definition: types.h:120
#define CACHE_ENTRY_MODTIME_FC
Definition: wininet.h:2294
#define CloseHandle
Definition: compat.h:398
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
static void test_RetrieveUrlCacheEntryA(void)
Definition: urlcache.c:180
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
static char filenameA1[MAX_PATH+1]
Definition: urlcache.c:44
static void check_cache_entry_infoA(const char *returnedfrom, INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo)
Definition: urlcache.c:48
#define error(str)
Definition: mkdosfs.c:1605
static void _check_file_not_exists(LONG l, LPCSTR filename)
Definition: urlcache.c:333
DWORD dwStructSize
Definition: wininet.h:2104
#define ok_(x1, x2)
BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName)
Definition: urlcache.c:3309
BOOL WINAPI FindNextUrlCacheEntryA(HANDLE hEnumHandle, LPINTERNET_CACHE_ENTRY_INFOA lpNextCacheEntryInfo, LPDWORD lpdwNextCacheEntryInfoBufferSize)
Definition: urlcache.c:3640
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void test_find_url_cache_entriesA(void)
Definition: urlcache.c:56
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static BOOL(WINAPI *pDeleteUrlCacheEntryA)(LPCSTR)
#define free
Definition: debug_ros.c:5
#define U(x)
Definition: wordpad.c:44
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define wine_dbgstr_w
Definition: kernel32.h:34
struct _INTERNET_CACHE_ENTRY_INFOA INTERNET_CACHE_ENTRY_INFOA
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2282
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static void test_trailing_slash(void)
Definition: urlcache.c:1076
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
BOOL WINAPI GetUrlCacheEntryInfoExA(LPCSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufSize, LPSTR lpszReserved, LPDWORD lpdwReserved, LPVOID lpReserved, DWORD dwFlags)
Definition: urlcache.c:1878
static void test_urlcacheW(void)
Definition: urlcache.c:838
const char * filename
Definition: ioapi.h:135
DWORD dwSizeLow
Definition: wininet.h:2110
DWORD dwHitRate
Definition: wininet.h:2132
#define FILE_SHARE_READ
Definition: compat.h:125
struct _test_info info[]
Definition: SetCursorPos.c:19
LPWSTR lpszFileExtension
Definition: wininet.h:2142
static void create_and_write_file(LPCSTR filename, void *data, DWORD len)
Definition: urlcache.c:347
DWORD dwHighDateTime
Definition: mapidefs.h:66
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
LPBYTE lpHeaderInfo
Definition: wininet.h:2140
unsigned char * LPBYTE
Definition: typedefs.h:52
static void _check_file_exists(LONG l, LPCSTR filename)
Definition: urlcache.c:319
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define STICKY_CACHE_ENTRY
Definition: wininet.h:2087
Definition: wininet.h:2103
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
time_t now
Definition: finger.c:65
#define URLHISTORY_CACHE_ENTRY
Definition: wininet.h:2090
#define GENERIC_WRITE
Definition: nt_native.h:90
#define ok(value,...)
__u8 cluster_size
Definition: mkdosfs.c:362
static const char test_url1[]
Definition: urlcache.c:36
FILETIME ExpireTime
Definition: wininet.h:2113
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static int zero_byte(mpg123_handle *fr)
Definition: libmpg123.c:694
#define CACHE_ENTRY_ATTRIBUTE_FC
Definition: wininet.h:2292
DWORD CacheEntryType
Definition: wininet.h:2107
DWORD dwHitRate
Definition: wininet.h:2109
BOOL WINAPI CreateUrlCacheEntryA(LPCSTR lpszUrlName, DWORD dwExpectedFileSize, LPCSTR lpszFileExtension, LPSTR lpszFileName, DWORD dwReserved)
Definition: urlcache.c:2807
const char * LPCSTR
Definition: xmlstorage.h:183
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define OPEN_EXISTING
Definition: compat.h:426
LPSTR lpszSourceUrlName
Definition: wininet.h:2105
START_TEST(urlcache)
Definition: urlcache.c:1103
#define NORMAL_CACHE_ENTRY
Definition: wininet.h:2086
r l[0]
Definition: byte_order.h:167
struct _ULARGE_INTEGER::@3737 u
static void test_GetDiskInfoA(void)
Definition: urlcache.c:1024
static BOOL ie10_cache
Definition: urlcache.c:46
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI CommitUrlCacheEntryW(LPCWSTR lpszUrlName, LPCWSTR lpszLocalFileName, FILETIME ExpireTime, FILETIME LastModifiedTime, DWORD CacheEntryType, LPWSTR lpHeaderInfo, DWORD dwHeaderSize, LPCWSTR lpszFileExtension, LPCWSTR lpszOriginalUrl)
Definition: urlcache.c:3096
FILETIME LastAccessTime
Definition: wininet.h:2137
FILETIME ExpireTime
Definition: wininet.h:2136
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR url[]
Definition: encode.c:1432
BOOL WINAPI GetUrlCacheEntryInfoExW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufSize, LPWSTR lpszReserved, LPDWORD lpdwReserved, LPVOID lpReserved, DWORD dwFlags)
Definition: urlcache.c:1991
uint64_t ULONGLONG
Definition: typedefs.h:65
BOOL WINAPI FindCloseUrlCache(HANDLE hEnumHandle)
Definition: urlcache.c:3670
LPWSTR lpszLocalFileName
Definition: wininet.h:2129
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
const char file[]
Definition: icontest.c:11
DWORD dwStructSize
Definition: wininet.h:2127
unsigned long DWORD
Definition: ntddk_ex.h:95
static void test_urlcacheA(void)
Definition: urlcache.c:364
LPWSTR lpszSourceUrlName
Definition: wininet.h:2128
BOOL WINAPI GetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize)
Definition: urlcache.c:2021
#define SetLastError(x)
Definition: compat.h:409
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPSTR lpszLocalFileName
Definition: wininet.h:2106
BOOL WINAPI GetUrlCacheEntryInfoA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize)
Definition: urlcache.c:1897
FILETIME LastModifiedTime
Definition: wininet.h:2112
DWORD dwUseCount
Definition: wininet.h:2131
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
BOOL WINAPI IsUrlCacheEntryExpiredA(LPCSTR url, DWORD dwFlags, FILETIME *pftLastModified)
Definition: urlcache.c:3902
DWORD dwSizeHigh
Definition: wininet.h:2111
static void test_IsUrlCacheEntryExpiredA(void)
Definition: urlcache.c:207
GLenum GLsizei len
Definition: glext.h:6722
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
unsigned char BYTE
Definition: mem.h:68
#define GENERIC_READ
Definition: compat.h:124
INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR lpszUrlSearchPattern, LPINTERNET_CACHE_ENTRY_INFOA lpFirstCacheEntryInfo, LPDWORD lpdwFirstCacheEntryInfoBufferSize)
Definition: urlcache.c:3480
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135
#define err(...)
DWORD dwUseCount
Definition: wininet.h:2108
FILETIME LastModifiedTime
Definition: wininet.h:2135
_In_ HANDLE hFile
Definition: mswsock.h:90
#define broken(x)
Definition: _sntprintf.h:21
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define COOKIE_CACHE_ENTRY
Definition: wininet.h:2089
#define CREATE_ALWAYS
Definition: disk.h:72
#define CACHE_ENTRY_EXEMPT_DELTA_FC
Definition: wininet.h:2299
FILETIME LastSyncTime
Definition: wininet.h:2115
#define HeapReAlloc
Definition: compat.h:393
BOOL WINAPI CommitUrlCacheEntryA(LPCSTR lpszUrlName, LPCSTR lpszLocalFileName, FILETIME ExpireTime, FILETIME LastModifiedTime, DWORD CacheEntryType, LPBYTE lpHeaderInfo, DWORD dwHeaderSize, LPCSTR lpszFileExtension, LPCSTR lpszOriginalUrl)
Definition: urlcache.c:3074
Definition: services.c:325
FILETIME LastSyncTime
Definition: wininet.h:2138
static PVOID hdll
Definition: shimdbg.c:126
BOOL WINAPI SetUrlCacheEntryInfoA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, DWORD dwFieldControl)
Definition: urlcache.c:2032
DWORD dwSizeHigh
Definition: wininet.h:2134
#define MultiByteToWideChar
Definition: compat.h:100
char * strchr(const char *String, int ch)
Definition: utclib.c:501
static const char test_hash_collisions2[]
Definition: urlcache.c:38
static void test_FindCloseUrlCache(void)
Definition: urlcache.c:1012
unsigned long long DWORDLONG
Definition: intsafe.h:99
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static BOOL old_ie
Definition: urlcache.c:45
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
DWORD dwSizeLow
Definition: wininet.h:2133
#define GetProcAddress(x, y)
Definition: compat.h:410
FILETIME LastAccessTime
Definition: wininet.h:2114
static const char test_hash_collisions1[]
Definition: urlcache.c:37
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
BOOL WINAPI GetDiskInfoA(PCSTR path, PDWORD cluster_size, PDWORDLONG free, PDWORDLONG total)
Definition: urlcache.c:3986
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
GLfloat GLfloat p
Definition: glext.h:8902
DWORD dwHeaderInfoSize
Definition: wininet.h:2118
#define memset(x, y, z)
Definition: compat.h:39
DWORD CacheEntryType
Definition: wininet.h:2130
#define win_skip
Definition: test.h:141
#define check_file_exists(f)
Definition: urlcache.c:331
static BOOL cache_entry_exists(const char *url)
Definition: urlcache.c:1064
#define HeapFree(x, y, z)
Definition: compat.h:394
BOOL WINAPI RetrieveUrlCacheEntryFileA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize, DWORD dwReserved)
Definition: urlcache.c:2182
DWORD dwLowDateTime
Definition: mapidefs.h:65
LPSTR lpszFileExtension
Definition: wininet.h:2119
#define check_file_not_exists(f)
Definition: urlcache.c:345
static void test_GetUrlCacheEntryInfoExA(void)
Definition: urlcache.c:105
static const char test_url[]
Definition: urlcache.c:33
Definition: fci.c:126
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
static char filenameA[MAX_PATH+1]
Definition: urlcache.c:43
Definition: wininet.h:2126