ReactOS  0.4.14-dev-1025-gd1ac13c
urlcache.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wininet.h"
#include "winineti.h"
#include "shlobj.h"
#include "wine/test.h"
Include dependency graph for urlcache.c:

Go to the source code of this file.

Macros

#define NONAMELESSUNION
 
#define NONAMELESSSTRUCT
 
#define check_file_exists(f)   _check_file_exists(__LINE__, f)
 
#define check_file_not_exists(f)   _check_file_not_exists(__LINE__, f)
 

Functions

static BOOL (WINAPI *pDeleteUrlCacheEntryA)(LPCSTR)
 
static void check_cache_entry_infoA (const char *returnedfrom, INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo)
 
static void test_find_url_cache_entriesA (void)
 
static void test_GetUrlCacheEntryInfoExA (void)
 
static void test_RetrieveUrlCacheEntryA (void)
 
static void test_IsUrlCacheEntryExpiredA (void)
 
static void _check_file_exists (LONG l, LPCSTR filename)
 
static void _check_file_not_exists (LONG l, LPCSTR filename)
 
static void create_and_write_file (LPCSTR filename, void *data, DWORD len)
 
static void test_urlcacheA (void)
 
static void test_urlcacheW (void)
 
static void test_FindCloseUrlCache (void)
 
static void test_GetDiskInfoA (void)
 
static BOOL cache_entry_exists (const char *url)
 
static void test_trailing_slash (void)
 
static void get_cache_path (DWORD flags, char path[MAX_PATH], char path_win8[MAX_PATH])
 
static void test_GetUrlCacheConfigInfo (void)
 
 START_TEST (urlcache)
 

Variables

static const char test_url [] = "http://urlcachetest.winehq.org/index.html"
 
static const WCHAR test_urlW []
 
static const char test_url1 [] = "Visited: user@http://urlcachetest.winehq.org/index.html"
 
static const char test_hash_collisions1 [] = "Visited: http://winehq.org/doc0.html"
 
static const char test_hash_collisions2 [] = "Visited: http://winehq.org/doc75651909.html"
 
static DWORD
 
static char filenameA [MAX_PATH+1]
 
static char filenameA1 [MAX_PATH+1]
 
static BOOL old_ie = FALSE
 
static BOOL ie10_cache = FALSE
 

Macro Definition Documentation

◆ check_file_exists

#define check_file_exists (   f)    _check_file_exists(__LINE__, f)

Definition at line 335 of file urlcache.c.

◆ check_file_not_exists

#define check_file_not_exists (   f)    _check_file_not_exists(__LINE__, f)

Definition at line 349 of file urlcache.c.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 22 of file urlcache.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 21 of file urlcache.c.

Function Documentation

◆ _check_file_exists()

static void _check_file_exists ( LONG  l,
LPCSTR  filename 
)
static

Definition at line 323 of file urlcache.c.

324 {
325  HANDLE file;
326 
329  ok_(__FILE__,l)(file != INVALID_HANDLE_VALUE,
330  "expected file to exist, CreateFile failed with error %d\n",
331  GetLastError());
332  CloseHandle(file);
333 }
#define CloseHandle
Definition: compat.h:406
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
const char * filename
Definition: ioapi.h:135
#define FILE_SHARE_READ
Definition: compat.h:125
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:434
r l[0]
Definition: byte_order.h:167
const char file[]
Definition: icontest.c:11
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
#define ok_(x1, x2)
Definition: atltest.h:61
Definition: fci.c:126

◆ _check_file_not_exists()

static void _check_file_not_exists ( LONG  l,
LPCSTR  filename 
)
static

Definition at line 337 of file urlcache.c.

338 {
339  HANDLE file;
340 
343  ok_(__FILE__,l)(file == INVALID_HANDLE_VALUE,
344  "expected file not to exist\n");
345  if (file != INVALID_HANDLE_VALUE)
346  CloseHandle(file);
347 }
#define CloseHandle
Definition: compat.h:406
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
const char * filename
Definition: ioapi.h:135
#define FILE_SHARE_READ
Definition: compat.h:125
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:434
r l[0]
Definition: byte_order.h:167
const char file[]
Definition: icontest.c:11
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
#define ok_(x1, x2)
Definition: atltest.h:61
Definition: fci.c:126

◆ BOOL()

static BOOL ( WINAPI pDeleteUrlCacheEntryA)
static

◆ cache_entry_exists()

static BOOL cache_entry_exists ( const char url)
static

Definition at line 1068 of file urlcache.c.

1069 {
1070  static char buf[10000];
1071  DWORD size = sizeof(buf);
1072  BOOL ret;
1073 
1074  ret = GetUrlCacheEntryInfoA(url, (void*)buf, &size);
1075  ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND, "GetUrlCacheEntryInfoA returned %x (%u)\n", ret, GetLastError());
1076 
1077  return ret;
1078 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
GLsizeiptr size
Definition: glext.h:5919
static const WCHAR url[]
Definition: encode.c:1432
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI GetUrlCacheEntryInfoA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize)
Definition: urlcache.c:1898
int ret
#define ok(value,...)
Definition: atltest.h:57

Referenced by test_trailing_slash().

◆ check_cache_entry_infoA()

static void check_cache_entry_infoA ( const char returnedfrom,
INTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo 
)
static

Definition at line 52 of file urlcache.c.

53 {
54  ok(lpCacheEntryInfo->dwStructSize == sizeof(*lpCacheEntryInfo), "%s: dwStructSize was %d\n", returnedfrom, lpCacheEntryInfo->dwStructSize);
55  ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_url), "%s: lpszSourceUrlName should be %s instead of %s\n", returnedfrom, test_url, lpCacheEntryInfo->lpszSourceUrlName);
56  ok(!strcmp(lpCacheEntryInfo->lpszLocalFileName, filenameA), "%s: lpszLocalFileName should be %s instead of %s\n", returnedfrom, filenameA, lpCacheEntryInfo->lpszLocalFileName);
57  ok(!strcmp(lpCacheEntryInfo->lpszFileExtension, "html"), "%s: lpszFileExtension should be html instead of %s\n", returnedfrom, lpCacheEntryInfo->lpszFileExtension);
58 }
DWORD dwStructSize
Definition: wininet.h:2105
LPSTR lpszSourceUrlName
Definition: wininet.h:2106
LPSTR lpszLocalFileName
Definition: wininet.h:2107
#define ok(value,...)
Definition: atltest.h:57
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
LPSTR lpszFileExtension
Definition: wininet.h:2120
static const char test_url[]
Definition: urlcache.c:37
static char filenameA[MAX_PATH+1]
Definition: urlcache.c:47

Referenced by test_GetUrlCacheEntryInfoExA(), and test_urlcacheA().

◆ create_and_write_file()

static void create_and_write_file ( LPCSTR  filename,
void data,
DWORD  len 
)
static

Definition at line 351 of file urlcache.c.

352 {
353  HANDLE file;
354  DWORD written;
355  BOOL ret;
356 
360  ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed with error %d\n", GetLastError());
361 
362  ret = WriteFile(file, data, len, &written, NULL);
363  ok(ret, "WriteFile failed with error %d\n", GetLastError());
364 
365  CloseHandle(file);
366 }
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 CloseHandle
Definition: compat.h:406
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
const char * filename
Definition: ioapi.h:135
#define FILE_SHARE_READ
Definition: compat.h:125
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
GLenum GLsizei len
Definition: glext.h:6722
#define CREATE_ALWAYS
Definition: disk.h:72
#define ok(value,...)
Definition: atltest.h:57
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
Definition: fci.c:126

Referenced by test_trailing_slash(), and test_urlcacheA().

◆ get_cache_path()

static void get_cache_path ( DWORD  flags,
char  path[MAX_PATH],
char  path_win8[MAX_PATH] 
)
static

Definition at line 1107 of file urlcache.c.

