4 * Copyright 2008 Robert Shearman for CodeWeavers
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.
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.
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
30 #include "wine/test.h"
32 #define TEST_URL "http://urlcachetest.winehq.org/index.html"
33 #define TEST_URL1 "Visited: user@http://urlcachetest.winehq.org/index.html"
35 static BOOL (WINAPI
*pDeleteUrlCacheEntryA
)(LPCSTR
);
36 static BOOL (WINAPI
*pUnlockUrlCacheEntryFileA
)(LPCSTR
,DWORD
);
38 static char filenameA
[MAX_PATH
+ 1];
39 static char filenameA1
[MAX_PATH
+ 1];
41 static void check_cache_entry_infoA(const char *returnedfrom
, LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo
)
43 ok(lpCacheEntryInfo
->dwStructSize
== sizeof(*lpCacheEntryInfo
), "%s: dwStructSize was %d\n", returnedfrom
, lpCacheEntryInfo
->dwStructSize
);
44 ok(!strcmp(lpCacheEntryInfo
->lpszSourceUrlName
, TEST_URL
), "%s: lpszSourceUrlName should be %s instead of %s\n", returnedfrom
, TEST_URL
, lpCacheEntryInfo
->lpszSourceUrlName
);
45 ok(!strcmp(lpCacheEntryInfo
->lpszLocalFileName
, filenameA
), "%s: lpszLocalFileName should be %s instead of %s\n", returnedfrom
, filenameA
, lpCacheEntryInfo
->lpszLocalFileName
);
46 ok(!strcmp(lpCacheEntryInfo
->lpszFileExtension
, "html"), "%s: lpszFileExtension should be html instead of %s\n", returnedfrom
, lpCacheEntryInfo
->lpszFileExtension
);
49 static void test_find_url_cache_entriesA(void)
54 DWORD cbCacheEntryInfo
;
55 DWORD cbCacheEntryInfoSaved
;
56 LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo
;
59 SetLastError(0xdeadbeef);
60 hEnumHandle
= FindFirstUrlCacheEntry(NULL
, NULL
, &cbCacheEntryInfo
);
61 ok(!hEnumHandle
, "FindFirstUrlCacheEntry should have failed\n");
62 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
, "FindFirstUrlCacheEntry should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
63 lpCacheEntryInfo
= HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo
* sizeof(char));
64 cbCacheEntryInfoSaved
= cbCacheEntryInfo
;
65 hEnumHandle
= FindFirstUrlCacheEntry(NULL
, lpCacheEntryInfo
, &cbCacheEntryInfo
);
66 ok(hEnumHandle
!= NULL
, "FindFirstUrlCacheEntry failed with error %d\n", GetLastError());
69 if (!strcmp(lpCacheEntryInfo
->lpszSourceUrlName
, TEST_URL
))
75 SetLastError(0xdeadbeef);
76 cbCacheEntryInfo
= cbCacheEntryInfoSaved
;
77 ret
= FindNextUrlCacheEntry(hEnumHandle
, lpCacheEntryInfo
, &cbCacheEntryInfo
);
80 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER
)
82 lpCacheEntryInfo
= HeapReAlloc(GetProcessHeap(), 0, lpCacheEntryInfo
, cbCacheEntryInfo
);
83 cbCacheEntryInfoSaved
= cbCacheEntryInfo
;
84 ret
= FindNextUrlCacheEntry(hEnumHandle
, lpCacheEntryInfo
, &cbCacheEntryInfo
);
90 ok(ret
, "FindNextUrlCacheEntry failed with error %d\n", GetLastError());
91 ok(found
, "Committed url cache entry not found during enumeration\n");
93 ret
= FindCloseUrlCache(hEnumHandle
);
94 ok(ret
, "FindCloseUrlCache failed with error %d\n", GetLastError());
97 static void test_GetUrlCacheEntryInfoExA(void)
100 DWORD cbCacheEntryInfo
, cbRedirectUrl
;
101 LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo
;
103 SetLastError(0xdeadbeef);
104 ret
= GetUrlCacheEntryInfoEx(NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, 0);
105 ok(!ret
, "GetUrlCacheEntryInfoEx with NULL URL and NULL args should have failed\n");
106 ok(GetLastError() == ERROR_INVALID_PARAMETER
,
107 "GetUrlCacheEntryInfoEx with NULL URL and NULL args should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
109 cbCacheEntryInfo
= sizeof(INTERNET_CACHE_ENTRY_INFO
);
110 SetLastError(0xdeadbeef);
111 ret
= GetUrlCacheEntryInfoEx("", NULL
, &cbCacheEntryInfo
, NULL
, NULL
, NULL
, 0);
112 ok(!ret
, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
113 ok(GetLastError() == ERROR_FILE_NOT_FOUND
,
114 "GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %d\n", GetLastError());
116 ret
= GetUrlCacheEntryInfoEx(TEST_URL
, NULL
, NULL
, NULL
, NULL
, NULL
, 0);
117 ok(ret
, "GetUrlCacheEntryInfoEx with NULL args failed with error %d\n", GetLastError());
119 cbCacheEntryInfo
= 0;
120 SetLastError(0xdeadbeef);
121 ret
= GetUrlCacheEntryInfoEx(TEST_URL
, NULL
, &cbCacheEntryInfo
, NULL
, NULL
, NULL
, 0);
122 ok(!ret
, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
123 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
,
124 "GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
126 lpCacheEntryInfo
= HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo
);
128 SetLastError(0xdeadbeef);
129 ret
= GetUrlCacheEntryInfoEx(TEST_URL
, lpCacheEntryInfo
, &cbCacheEntryInfo
, NULL
, NULL
, NULL
, 0x200);
130 ok(!ret
, "GetUrlCacheEntryInfoEx succeeded\n");
131 ok(GetLastError() == ERROR_FILE_NOT_FOUND
,
132 "GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %d\n", GetLastError());
134 ret
= GetUrlCacheEntryInfoEx(TEST_URL
, lpCacheEntryInfo
, &cbCacheEntryInfo
, NULL
, NULL
, NULL
, 0);
135 ok(ret
, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
137 if (ret
) check_cache_entry_infoA("GetUrlCacheEntryInfoEx", lpCacheEntryInfo
);
139 cbCacheEntryInfo
= 100000;
140 SetLastError(0xdeadbeef);
141 ret
= GetUrlCacheEntryInfoEx(TEST_URL
, NULL
, &cbCacheEntryInfo
, NULL
, NULL
, NULL
, 0);
142 ok(!ret
, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
143 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
, "GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
145 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo
);
147 /* Querying the redirect URL fails with ERROR_INVALID_PARAMETER */
148 SetLastError(0xdeadbeef);
149 ret
= GetUrlCacheEntryInfoEx(TEST_URL
, NULL
, NULL
, NULL
, &cbRedirectUrl
, NULL
, 0);
150 ok(!ret
, "GetUrlCacheEntryInfoEx should have failed\n");
151 ok(GetLastError() == ERROR_INVALID_PARAMETER
,
152 "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
153 SetLastError(0xdeadbeef);
154 ret
= GetUrlCacheEntryInfoEx(TEST_URL
, NULL
, &cbCacheEntryInfo
, NULL
, &cbRedirectUrl
, NULL
, 0);
155 ok(!ret
, "GetUrlCacheEntryInfoEx should have failed\n");
156 ok(GetLastError() == ERROR_INVALID_PARAMETER
,
157 "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
160 static void test_RetrieveUrlCacheEntryA(void)
163 DWORD cbCacheEntryInfo
;
165 cbCacheEntryInfo
= 0;
166 SetLastError(0xdeadbeef);
167 ret
= RetrieveUrlCacheEntryFile(NULL
, NULL
, &cbCacheEntryInfo
, 0);
168 ok(!ret
, "RetrieveUrlCacheEntryFile should have failed\n");
169 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
173 /* Crashes on Win9x, NT4 and W2K */
174 SetLastError(0xdeadbeef);
175 ret
= RetrieveUrlCacheEntryFile(TEST_URL
, NULL
, NULL
, 0);
176 ok(!ret
, "RetrieveUrlCacheEntryFile should have failed\n");
177 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
180 SetLastError(0xdeadbeef);
181 cbCacheEntryInfo
= 100000;
182 ret
= RetrieveUrlCacheEntryFile(NULL
, NULL
, &cbCacheEntryInfo
, 0);
183 ok(!ret
, "RetrieveUrlCacheEntryFile should have failed\n");
184 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
187 static void test_IsUrlCacheEntryExpiredA(void)
189 static const char uncached_url
[] =
190 "What's the airspeed velocity of an unladen swallow?";
194 LPINTERNET_CACHE_ENTRY_INFO info
;
195 ULARGE_INTEGER exp_time
;
197 /* The function returns TRUE when the output time is NULL or the tested URL
200 ret
= IsUrlCacheEntryExpiredA(NULL
, 0, NULL
);
201 ok(ret
, "expected TRUE\n");
202 ft
.dwLowDateTime
= 0xdeadbeef;
203 ft
.dwHighDateTime
= 0xbaadf00d;
204 ret
= IsUrlCacheEntryExpiredA(NULL
, 0, &ft
);
205 ok(ret
, "expected TRUE\n");
206 ok(ft
.dwLowDateTime
== 0xdeadbeef && ft
.dwHighDateTime
== 0xbaadf00d,
207 "expected time to be unchanged, got (%u,%u)\n",
208 ft
.dwLowDateTime
, ft
.dwHighDateTime
);
209 ret
= IsUrlCacheEntryExpiredA(TEST_URL
, 0, NULL
);
210 ok(ret
, "expected TRUE\n");
212 /* The return value should indicate whether the URL is expired,
213 * and the filetime indicates the last modified time, but a cache entry
214 * with a zero expire time is "not expired".
216 ft
.dwLowDateTime
= 0xdeadbeef;
217 ft
.dwHighDateTime
= 0xbaadf00d;
218 ret
= IsUrlCacheEntryExpiredA(TEST_URL
, 0, &ft
);
219 ok(!ret
, "expected FALSE\n");
220 ok(!ft
.dwLowDateTime
&& !ft
.dwHighDateTime
,
221 "expected time (0,0), got (%u,%u)\n",
222 ft
.dwLowDateTime
, ft
.dwHighDateTime
);
224 /* Same behavior with bogus flags. */
225 ft
.dwLowDateTime
= 0xdeadbeef;
226 ft
.dwHighDateTime
= 0xbaadf00d;
227 ret
= IsUrlCacheEntryExpiredA(TEST_URL
, 0xffffffff, &ft
);
228 ok(!ret
, "expected FALSE\n");
229 ok(!ft
.dwLowDateTime
&& !ft
.dwHighDateTime
,
230 "expected time (0,0), got (%u,%u)\n",
231 ft
.dwLowDateTime
, ft
.dwHighDateTime
);
233 /* Set the expire time to a point in the past.. */
234 ret
= GetUrlCacheEntryInfo(TEST_URL
, NULL
, &size
);
235 ok(!ret
, "GetUrlCacheEntryInfo should have failed\n");
236 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
,
237 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
238 info
= HeapAlloc(GetProcessHeap(), 0, size
);
239 ret
= GetUrlCacheEntryInfo(TEST_URL
, info
, &size
);
240 ok(ret
, "GetUrlCacheEntryInfo failed: %d\n", GetLastError());
241 GetSystemTimeAsFileTime(&info
->ExpireTime
);
242 exp_time
.u
.LowPart
= info
->ExpireTime
.dwLowDateTime
;
243 exp_time
.u
.HighPart
= info
->ExpireTime
.dwHighDateTime
;
244 exp_time
.QuadPart
-= 10 * 60 * (ULONGLONG
)10000000;
245 info
->ExpireTime
.dwLowDateTime
= exp_time
.u
.LowPart
;
246 info
->ExpireTime
.dwHighDateTime
= exp_time
.u
.HighPart
;
247 ret
= SetUrlCacheEntryInfo(TEST_URL
, info
, CACHE_ENTRY_EXPTIME_FC
);
248 ok(ret
, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
249 ft
.dwLowDateTime
= 0xdeadbeef;
250 ft
.dwHighDateTime
= 0xbaadf00d;
251 /* and the entry should be expired. */
252 ret
= IsUrlCacheEntryExpiredA(TEST_URL
, 0, &ft
);
253 ok(ret
, "expected TRUE\n");
254 /* The modified time returned is 0. */
255 ok(!ft
.dwLowDateTime
&& !ft
.dwHighDateTime
,
256 "expected time (0,0), got (%u,%u)\n",
257 ft
.dwLowDateTime
, ft
.dwHighDateTime
);
258 /* Set the expire time to a point in the future.. */
259 exp_time
.QuadPart
+= 20 * 60 * (ULONGLONG
)10000000;
260 info
->ExpireTime
.dwLowDateTime
= exp_time
.u
.LowPart
;
261 info
->ExpireTime
.dwHighDateTime
= exp_time
.u
.HighPart
;
262 ret
= SetUrlCacheEntryInfo(TEST_URL
, info
, CACHE_ENTRY_EXPTIME_FC
);
263 ok(ret
, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
264 ft
.dwLowDateTime
= 0xdeadbeef;
265 ft
.dwHighDateTime
= 0xbaadf00d;
266 /* and the entry should no longer be expired. */
267 ret
= IsUrlCacheEntryExpiredA(TEST_URL
, 0, &ft
);
268 ok(!ret
, "expected FALSE\n");
269 /* The modified time returned is still 0. */
270 ok(!ft
.dwLowDateTime
&& !ft
.dwHighDateTime
,
271 "expected time (0,0), got (%u,%u)\n",
272 ft
.dwLowDateTime
, ft
.dwHighDateTime
);
273 /* Set the modified time... */
274 GetSystemTimeAsFileTime(&info
->LastModifiedTime
);
275 ret
= SetUrlCacheEntryInfo(TEST_URL
, info
, CACHE_ENTRY_MODTIME_FC
);
276 ok(ret
, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
277 /* and the entry should still be unexpired.. */
278 ret
= IsUrlCacheEntryExpiredA(TEST_URL
, 0, &ft
);
279 ok(!ret
, "expected FALSE\n");
280 /* but the modified time returned is the last modified time just set. */
281 ok(ft
.dwLowDateTime
== info
->LastModifiedTime
.dwLowDateTime
&&
282 ft
.dwHighDateTime
== info
->LastModifiedTime
.dwHighDateTime
,
283 "expected time (%u,%u), got (%u,%u)\n",
284 info
->LastModifiedTime
.dwLowDateTime
,
285 info
->LastModifiedTime
.dwHighDateTime
,
286 ft
.dwLowDateTime
, ft
.dwHighDateTime
);
287 HeapFree(GetProcessHeap(), 0, info
);
289 /* An uncached URL is implicitly expired, but with unknown time. */
290 ft
.dwLowDateTime
= 0xdeadbeef;
291 ft
.dwHighDateTime
= 0xbaadf00d;
292 ret
= IsUrlCacheEntryExpiredA(uncached_url
, 0, &ft
);
293 ok(ret
, "expected TRUE\n");
294 ok(!ft
.dwLowDateTime
&& !ft
.dwHighDateTime
,
295 "expected time (0,0), got (%u,%u)\n",
296 ft
.dwLowDateTime
, ft
.dwHighDateTime
);
299 static void _check_file_exists(LONG l
, LPCSTR filename
)
303 file
= CreateFileA(filename
, GENERIC_READ
, FILE_SHARE_READ
|FILE_SHARE_WRITE
,
304 NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
305 ok_(__FILE__
,l
)(file
!= INVALID_HANDLE_VALUE
,
306 "expected file to exist, CreateFile failed with error %d\n",
311 #define check_file_exists(f) _check_file_exists(__LINE__, f)
313 static void _check_file_not_exists(LONG l
, LPCSTR filename
)
317 file
= CreateFileA(filename
, GENERIC_READ
, FILE_SHARE_READ
|FILE_SHARE_WRITE
,
318 NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
319 ok_(__FILE__
,l
)(file
== INVALID_HANDLE_VALUE
,
320 "expected file not to exist\n");
321 if (file
!= INVALID_HANDLE_VALUE
)
325 #define check_file_not_exists(f) _check_file_not_exists(__LINE__, f)
327 static void create_and_write_file(LPCSTR filename
, void *data
, DWORD len
)
333 file
= CreateFileA(filename
, GENERIC_WRITE
,
334 FILE_SHARE_READ
|FILE_SHARE_WRITE
, NULL
, CREATE_ALWAYS
,
335 FILE_ATTRIBUTE_NORMAL
, NULL
);
336 ok(file
!= INVALID_HANDLE_VALUE
, "CreateFileA failed with error %d\n", GetLastError());
338 ret
= WriteFile(file
, data
, len
, &written
, NULL
);
339 ok(ret
, "WriteFile failed with error %d\n", GetLastError());
344 static void test_urlcacheA(void)
346 static char ok_header
[] = "HTTP/1.0 200 OK\r\n\r\n";
350 LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo
;
351 LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo2
;
352 DWORD cbCacheEntryInfo
;
353 static const FILETIME filetime_zero
;
356 ret
= CreateUrlCacheEntry(TEST_URL
, 0, "html", filenameA
, 0);
357 ok(ret
, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
359 ret
= CreateUrlCacheEntry(TEST_URL
, 0, "html", filenameA1
, 0);
360 ok(ret
, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
362 ok(lstrcmpiA(filenameA
, filenameA1
), "expected a different file name\n");
364 create_and_write_file(filenameA
, &zero_byte
, sizeof(zero_byte
));
366 ret
= CommitUrlCacheEntry(TEST_URL1
, NULL
, filetime_zero
, filetime_zero
, NORMAL_CACHE_ENTRY
|URLHISTORY_CACHE_ENTRY
, NULL
, 0, "html", NULL
);
367 ok(ret
, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
368 cbCacheEntryInfo
= 0;
369 ret
= GetUrlCacheEntryInfo(TEST_URL1
, NULL
, &cbCacheEntryInfo
);
370 ok(!ret
, "GetUrlCacheEntryInfo should have failed\n");
371 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
,
372 "GetUrlCacheEntryInfo should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
373 lpCacheEntryInfo
= HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo
);
374 ret
= GetUrlCacheEntryInfo(TEST_URL1
, lpCacheEntryInfo
, &cbCacheEntryInfo
);
375 ok(ret
, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
376 ok(!memcmp(&lpCacheEntryInfo
->ExpireTime
, &filetime_zero
, sizeof(FILETIME
)),
377 "expected zero ExpireTime\n");
378 ok(!memcmp(&lpCacheEntryInfo
->LastModifiedTime
, &filetime_zero
, sizeof(FILETIME
)),
379 "expected zero LastModifiedTime\n");
380 ok(lpCacheEntryInfo
->CacheEntryType
== (NORMAL_CACHE_ENTRY
|URLHISTORY_CACHE_ENTRY
) ||
381 broken(lpCacheEntryInfo
->CacheEntryType
== NORMAL_CACHE_ENTRY
/* NT4/W2k */),
382 "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x\n",
383 lpCacheEntryInfo
->CacheEntryType
);
384 ok(!U(*lpCacheEntryInfo
).dwExemptDelta
, "expected dwExemptDelta 0, got %d\n",
385 U(*lpCacheEntryInfo
).dwExemptDelta
);
387 /* Make sure there is a notable change in timestamps */
390 /* A subsequent commit with a different time/type doesn't change most of the entry */
391 GetSystemTimeAsFileTime(&now
);
392 ret
= CommitUrlCacheEntry(TEST_URL1
, NULL
, now
, now
, NORMAL_CACHE_ENTRY
,
393 (LPBYTE
)ok_header
, strlen(ok_header
), NULL
, NULL
);
394 ok(ret
, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
395 cbCacheEntryInfo
= 0;
396 ret
= GetUrlCacheEntryInfo(TEST_URL1
, NULL
, &cbCacheEntryInfo
);
397 ok(!ret
, "GetUrlCacheEntryInfo should have failed\n");
398 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
,
399 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
400 lpCacheEntryInfo2
= HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo
);
401 ret
= GetUrlCacheEntryInfo(TEST_URL1
, lpCacheEntryInfo2
, &cbCacheEntryInfo
);
402 ok(ret
, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
403 /* but it does change the time.. */
405 ok(memcmp(&lpCacheEntryInfo2
->ExpireTime
, &filetime_zero
, sizeof(FILETIME
)),
406 "expected positive ExpireTime\n");
408 ok(memcmp(&lpCacheEntryInfo2
->LastModifiedTime
, &filetime_zero
, sizeof(FILETIME
)),
409 "expected positive LastModifiedTime\n");
410 ok(lpCacheEntryInfo2
->CacheEntryType
== (NORMAL_CACHE_ENTRY
|URLHISTORY_CACHE_ENTRY
) ||
411 broken(lpCacheEntryInfo2
->CacheEntryType
== NORMAL_CACHE_ENTRY
/* NT4/W2k */),
412 "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x\n",
413 lpCacheEntryInfo2
->CacheEntryType
);
414 /* and set the headers. */
416 ok(lpCacheEntryInfo2
->dwHeaderInfoSize
== 19,
417 "expected headers size 19, got %d\n",
418 lpCacheEntryInfo2
->dwHeaderInfoSize
);
419 /* Hit rate gets incremented by 1 */
421 ok((lpCacheEntryInfo
->dwHitRate
+ 1) == lpCacheEntryInfo2
->dwHitRate
,
422 "HitRate not incremented by one on commit\n");
423 /* Last access time should be updated */
425 ok(!(lpCacheEntryInfo
->LastAccessTime
.dwHighDateTime
== lpCacheEntryInfo2
->LastAccessTime
.dwHighDateTime
&&
426 lpCacheEntryInfo
->LastAccessTime
.dwLowDateTime
== lpCacheEntryInfo2
->LastAccessTime
.dwLowDateTime
),
427 "Last accessed time was not updated by commit\n");
428 /* File extension should be unset */
430 ok(lpCacheEntryInfo2
->lpszFileExtension
== NULL
,
431 "Fileextension isn't unset: %s\n",
432 lpCacheEntryInfo2
->lpszFileExtension
);
433 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo
);
434 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo2
);
436 ret
= CommitUrlCacheEntry(TEST_URL
, filenameA
, filetime_zero
, filetime_zero
, NORMAL_CACHE_ENTRY
, NULL
, 0, "html", NULL
);
437 ok(ret
, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
439 cbCacheEntryInfo
= 0;
440 SetLastError(0xdeadbeef);
441 ret
= RetrieveUrlCacheEntryFile(TEST_URL
, NULL
, &cbCacheEntryInfo
, 0);
442 ok(!ret
, "RetrieveUrlCacheEntryFile should have failed\n");
443 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
,
444 "RetrieveUrlCacheEntryFile should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
446 lpCacheEntryInfo
= HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo
);
447 ret
= RetrieveUrlCacheEntryFile(TEST_URL
, lpCacheEntryInfo
, &cbCacheEntryInfo
, 0);
448 ok(ret
, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
450 if (ret
) check_cache_entry_infoA("RetrieveUrlCacheEntryFile", lpCacheEntryInfo
);
452 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo
);
454 cbCacheEntryInfo
= 0;
455 SetLastError(0xdeadbeef);
456 ret
= RetrieveUrlCacheEntryFile(TEST_URL1
, NULL
, &cbCacheEntryInfo
, 0);
457 ok(!ret
, "RetrieveUrlCacheEntryFile should have failed\n");
458 ok(GetLastError() == ERROR_INVALID_DATA
,
459 "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_DATA instead of %d\n", GetLastError());
461 if (pUnlockUrlCacheEntryFileA
)
463 ret
= pUnlockUrlCacheEntryFileA(TEST_URL
, 0);
464 ok(ret
, "UnlockUrlCacheEntryFileA failed with error %d\n", GetLastError());
467 /* test Find*UrlCacheEntry functions */
468 test_find_url_cache_entriesA();
470 test_GetUrlCacheEntryInfoExA();
471 test_RetrieveUrlCacheEntryA();
472 test_IsUrlCacheEntryExpiredA();
474 if (pDeleteUrlCacheEntryA
)
476 ret
= pDeleteUrlCacheEntryA(TEST_URL
);
477 ok(ret
, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
478 ret
= pDeleteUrlCacheEntryA(TEST_URL1
);
479 ok(ret
, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
482 SetLastError(0xdeadbeef);
483 ret
= DeleteFile(filenameA
);
485 ok(!ret
&& GetLastError() == ERROR_FILE_NOT_FOUND
, "local file should no longer exist\n");
487 /* Creating two entries with the same URL */
488 ret
= CreateUrlCacheEntry(TEST_URL
, 0, "html", filenameA
, 0);
489 ok(ret
, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
491 ret
= CreateUrlCacheEntry(TEST_URL
, 0, "html", filenameA1
, 0);
492 ok(ret
, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
494 ok(lstrcmpiA(filenameA
, filenameA1
), "expected a different file name\n");
496 create_and_write_file(filenameA
, &zero_byte
, sizeof(zero_byte
));
497 create_and_write_file(filenameA1
, &zero_byte
, sizeof(zero_byte
));
498 check_file_exists(filenameA
);
499 check_file_exists(filenameA1
);
501 ret
= CommitUrlCacheEntry(TEST_URL
, filenameA
, filetime_zero
,
502 filetime_zero
, NORMAL_CACHE_ENTRY
, (LPBYTE
)ok_header
,
503 strlen(ok_header
), "html", NULL
);
504 ok(ret
, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
505 check_file_exists(filenameA
);
506 check_file_exists(filenameA1
);
507 ret
= CommitUrlCacheEntry(TEST_URL
, filenameA1
, filetime_zero
,
508 filetime_zero
, COOKIE_CACHE_ENTRY
, NULL
, 0, "html", NULL
);
509 ok(ret
, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
510 /* By committing the same URL a second time, the prior entry is
513 cbCacheEntryInfo
= 0;
514 SetLastError(0xdeadbeef);
515 ret
= GetUrlCacheEntryInfo(TEST_URL
, NULL
, &cbCacheEntryInfo
);
516 ok(!ret
, "GetUrlCacheEntryInfo should have failed\n");
517 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
,
518 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
519 lpCacheEntryInfo
= HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo
);
520 ret
= GetUrlCacheEntryInfo(TEST_URL
, lpCacheEntryInfo
, &cbCacheEntryInfo
);
521 ok(ret
, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
522 /* with the previous entry type retained.. */
523 ok(lpCacheEntryInfo
->CacheEntryType
& NORMAL_CACHE_ENTRY
,
524 "expected cache entry type NORMAL_CACHE_ENTRY, got %d (0x%08x)\n",
525 lpCacheEntryInfo
->CacheEntryType
, lpCacheEntryInfo
->CacheEntryType
);
526 /* and the headers overwritten.. */
528 ok(!lpCacheEntryInfo
->dwHeaderInfoSize
, "expected headers size 0, got %d\n",
529 lpCacheEntryInfo
->dwHeaderInfoSize
);
530 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo
);
531 /* and the previous filename shouldn't exist. */
533 check_file_not_exists(filenameA
);
534 check_file_exists(filenameA1
);
536 if (pDeleteUrlCacheEntryA
)
538 ret
= pDeleteUrlCacheEntryA(TEST_URL
);
539 ok(ret
, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
541 check_file_not_exists(filenameA
);
543 check_file_not_exists(filenameA1
);
544 /* Just in case, clean up files */
545 DeleteFileA(filenameA1
);
546 DeleteFileA(filenameA
);
549 /* Check whether a retrieved cache entry can be deleted before it's
552 ret
= CreateUrlCacheEntry(TEST_URL
, 0, "html", filenameA
, 0);
553 ok(ret
, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
554 ret
= CommitUrlCacheEntry(TEST_URL
, filenameA
, filetime_zero
, filetime_zero
,
555 NORMAL_CACHE_ENTRY
, NULL
, 0, "html", NULL
);
556 ok(ret
, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
558 cbCacheEntryInfo
= 0;
559 SetLastError(0xdeadbeef);
560 ret
= RetrieveUrlCacheEntryFile(TEST_URL
, NULL
, &cbCacheEntryInfo
, 0);
561 ok(!ret
, "RetrieveUrlCacheEntryFile should have failed\n");
562 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
,
563 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
565 lpCacheEntryInfo
= HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo
);
566 ret
= RetrieveUrlCacheEntryFile(TEST_URL
, lpCacheEntryInfo
,
567 &cbCacheEntryInfo
, 0);
568 ok(ret
, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
570 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo
);
572 if (pDeleteUrlCacheEntryA
)
574 ret
= pDeleteUrlCacheEntryA(TEST_URL
);
575 ok(!ret
, "Expected failure\n");
576 ok(GetLastError() == ERROR_SHARING_VIOLATION
,
577 "Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
578 check_file_exists(filenameA
);
581 lpCacheEntryInfo
= HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo
);
582 memset(lpCacheEntryInfo
, 0, cbCacheEntryInfo
);
583 ret
= GetUrlCacheEntryInfo(TEST_URL
, lpCacheEntryInfo
, &cbCacheEntryInfo
);
584 ok(ret
, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
585 ok(lpCacheEntryInfo
->CacheEntryType
& DELETED_CACHE_ENTRY
,
586 "CacheEntryType hasn't DELETED_CACHE_ENTRY set, (flags %08x)\n",
587 lpCacheEntryInfo
->CacheEntryType
);
588 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo
);
590 if (pUnlockUrlCacheEntryFileA
)
592 check_file_exists(filenameA
);
593 ret
= pUnlockUrlCacheEntryFileA(TEST_URL
, 0);
594 ok(ret
, "UnlockUrlCacheEntryFileA failed: %d\n", GetLastError());
595 /* By unlocking the already-deleted cache entry, the file associated
596 * with it is deleted..
599 check_file_not_exists(filenameA
);
600 /* (just in case, delete file) */
601 DeleteFileA(filenameA
);
603 if (pDeleteUrlCacheEntryA
)
605 /* and a subsequent deletion should fail. */
606 ret
= pDeleteUrlCacheEntryA(TEST_URL
);
607 ok(!ret
, "Expected failure\n");
608 ok(GetLastError() == ERROR_FILE_NOT_FOUND
,
609 "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
612 /* Test whether preventing a file from being deleted causes
613 * DeleteUrlCacheEntryA to fail.
615 ret
= CreateUrlCacheEntry(TEST_URL
, 0, "html", filenameA
, 0);
616 ok(ret
, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
618 create_and_write_file(filenameA
, &zero_byte
, sizeof(zero_byte
));
619 check_file_exists(filenameA
);
621 ret
= CommitUrlCacheEntry(TEST_URL
, filenameA
, filetime_zero
,
622 filetime_zero
, NORMAL_CACHE_ENTRY
, (LPBYTE
)ok_header
,
623 strlen(ok_header
), "html", NULL
);
624 ok(ret
, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
625 check_file_exists(filenameA
);
626 hFile
= CreateFileA(filenameA
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
,
627 FILE_ATTRIBUTE_NORMAL
, NULL
);
628 ok(hFile
!= INVALID_HANDLE_VALUE
, "CreateFileA failed: %d\n",
630 if (pDeleteUrlCacheEntryA
)
632 /* DeleteUrlCacheEntryA should succeed.. */
633 ret
= pDeleteUrlCacheEntryA(TEST_URL
);
634 ok(ret
, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
637 if (pDeleteUrlCacheEntryA
)
639 /* and a subsequent deletion should fail.. */
640 ret
= pDeleteUrlCacheEntryA(TEST_URL
);
641 ok(!ret
, "Expected failure\n");
642 ok(GetLastError() == ERROR_FILE_NOT_FOUND
,
643 "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
645 /* and the file should be untouched. */
646 check_file_exists(filenameA
);
647 DeleteFileA(filenameA
);
649 /* Try creating a sticky entry. Unlike non-sticky entries, the filename
650 * must have been set already.
652 SetLastError(0xdeadbeef);
653 ret
= CommitUrlCacheEntry(TEST_URL
, NULL
, filetime_zero
, filetime_zero
,
654 STICKY_CACHE_ENTRY
, (LPBYTE
)ok_header
, strlen(ok_header
), "html",
656 ok(!ret
, "expected failure\n");
657 ok(GetLastError() == ERROR_INVALID_PARAMETER
,
658 "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
659 SetLastError(0xdeadbeef);
660 ret
= CommitUrlCacheEntry(TEST_URL
, NULL
, filetime_zero
, filetime_zero
,
661 NORMAL_CACHE_ENTRY
|STICKY_CACHE_ENTRY
,
662 (LPBYTE
)ok_header
, strlen(ok_header
), "html", NULL
);
663 ok(!ret
, "expected failure\n");
664 ok(GetLastError() == ERROR_INVALID_PARAMETER
,
665 "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
667 ret
= CreateUrlCacheEntry(TEST_URL
, 0, "html", filenameA
, 0);
668 ok(ret
, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
669 create_and_write_file(filenameA
, &zero_byte
, sizeof(zero_byte
));
670 ret
= CommitUrlCacheEntry(TEST_URL
, filenameA
, filetime_zero
, filetime_zero
,
671 NORMAL_CACHE_ENTRY
|STICKY_CACHE_ENTRY
,
672 (LPBYTE
)ok_header
, strlen(ok_header
), "html", NULL
);
673 ok(ret
, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
674 cbCacheEntryInfo
= 0;
675 SetLastError(0xdeadbeef);
676 ret
= GetUrlCacheEntryInfo(TEST_URL
, NULL
, &cbCacheEntryInfo
);
677 ok(!ret
, "GetUrlCacheEntryInfo should have failed\n");
678 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
,
679 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
680 lpCacheEntryInfo
= HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo
);
681 ret
= GetUrlCacheEntryInfo(TEST_URL
, lpCacheEntryInfo
, &cbCacheEntryInfo
);
682 ok(ret
, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
683 ok(lpCacheEntryInfo
->CacheEntryType
& (NORMAL_CACHE_ENTRY
|STICKY_CACHE_ENTRY
),
684 "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
685 lpCacheEntryInfo
->CacheEntryType
, lpCacheEntryInfo
->CacheEntryType
);
686 ok(U(*lpCacheEntryInfo
).dwExemptDelta
== 86400,
687 "expected dwExemptDelta 86400, got %d\n",
688 U(*lpCacheEntryInfo
).dwExemptDelta
);
689 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo
);
690 if (pDeleteUrlCacheEntryA
)
692 ret
= pDeleteUrlCacheEntryA(TEST_URL
);
693 ok(ret
, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
694 /* When explicitly deleting the cache entry, the file is also deleted */
696 check_file_not_exists(filenameA
);
698 /* Test once again, setting the exempt delta via SetUrlCacheEntryInfo */
699 ret
= CreateUrlCacheEntry(TEST_URL
, 0, "html", filenameA
, 0);
700 ok(ret
, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
701 create_and_write_file(filenameA
, &zero_byte
, sizeof(zero_byte
));
702 ret
= CommitUrlCacheEntry(TEST_URL
, filenameA
, filetime_zero
, filetime_zero
,
703 NORMAL_CACHE_ENTRY
|STICKY_CACHE_ENTRY
,
704 (LPBYTE
)ok_header
, strlen(ok_header
), "html", NULL
);
705 ok(ret
, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
706 cbCacheEntryInfo
= 0;
707 SetLastError(0xdeadbeef);
708 ret
= GetUrlCacheEntryInfo(TEST_URL
, NULL
, &cbCacheEntryInfo
);
709 ok(!ret
, "GetUrlCacheEntryInfo should have failed\n");
710 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER
,
711 "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
712 lpCacheEntryInfo
= HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo
);
713 ret
= GetUrlCacheEntryInfo(TEST_URL
, lpCacheEntryInfo
, &cbCacheEntryInfo
);
714 ok(ret
, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
715 ok(lpCacheEntryInfo
->CacheEntryType
& (NORMAL_CACHE_ENTRY
|STICKY_CACHE_ENTRY
),
716 "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
717 lpCacheEntryInfo
->CacheEntryType
, lpCacheEntryInfo
->CacheEntryType
);
718 ok(U(*lpCacheEntryInfo
).dwExemptDelta
== 86400,
719 "expected dwExemptDelta 86400, got %d\n",
720 U(*lpCacheEntryInfo
).dwExemptDelta
);
721 U(*lpCacheEntryInfo
).dwExemptDelta
= 0;
722 ret
= SetUrlCacheEntryInfoA(TEST_URL
, lpCacheEntryInfo
,
723 CACHE_ENTRY_EXEMPT_DELTA_FC
);
724 ok(ret
, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
725 ret
= GetUrlCacheEntryInfo(TEST_URL
, lpCacheEntryInfo
, &cbCacheEntryInfo
);
726 ok(ret
, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
727 ok(!U(*lpCacheEntryInfo
).dwExemptDelta
, "expected dwExemptDelta 0, got %d\n",
728 U(*lpCacheEntryInfo
).dwExemptDelta
);
729 /* See whether a sticky cache entry has the flag cleared once the exempt
730 * delta is meaningless.
732 ok(lpCacheEntryInfo
->CacheEntryType
& (NORMAL_CACHE_ENTRY
|STICKY_CACHE_ENTRY
),
733 "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
734 lpCacheEntryInfo
->CacheEntryType
, lpCacheEntryInfo
->CacheEntryType
);
736 /* Recommit of Url entry keeps dwExemptDelta */
737 U(*lpCacheEntryInfo
).dwExemptDelta
= 8600;
738 ret
= SetUrlCacheEntryInfoA(TEST_URL
, lpCacheEntryInfo
,
739 CACHE_ENTRY_EXEMPT_DELTA_FC
);
740 ok(ret
, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
742 ret
= CreateUrlCacheEntry(TEST_URL
, 0, "html", filenameA1
, 0);
743 ok(ret
, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
744 create_and_write_file(filenameA1
, &zero_byte
, sizeof(zero_byte
));
746 ret
= CommitUrlCacheEntry(TEST_URL
, filenameA1
, filetime_zero
, filetime_zero
,
747 NORMAL_CACHE_ENTRY
|STICKY_CACHE_ENTRY
,
748 (LPBYTE
)ok_header
, strlen(ok_header
), "html", NULL
);
749 ok(ret
, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
751 ret
= GetUrlCacheEntryInfo(TEST_URL
, lpCacheEntryInfo
, &cbCacheEntryInfo
);
752 ok(ret
, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
753 ok(U(*lpCacheEntryInfo
).dwExemptDelta
== 8600,
754 "expected dwExemptDelta 8600, got %d\n",
755 U(*lpCacheEntryInfo
).dwExemptDelta
);
757 HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo
);
759 if (pDeleteUrlCacheEntryA
)
761 ret
= pDeleteUrlCacheEntryA(TEST_URL
);
762 ok(ret
, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
764 check_file_not_exists(filenameA
);
768 static void test_FindCloseUrlCache(void)
773 SetLastError(0xdeadbeef);
774 r
= FindCloseUrlCache(NULL
);
775 err
= GetLastError();
776 ok(0 == r
, "expected 0, got %d\n", r
);
777 ok(ERROR_INVALID_HANDLE
== err
, "expected %d, got %d\n", ERROR_INVALID_HANDLE
, err
);
780 static void test_GetDiskInfoA(void)
783 DWORD error
, cluster_size
;
784 DWORDLONG free
, total
;
785 char path
[MAX_PATH
], *p
;
787 GetSystemDirectoryA(path
, MAX_PATH
);
788 if ((p
= strchr(path
, '\\'))) *++p
= 0;
790 ret
= GetDiskInfoA(path
, &cluster_size
, &free
, &total
);
791 ok(ret
, "GetDiskInfoA failed %u\n", GetLastError());
793 ret
= GetDiskInfoA(path
, &cluster_size
, &free
, NULL
);
794 ok(ret
, "GetDiskInfoA failed %u\n", GetLastError());
796 ret
= GetDiskInfoA(path
, &cluster_size
, NULL
, NULL
);
797 ok(ret
, "GetDiskInfoA failed %u\n", GetLastError());
799 ret
= GetDiskInfoA(path
, NULL
, NULL
, NULL
);
800 ok(ret
, "GetDiskInfoA failed %u\n", GetLastError());
802 SetLastError(0xdeadbeef);
803 strcpy(p
, "\\non\\existing\\path");
804 ret
= GetDiskInfoA(path
, NULL
, NULL
, NULL
);
805 error
= GetLastError();
807 broken(ret
), /* < IE7 */
808 "GetDiskInfoA succeeded\n");
809 ok(error
== ERROR_PATH_NOT_FOUND
||
810 broken(error
== 0xdeadbeef), /* < IE7 */
811 "got %u expected ERROR_PATH_NOT_FOUND\n", error
);
813 SetLastError(0xdeadbeef);
814 ret
= GetDiskInfoA(NULL
, NULL
, NULL
, NULL
);
815 error
= GetLastError();
816 ok(!ret
, "GetDiskInfoA succeeded\n");
817 ok(error
== ERROR_INVALID_PARAMETER
, "got %u expected ERROR_INVALID_PARAMETER\n", error
);
823 hdll
= GetModuleHandleA("wininet.dll");
825 if(!GetProcAddress(hdll
, "InternetGetCookieExW")) {
826 win_skip("Too old IE (older than 6.0)\n");
830 pDeleteUrlCacheEntryA
= (void*)GetProcAddress(hdll
, "DeleteUrlCacheEntryA");
831 pUnlockUrlCacheEntryFileA
= (void*)GetProcAddress(hdll
, "UnlockUrlCacheEntryFileA");
833 test_FindCloseUrlCache();