1108 {
1109  BOOL ret;
1110  int folder = -1;
1111  const char *suffix = "";
1112  const char *suffix_win8 = "";
1113 
1114  switch (flags)
1115  {
1116  case 0:
1119  suffix = "\\Content.IE5\\";
1120  suffix_win8 = "\\IE\\";
1121  break;
1122 
1125  suffix = "\\";
1126  suffix_win8 = "\\";
1127  break;
1128 
1131  suffix = "\\History.IE5\\";
1132  suffix_win8 = "\\History.IE5\\";
1133  break;
1134 
1135  default:
1136  ok(0, "unexpected flags %#x\n", flags);
1137  break;
1138  }
1139 
1141  ok(ret, "SHGetSpecialFolderPath error %u\n", GetLastError());
1142 
1143  strcpy(path_win8, path);
1144  strcat(path_win8, suffix_win8);
1145 
1146  strcat(path, suffix);
1147 }
#define CSIDL_COOKIES
Definition: shlobj.h:2043
Definition: fci.c:115
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define CACHE_CONFIG_HISTORY_PATHS_FC
Definition: winineti.h:103
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define CSIDL_HISTORY
Definition: shlobj.h:2044
#define CSIDL_INTERNET_CACHE
Definition: shlobj.h:2042
BOOL WINAPI SHGetSpecialFolderPathA(HWND hwndOwner, LPSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:2672
unsigned int BOOL
Definition: ntddk_ex.h:94
GLbitfield flags
Definition: glext.h:7161
int ret
#define CACHE_CONFIG_COOKIES_PATHS_FC
Definition: winineti.h:102
#define ok(value,...)
Definition: atltest.h:57
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define CACHE_CONFIG_CONTENT_PATHS_FC
Definition: winineti.h:101

Referenced by test_GetUrlCacheConfigInfo().

◆ START_TEST()

START_TEST ( urlcache  )

Definition at line 1203 of file urlcache.c.

1204 {
1205  HMODULE hdll;
1206  hdll = GetModuleHandleA("wininet.dll");
1207 
1208  if(!GetProcAddress(hdll, "InternetGetCookieExW")) {
1209  win_skip("Too old IE (older than 6.0)\n");
1210  return;
1211  }
1212  if(!GetProcAddress(hdll, "InternetGetSecurityInfoByURL")) /* < IE7 */
1213  old_ie = TRUE;
1214 
1215  if(GetProcAddress(hdll, "CreateUrlCacheEntryExW")) {
1216  trace("Running tests on IE10 or newer\n");
1217  ie10_cache = TRUE;
1218  }
1219 
1220  pDeleteUrlCacheEntryA = (void*)GetProcAddress(hdll, "DeleteUrlCacheEntryA");
1221  pUnlockUrlCacheEntryFileA = (void*)GetProcAddress(hdll, "UnlockUrlCacheEntryFileA");
1222  test_urlcacheA();
1223  test_urlcacheW();
1228 }
#define TRUE
Definition: types.h:120
static void test_trailing_slash(void)
Definition: urlcache.c:1080
static void test_urlcacheW(void)
Definition: urlcache.c:842
static void test_GetUrlCacheConfigInfo(void)
Definition: urlcache.c:1149
static void test_GetDiskInfoA(void)
Definition: urlcache.c:1028
static BOOL ie10_cache
Definition: urlcache.c:50
#define trace
Definition: atltest.h:70
static void test_urlcacheA(void)
Definition: urlcache.c:368
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
static PVOID hdll
Definition: shimdbg.c:126
static void test_FindCloseUrlCache(void)
Definition: urlcache.c:1016
static BOOL old_ie
Definition: urlcache.c:49
#define GetProcAddress(x, y)
Definition: compat.h:418
#define win_skip
Definition: test.h:149

◆ test_find_url_cache_entriesA()

static void test_find_url_cache_entriesA ( void  )
static

Definition at line 60 of file urlcache.c.

61 {
62  BOOL ret;
63  HANDLE hEnumHandle;
64  BOOL found = FALSE;
65  DWORD cbCacheEntryInfo;
66  DWORD cbCacheEntryInfoSaved;
67  INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
68 
69  cbCacheEntryInfo = 0;
70  SetLastError(0xdeadbeef);
71  hEnumHandle = FindFirstUrlCacheEntryA(NULL, NULL, &cbCacheEntryInfo);
72  ok(!hEnumHandle, "FindFirstUrlCacheEntry should have failed\n");
73  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "FindFirstUrlCacheEntry should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
74  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo * sizeof(char));
75  cbCacheEntryInfoSaved = cbCacheEntryInfo;
76  hEnumHandle = FindFirstUrlCacheEntryA(NULL, lpCacheEntryInfo, &cbCacheEntryInfo);
77  ok(hEnumHandle != NULL, "FindFirstUrlCacheEntry failed with error %d\n", GetLastError());
78  while (TRUE)
79  {
80  if (!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_url))
81  {
82  found = TRUE;
83  ret = TRUE;
84  break;
85  }
86  SetLastError(0xdeadbeef);
87  cbCacheEntryInfo = cbCacheEntryInfoSaved;
88  ret = FindNextUrlCacheEntryA(hEnumHandle, lpCacheEntryInfo, &cbCacheEntryInfo);
89  if (!ret)
90  {
92  {
93  lpCacheEntryInfo = HeapReAlloc(GetProcessHeap(), 0, lpCacheEntryInfo, cbCacheEntryInfo);
94  cbCacheEntryInfoSaved = cbCacheEntryInfo;
95  ret = FindNextUrlCacheEntryA(hEnumHandle, lpCacheEntryInfo, &cbCacheEntryInfo);
96  }
97  }
98  if (!ret)
99  break;
100  }
101  ok(ret, "FindNextUrlCacheEntry failed with error %d\n", GetLastError());
102  ok(found, "Committed url cache entry not found during enumeration\n");
103 
104  ret = FindCloseUrlCache(hEnumHandle);
105  ok(ret, "FindCloseUrlCache failed with error %d\n", GetLastError());
106  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
107 }
#define TRUE
Definition: types.h:120
BOOL WINAPI FindNextUrlCacheEntryA(HANDLE hEnumHandle, LPINTERNET_CACHE_ENTRY_INFOA lpNextCacheEntryInfo, LPDWORD lpdwNextCacheEntryInfoBufferSize)
Definition: urlcache.c:3641
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
Definition: wininet.h:2104
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
LPSTR lpszSourceUrlName
Definition: wininet.h:2106
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI FindCloseUrlCache(HANDLE hEnumHandle)
Definition: urlcache.c:3671
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR lpszUrlSearchPattern, LPINTERNET_CACHE_ENTRY_INFOA lpFirstCacheEntryInfo, LPDWORD lpdwFirstCacheEntryInfoBufferSize)
Definition: urlcache.c:3481
#define ok(value,...)
Definition: atltest.h:57
#define HeapReAlloc
Definition: compat.h:401
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define HeapFree(x, y, z)
Definition: compat.h:402
static const char test_url[]
Definition: urlcache.c:37
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by test_urlcacheA().

◆ test_FindCloseUrlCache()

static void test_FindCloseUrlCache ( void  )
static

Definition at line 1016 of file urlcache.c.

1017 {
1018  BOOL r;
1019  DWORD err;
1020 
1021  SetLastError(0xdeadbeef);
1023  err = GetLastError();
1024  ok(0 == r, "expected 0, got %d\n", r);
1025  ok(ERROR_INVALID_HANDLE == err, "expected %d, got %d\n", ERROR_INVALID_HANDLE, err);
1026 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI FindCloseUrlCache(HANDLE hEnumHandle)
Definition: urlcache.c:3671
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
#define err(...)
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_GetDiskInfoA()

static void test_GetDiskInfoA ( void  )
static

Definition at line 1028 of file urlcache.c.

1029 {
1030  BOOL ret;
1032  DWORDLONG free, total;
1033  char path[MAX_PATH], *p;
1034 
1036  if ((p = strchr(path, '\\'))) *++p = 0;
1037 
1038  ret = GetDiskInfoA(path, &cluster_size, &free, &total);
1039  ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1040 
1042  ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1043 
1045  ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1046 
1048  ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
1049 
1050  SetLastError(0xdeadbeef);
1051  strcpy(p, "\\non\\existing\\path");
1053  error = GetLastError();
1054  ok(!ret ||
1055  broken(old_ie && ret), /* < IE7 */
1056  "GetDiskInfoA succeeded\n");
1058  broken(old_ie && error == 0xdeadbeef), /* < IE7 */
1059  "got %u expected ERROR_PATH_NOT_FOUND\n", error);
1060 
1061  SetLastError(0xdeadbeef);
1063  error = GetLastError();
1064  ok(!ret, "GetDiskInfoA succeeded\n");
1065  ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", error);
1066 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define error(str)
Definition: mkdosfs.c:1605
#define free
Definition: debug_ros.c:5
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2282
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
__u8 cluster_size
Definition: mkdosfs.c:362
smooth NULL
Definition: ftsmooth.c:416
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
char * strchr(const char *String, int ch)
Definition: utclib.c:501
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:49
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
BOOL WINAPI GetDiskInfoA(PCSTR path, PDWORD cluster_size, PDWORDLONG free, PDWORDLONG total)
Definition: urlcache.c:4074
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by START_TEST().

◆ test_GetUrlCacheConfigInfo()

static void test_GetUrlCacheConfigInfo ( void  )
static

Definition at line 1149 of file urlcache.c.

1150 {
1152  struct
1153  {
1155  DWORD dwStructSize;
1156  DWORD flags;
1157  BOOL ret;
1158  DWORD error;
1159  } td[] =
1160  {
1161 #if 0 /* crashes under Vista */
1162  { NULL, 0, 0, FALSE, ERROR_INVALID_PARAMETER },
1163 #endif
1164  { &info, 0, 0, TRUE },
1165  { &info, sizeof(info) - 1, 0, TRUE },
1166  { &info, sizeof(info) + 1, 0, TRUE },
1168  { &info, sizeof(info), CACHE_CONFIG_CONTENT_PATHS_FC, TRUE },
1170  { &info, sizeof(info), CACHE_CONFIG_COOKIES_PATHS_FC, TRUE },
1172  { &info, sizeof(info), CACHE_CONFIG_HISTORY_PATHS_FC, TRUE },
1173  };
1174  int i;
1175  BOOL ret;
1176 
1177  for (i = 0; i < ARRAY_SIZE(td); i++)
1178  {
1179  if (td[i].info)
1180  {
1181  memset(&info, 0, sizeof(*td[i].info));
1182  info.dwStructSize = td[i].dwStructSize;
1183  }
1184 
1185  SetLastError(0xdeadbeef);
1186  ret = GetUrlCacheConfigInfoA(td[i].info, NULL, td[i].flags);
1187  ok(ret == td[i].ret, "%d: expected %d, got %d\n", i, td[i].ret, ret);
1188  if (!ret)
1189  ok(GetLastError() == td[i].error, "%d: expected %u, got %u\n", i, td[i].error, GetLastError());
1190  else
1191  {
1192  char path[MAX_PATH], path_win8[MAX_PATH];
1193 
1194  get_cache_path(td[i].flags, path, path_win8);
1195 
1196  ok(info.dwStructSize == td[i].dwStructSize, "got %u\n", info.dwStructSize);
1197  ok(!lstrcmpA(info.CachePath, path) || !lstrcmpA(info.CachePath, path_win8),
1198  "%d: expected %s or %s, got %s\n", i, path, path_win8, info.CachePath);
1199  }
1200  }
1201 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
#define error(str)
Definition: mkdosfs.c:1605
#define CACHE_CONFIG_HISTORY_PATHS_FC
Definition: winineti.h:103
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static void get_cache_path(DWORD flags, char path[MAX_PATH], char path_win8[MAX_PATH])
Definition: urlcache.c:1107
struct _test_info info[]
Definition: SetCursorPos.c:19
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI GetUrlCacheConfigInfoA(LPINTERNET_CACHE_CONFIG_INFOA info, LPDWORD size, DWORD flags)
Definition: urlcache.c:3869
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
GLbitfield flags
Definition: glext.h:7161
int ret
#define CACHE_CONFIG_COOKIES_PATHS_FC
Definition: winineti.h:102
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define memset(x, y, z)
Definition: compat.h:39
#define CACHE_CONFIG_CONTENT_PATHS_FC
Definition: winineti.h:101

Referenced by START_TEST().

◆ test_GetUrlCacheEntryInfoExA()

static void test_GetUrlCacheEntryInfoExA ( void  )
static

Definition at line 109 of file urlcache.c.

110 {
111  BOOL ret;
112  DWORD cbCacheEntryInfo, cbRedirectUrl;
113  INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
114 
115  SetLastError(0xdeadbeef);
117  ok(!ret, "GetUrlCacheEntryInfoEx with NULL URL and NULL args should have failed\n");
119  "GetUrlCacheEntryInfoEx with NULL URL and NULL args should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
120 
121  cbCacheEntryInfo = sizeof(INTERNET_CACHE_ENTRY_INFOA);
122  SetLastError(0xdeadbeef);
123  ret = GetUrlCacheEntryInfoExA("", NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
124  ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
126  "GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %d\n", GetLastError());
127 
129  ok(ret, "GetUrlCacheEntryInfoEx with NULL args failed with error %d\n", GetLastError());
130 
131  cbCacheEntryInfo = 0;
132  SetLastError(0xdeadbeef);
133  ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
134  ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
136  "GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
137 
138  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
139 
140  SetLastError(0xdeadbeef);
141  ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
142  ok(ret == ie10_cache, "GetUrlCacheEntryInfoEx returned %x\n", ret);
144  "GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %d\n", GetLastError());
145 
146  /* Unicode version of function seems to ignore 0x200 flag */
147  ret = GetUrlCacheEntryInfoExW(test_urlW, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
148  ok(ret || broken(old_ie && !ret), "GetUrlCacheEntryInfoExW failed with error %d\n", GetLastError());
149 
150  ret = GetUrlCacheEntryInfoExA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
151  ok(ret, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
152 
153  if (ret) check_cache_entry_infoA("GetUrlCacheEntryInfoEx", lpCacheEntryInfo);
154 
155  lpCacheEntryInfo->CacheEntryType |= 0x10000000; /* INSTALLED_CACHE_ENTRY */
157  ok(ret, "SetUrlCacheEntryInfoA failed with error %d\n", GetLastError());
158 
159  SetLastError(0xdeadbeef);
160  ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
161  ok(ret, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
162 
163  cbCacheEntryInfo = 100000;
164  SetLastError(0xdeadbeef);
165  ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
166  ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
167  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
168 
169  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
170 
171  /* Querying the redirect URL fails with ERROR_INVALID_PARAMETER */
172  SetLastError(0xdeadbeef);
173  ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, &cbRedirectUrl, NULL, 0);
174  ok(!ret, "GetUrlCacheEntryInfoEx should have failed\n");
176  "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
177  SetLastError(0xdeadbeef);
178  ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, &cbRedirectUrl, NULL, 0);
179  ok(!ret, "GetUrlCacheEntryInfoEx should have failed\n");
181  "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
182 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static const WCHAR test_urlW[]
Definition: urlcache.c:38
static void check_cache_entry_infoA(const char *returnedfrom, INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo)
Definition: urlcache.c:52
struct _INTERNET_CACHE_ENTRY_INFOA INTERNET_CACHE_ENTRY_INFOA
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI GetUrlCacheEntryInfoExA(LPCSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufSize, LPSTR lpszReserved, LPDWORD lpdwReserved, LPVOID lpReserved, DWORD dwFlags)
Definition: urlcache.c:1879
Definition: wininet.h:2104
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define CACHE_ENTRY_ATTRIBUTE_FC
Definition: wininet.h:2293
DWORD CacheEntryType
Definition: wininet.h:2108
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static BOOL ie10_cache
Definition: urlcache.c:50
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI GetUrlCacheEntryInfoExW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufSize, LPWSTR lpszReserved, LPDWORD lpdwReserved, LPVOID lpReserved, DWORD dwFlags)
Definition: urlcache.c:1992
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI SetUrlCacheEntryInfoA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, DWORD dwFieldControl)
Definition: urlcache.c:2033
static BOOL old_ie
Definition: urlcache.c:49
#define HeapFree(x, y, z)
Definition: compat.h:402
static const char test_url[]
Definition: urlcache.c:37
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by test_urlcacheA().

◆ test_IsUrlCacheEntryExpiredA()

static void test_IsUrlCacheEntryExpiredA ( void  )
static

Definition at line 211 of file urlcache.c.

212 {
213  static const char uncached_url[] =
214  "What's the airspeed velocity of an unladen swallow?";
215  BOOL ret;
216  FILETIME ft;
217  DWORD size;
219  ULARGE_INTEGER exp_time;
220 
221  /* The function returns TRUE when the output time is NULL or the tested URL
222  * is NULL.
223  */
225  ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
226  ft.dwLowDateTime = 0xdeadbeef;
227  ft.dwHighDateTime = 0xbaadf00d;
228  ret = IsUrlCacheEntryExpiredA(NULL, 0, &ft);
229  ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
230  ok(ft.dwLowDateTime == 0xdeadbeef && ft.dwHighDateTime == 0xbaadf00d,
231  "expected time to be unchanged, got (%u,%u)\n",
234  ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
235 
236  /* The return value should indicate whether the URL is expired,
237  * and the filetime indicates the last modified time, but a cache entry
238  * with a zero expire time is "not expired".
239  */
240  ft.dwLowDateTime = 0xdeadbeef;
241  ft.dwHighDateTime = 0xbaadf00d;
243  ok(!ret, "expected FALSE\n");
244  ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
245  "expected time (0,0), got (%u,%u)\n",
247 
248  /* Same behavior with bogus flags. */
249  ft.dwLowDateTime = 0xdeadbeef;
250  ft.dwHighDateTime = 0xbaadf00d;
251  ret = IsUrlCacheEntryExpiredA(test_url, 0xffffffff, &ft);
252  ok(!ret, "expected FALSE\n");
253  ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
254  "expected time (0,0), got (%u,%u)\n",
256 
257  /* Set the expire time to a point in the past.. */
259  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
261  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
264  ok(ret, "GetUrlCacheEntryInfo failed: %d\n", GetLastError());
265  GetSystemTimeAsFileTime(&info->ExpireTime);
266  exp_time.u.LowPart = info->ExpireTime.dwLowDateTime;
267  exp_time.u.HighPart = info->ExpireTime.dwHighDateTime;
268  exp_time.QuadPart -= 10 * 60 * (ULONGLONG)10000000;
269  info->ExpireTime.dwLowDateTime = exp_time.u.LowPart;
270  info->ExpireTime.dwHighDateTime = exp_time.u.HighPart;
272  ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
273  ft.dwLowDateTime = 0xdeadbeef;
274  ft.dwHighDateTime = 0xbaadf00d;
275  /* and the entry should be expired. */
277  ok(ret, "expected TRUE\n");
278  /* The modified time returned is 0. */
279  ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
280  "expected time (0,0), got (%u,%u)\n",
282  /* Set the expire time to a point in the future.. */
283  exp_time.QuadPart += 20 * 60 * (ULONGLONG)10000000;
284  info->ExpireTime.dwLowDateTime = exp_time.u.LowPart;
285  info->ExpireTime.dwHighDateTime = exp_time.u.HighPart;
287  ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
288  ft.dwLowDateTime = 0xdeadbeef;
289  ft.dwHighDateTime = 0xbaadf00d;
290  /* and the entry should no longer be expired. */
292  ok(!ret, "expected FALSE\n");
293  /* The modified time returned is still 0. */
294  ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
295  "expected time (0,0), got (%u,%u)\n",
297  /* Set the modified time... */
298  GetSystemTimeAsFileTime(&info->LastModifiedTime);
300  ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
301  /* and the entry should still be unexpired.. */
303  ok(!ret, "expected FALSE\n");
304  /* but the modified time returned is the last modified time just set. */
305  ok(ft.dwLowDateTime == info->LastModifiedTime.dwLowDateTime &&
306  ft.dwHighDateTime == info->LastModifiedTime.dwHighDateTime,
307  "expected time (%u,%u), got (%u,%u)\n",
308  info->LastModifiedTime.dwLowDateTime,
309  info->LastModifiedTime.dwHighDateTime,
312 
313  /* An uncached URL is implicitly expired, but with unknown time. */
314  ft.dwLowDateTime = 0xdeadbeef;
315  ft.dwHighDateTime = 0xbaadf00d;
316  ret = IsUrlCacheEntryExpiredA(uncached_url, 0, &ft);
317  ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
318  ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
319  "expected time (0,0), got (%u,%u)\n",
321 }
#define CACHE_ENTRY_EXPTIME_FC
Definition: wininet.h:2296
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define CACHE_ENTRY_MODTIME_FC
Definition: wininet.h:2295
struct _ULARGE_INTEGER::@3765 u
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
struct _test_info info[]
Definition: SetCursorPos.c:19
DWORD dwHighDateTime
Definition: mapidefs.h:66
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
Definition: wininet.h:2104
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static BOOL ie10_cache
Definition: urlcache.c:50
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
uint64_t ULONGLONG
Definition: typedefs.h:66
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI GetUrlCacheEntryInfoA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize)
Definition: urlcache.c:1898
int ret
BOOL WINAPI IsUrlCacheEntryExpiredA(LPCSTR url, DWORD dwFlags, FILETIME *pftLastModified)
Definition: urlcache.c:3990
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI SetUrlCacheEntryInfoA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, DWORD dwFieldControl)
Definition: urlcache.c:2033
#define HeapFree(x, y, z)
Definition: compat.h:402
DWORD dwLowDateTime
Definition: mapidefs.h:65
static const char test_url[]
Definition: urlcache.c:37
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by test_urlcacheA().

◆ test_RetrieveUrlCacheEntryA()

static void test_RetrieveUrlCacheEntryA ( void  )
static

Definition at line 184 of file urlcache.c.

185 {
186  BOOL ret;
187  DWORD cbCacheEntryInfo;
188 
189  cbCacheEntryInfo = 0;
190  SetLastError(0xdeadbeef);
191  ret = RetrieveUrlCacheEntryFileA(NULL, NULL, &cbCacheEntryInfo, 0);
192  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
193  ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
194 
195  if (0)
196  {
197  /* Crashes on Win9x, NT4 and W2K */
198  SetLastError(0xdeadbeef);
200  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
201  ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
202  }
203 
204  SetLastError(0xdeadbeef);
205  cbCacheEntryInfo = 100000;
206  ret = RetrieveUrlCacheEntryFileA(NULL, NULL, &cbCacheEntryInfo, 0);
207  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
208  ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
209 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI RetrieveUrlCacheEntryFileA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize, DWORD dwReserved)
Definition: urlcache.c:2183
static const char test_url[]
Definition: urlcache.c:37

Referenced by test_urlcacheA().

◆ test_trailing_slash()

static void test_trailing_slash ( void  )
static

Definition at line 1080 of file urlcache.c.

1081 {
1082  char filename[MAX_PATH];
1083  BYTE zero_byte = 0;
1084  BOOL ret;
1085 
1086  static const FILETIME filetime_zero;
1087  static char url_with_slash[] = "http://testing.cache.com/";
1088 
1089 
1090  ret = CreateUrlCacheEntryA(url_with_slash, 0, "html", filename, 0);
1091  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
1092 
1094 
1095  ret = CommitUrlCacheEntryA("Visited: http://testing.cache.com/", NULL, filetime_zero, filetime_zero,
1096  NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
1097  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
1098 
1099  ok(cache_entry_exists("Visited: http://testing.cache.com/"), "cache entry does not exist\n");
1100  ok(!cache_entry_exists("Visited: http://testing.cache.com"), "cache entry exists\n");
1101 
1102  ret = DeleteUrlCacheEntryA("Visited: http://testing.cache.com/");
1103  ok(ret, "DeleteCacheEntryA failed\n");
1105 }
BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName)
Definition: urlcache.c:3310
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
const char * filename
Definition: ioapi.h:135
static void create_and_write_file(LPCSTR filename, void *data, DWORD len)
Definition: urlcache.c:351
unsigned int BOOL
Definition: ntddk_ex.h:94
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
BOOL WINAPI CreateUrlCacheEntryA(LPCSTR lpszUrlName, DWORD dwExpectedFileSize, LPCSTR lpszFileExtension, LPSTR lpszFileName, DWORD dwReserved)
Definition: urlcache.c:2808
#define NORMAL_CACHE_ENTRY
Definition: wininet.h:2087
#define MAX_PATH
Definition: compat.h:26
int ret
unsigned char BYTE
Definition: mem.h:68
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI CommitUrlCacheEntryA(LPCSTR lpszUrlName, LPCSTR lpszLocalFileName, FILETIME ExpireTime, FILETIME LastModifiedTime, DWORD CacheEntryType, LPBYTE lpHeaderInfo, DWORD dwHeaderSize, LPCSTR lpszFileExtension, LPCSTR lpszOriginalUrl)
Definition: urlcache.c:3075
static BOOL cache_entry_exists(const char *url)
Definition: urlcache.c:1068

Referenced by START_TEST().

◆ test_urlcacheA()

static void test_urlcacheA ( void  )
static

Definition at line 368 of file urlcache.c.

369 {
370  static char long_url[300] = "http://www.winehq.org/";
371  static char ok_header[] = "HTTP/1.0 200 OK\r\n\r\n";
372  BOOL ret;
373  HANDLE hFile;
374  BYTE zero_byte = 0;
375  INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
376  INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo2;
377  DWORD cbCacheEntryInfo;
378  static const FILETIME filetime_zero;
379  FILETIME now;
380  int len;
381 
382  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
383  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
384 
385  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
386  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
389 
390  ok(lstrcmpiA(filenameA, filenameA1), "expected a different file name\n");
391 
393 
394  ret = CommitUrlCacheEntryA(test_url1, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
395  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
396  cbCacheEntryInfo = 0;
397  ret = GetUrlCacheEntryInfoA(test_url1, NULL, &cbCacheEntryInfo);
398  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
400  "GetUrlCacheEntryInfo should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
401  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
402  ret = GetUrlCacheEntryInfoA(test_url1, lpCacheEntryInfo, &cbCacheEntryInfo);
403  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
404  ok(!memcmp(&lpCacheEntryInfo->ExpireTime, &filetime_zero, sizeof(FILETIME)),
405  "expected zero ExpireTime\n");
406  ok(!memcmp(&lpCacheEntryInfo->LastModifiedTime, &filetime_zero, sizeof(FILETIME)),
407  "expected zero LastModifiedTime\n");
409  broken(lpCacheEntryInfo->CacheEntryType == NORMAL_CACHE_ENTRY /* NT4/W2k */),
410  "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x\n",
411  lpCacheEntryInfo->CacheEntryType);
412  ok(!U(*lpCacheEntryInfo).dwExemptDelta, "expected dwExemptDelta 0, got %d\n",
413  U(*lpCacheEntryInfo).dwExemptDelta);
414 
415  /* Make sure there is a notable change in timestamps */
416  Sleep(1000);
417 
418  /* A subsequent commit with a different time/type doesn't change most of the entry */
421  (LPBYTE)ok_header, strlen(ok_header), NULL, NULL);
422  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
423  cbCacheEntryInfo = 0;
424  ret = GetUrlCacheEntryInfoA(test_url1, NULL, &cbCacheEntryInfo);
425  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
427  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
428  lpCacheEntryInfo2 = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
429  ret = GetUrlCacheEntryInfoA(test_url1, lpCacheEntryInfo2, &cbCacheEntryInfo);
430  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
431  /* but it does change the time.. */
432  ok(memcmp(&lpCacheEntryInfo2->ExpireTime, &filetime_zero, sizeof(FILETIME)),
433  "expected positive ExpireTime\n");
434  ok(memcmp(&lpCacheEntryInfo2->LastModifiedTime, &filetime_zero, sizeof(FILETIME)),
435  "expected positive LastModifiedTime\n");
437  broken(lpCacheEntryInfo2->CacheEntryType == NORMAL_CACHE_ENTRY /* NT4/W2k */),
438  "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x\n",
439  lpCacheEntryInfo2->CacheEntryType);
440  /* and set the headers. */
441  ok(lpCacheEntryInfo2->dwHeaderInfoSize == 19,
442  "expected headers size 19, got %d\n",
443  lpCacheEntryInfo2->dwHeaderInfoSize);
444  /* Hit rate gets incremented by 1 */
445  ok((lpCacheEntryInfo->dwHitRate + 1) == lpCacheEntryInfo2->dwHitRate,
446  "HitRate not incremented by one on commit\n");
447  /* Last access time should be updated */
448  ok(!(lpCacheEntryInfo->LastAccessTime.dwHighDateTime == lpCacheEntryInfo2->LastAccessTime.dwHighDateTime &&
449  lpCacheEntryInfo->LastAccessTime.dwLowDateTime == lpCacheEntryInfo2->LastAccessTime.dwLowDateTime),
450  "Last accessed time was not updated by commit\n");
451  /* File extension should be unset */
452  ok(lpCacheEntryInfo2->lpszFileExtension == NULL,
453  "Fileextension isn't unset: %s\n",
454  lpCacheEntryInfo2->lpszFileExtension);
455  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
456  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo2);
457 
458  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
459  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
460 
461  cbCacheEntryInfo = 0;
462  SetLastError(0xdeadbeef);
463  ret = RetrieveUrlCacheEntryFileA(test_url, NULL, &cbCacheEntryInfo, 0);
464  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
466  "RetrieveUrlCacheEntryFile should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
467 
468  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
469  ret = RetrieveUrlCacheEntryFileA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, 0);
470  ok(ret, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
471 
472  if (ret) check_cache_entry_infoA("RetrieveUrlCacheEntryFile", lpCacheEntryInfo);
473 
474  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
475 
476  cbCacheEntryInfo = 0;
477  SetLastError(0xdeadbeef);
478  ret = RetrieveUrlCacheEntryFileA(test_url1, NULL, &cbCacheEntryInfo, 0);
479  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
481  "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_DATA instead of %d\n", GetLastError());
482 
483  if (pUnlockUrlCacheEntryFileA)
484  {
485  ret = pUnlockUrlCacheEntryFileA(test_url, 0);
486  ok(ret, "UnlockUrlCacheEntryFileA failed with error %d\n", GetLastError());
487  }
488 
489  /* test Find*UrlCacheEntry functions */
491 
495 
496  if (pDeleteUrlCacheEntryA)
497  {
498  ret = pDeleteUrlCacheEntryA(test_url);
499  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
500  ret = pDeleteUrlCacheEntryA(test_url1);
501  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
502  }
503 
504  SetLastError(0xdeadbeef);
506  ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "local file should no longer exist\n");
507 
508  /* Creating two entries with the same URL */
509  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
510  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
511 
512  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
513  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
514 
515  ok(lstrcmpiA(filenameA, filenameA1), "expected a different file name\n");
516 
521 
522  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero,
523  filetime_zero, NORMAL_CACHE_ENTRY, (LPBYTE)ok_header,
524  strlen(ok_header), "html", NULL);
525  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
528  ret = CommitUrlCacheEntryA(test_url, filenameA1, filetime_zero,
529  filetime_zero, COOKIE_CACHE_ENTRY, NULL, 0, "html", NULL);
530  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
531  /* By committing the same URL a second time, the prior entry is
532  * overwritten...
533  */
534  cbCacheEntryInfo = 0;
535  SetLastError(0xdeadbeef);
536  ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
537  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
539  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
540  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
541  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
542  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
543  /* with the previous entry type retained.. */
544  ok(lpCacheEntryInfo->CacheEntryType & NORMAL_CACHE_ENTRY,
545  "expected cache entry type NORMAL_CACHE_ENTRY, got %d (0x%08x)\n",
546  lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
547  /* and the headers overwritten.. */
548  ok(!lpCacheEntryInfo->dwHeaderInfoSize, "expected headers size 0, got %d\n",
549  lpCacheEntryInfo->dwHeaderInfoSize);
550  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
551  /* and the previous filename shouldn't exist. */
554 
555  if (pDeleteUrlCacheEntryA)
556  {
557  ret = pDeleteUrlCacheEntryA(test_url);
558  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
561  /* Just in case, clean up files */
564  }
565 
566  /* Check whether a retrieved cache entry can be deleted before it's
567  * unlocked:
568  */
569  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
570  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
571  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
572  NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
573  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
574 
575  cbCacheEntryInfo = 0;
576  SetLastError(0xdeadbeef);
577  ret = RetrieveUrlCacheEntryFileA(test_url, NULL, &cbCacheEntryInfo, 0);
578  ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
580  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
581 
582  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
583  ret = RetrieveUrlCacheEntryFileA(test_url, lpCacheEntryInfo,
584  &cbCacheEntryInfo, 0);
585  ok(ret, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
586 
587  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
588 
589  if (pDeleteUrlCacheEntryA)
590  {
591  ret = pDeleteUrlCacheEntryA(test_url);
592  ok(!ret, "Expected failure\n");
594  "Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
596  }
597 
598  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
599  memset(lpCacheEntryInfo, 0, cbCacheEntryInfo);
600  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
601  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
602  ok(lpCacheEntryInfo->CacheEntryType & 0x400000,
603  "CacheEntryType hasn't PENDING_DELETE_CACHE_ENTRY set, (flags %08x)\n",
604  lpCacheEntryInfo->CacheEntryType);
605  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
606 
607  if (pUnlockUrlCacheEntryFileA)
608  {
610  ret = pUnlockUrlCacheEntryFileA(test_url, 0);
611  ok(ret, "UnlockUrlCacheEntryFileA failed: %d\n", GetLastError());
612  /* By unlocking the already-deleted cache entry, the file associated
613  * with it is deleted..
614  */
616  /* (just in case, delete file) */
618  }
619  if (pDeleteUrlCacheEntryA)
620  {
621  /* and a subsequent deletion should fail. */
622  ret = pDeleteUrlCacheEntryA(test_url);
623  ok(!ret, "Expected failure\n");
625  "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
626  }
627 
628  /* Test whether preventing a file from being deleted causes
629  * DeleteUrlCacheEntryA to fail.
630  */
631  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
632  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
633 
636 
637  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero,
638  filetime_zero, NORMAL_CACHE_ENTRY, (LPBYTE)ok_header,
639  strlen(ok_header), "html", NULL);
640  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
644  ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA failed: %d\n",
645  GetLastError());
646  if (pDeleteUrlCacheEntryA)
647  {
648  /* DeleteUrlCacheEntryA should succeed.. */
649  ret = pDeleteUrlCacheEntryA(test_url);
650  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
651  }
653  if (pDeleteUrlCacheEntryA)
654  {
655  /* and a subsequent deletion should fail.. */
656  ret = pDeleteUrlCacheEntryA(test_url);
657  ok(!ret, "Expected failure\n");
659  "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
660  }
661  /* and the file should be untouched. */
664 
665  /* Try creating a sticky entry. Unlike non-sticky entries, the filename
666  * must have been set already.
667  */
668  SetLastError(0xdeadbeef);
669  ret = CommitUrlCacheEntryA(test_url, NULL, filetime_zero, filetime_zero,
670  STICKY_CACHE_ENTRY, (LPBYTE)ok_header, strlen(ok_header), "html",
671  NULL);
672  ok(ret == ie10_cache, "CommitUrlCacheEntryA returned %x\n", ret);
674  "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
675  SetLastError(0xdeadbeef);
676  ret = CommitUrlCacheEntryA(test_url, NULL, filetime_zero, filetime_zero,
678  (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
679  ok(ret == ie10_cache, "CommitUrlCacheEntryA returned %x\n", ret);
681  "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
682 
683  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
684  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
686  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
688  (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
689  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
690  cbCacheEntryInfo = 0;
691  SetLastError(0xdeadbeef);
692  ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
693  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
695  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
696  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
697  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
698  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
700  "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
701  lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
702  ok(U(*lpCacheEntryInfo).dwExemptDelta == 86400,
703  "expected dwExemptDelta 86400, got %d\n",
704  U(*lpCacheEntryInfo).dwExemptDelta);
705  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
706  if (pDeleteUrlCacheEntryA)
707  {
708  ret = pDeleteUrlCacheEntryA(test_url);
709  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
710  /* When explicitly deleting the cache entry, the file is also deleted */
712  }
713  /* Test once again, setting the exempt delta via SetUrlCacheEntryInfo */
714  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
715  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
717  ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
719  (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
720  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
721  cbCacheEntryInfo = 0;
722  SetLastError(0xdeadbeef);
723  ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
724  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
726  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
727  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
728  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
729  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
731  "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
732  lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
733  ok(U(*lpCacheEntryInfo).dwExemptDelta == 86400,
734  "expected dwExemptDelta 86400, got %d\n",
735  U(*lpCacheEntryInfo).dwExemptDelta);
736  U(*lpCacheEntryInfo).dwExemptDelta = 0;
737  ret = SetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo,
739  ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
740  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
741  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
742  ok(!U(*lpCacheEntryInfo).dwExemptDelta, "expected dwExemptDelta 0, got %d\n",
743  U(*lpCacheEntryInfo).dwExemptDelta);
744  /* See whether a sticky cache entry has the flag cleared once the exempt
745  * delta is meaningless.
746  */
748  "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
749  lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
750 
751  /* Recommit of Url entry keeps dwExemptDelta */
752  U(*lpCacheEntryInfo).dwExemptDelta = 8600;
753  ret = SetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo,
755  ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
756 
757  ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
758  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
760 
761  ret = CommitUrlCacheEntryA(test_url, filenameA1, filetime_zero, filetime_zero,
763  (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
764  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
765 
766  ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
767  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
768  ok(U(*lpCacheEntryInfo).dwExemptDelta == 8600 || (ie10_cache && U(*lpCacheEntryInfo).dwExemptDelta == 86400),
769  "expected dwExemptDelta 8600, got %d\n", U(*lpCacheEntryInfo).dwExemptDelta);
770 
771  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
772 
773  if (pDeleteUrlCacheEntryA)
774  {
775  ret = pDeleteUrlCacheEntryA(test_url);
776  ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
778  }
779 
780  /* Test if files with identical hash keys are handled correctly */
781  ret = CommitUrlCacheEntryA(test_hash_collisions1, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
782  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
783  ret = CommitUrlCacheEntryA(test_hash_collisions2, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
784  ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
785 
786  cbCacheEntryInfo = 0;
787  ret = GetUrlCacheEntryInfoA(test_hash_collisions1, NULL, &cbCacheEntryInfo);
788  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
790  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
791  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
792  ret = GetUrlCacheEntryInfoA(test_hash_collisions1, lpCacheEntryInfo, &cbCacheEntryInfo);
793  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
794  ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_hash_collisions1),
795  "got incorrect entry: %s\n", lpCacheEntryInfo->lpszSourceUrlName);
796  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
797 
798  cbCacheEntryInfo = 0;
799  ret = GetUrlCacheEntryInfoA(test_hash_collisions2, NULL, &cbCacheEntryInfo);
800  ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
802  "expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
803  lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
804  ret = GetUrlCacheEntryInfoA(test_hash_collisions2, lpCacheEntryInfo, &cbCacheEntryInfo);
805  ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
806  ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_hash_collisions2),
807  "got incorrect entry: %s\n", lpCacheEntryInfo->lpszSourceUrlName);
808  HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
809 
810  if (pDeleteUrlCacheEntryA) {
811  ret = pDeleteUrlCacheEntryA(test_hash_collisions1);
812  ok(ret, "DeleteUrlCacheEntry failed: %d\n", GetLastError());
813  ret = pDeleteUrlCacheEntryA(test_hash_collisions2);
814  ok(ret, "DeleteUrlCacheEntry failed: %d\n", GetLastError());
815  }
816 
817  len = strlen(long_url);
818  memset(long_url+len, 'a', sizeof(long_url)-len);
819  long_url[sizeof(long_url)-1] = 0;
820  ret = CreateUrlCacheEntryA(long_url, 0, NULL, filenameA, 0);
821  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
824 
825  ret = CreateUrlCacheEntryA(long_url, 0, "extension", filenameA, 0);
826  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
829 
830  long_url[250] = 0;
831  ret = CreateUrlCacheEntryA(long_url, 0, NULL, filenameA, 0);
832  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
835 
836  ret = CreateUrlCacheEntryA(long_url, 0, "extension", filenameA, 0);
837  ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
840 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define CloseHandle
Definition: compat.h:406
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
static void test_RetrieveUrlCacheEntryA(void)
Definition: urlcache.c:184
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:48
static void check_cache_entry_infoA(const char *returnedfrom, INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo)
Definition: urlcache.c:52
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void test_find_url_cache_entriesA(void)
Definition: urlcache.c:60
#define U(x)
Definition: wordpad.c:46
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static void create_and_write_file(LPCSTR filename, void *data, DWORD len)
Definition: urlcache.c:351
DWORD dwHighDateTime
Definition: mapidefs.h:66
unsigned char * LPBYTE
Definition: typedefs.h:53
#define STICKY_CACHE_ENTRY
Definition: wininet.h:2088
Definition: wininet.h:2104
unsigned int BOOL
Definition: ntddk_ex.h:94
time_t now
Definition: finger.c:65
#define URLHISTORY_CACHE_ENTRY
Definition: wininet.h:2091
static const char test_url1[]
Definition: urlcache.c:40
FILETIME ExpireTime
Definition: wininet.h:2114
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
DWORD CacheEntryType
Definition: wininet.h:2108
DWORD dwHitRate
Definition: wininet.h:2110
BOOL WINAPI CreateUrlCacheEntryA(LPCSTR lpszUrlName, DWORD dwExpectedFileSize, LPCSTR lpszFileExtension, LPSTR lpszFileName, DWORD dwReserved)
Definition: urlcache.c:2808
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define OPEN_EXISTING
Definition: compat.h:434
LPSTR lpszSourceUrlName
Definition: wininet.h:2106
#define NORMAL_CACHE_ENTRY
Definition: wininet.h:2087
static BOOL ie10_cache
Definition: urlcache.c:50
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
BOOL WINAPI GetUrlCacheEntryInfoA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize)
Definition: urlcache.c:1898
FILETIME LastModifiedTime
Definition: wininet.h:2113
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
static void test_IsUrlCacheEntryExpiredA(void)
Definition: urlcache.c:211
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
#define GENERIC_READ
Definition: compat.h:124
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135
_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:2090
#define CACHE_ENTRY_EXEMPT_DELTA_FC
Definition: wininet.h:2300
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI CommitUrlCacheEntryA(LPCSTR lpszUrlName, LPCSTR lpszLocalFileName, FILETIME ExpireTime, FILETIME LastModifiedTime, DWORD CacheEntryType, LPBYTE lpHeaderInfo, DWORD dwHeaderSize, LPCSTR lpszFileExtension, LPCSTR lpszOriginalUrl)
Definition: urlcache.c:3075
BOOL WINAPI SetUrlCacheEntryInfoA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, DWORD dwFieldControl)
Definition: urlcache.c:2033
static const char test_hash_collisions2[]
Definition: urlcache.c:42
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
FILETIME LastAccessTime
Definition: wininet.h:2115
static const char test_hash_collisions1[]
Definition: urlcache.c:41
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
DWORD dwHeaderInfoSize
Definition: wininet.h:2119
#define memset(x, y, z)
Definition: compat.h:39
#define check_file_exists(f)
Definition: urlcache.c:335
#define HeapFree(x, y, z)
Definition: compat.h:402
BOOL WINAPI RetrieveUrlCacheEntryFileA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize, DWORD dwReserved)
Definition: urlcache.c:2183
DWORD dwLowDateTime
Definition: mapidefs.h:65
LPSTR lpszFileExtension
Definition: wininet.h:2120
#define check_file_not_exists(f)
Definition: urlcache.c:349
static void test_GetUrlCacheEntryInfoExA(void)
Definition: urlcache.c:109
static const char test_url[]
Definition: urlcache.c:37
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
static char filenameA[MAX_PATH+1]
Definition: urlcache.c:47

Referenced by START_TEST().

◆ test_urlcacheW()

static void test_urlcacheW ( void  )
static

Definition at line 842 of file urlcache.c.

843 {
844  static struct test_data
845  {
846  DWORD err;
847  WCHAR url[128];
848  char encoded_url[128];
849  WCHAR extension[32];
850  WCHAR header_info[128];
851  }urls[] = {
852  {
853  0, {'h','t','t','p',':','/','/','T','.','p','l','/','t',0},
854  "http://T.pl/t", {0}, {0}
855  },
856  {
857  0, {'w','w','w','.','T','.','p','l','/','t',0},
858  "www.T.pl/t", {0}, {0}
859  },
860  {
861  0, {'h','t','t','p',':','/','/','w','w','w','.','t','e','s','t',0x15b,0x107,
862  '.','o','r','g','/','t','e','s','t','.','h','t','m','l',0},
863  "http://www.xn--test-ota71c.org/test.html", {'t','x','t',0}, {0}
864  },
865  {
866  0, {'w','w','w','.','T','e','s','t',0x15b,0x107,'.','o','r','g',
867  '/','t','e','s','t','.','h','t','m','l',0},
868  "www.Test\xc5\x9b\xc4\x87.org/test.html", {'a',0x106,'a',0}, {'b',0x106,'b',0}
869  },
870  {
871  0, {'H','t','t','p','s',':','/','/',0x15b,0x15b,0x107,'/','t',0x107,'/',
872  't','e','s','t','?','a','=','%','2','0',0x106,0},
873  "Https://xn--4da1oa/t\xc4\x87/test?a=%20\xc4\x86", {'a',0x15b,'a',0}, {'b',0x15b,'b',0}
874  },
875  {
876  12005, {'h','t','t','p','s',':','/','/','/','/',0x107,'.','o','r','g','/','t','e','s','t',0},
877  "", {0}, {0}
878  },
879  {
880  0, {'C','o','o','k','i','e',':',' ','u','s','e','r','@','h','t','t','p',
881  ':','/','/','t',0x15b,0x107,'.','o','r','g','/',0},
882  "Cookie: user@http://t\xc5\x9b\xc4\x87.org/", {0}, {0}
883  }
884  };
885  static const FILETIME filetime_zero;
886 
887  WCHAR bufW[MAX_PATH];
888  DWORD i;
889  BOOL ret;
890 
891  if(old_ie) {
892  win_skip("urlcache unicode functions\n");
893  return;
894  }
895 
896  if(ie10_cache) {
897  if(!MultiByteToWideChar(CP_ACP, 0, urls[6].encoded_url, -1,
898  urls[6].url, ARRAY_SIZE(urls[6].url)))
899  urls[6].url[0] = 0;
900 
901  trace("converted url in test 6: %s\n", wine_dbgstr_w(urls[6].url));
902  }
903 
904  for(i=0; i<ARRAY_SIZE(urls); i++) {
905  INTERNET_CACHE_ENTRY_INFOA *entry_infoA;
906  INTERNET_CACHE_ENTRY_INFOW *entry_infoW;
907  DWORD size;
908 
909  if(!urls[i].url[0]) {
910  win_skip("No UTF16 version of url (%d)\n", i);
911  continue;
912  }
913 
914  SetLastError(0xdeadbeef);
915  ret = CreateUrlCacheEntryW(urls[i].url, 0, NULL, bufW, 0);
916  if(urls[i].err != 0) {
917  ok(!ret, "%d) CreateUrlCacheEntryW succeeded\n", i);
918  ok(urls[i].err == GetLastError(), "%d) GetLastError() = %d\n", i, GetLastError());
919  continue;
920  }
921  ok(ret, "%d) CreateUrlCacheEntryW failed: %d\n", i, GetLastError());
922 
923  /* dwHeaderSize is ignored, pass 0 to prove it */
924  ret = CommitUrlCacheEntryW(urls[i].url, bufW, filetime_zero, filetime_zero,
925  NORMAL_CACHE_ENTRY, urls[i].header_info, 0, urls[i].extension, NULL);
926  ok(ret, "%d) CommitUrlCacheEntryW failed: %d\n", i, GetLastError());
927 
928  SetLastError(0xdeadbeef);
929  size = 0;
930  ret = GetUrlCacheEntryInfoW(urls[i].url, NULL, &size);
932  "%d) GetLastError() = %d\n", i, GetLastError());
933  entry_infoW = HeapAlloc(GetProcessHeap(), 0, size);
934  ret = GetUrlCacheEntryInfoW(urls[i].url, entry_infoW, &size);
935  ok(ret, "%d) GetUrlCacheEntryInfoW failed: %d\n", i, GetLastError());
936 
937  ret = GetUrlCacheEntryInfoA(urls[i].encoded_url, NULL, &size);
939  "%d) GetLastError() = %d\n", i, GetLastError());
941  win_skip("ANSI version of url is incorrect\n");
942  continue;
943  }
944  entry_infoA = HeapAlloc(GetProcessHeap(), 0, size);
945  ret = GetUrlCacheEntryInfoA(urls[i].encoded_url, entry_infoA, &size);
946  ok(ret, "%d) GetUrlCacheEntryInfoA failed: %d\n", i, GetLastError());
947 
948  ok(entry_infoW->dwStructSize == entry_infoA->dwStructSize,
949  "%d) entry_infoW->dwStructSize = %d, expected %d\n",
950  i, entry_infoW->dwStructSize, entry_infoA->dwStructSize);
951  ok(!lstrcmpW(urls[i].url, entry_infoW->lpszSourceUrlName),
952  "%d) entry_infoW->lpszSourceUrlName = %s\n",
953  i, wine_dbgstr_w(entry_infoW->lpszSourceUrlName));
954  ok(!lstrcmpA(urls[i].encoded_url, entry_infoA->lpszSourceUrlName),
955  "%d) entry_infoA->lpszSourceUrlName = %s\n",
956  i, entry_infoA->lpszSourceUrlName);
957  ok(entry_infoW->CacheEntryType == entry_infoA->CacheEntryType,
958  "%d) entry_infoW->CacheEntryType = %x, expected %x\n",
959  i, entry_infoW->CacheEntryType, entry_infoA->CacheEntryType);
960  ok(entry_infoW->dwUseCount == entry_infoA->dwUseCount,
961  "%d) entry_infoW->dwUseCount = %d, expected %d\n",
962  i, entry_infoW->dwUseCount, entry_infoA->dwUseCount);
963  ok(entry_infoW->dwHitRate == entry_infoA->dwHitRate,
964  "%d) entry_infoW->dwHitRate = %d, expected %d\n",
965  i, entry_infoW->dwHitRate, entry_infoA->dwHitRate);
966  ok(entry_infoW->dwSizeLow == entry_infoA->dwSizeLow,
967  "%d) entry_infoW->dwSizeLow = %d, expected %d\n",
968  i, entry_infoW->dwSizeLow, entry_infoA->dwSizeLow);
969  ok(entry_infoW->dwSizeHigh == entry_infoA->dwSizeHigh,
970  "%d) entry_infoW->dwSizeHigh = %d, expected %d\n",
971  i, entry_infoW->dwSizeHigh, entry_infoA->dwSizeHigh);
972  ok(!memcmp(&entry_infoW->LastModifiedTime, &entry_infoA->LastModifiedTime, sizeof(FILETIME)),
973  "%d) entry_infoW->LastModifiedTime is incorrect\n", i);
974  ok(!memcmp(&entry_infoW->ExpireTime, &entry_infoA->ExpireTime, sizeof(FILETIME)),
975  "%d) entry_infoW->ExpireTime is incorrect\n", i);
976  ok(!memcmp(&entry_infoW->LastAccessTime, &entry_infoA->LastAccessTime, sizeof(FILETIME)),
977  "%d) entry_infoW->LastAccessTime is incorrect\n", i);
978  ok(!memcmp(&entry_infoW->LastSyncTime, &entry_infoA->LastSyncTime, sizeof(FILETIME)),
979  "%d) entry_infoW->LastSyncTime is incorrect\n", i);
980 
981  MultiByteToWideChar(CP_ACP, 0, entry_infoA->lpszLocalFileName, -1, bufW, MAX_PATH);
982  ok(!lstrcmpW(entry_infoW->lpszLocalFileName, bufW),
983  "%d) entry_infoW->lpszLocalFileName = %s, expected %s\n",
984  i, wine_dbgstr_w(entry_infoW->lpszLocalFileName), wine_dbgstr_w(bufW));
985 
986  if(!urls[i].header_info[0]) {
987  ok(!entry_infoW->lpHeaderInfo, "entry_infoW->lpHeaderInfo != NULL\n");
988  }else {
989  ok(!lstrcmpW((WCHAR*)entry_infoW->lpHeaderInfo, urls[i].header_info),
990  "%d) entry_infoW->lpHeaderInfo = %s\n",
991  i, wine_dbgstr_w((WCHAR*)entry_infoW->lpHeaderInfo));
992  }
993 
994  if(!urls[i].extension[0]) {
995  ok(!entry_infoW->lpszFileExtension || (ie10_cache && !entry_infoW->lpszFileExtension[0]),
996  "%d) entry_infoW->lpszFileExtension = %s\n",
997  i, wine_dbgstr_w(entry_infoW->lpszFileExtension));
998  }else {
999  MultiByteToWideChar(CP_ACP, 0, entry_infoA->lpszFileExtension, -1, bufW, MAX_PATH);
1000  ok(!lstrcmpW(entry_infoW->lpszFileExtension, bufW) ||
1001  (ie10_cache && !lstrcmpW(entry_infoW->lpszFileExtension, urls[i].extension)),
1002  "%d) entry_infoW->lpszFileExtension = %s, expected %s\n",
1003  i, wine_dbgstr_w(entry_infoW->lpszFileExtension), wine_dbgstr_w(bufW));
1004  }
1005 
1006  HeapFree(GetProcessHeap(), 0, entry_infoW);
1007  HeapFree(GetProcessHeap(), 0, entry_infoA);
1008 
1009  if(pDeleteUrlCacheEntryA) {
1010  ret = pDeleteUrlCacheEntryA(urls[i].encoded_url);
1011  ok(ret, "%d) DeleteUrlCacheEntryW failed: %d\n", i, GetLastError());
1012  }
1013  }
1014 }
BOOL WINAPI CreateUrlCacheEntryW(LPCWSTR lpszUrlName, DWORD dwExpectedFileSize, LPCWSTR lpszFileExtension, LPWSTR lpszFileName, DWORD dwReserved)
Definition: urlcache.c:2827
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
DWORD dwStructSize
Definition: wininet.h:2105
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define CP_ACP
Definition: compat.h:99
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD dwSizeLow
Definition: wininet.h:2111
DWORD dwHitRate
Definition: wininet.h:2133
LPWSTR lpszFileExtension
Definition: wininet.h:2143
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:2141
Definition: wininet.h:2104
unsigned int BOOL
Definition: ntddk_ex.h:94
FILETIME ExpireTime
Definition: wininet.h:2114
smooth NULL
Definition: ftsmooth.c:416
DWORD CacheEntryType
Definition: wininet.h:2108
DWORD dwHitRate
Definition: wininet.h:2110
LPSTR lpszSourceUrlName
Definition: wininet.h:2106
#define NORMAL_CACHE_ENTRY
Definition: wininet.h:2087
static BOOL ie10_cache
Definition: urlcache.c:50
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
#define trace
Definition: atltest.h:70
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:3097
FILETIME LastAccessTime
Definition: wininet.h:2138
FILETIME ExpireTime
Definition: wininet.h:2137
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR url[]
Definition: encode.c:1432
LPWSTR lpszLocalFileName
Definition: wininet.h:2130
#define MAX_PATH
Definition: compat.h:26
DWORD dwStructSize
Definition: wininet.h:2128
unsigned long DWORD
Definition: ntddk_ex.h:95
LPWSTR lpszSourceUrlName
Definition: wininet.h:2129
BOOL WINAPI GetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize)
Definition: urlcache.c:2022
#define SetLastError(x)
Definition: compat.h:417
LPSTR lpszLocalFileName
Definition: wininet.h:2107
BOOL WINAPI GetUrlCacheEntryInfoA(LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize)
Definition: urlcache.c:1898
FILETIME LastModifiedTime
Definition: wininet.h:2113
DWORD dwUseCount
Definition: wininet.h:2132
int ret
DWORD dwSizeHigh
Definition: wininet.h:2112
#define err(...)
DWORD dwUseCount
Definition: wininet.h:2109
FILETIME LastModifiedTime
Definition: wininet.h:2136
#define ARRAY_SIZE(a)
Definition: main.h:24
FILETIME LastSyncTime
Definition: wininet.h:2116
#define ok(value,...)
Definition: atltest.h:57
FILETIME LastSyncTime
Definition: wininet.h:2139
DWORD dwSizeHigh
Definition: wininet.h:2135
#define MultiByteToWideChar
Definition: compat.h:100
static BOOL old_ie
Definition: urlcache.c:49
DWORD dwSizeLow
Definition: wininet.h:2134
FILETIME LastAccessTime
Definition: wininet.h:2115
DWORD CacheEntryType
Definition: wininet.h:2131
#define win_skip
Definition: test.h:149
#define HeapFree(x, y, z)
Definition: compat.h:402
LPSTR lpszFileExtension
Definition: wininet.h:2120
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
Definition: wininet.h:2127

Referenced by START_TEST().

Variable Documentation

◆ DWORD

Definition at line 45 of file urlcache.c.

Referenced by urlcache_entry_alloc(), and urlcache_entry_free().

◆ filenameA

char filenameA[MAX_PATH+1]
static

Definition at line 47 of file urlcache.c.

Referenced by check_cache_entry_infoA(), and test_urlcacheA().

◆ filenameA1

char filenameA1[MAX_PATH+1]
static

Definition at line 48 of file urlcache.c.

Referenced by test_urlcacheA().

◆ ie10_cache

◆ old_ie

BOOL old_ie = FALSE
static

◆ test_hash_collisions1

const char test_hash_collisions1[] = "Visited: http://winehq.org/doc0.html"
static

Definition at line 41 of file urlcache.c.

Referenced by test_urlcacheA().

◆ test_hash_collisions2

const char test_hash_collisions2[] = "Visited: http://winehq.org/doc75651909.html"
static

Definition at line 42 of file urlcache.c.

Referenced by test_urlcacheA().

◆ test_url

◆ test_url1

const char test_url1[] = "Visited: user@http://urlcachetest.winehq.org/index.html"
static

Definition at line 40 of file urlcache.c.

Referenced by test_urlcacheA().

◆ test_urlW

const WCHAR test_urlW[]
static
Initial value:
= {'h','t','t','p',':','/','/','u','r','l','c','a','c','h','e','t','e','s','t','.',
'w','i','n','e','h','q','.','o','r','g','/','i','n','d','e','x','.','h','t','m','l',0}

Definition at line 38 of file urlcache.c.

Referenced by test_GetUrlCacheEntryInfoExA().