Commit a448427b authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

wininet: Rename URL_CACHEFILE_ENTRY to entry_url.

parent 9d98ced7
...@@ -106,42 +106,42 @@ typedef struct ...@@ -106,42 +106,42 @@ typedef struct
DWORD blocks_used; /* number of 128byte blocks used by this entry */ DWORD blocks_used; /* number of 128byte blocks used by this entry */
} entry_header; } entry_header;
typedef struct _URL_CACHEFILE_ENTRY typedef struct
{ {
entry_header CacheFileEntry; entry_header header;
FILETIME LastModifiedTime; FILETIME modification_time;
FILETIME LastAccessTime; FILETIME access_time;
WORD wExpiredDate; /* expire date in dos format */ WORD expire_date; /* expire date in dos format */
WORD wExpiredTime; /* expire time in dos format */ WORD expire_time; /* expire time in dos format */
DWORD dwUnknown1; /* usually zero */ DWORD unk1; /* usually zero */
ULARGE_INTEGER size; /* see INTERNET_CACHE_ENTRY_INFO::dwSizeLow/High */ ULARGE_INTEGER size; /* see INTERNET_CACHE_ENTRY_INFO::dwSizeLow/High */
DWORD dwUnknown2; /* usually zero */ DWORD unk2; /* usually zero */
DWORD dwExemptDelta; /* see INTERNET_CACHE_ENTRY_INFO::dwExemptDelta */ DWORD exempt_delta; /* see INTERNET_CACHE_ENTRY_INFO::dwExemptDelta */
DWORD dwUnknown3; /* usually 0x60 */ DWORD unk3; /* usually 0x60 */
DWORD dwOffsetUrl; /* offset of start of url from start of entry */ DWORD url_off; /* offset of start of url from start of entry */
BYTE CacheDir; /* index of cache directory this url is stored in */ BYTE cache_dir; /* index of cache directory this url is stored in */
BYTE Unknown4; /* usually zero */ BYTE unk4; /* usually zero */
WORD wUnknown5; /* usually 0x1010 */ WORD unk5; /* usually 0x1010 */
DWORD dwOffsetLocalName; /* offset of start of local filename from start of entry */ DWORD local_name_off; /* offset of start of local filename from start of entry */
DWORD CacheEntryType; /* see INTERNET_CACHE_ENTRY_INFO::CacheEntryType */ DWORD cache_entry_type; /* see INTERNET_CACHE_ENTRY_INFO::CacheEntryType */
DWORD dwOffsetHeaderInfo; /* offset of start of header info from start of entry */ DWORD header_info_off; /* offset of start of header info from start of entry */
DWORD dwHeaderInfoSize; DWORD header_info_size;
DWORD dwOffsetFileExtension; /* offset of start of file extension from start of entry */ DWORD file_extension_off; /* offset of start of file extension from start of entry */
WORD wLastSyncDate; /* last sync date in dos format */ WORD sync_date; /* last sync date in dos format */
WORD wLastSyncTime; /* last sync time in dos format */ WORD sync_time; /* last sync time in dos format */
DWORD dwHitRate; /* see INTERNET_CACHE_ENTRY_INFO::dwHitRate */ DWORD hit_rate; /* see INTERNET_CACHE_ENTRY_INFO::dwHitRate */
DWORD dwUseCount; /* see INTERNET_CACHE_ENTRY_INFO::dwUseCount */ DWORD use_count; /* see INTERNET_CACHE_ENTRY_INFO::dwUseCount */
WORD LastWriteDate; WORD write_date;
WORD LastWriteTime; WORD write_time;
DWORD dwUnknown7; /* usually zero */ DWORD unk7; /* usually zero */
DWORD dwUnknown8; /* usually zero */ DWORD unk8; /* usually zero */
/* packing to dword align start of next field */ /* packing to dword align start of next field */
/* CHAR szSourceUrlName[]; (url) */ /* CHAR szSourceUrlName[]; (url) */
/* packing to dword align start of next field */ /* packing to dword align start of next field */
/* CHAR szLocalFileName[]; (local file name excluding path) */ /* CHAR szLocalFileName[]; (local file name excluding path) */
/* packing to dword align start of next field */ /* packing to dword align start of next field */
/* CHAR szHeaderInfo[]; (header info) */ /* CHAR szHeaderInfo[]; (header info) */
} URL_CACHEFILE_ENTRY; } entry_url;
struct _HASH_ENTRY struct _HASH_ENTRY
{ {
...@@ -1038,7 +1038,7 @@ static void URLCache_FileTimeToDosDateTime(const FILETIME *ft, WORD *fatdate, ...@@ -1038,7 +1038,7 @@ static void URLCache_FileTimeToDosDateTime(const FILETIME *ft, WORD *fatdate,
* URLCache_DeleteFile (Internal) * URLCache_DeleteFile (Internal)
*/ */
static DWORD URLCache_DeleteFile(const URLCACHECONTAINER *container, static DWORD URLCache_DeleteFile(const URLCACHECONTAINER *container,
URLCACHE_HEADER *header, URL_CACHEFILE_ENTRY *url_entry) URLCACHE_HEADER *header, entry_url *url_entry)
{ {
WIN32_FILE_ATTRIBUTE_DATA attr; WIN32_FILE_ATTRIBUTE_DATA attr;
WCHAR path[MAX_PATH]; WCHAR path[MAX_PATH];
...@@ -1046,18 +1046,18 @@ static DWORD URLCache_DeleteFile(const URLCACHECONTAINER *container, ...@@ -1046,18 +1046,18 @@ static DWORD URLCache_DeleteFile(const URLCACHECONTAINER *container,
DWORD err; DWORD err;
WORD date, time; WORD date, time;
if(!url_entry->dwOffsetLocalName) if(!url_entry->local_name_off)
goto succ; goto succ;
if(!URLCache_LocalFileNameToPathW(container, header, if(!URLCache_LocalFileNameToPathW(container, header,
(LPCSTR)url_entry+url_entry->dwOffsetLocalName, (LPCSTR)url_entry+url_entry->local_name_off,
url_entry->CacheDir, path, &path_size)) url_entry->cache_dir, path, &path_size))
goto succ; goto succ;
if(!GetFileAttributesExW(path, GetFileExInfoStandard, &attr)) if(!GetFileAttributesExW(path, GetFileExInfoStandard, &attr))
goto succ; goto succ;
URLCache_FileTimeToDosDateTime(&attr.ftLastWriteTime, &date, &time); URLCache_FileTimeToDosDateTime(&attr.ftLastWriteTime, &date, &time);
if(date != url_entry->LastWriteDate || time != url_entry->LastWriteTime) if(date != url_entry->write_date || time != url_entry->write_time)
goto succ; goto succ;
err = (DeleteFileW(path) ? ERROR_SUCCESS : GetLastError()); err = (DeleteFileW(path) ? ERROR_SUCCESS : GetLastError());
...@@ -1065,12 +1065,12 @@ static DWORD URLCache_DeleteFile(const URLCACHECONTAINER *container, ...@@ -1065,12 +1065,12 @@ static DWORD URLCache_DeleteFile(const URLCACHECONTAINER *container,
return err; return err;
succ: succ:
if (url_entry->CacheDir < header->DirectoryCount) if (url_entry->cache_dir < header->DirectoryCount)
{ {
if (header->directory_data[url_entry->CacheDir].dwNumFiles) if (header->directory_data[url_entry->cache_dir].dwNumFiles)
header->directory_data[url_entry->CacheDir].dwNumFiles--; header->directory_data[url_entry->cache_dir].dwNumFiles--;
} }
if (url_entry->CacheEntryType & STICKY_CACHE_ENTRY) if (url_entry->cache_entry_type & STICKY_CACHE_ENTRY)
{ {
if (url_entry->size.QuadPart < header->ExemptUsage.QuadPart) if (url_entry->size.QuadPart < header->ExemptUsage.QuadPart)
header->ExemptUsage.QuadPart -= url_entry->size.QuadPart; header->ExemptUsage.QuadPart -= url_entry->size.QuadPart;
...@@ -1095,14 +1095,14 @@ static BOOL urlcache_clean_leaked_entries(URLCACHECONTAINER *container, URLCACHE ...@@ -1095,14 +1095,14 @@ static BOOL urlcache_clean_leaked_entries(URLCACHECONTAINER *container, URLCACHE
leak_off = &header->options[CACHE_HEADER_DATA_ROOT_LEAK_OFFSET]; leak_off = &header->options[CACHE_HEADER_DATA_ROOT_LEAK_OFFSET];
while(*leak_off) { while(*leak_off) {
URL_CACHEFILE_ENTRY *url_entry = (URL_CACHEFILE_ENTRY*)((LPBYTE)header + *leak_off); entry_url *url_entry = (entry_url*)((LPBYTE)header + *leak_off);
if(SUCCEEDED(URLCache_DeleteFile(container, header, url_entry))) { if(SUCCEEDED(URLCache_DeleteFile(container, header, url_entry))) {
*leak_off = url_entry->dwExemptDelta; *leak_off = url_entry->exempt_delta;
URLCache_DeleteEntry(header, &url_entry->CacheFileEntry); URLCache_DeleteEntry(header, &url_entry->header);
freed = TRUE; freed = TRUE;
}else { }else {
leak_off = &url_entry->dwExemptDelta; leak_off = &url_entry->exempt_delta;
} }
} }
...@@ -1176,7 +1176,7 @@ static DWORD URLCache_CopyEntry( ...@@ -1176,7 +1176,7 @@ static DWORD URLCache_CopyEntry(
LPCURLCACHE_HEADER pHeader, LPCURLCACHE_HEADER pHeader,
LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo,
LPDWORD lpdwBufferSize, LPDWORD lpdwBufferSize,
const URL_CACHEFILE_ENTRY * pUrlEntry, const entry_url * pUrlEntry,
BOOL bUnicode) BOOL bUnicode)
{ {
int lenUrl; int lenUrl;
...@@ -1188,29 +1188,27 @@ static DWORD URLCache_CopyEntry( ...@@ -1188,29 +1188,27 @@ static DWORD URLCache_CopyEntry(
lpCacheEntryInfo->lpszFileExtension = NULL; lpCacheEntryInfo->lpszFileExtension = NULL;
lpCacheEntryInfo->lpszLocalFileName = NULL; lpCacheEntryInfo->lpszLocalFileName = NULL;
lpCacheEntryInfo->lpszSourceUrlName = NULL; lpCacheEntryInfo->lpszSourceUrlName = NULL;
lpCacheEntryInfo->CacheEntryType = pUrlEntry->CacheEntryType; lpCacheEntryInfo->CacheEntryType = pUrlEntry->cache_entry_type;
lpCacheEntryInfo->u.dwExemptDelta = pUrlEntry->dwExemptDelta; lpCacheEntryInfo->u.dwExemptDelta = pUrlEntry->exempt_delta;
lpCacheEntryInfo->dwHeaderInfoSize = pUrlEntry->dwHeaderInfoSize; lpCacheEntryInfo->dwHeaderInfoSize = pUrlEntry->header_info_size;
lpCacheEntryInfo->dwHitRate = pUrlEntry->dwHitRate; lpCacheEntryInfo->dwHitRate = pUrlEntry->hit_rate;
lpCacheEntryInfo->dwSizeHigh = pUrlEntry->size.u.HighPart; lpCacheEntryInfo->dwSizeHigh = pUrlEntry->size.u.HighPart;
lpCacheEntryInfo->dwSizeLow = pUrlEntry->size.u.LowPart; lpCacheEntryInfo->dwSizeLow = pUrlEntry->size.u.LowPart;
lpCacheEntryInfo->dwStructSize = sizeof(*lpCacheEntryInfo); lpCacheEntryInfo->dwStructSize = sizeof(*lpCacheEntryInfo);
lpCacheEntryInfo->dwUseCount = pUrlEntry->dwUseCount; lpCacheEntryInfo->dwUseCount = pUrlEntry->use_count;
URLCache_DosDateTimeToFileTime(pUrlEntry->wExpiredDate, pUrlEntry->wExpiredTime, &lpCacheEntryInfo->ExpireTime); URLCache_DosDateTimeToFileTime(pUrlEntry->expire_date, pUrlEntry->expire_time, &lpCacheEntryInfo->ExpireTime);
lpCacheEntryInfo->LastAccessTime.dwHighDateTime = pUrlEntry->LastAccessTime.dwHighDateTime; lpCacheEntryInfo->LastAccessTime = pUrlEntry->access_time;
lpCacheEntryInfo->LastAccessTime.dwLowDateTime = pUrlEntry->LastAccessTime.dwLowDateTime; lpCacheEntryInfo->LastModifiedTime = pUrlEntry->modification_time;
lpCacheEntryInfo->LastModifiedTime.dwHighDateTime = pUrlEntry->LastModifiedTime.dwHighDateTime; URLCache_DosDateTimeToFileTime(pUrlEntry->sync_date, pUrlEntry->sync_time, &lpCacheEntryInfo->LastSyncTime);
lpCacheEntryInfo->LastModifiedTime.dwLowDateTime = pUrlEntry->LastModifiedTime.dwLowDateTime;
URLCache_DosDateTimeToFileTime(pUrlEntry->wLastSyncDate, pUrlEntry->wLastSyncTime, &lpCacheEntryInfo->LastSyncTime);
} }
if ((dwRequiredSize % 4) && (dwRequiredSize < *lpdwBufferSize)) if ((dwRequiredSize % 4) && (dwRequiredSize < *lpdwBufferSize))
ZeroMemory((LPBYTE)lpCacheEntryInfo + dwRequiredSize, 4 - (dwRequiredSize % 4)); ZeroMemory((LPBYTE)lpCacheEntryInfo + dwRequiredSize, 4 - (dwRequiredSize % 4));
dwRequiredSize = DWORD_ALIGN(dwRequiredSize); dwRequiredSize = DWORD_ALIGN(dwRequiredSize);
if (bUnicode) if (bUnicode)
lenUrl = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pUrlEntry + pUrlEntry->dwOffsetUrl, -1, NULL, 0); lenUrl = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pUrlEntry + pUrlEntry->url_off, -1, NULL, 0);
else else
lenUrl = strlen((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetUrl); lenUrl = strlen((LPCSTR)pUrlEntry + pUrlEntry->url_off);
dwRequiredSize += (lenUrl + 1) * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); dwRequiredSize += (lenUrl + 1) * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
/* FIXME: is source url optional? */ /* FIXME: is source url optional? */
...@@ -1220,23 +1218,23 @@ static DWORD URLCache_CopyEntry( ...@@ -1220,23 +1218,23 @@ static DWORD URLCache_CopyEntry(
lpCacheEntryInfo->lpszSourceUrlName = (LPSTR)lpCacheEntryInfo + dwRequiredSize - lenUrlBytes; lpCacheEntryInfo->lpszSourceUrlName = (LPSTR)lpCacheEntryInfo + dwRequiredSize - lenUrlBytes;
if (bUnicode) if (bUnicode)
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pUrlEntry + pUrlEntry->dwOffsetUrl, -1, (LPWSTR)lpCacheEntryInfo->lpszSourceUrlName, lenUrl + 1); MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pUrlEntry + pUrlEntry->url_off, -1, (LPWSTR)lpCacheEntryInfo->lpszSourceUrlName, lenUrl + 1);
else else
memcpy(lpCacheEntryInfo->lpszSourceUrlName, (LPCSTR)pUrlEntry + pUrlEntry->dwOffsetUrl, lenUrlBytes); memcpy(lpCacheEntryInfo->lpszSourceUrlName, (LPCSTR)pUrlEntry + pUrlEntry->url_off, lenUrlBytes);
} }
if ((dwRequiredSize % 4) && (dwRequiredSize < *lpdwBufferSize)) if ((dwRequiredSize % 4) && (dwRequiredSize < *lpdwBufferSize))
ZeroMemory((LPBYTE)lpCacheEntryInfo + dwRequiredSize, 4 - (dwRequiredSize % 4)); ZeroMemory((LPBYTE)lpCacheEntryInfo + dwRequiredSize, 4 - (dwRequiredSize % 4));
dwRequiredSize = DWORD_ALIGN(dwRequiredSize); dwRequiredSize = DWORD_ALIGN(dwRequiredSize);
if (pUrlEntry->dwOffsetLocalName) if (pUrlEntry->local_name_off)
{ {
LONG nLocalFilePathSize; LONG nLocalFilePathSize;
LPSTR lpszLocalFileName; LPSTR lpszLocalFileName;
lpszLocalFileName = (LPSTR)lpCacheEntryInfo + dwRequiredSize; lpszLocalFileName = (LPSTR)lpCacheEntryInfo + dwRequiredSize;
nLocalFilePathSize = *lpdwBufferSize - dwRequiredSize; nLocalFilePathSize = *lpdwBufferSize - dwRequiredSize;
if ((bUnicode && URLCache_LocalFileNameToPathW(pContainer, pHeader, (LPCSTR)pUrlEntry + pUrlEntry->dwOffsetLocalName, pUrlEntry->CacheDir, (LPWSTR)lpszLocalFileName, &nLocalFilePathSize)) || if ((bUnicode && URLCache_LocalFileNameToPathW(pContainer, pHeader, (LPCSTR)pUrlEntry + pUrlEntry->local_name_off, pUrlEntry->cache_dir, (LPWSTR)lpszLocalFileName, &nLocalFilePathSize)) ||
(!bUnicode && URLCache_LocalFileNameToPathA(pContainer, pHeader, (LPCSTR)pUrlEntry + pUrlEntry->dwOffsetLocalName, pUrlEntry->CacheDir, lpszLocalFileName, &nLocalFilePathSize))) (!bUnicode && URLCache_LocalFileNameToPathA(pContainer, pHeader, (LPCSTR)pUrlEntry + pUrlEntry->local_name_off, pUrlEntry->cache_dir, lpszLocalFileName, &nLocalFilePathSize)))
{ {
lpCacheEntryInfo->lpszLocalFileName = lpszLocalFileName; lpCacheEntryInfo->lpszLocalFileName = lpszLocalFileName;
} }
...@@ -1246,35 +1244,35 @@ static DWORD URLCache_CopyEntry( ...@@ -1246,35 +1244,35 @@ static DWORD URLCache_CopyEntry(
ZeroMemory((LPBYTE)lpCacheEntryInfo + dwRequiredSize, 4 - (dwRequiredSize % 4)); ZeroMemory((LPBYTE)lpCacheEntryInfo + dwRequiredSize, 4 - (dwRequiredSize % 4));
dwRequiredSize = DWORD_ALIGN(dwRequiredSize); dwRequiredSize = DWORD_ALIGN(dwRequiredSize);
} }
dwRequiredSize += pUrlEntry->dwHeaderInfoSize + 1; dwRequiredSize += pUrlEntry->header_info_size + 1;
if (*lpdwBufferSize >= dwRequiredSize) if (*lpdwBufferSize >= dwRequiredSize)
{ {
lpCacheEntryInfo->lpHeaderInfo = (LPBYTE)lpCacheEntryInfo + dwRequiredSize - pUrlEntry->dwHeaderInfoSize - 1; lpCacheEntryInfo->lpHeaderInfo = (LPBYTE)lpCacheEntryInfo + dwRequiredSize - pUrlEntry->header_info_size - 1;
memcpy(lpCacheEntryInfo->lpHeaderInfo, (LPCSTR)pUrlEntry + pUrlEntry->dwOffsetHeaderInfo, pUrlEntry->dwHeaderInfoSize); memcpy(lpCacheEntryInfo->lpHeaderInfo, (LPCSTR)pUrlEntry + pUrlEntry->header_info_off, pUrlEntry->header_info_size);
((LPBYTE)lpCacheEntryInfo)[dwRequiredSize - 1] = '\0'; ((LPBYTE)lpCacheEntryInfo)[dwRequiredSize - 1] = '\0';
} }
if ((dwRequiredSize % 4) && (dwRequiredSize < *lpdwBufferSize)) if ((dwRequiredSize % 4) && (dwRequiredSize < *lpdwBufferSize))
ZeroMemory((LPBYTE)lpCacheEntryInfo + dwRequiredSize, 4 - (dwRequiredSize % 4)); ZeroMemory((LPBYTE)lpCacheEntryInfo + dwRequiredSize, 4 - (dwRequiredSize % 4));
dwRequiredSize = DWORD_ALIGN(dwRequiredSize); dwRequiredSize = DWORD_ALIGN(dwRequiredSize);
if (pUrlEntry->dwOffsetFileExtension) if (pUrlEntry->file_extension_off)
{ {
int lenExtension; int lenExtension;
if (bUnicode) if (bUnicode)
lenExtension = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pUrlEntry + pUrlEntry->dwOffsetFileExtension, -1, NULL, 0); lenExtension = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pUrlEntry + pUrlEntry->file_extension_off, -1, NULL, 0);
else else
lenExtension = strlen((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetFileExtension) + 1; lenExtension = strlen((LPCSTR)pUrlEntry + pUrlEntry->file_extension_off) + 1;
dwRequiredSize += lenExtension * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); dwRequiredSize += lenExtension * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
if (*lpdwBufferSize >= dwRequiredSize) if (*lpdwBufferSize >= dwRequiredSize)
{ {
lpCacheEntryInfo->lpszFileExtension = (LPSTR)lpCacheEntryInfo + dwRequiredSize - lenExtension; lpCacheEntryInfo->lpszFileExtension = (LPSTR)lpCacheEntryInfo + dwRequiredSize - lenExtension;
if (bUnicode) if (bUnicode)
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pUrlEntry + pUrlEntry->dwOffsetFileExtension, -1, (LPWSTR)lpCacheEntryInfo->lpszSourceUrlName, lenExtension); MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pUrlEntry + pUrlEntry->file_extension_off, -1, (LPWSTR)lpCacheEntryInfo->lpszSourceUrlName, lenExtension);
else else
memcpy(lpCacheEntryInfo->lpszFileExtension, (LPCSTR)pUrlEntry + pUrlEntry->dwOffsetFileExtension, lenExtension * sizeof(CHAR)); memcpy(lpCacheEntryInfo->lpszFileExtension, (LPCSTR)pUrlEntry + pUrlEntry->file_extension_off, lenExtension * sizeof(CHAR));
} }
if ((dwRequiredSize % 4) && (dwRequiredSize < *lpdwBufferSize)) if ((dwRequiredSize % 4) && (dwRequiredSize < *lpdwBufferSize))
...@@ -1302,24 +1300,24 @@ static DWORD URLCache_CopyEntry( ...@@ -1302,24 +1300,24 @@ static DWORD URLCache_CopyEntry(
* ERROR_INSUFFICIENT_BUFFER if the buffer was too small * ERROR_INSUFFICIENT_BUFFER if the buffer was too small
* *
*/ */
static DWORD URLCache_SetEntryInfo(URL_CACHEFILE_ENTRY * pUrlEntry, const INTERNET_CACHE_ENTRY_INFOW * lpCacheEntryInfo, DWORD dwFieldControl) static DWORD URLCache_SetEntryInfo(entry_url * pUrlEntry, const INTERNET_CACHE_ENTRY_INFOW * lpCacheEntryInfo, DWORD dwFieldControl)
{ {
if (dwFieldControl & CACHE_ENTRY_ACCTIME_FC) if (dwFieldControl & CACHE_ENTRY_ACCTIME_FC)
pUrlEntry->LastAccessTime = lpCacheEntryInfo->LastAccessTime; pUrlEntry->access_time = lpCacheEntryInfo->LastAccessTime;
if (dwFieldControl & CACHE_ENTRY_ATTRIBUTE_FC) if (dwFieldControl & CACHE_ENTRY_ATTRIBUTE_FC)
pUrlEntry->CacheEntryType = lpCacheEntryInfo->CacheEntryType; pUrlEntry->cache_entry_type = lpCacheEntryInfo->CacheEntryType;
if (dwFieldControl & CACHE_ENTRY_EXEMPT_DELTA_FC) if (dwFieldControl & CACHE_ENTRY_EXEMPT_DELTA_FC)
pUrlEntry->dwExemptDelta = lpCacheEntryInfo->u.dwExemptDelta; pUrlEntry->exempt_delta = lpCacheEntryInfo->u.dwExemptDelta;
if (dwFieldControl & CACHE_ENTRY_EXPTIME_FC) if (dwFieldControl & CACHE_ENTRY_EXPTIME_FC)
URLCache_FileTimeToDosDateTime(&lpCacheEntryInfo->ExpireTime, &pUrlEntry->wExpiredDate, &pUrlEntry->wExpiredTime); URLCache_FileTimeToDosDateTime(&lpCacheEntryInfo->ExpireTime, &pUrlEntry->expire_date, &pUrlEntry->expire_time);
if (dwFieldControl & CACHE_ENTRY_HEADERINFO_FC) if (dwFieldControl & CACHE_ENTRY_HEADERINFO_FC)
FIXME("CACHE_ENTRY_HEADERINFO_FC unimplemented\n"); FIXME("CACHE_ENTRY_HEADERINFO_FC unimplemented\n");
if (dwFieldControl & CACHE_ENTRY_HITRATE_FC) if (dwFieldControl & CACHE_ENTRY_HITRATE_FC)
pUrlEntry->dwHitRate = lpCacheEntryInfo->dwHitRate; pUrlEntry->hit_rate = lpCacheEntryInfo->dwHitRate;
if (dwFieldControl & CACHE_ENTRY_MODTIME_FC) if (dwFieldControl & CACHE_ENTRY_MODTIME_FC)
pUrlEntry->LastModifiedTime = lpCacheEntryInfo->LastModifiedTime; pUrlEntry->modification_time = lpCacheEntryInfo->LastModifiedTime;
if (dwFieldControl & CACHE_ENTRY_SYNCTIME_FC) if (dwFieldControl & CACHE_ENTRY_SYNCTIME_FC)
URLCache_FileTimeToDosDateTime(&lpCacheEntryInfo->LastAccessTime, &pUrlEntry->wLastSyncDate, &pUrlEntry->wLastSyncTime); URLCache_FileTimeToDosDateTime(&lpCacheEntryInfo->LastAccessTime, &pUrlEntry->sync_date, &pUrlEntry->sync_time);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -1704,7 +1702,7 @@ static BOOL URLCache_DeleteCacheDirectory(LPCWSTR lpszPath) ...@@ -1704,7 +1702,7 @@ static BOOL URLCache_DeleteCacheDirectory(LPCWSTR lpszPath)
* *
* Checks if entry is locked. Unlocks it if possible. * Checks if entry is locked. Unlocks it if possible.
*/ */
static BOOL URLCache_IsLocked(struct _HASH_ENTRY *hash_entry, URL_CACHEFILE_ENTRY *url_entry) static BOOL URLCache_IsLocked(struct _HASH_ENTRY *hash_entry, entry_url *url_entry)
{ {
FILETIME cur_time; FILETIME cur_time;
ULARGE_INTEGER acc_time, time; ULARGE_INTEGER acc_time, time;
...@@ -1716,15 +1714,15 @@ static BOOL URLCache_IsLocked(struct _HASH_ENTRY *hash_entry, URL_CACHEFILE_ENTR ...@@ -1716,15 +1714,15 @@ static BOOL URLCache_IsLocked(struct _HASH_ENTRY *hash_entry, URL_CACHEFILE_ENTR
time.u.LowPart = cur_time.dwLowDateTime; time.u.LowPart = cur_time.dwLowDateTime;
time.u.HighPart = cur_time.dwHighDateTime; time.u.HighPart = cur_time.dwHighDateTime;
acc_time.u.LowPart = url_entry->LastAccessTime.dwLowDateTime; acc_time.u.LowPart = url_entry->access_time.dwLowDateTime;
acc_time.u.HighPart = url_entry->LastAccessTime.dwHighDateTime; acc_time.u.HighPart = url_entry->access_time.dwHighDateTime;
time.QuadPart -= acc_time.QuadPart; time.QuadPart -= acc_time.QuadPart;
/* check if entry was locked for at least a day */ /* check if entry was locked for at least a day */
if(time.QuadPart > (ULONGLONG)24*60*60*FILETIME_SECOND) { if(time.QuadPart > (ULONGLONG)24*60*60*FILETIME_SECOND) {
URLCache_HashEntrySetFlags(hash_entry, HASHTABLE_URL); URLCache_HashEntrySetFlags(hash_entry, HASHTABLE_URL);
url_entry->dwUseCount = 0; url_entry->use_count = 0;
return FALSE; return FALSE;
} }
...@@ -1747,7 +1745,7 @@ BOOL WINAPI GetUrlCacheEntryInfoExA( ...@@ -1747,7 +1745,7 @@ BOOL WINAPI GetUrlCacheEntryInfoExA(
LPURLCACHE_HEADER pHeader; LPURLCACHE_HEADER pHeader;
struct _HASH_ENTRY * pHashEntry; struct _HASH_ENTRY * pHashEntry;
const entry_header *pEntry; const entry_header *pEntry;
const URL_CACHEFILE_ENTRY * pUrlEntry; const entry_url * pUrlEntry;
URLCACHECONTAINER * pContainer; URLCACHECONTAINER * pContainer;
DWORD error; DWORD error;
...@@ -1806,12 +1804,12 @@ BOOL WINAPI GetUrlCacheEntryInfoExA( ...@@ -1806,12 +1804,12 @@ BOOL WINAPI GetUrlCacheEntryInfoExA(
return FALSE; return FALSE;
} }
pUrlEntry = (const URL_CACHEFILE_ENTRY *)pEntry; pUrlEntry = (const entry_url *)pEntry;
TRACE("Found URL: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetUrl)); TRACE("Found URL: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->url_off));
TRACE("Header info: %s\n", debugstr_an((LPCSTR)pUrlEntry + TRACE("Header info: %s\n", debugstr_an((LPCSTR)pUrlEntry +
pUrlEntry->dwOffsetHeaderInfo, pUrlEntry->dwHeaderInfoSize)); pUrlEntry->header_info_off, pUrlEntry->header_info_size));
if((dwFlags & GET_INSTALLED_ENTRY) && !(pUrlEntry->CacheEntryType & INSTALLED_CACHE_ENTRY)) if((dwFlags & GET_INSTALLED_ENTRY) && !(pUrlEntry->cache_entry_type & INSTALLED_CACHE_ENTRY))
{ {
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
SetLastError(ERROR_FILE_NOT_FOUND); SetLastError(ERROR_FILE_NOT_FOUND);
...@@ -1836,8 +1834,8 @@ BOOL WINAPI GetUrlCacheEntryInfoExA( ...@@ -1836,8 +1834,8 @@ BOOL WINAPI GetUrlCacheEntryInfoExA(
SetLastError(error); SetLastError(error);
return FALSE; return FALSE;
} }
if(pUrlEntry->dwOffsetLocalName) if(pUrlEntry->local_name_off)
TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetLocalName)); TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->local_name_off));
} }
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
...@@ -1887,7 +1885,7 @@ BOOL WINAPI GetUrlCacheEntryInfoExW( ...@@ -1887,7 +1885,7 @@ BOOL WINAPI GetUrlCacheEntryInfoExW(
LPURLCACHE_HEADER pHeader; LPURLCACHE_HEADER pHeader;
struct _HASH_ENTRY * pHashEntry; struct _HASH_ENTRY * pHashEntry;
const entry_header *pEntry; const entry_header *pEntry;
const URL_CACHEFILE_ENTRY * pUrlEntry; const entry_url * pUrlEntry;
URLCACHECONTAINER * pContainer; URLCACHECONTAINER * pContainer;
DWORD error; DWORD error;
...@@ -1949,10 +1947,10 @@ BOOL WINAPI GetUrlCacheEntryInfoExW( ...@@ -1949,10 +1947,10 @@ BOOL WINAPI GetUrlCacheEntryInfoExW(
return FALSE; return FALSE;
} }
pUrlEntry = (const URL_CACHEFILE_ENTRY *)pEntry; pUrlEntry = (const entry_url *)pEntry;
TRACE("Found URL: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetUrl)); TRACE("Found URL: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->url_off));
TRACE("Header info: %s\n", debugstr_an((LPCSTR)pUrlEntry + TRACE("Header info: %s\n", debugstr_an((LPCSTR)pUrlEntry +
pUrlEntry->dwOffsetHeaderInfo, pUrlEntry->dwHeaderInfoSize)); pUrlEntry->header_info_off, pUrlEntry->header_info_size));
if (lpdwCacheEntryInfoBufSize) if (lpdwCacheEntryInfoBufSize)
{ {
...@@ -1972,8 +1970,8 @@ BOOL WINAPI GetUrlCacheEntryInfoExW( ...@@ -1972,8 +1970,8 @@ BOOL WINAPI GetUrlCacheEntryInfoExW(
SetLastError(error); SetLastError(error);
return FALSE; return FALSE;
} }
if(pUrlEntry->dwOffsetLocalName) if(pUrlEntry->local_name_off)
TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetLocalName)); TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->local_name_off));
} }
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
...@@ -2032,7 +2030,7 @@ BOOL WINAPI SetUrlCacheEntryInfoA( ...@@ -2032,7 +2030,7 @@ BOOL WINAPI SetUrlCacheEntryInfoA(
} }
URLCache_SetEntryInfo( URLCache_SetEntryInfo(
(URL_CACHEFILE_ENTRY *)pEntry, (entry_url *)pEntry,
(const INTERNET_CACHE_ENTRY_INFOW *)lpCacheEntryInfo, (const INTERNET_CACHE_ENTRY_INFOW *)lpCacheEntryInfo,
dwFieldControl); dwFieldControl);
...@@ -2089,7 +2087,7 @@ BOOL WINAPI SetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW ...@@ -2089,7 +2087,7 @@ BOOL WINAPI SetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW
} }
URLCache_SetEntryInfo( URLCache_SetEntryInfo(
(URL_CACHEFILE_ENTRY *)pEntry, (entry_url *)pEntry,
lpCacheEntryInfo, lpCacheEntryInfo,
dwFieldControl); dwFieldControl);
...@@ -2112,7 +2110,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA( ...@@ -2112,7 +2110,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA(
LPURLCACHE_HEADER pHeader; LPURLCACHE_HEADER pHeader;
struct _HASH_ENTRY * pHashEntry; struct _HASH_ENTRY * pHashEntry;
entry_header *pEntry; entry_header *pEntry;
URL_CACHEFILE_ENTRY * pUrlEntry; entry_url * pUrlEntry;
URLCACHECONTAINER * pContainer; URLCACHECONTAINER * pContainer;
DWORD error; DWORD error;
...@@ -2163,17 +2161,17 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA( ...@@ -2163,17 +2161,17 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA(
return FALSE; return FALSE;
} }
pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry; pUrlEntry = (entry_url *)pEntry;
if (!pUrlEntry->dwOffsetLocalName) if (!pUrlEntry->local_name_off)
{ {
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
SetLastError(ERROR_INVALID_DATA); SetLastError(ERROR_INVALID_DATA);
return FALSE; return FALSE;
} }
TRACE("Found URL: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetUrl)); TRACE("Found URL: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->url_off));
TRACE("Header info: %s\n", debugstr_an((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetHeaderInfo, TRACE("Header info: %s\n", debugstr_an((LPCSTR)pUrlEntry + pUrlEntry->header_info_off,
pUrlEntry->dwHeaderInfoSize)); pUrlEntry->header_info_size));
error = URLCache_CopyEntry(pContainer, pHeader, lpCacheEntryInfo, error = URLCache_CopyEntry(pContainer, pHeader, lpCacheEntryInfo,
lpdwCacheEntryInfoBufferSize, pUrlEntry, lpdwCacheEntryInfoBufferSize, pUrlEntry,
...@@ -2184,12 +2182,12 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA( ...@@ -2184,12 +2182,12 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA(
SetLastError(error); SetLastError(error);
return FALSE; return FALSE;
} }
TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetLocalName)); TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->local_name_off));
pUrlEntry->dwHitRate++; pUrlEntry->hit_rate++;
pUrlEntry->dwUseCount++; pUrlEntry->use_count++;
URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_LOCK); URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_LOCK);
GetSystemTimeAsFileTime(&pUrlEntry->LastAccessTime); GetSystemTimeAsFileTime(&pUrlEntry->access_time);
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
...@@ -2210,7 +2208,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW( ...@@ -2210,7 +2208,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW(
LPURLCACHE_HEADER pHeader; LPURLCACHE_HEADER pHeader;
struct _HASH_ENTRY * pHashEntry; struct _HASH_ENTRY * pHashEntry;
entry_header *pEntry; entry_header *pEntry;
URL_CACHEFILE_ENTRY * pUrlEntry; entry_url * pUrlEntry;
URLCACHECONTAINER * pContainer; URLCACHECONTAINER * pContainer;
DWORD error; DWORD error;
...@@ -2261,17 +2259,17 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW( ...@@ -2261,17 +2259,17 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW(
return FALSE; return FALSE;
} }
pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry; pUrlEntry = (entry_url *)pEntry;
if (!pUrlEntry->dwOffsetLocalName) if (!pUrlEntry->local_name_off)
{ {
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
SetLastError(ERROR_INVALID_DATA); SetLastError(ERROR_INVALID_DATA);
return FALSE; return FALSE;
} }
TRACE("Found URL: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetUrl)); TRACE("Found URL: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->url_off));
TRACE("Header info: %s\n", debugstr_an((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetHeaderInfo, TRACE("Header info: %s\n", debugstr_an((LPCSTR)pUrlEntry + pUrlEntry->header_info_off,
pUrlEntry->dwHeaderInfoSize)); pUrlEntry->header_info_size));
error = URLCache_CopyEntry( error = URLCache_CopyEntry(
pContainer, pContainer,
...@@ -2286,12 +2284,12 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW( ...@@ -2286,12 +2284,12 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW(
SetLastError(error); SetLastError(error);
return FALSE; return FALSE;
} }
TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetLocalName)); TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->local_name_off));
pUrlEntry->dwHitRate++; pUrlEntry->hit_rate++;
pUrlEntry->dwUseCount++; pUrlEntry->use_count++;
URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_LOCK); URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_LOCK);
GetSystemTimeAsFileTime(&pUrlEntry->LastAccessTime); GetSystemTimeAsFileTime(&pUrlEntry->access_time);
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
...@@ -2302,7 +2300,7 @@ static BOOL DeleteUrlCacheEntryInternal(const URLCACHECONTAINER * pContainer, ...@@ -2302,7 +2300,7 @@ static BOOL DeleteUrlCacheEntryInternal(const URLCACHECONTAINER * pContainer,
LPURLCACHE_HEADER pHeader, struct _HASH_ENTRY *pHashEntry) LPURLCACHE_HEADER pHeader, struct _HASH_ENTRY *pHashEntry)
{ {
entry_header *pEntry; entry_header *pEntry;
URL_CACHEFILE_ENTRY * pUrlEntry; entry_url * pUrlEntry;
pEntry = (entry_header*)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); pEntry = (entry_header*)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry);
if (pEntry->signature != URL_SIGNATURE) if (pEntry->signature != URL_SIGNATURE)
...@@ -2313,11 +2311,11 @@ static BOOL DeleteUrlCacheEntryInternal(const URLCACHECONTAINER * pContainer, ...@@ -2313,11 +2311,11 @@ static BOOL DeleteUrlCacheEntryInternal(const URLCACHECONTAINER * pContainer,
return FALSE; return FALSE;
} }
pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry; pUrlEntry = (entry_url *)pEntry;
if(URLCache_IsLocked(pHashEntry, pUrlEntry)) if(URLCache_IsLocked(pHashEntry, pUrlEntry))
{ {
TRACE("Trying to delete locked entry\n"); TRACE("Trying to delete locked entry\n");
pUrlEntry->CacheEntryType |= PENDING_DELETE_CACHE_ENTRY; pUrlEntry->cache_entry_type |= PENDING_DELETE_CACHE_ENTRY;
SetLastError(ERROR_SHARING_VIOLATION); SetLastError(ERROR_SHARING_VIOLATION);
return FALSE; return FALSE;
} }
...@@ -2329,8 +2327,8 @@ static BOOL DeleteUrlCacheEntryInternal(const URLCACHECONTAINER * pContainer, ...@@ -2329,8 +2327,8 @@ static BOOL DeleteUrlCacheEntryInternal(const URLCACHECONTAINER * pContainer,
else else
{ {
/* Add entry to leaked files list */ /* Add entry to leaked files list */
pUrlEntry->CacheFileEntry.signature = LEAK_SIGNATURE; pUrlEntry->header.signature = LEAK_SIGNATURE;
pUrlEntry->dwExemptDelta = pHeader->options[CACHE_HEADER_DATA_ROOT_LEAK_OFFSET]; pUrlEntry->exempt_delta = pHeader->options[CACHE_HEADER_DATA_ROOT_LEAK_OFFSET];
pHeader->options[CACHE_HEADER_DATA_ROOT_LEAK_OFFSET] = pHashEntry->dwOffsetEntry; pHeader->options[CACHE_HEADER_DATA_ROOT_LEAK_OFFSET] = pHashEntry->dwOffsetEntry;
} }
...@@ -2418,13 +2416,13 @@ static BOOL urlcache_next_entry(URLCACHE_HEADER *header, DWORD *hash_table_off, ...@@ -2418,13 +2416,13 @@ static BOOL urlcache_next_entry(URLCACHE_HEADER *header, DWORD *hash_table_off,
* *
* Rating system is currently not fully compatible with native implementation. * Rating system is currently not fully compatible with native implementation.
*/ */
static DWORD urlcache_rate_entry(URL_CACHEFILE_ENTRY *url_entry, FILETIME *cur_time) static DWORD urlcache_rate_entry(entry_url *url_entry, FILETIME *cur_time)
{ {
ULARGE_INTEGER time, access_time; ULARGE_INTEGER time, access_time;
DWORD rating; DWORD rating;
access_time.u.LowPart = url_entry->LastAccessTime.dwLowDateTime; access_time.u.LowPart = url_entry->access_time.dwLowDateTime;
access_time.u.HighPart = url_entry->LastAccessTime.dwHighDateTime; access_time.u.HighPart = url_entry->access_time.dwHighDateTime;
time.u.LowPart = cur_time->dwLowDateTime; time.u.LowPart = cur_time->dwLowDateTime;
time.u.HighPart = cur_time->dwHighDateTime; time.u.HighPart = cur_time->dwHighDateTime;
...@@ -2433,17 +2431,17 @@ static DWORD urlcache_rate_entry(URL_CACHEFILE_ENTRY *url_entry, FILETIME *cur_t ...@@ -2433,17 +2431,17 @@ static DWORD urlcache_rate_entry(URL_CACHEFILE_ENTRY *url_entry, FILETIME *cur_t
if(time.QuadPart < access_time.QuadPart + (ULONGLONG)10*60*FILETIME_SECOND) if(time.QuadPart < access_time.QuadPart + (ULONGLONG)10*60*FILETIME_SECOND)
return -1; return -1;
if(url_entry->CacheEntryType & STICKY_CACHE_ENTRY) if(url_entry->cache_entry_type & STICKY_CACHE_ENTRY)
if(time.QuadPart < access_time.QuadPart + (ULONGLONG)url_entry->dwExemptDelta*FILETIME_SECOND) if(time.QuadPart < access_time.QuadPart + (ULONGLONG)url_entry->exempt_delta*FILETIME_SECOND)
return -1; return -1;
time.QuadPart = (time.QuadPart-access_time.QuadPart)/FILETIME_SECOND; time.QuadPart = (time.QuadPart-access_time.QuadPart)/FILETIME_SECOND;
rating = 400*60*60*24/(60*60*24+time.QuadPart); rating = 400*60*60*24/(60*60*24+time.QuadPart);
if(url_entry->dwHitRate > 100) if(url_entry->hit_rate > 100)
rating += 100; rating += 100;
else else
rating += url_entry->dwHitRate; rating += url_entry->hit_rate;
return rating; return rating;
} }
...@@ -2522,7 +2520,7 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter) ...@@ -2522,7 +2520,7 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter)
URLCACHE_HEADER *header; URLCACHE_HEADER *header;
struct _HASH_ENTRY *hash_entry; struct _HASH_ENTRY *hash_entry;
entry_header *entry; entry_header *entry;
URL_CACHEFILE_ENTRY *url_entry; entry_url *url_entry;
ULONGLONG desired_size, cur_size; ULONGLONG desired_size, cur_size;
DWORD delete_factor, hash_table_off, hash_table_entry; DWORD delete_factor, hash_table_off, hash_table_entry;
DWORD rate[100], rate_no; DWORD rate[100], rate_no;
...@@ -2566,8 +2564,8 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter) ...@@ -2566,8 +2564,8 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter)
continue; continue;
} }
url_entry = (URL_CACHEFILE_ENTRY*)entry; url_entry = (entry_url*)entry;
if(url_entry->CacheEntryType & filter) if(url_entry->cache_entry_type & filter)
continue; continue;
rate[rate_no] = urlcache_rate_entry(url_entry, &cur_time); rate[rate_no] = urlcache_rate_entry(url_entry, &cur_time);
...@@ -2592,12 +2590,12 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter) ...@@ -2592,12 +2590,12 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter)
if(entry->signature != URL_SIGNATURE) if(entry->signature != URL_SIGNATURE)
continue; continue;
url_entry = (URL_CACHEFILE_ENTRY*)entry; url_entry = (entry_url*)entry;
if(url_entry->CacheEntryType & filter) if(url_entry->cache_entry_type & filter)
continue; continue;
if(urlcache_rate_entry(url_entry, &cur_time) <= delete_factor) { if(urlcache_rate_entry(url_entry, &cur_time) <= delete_factor) {
TRACE("deleting file: %s\n", debugstr_a((char*)url_entry+url_entry->dwOffsetLocalName)); TRACE("deleting file: %s\n", debugstr_a((char*)url_entry+url_entry->local_name_off));
DeleteUrlCacheEntryInternal(container, header, hash_entry); DeleteUrlCacheEntryInternal(container, header, hash_entry);
if(header->CacheUsage.QuadPart+header->ExemptUsage.QuadPart <= desired_size) if(header->CacheUsage.QuadPart+header->ExemptUsage.QuadPart <= desired_size)
...@@ -2650,7 +2648,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileA( ...@@ -2650,7 +2648,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileA(
LPURLCACHE_HEADER pHeader; LPURLCACHE_HEADER pHeader;
struct _HASH_ENTRY * pHashEntry; struct _HASH_ENTRY * pHashEntry;
entry_header *pEntry; entry_header *pEntry;
URL_CACHEFILE_ENTRY * pUrlEntry; entry_url * pUrlEntry;
URLCACHECONTAINER * pContainer; URLCACHECONTAINER * pContainer;
DWORD error; DWORD error;
...@@ -2697,18 +2695,18 @@ BOOL WINAPI UnlockUrlCacheEntryFileA( ...@@ -2697,18 +2695,18 @@ BOOL WINAPI UnlockUrlCacheEntryFileA(
return FALSE; return FALSE;
} }
pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry; pUrlEntry = (entry_url *)pEntry;
if (pUrlEntry->dwUseCount == 0) if (pUrlEntry->use_count == 0)
{ {
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
return FALSE; return FALSE;
} }
pUrlEntry->dwUseCount--; pUrlEntry->use_count--;
if (!pUrlEntry->dwUseCount) if (!pUrlEntry->use_count)
{ {
URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_URL); URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_URL);
if (pUrlEntry->CacheEntryType & PENDING_DELETE_CACHE_ENTRY) if (pUrlEntry->cache_entry_type & PENDING_DELETE_CACHE_ENTRY)
DeleteUrlCacheEntryInternal(pContainer, pHeader, pHashEntry); DeleteUrlCacheEntryInternal(pContainer, pHeader, pHashEntry);
} }
...@@ -2726,7 +2724,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileW( LPCWSTR lpszUrlName, DWORD dwReserved ) ...@@ -2726,7 +2724,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileW( LPCWSTR lpszUrlName, DWORD dwReserved )
LPURLCACHE_HEADER pHeader; LPURLCACHE_HEADER pHeader;
struct _HASH_ENTRY * pHashEntry; struct _HASH_ENTRY * pHashEntry;
entry_header *pEntry; entry_header *pEntry;
URL_CACHEFILE_ENTRY * pUrlEntry; entry_url * pUrlEntry;
URLCACHECONTAINER * pContainer; URLCACHECONTAINER * pContainer;
DWORD error; DWORD error;
...@@ -2773,15 +2771,15 @@ BOOL WINAPI UnlockUrlCacheEntryFileW( LPCWSTR lpszUrlName, DWORD dwReserved ) ...@@ -2773,15 +2771,15 @@ BOOL WINAPI UnlockUrlCacheEntryFileW( LPCWSTR lpszUrlName, DWORD dwReserved )
return FALSE; return FALSE;
} }
pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry; pUrlEntry = (entry_url *)pEntry;
if (pUrlEntry->dwUseCount == 0) if (pUrlEntry->use_count == 0)
{ {
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
return FALSE; return FALSE;
} }
pUrlEntry->dwUseCount--; pUrlEntry->use_count--;
if (!pUrlEntry->dwUseCount) if (!pUrlEntry->use_count)
URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_URL); URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_URL);
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
...@@ -3077,7 +3075,7 @@ static BOOL CommitUrlCacheEntryInternal( ...@@ -3077,7 +3075,7 @@ static BOOL CommitUrlCacheEntryInternal(
LPURLCACHE_HEADER pHeader; LPURLCACHE_HEADER pHeader;
struct _HASH_ENTRY * pHashEntry; struct _HASH_ENTRY * pHashEntry;
entry_header *pEntry; entry_header *pEntry;
URL_CACHEFILE_ENTRY * pUrlEntry; entry_url * pUrlEntry;
DWORD url_entry_offset; DWORD url_entry_offset;
DWORD dwBytesNeeded = DWORD_ALIGN(sizeof(*pUrlEntry)); DWORD dwBytesNeeded = DWORD_ALIGN(sizeof(*pUrlEntry));
DWORD dwOffsetLocalFileName = 0; DWORD dwOffsetLocalFileName = 0;
...@@ -3152,7 +3150,7 @@ static BOOL CommitUrlCacheEntryInternal( ...@@ -3152,7 +3150,7 @@ static BOOL CommitUrlCacheEntryInternal(
if (URLCache_FindHash(pHeader, lpszUrlNameA, &pHashEntry)) if (URLCache_FindHash(pHeader, lpszUrlNameA, &pHashEntry))
{ {
URL_CACHEFILE_ENTRY *pUrlEntry = (URL_CACHEFILE_ENTRY*)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); entry_url *pUrlEntry = (entry_url*)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry);
if (URLCache_IsLocked(pHashEntry, pUrlEntry)) if (URLCache_IsLocked(pHashEntry, pUrlEntry))
{ {
TRACE("Trying to overwrite locked entry\n"); TRACE("Trying to overwrite locked entry\n");
...@@ -3160,8 +3158,8 @@ static BOOL CommitUrlCacheEntryInternal( ...@@ -3160,8 +3158,8 @@ static BOOL CommitUrlCacheEntryInternal(
goto cleanup; goto cleanup;
} }
hit_rate = pUrlEntry->dwHitRate; hit_rate = pUrlEntry->hit_rate;
exempt_delta = pUrlEntry->dwExemptDelta; exempt_delta = pUrlEntry->exempt_delta;
DeleteUrlCacheEntryInternal(pContainer, pHeader, pHashEntry); DeleteUrlCacheEntryInternal(pContainer, pHeader, pHashEntry);
} }
...@@ -3245,42 +3243,42 @@ static BOOL CommitUrlCacheEntryInternal( ...@@ -3245,42 +3243,42 @@ static BOOL CommitUrlCacheEntryInternal(
goto cleanup; goto cleanup;
/* FindFirstFreeEntry fills in blocks used */ /* FindFirstFreeEntry fills in blocks used */
pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry; pUrlEntry = (entry_url *)pEntry;
url_entry_offset = (LPBYTE)pUrlEntry - (LPBYTE)pHeader; url_entry_offset = (LPBYTE)pUrlEntry - (LPBYTE)pHeader;
pUrlEntry->CacheFileEntry.signature = URL_SIGNATURE; pUrlEntry->header.signature = URL_SIGNATURE;
pUrlEntry->CacheDir = cDirectory; pUrlEntry->cache_dir = cDirectory;
pUrlEntry->CacheEntryType = CacheEntryType | pContainer->default_entry_type; pUrlEntry->cache_entry_type = CacheEntryType | pContainer->default_entry_type;
pUrlEntry->dwHeaderInfoSize = dwHeaderSize; pUrlEntry->header_info_size = dwHeaderSize;
if ((CacheEntryType & STICKY_CACHE_ENTRY) && !exempt_delta) if ((CacheEntryType & STICKY_CACHE_ENTRY) && !exempt_delta)
{ {
/* Sticky entries have a default exempt time of one day */ /* Sticky entries have a default exempt time of one day */
exempt_delta = 86400; exempt_delta = 86400;
} }
pUrlEntry->dwExemptDelta = exempt_delta; pUrlEntry->exempt_delta = exempt_delta;
pUrlEntry->dwHitRate = hit_rate+1; pUrlEntry->hit_rate = hit_rate+1;
pUrlEntry->dwOffsetFileExtension = dwOffsetFileExtension; pUrlEntry->file_extension_off = dwOffsetFileExtension;
pUrlEntry->dwOffsetHeaderInfo = dwOffsetHeader; pUrlEntry->header_info_off = dwOffsetHeader;
pUrlEntry->dwOffsetLocalName = dwOffsetLocalFileName; pUrlEntry->local_name_off = dwOffsetLocalFileName;
pUrlEntry->dwOffsetUrl = DWORD_ALIGN(sizeof(*pUrlEntry)); pUrlEntry->url_off = DWORD_ALIGN(sizeof(*pUrlEntry));
pUrlEntry->size.QuadPart = file_size.QuadPart; pUrlEntry->size.QuadPart = file_size.QuadPart;
pUrlEntry->dwUseCount = 0; pUrlEntry->use_count = 0;
GetSystemTimeAsFileTime(&pUrlEntry->LastAccessTime); GetSystemTimeAsFileTime(&pUrlEntry->access_time);
pUrlEntry->LastModifiedTime = LastModifiedTime; pUrlEntry->modification_time = LastModifiedTime;
URLCache_FileTimeToDosDateTime(&pUrlEntry->LastAccessTime, &pUrlEntry->wLastSyncDate, &pUrlEntry->wLastSyncTime); URLCache_FileTimeToDosDateTime(&pUrlEntry->access_time, &pUrlEntry->sync_date, &pUrlEntry->sync_time);
URLCache_FileTimeToDosDateTime(&ExpireTime, &pUrlEntry->wExpiredDate, &pUrlEntry->wExpiredTime); URLCache_FileTimeToDosDateTime(&ExpireTime, &pUrlEntry->expire_date, &pUrlEntry->expire_time);
URLCache_FileTimeToDosDateTime(&file_attr.ftLastWriteTime, &pUrlEntry->LastWriteDate, &pUrlEntry->LastWriteTime); URLCache_FileTimeToDosDateTime(&file_attr.ftLastWriteTime, &pUrlEntry->write_date, &pUrlEntry->write_time);
/*** Unknowns ***/ /*** Unknowns ***/
pUrlEntry->dwUnknown1 = 0; pUrlEntry->unk1 = 0;
pUrlEntry->dwUnknown2 = 0; pUrlEntry->unk2 = 0;
pUrlEntry->dwUnknown3 = 0x60; pUrlEntry->unk3 = 0x60;
pUrlEntry->Unknown4 = 0; pUrlEntry->unk4 = 0;
pUrlEntry->wUnknown5 = 0x1010; pUrlEntry->unk5 = 0x1010;
pUrlEntry->dwUnknown7 = 0; pUrlEntry->unk7 = 0;
pUrlEntry->dwUnknown8 = 0; pUrlEntry->unk8 = 0;
strcpy((LPSTR)pUrlEntry + pUrlEntry->dwOffsetUrl, lpszUrlNameA); strcpy((LPSTR)pUrlEntry + pUrlEntry->url_off, lpszUrlNameA);
if (dwOffsetLocalFileName) if (dwOffsetLocalFileName)
strcpy((LPSTR)((LPBYTE)pUrlEntry + dwOffsetLocalFileName), pchLocalFileName); strcpy((LPSTR)((LPBYTE)pUrlEntry + dwOffsetLocalFileName), pchLocalFileName);
if (dwOffsetHeader) if (dwOffsetHeader)
...@@ -3294,17 +3292,17 @@ static BOOL CommitUrlCacheEntryInternal( ...@@ -3294,17 +3292,17 @@ static BOOL CommitUrlCacheEntryInternal(
error = cache_container_clean_index(pContainer, &pHeader); error = cache_container_clean_index(pContainer, &pHeader);
if (error == ERROR_SUCCESS) if (error == ERROR_SUCCESS)
{ {
pUrlEntry = (URL_CACHEFILE_ENTRY *)((LPBYTE)pHeader + url_entry_offset); pUrlEntry = (entry_url *)((LPBYTE)pHeader + url_entry_offset);
error = URLCache_AddEntryToHash(pHeader, lpszUrlNameA, error = URLCache_AddEntryToHash(pHeader, lpszUrlNameA,
url_entry_offset, HASHTABLE_URL); url_entry_offset, HASHTABLE_URL);
} }
} }
if (error != ERROR_SUCCESS) if (error != ERROR_SUCCESS)
URLCache_DeleteEntry(pHeader, &pUrlEntry->CacheFileEntry); URLCache_DeleteEntry(pHeader, &pUrlEntry->header);
else else
{ {
if (pUrlEntry->CacheDir < pHeader->DirectoryCount) if (pUrlEntry->cache_dir < pHeader->DirectoryCount)
pHeader->directory_data[pUrlEntry->CacheDir].dwNumFiles++; pHeader->directory_data[pUrlEntry->cache_dir].dwNumFiles++;
if (CacheEntryType & STICKY_CACHE_ENTRY) if (CacheEntryType & STICKY_CACHE_ENTRY)
pHeader->ExemptUsage.QuadPart += file_size.QuadPart; pHeader->ExemptUsage.QuadPart += file_size.QuadPart;
else else
...@@ -3972,18 +3970,18 @@ static BOOL FindNextUrlCacheEntryInternal( ...@@ -3972,18 +3970,18 @@ static BOOL FindNextUrlCacheEntryInternal(
for (; URLCache_EnumHashTableEntries(pHeader, pHashTableEntry, &pEntryHandle->dwHashEntryIndex, &pHashEntry); for (; URLCache_EnumHashTableEntries(pHeader, pHashTableEntry, &pEntryHandle->dwHashEntryIndex, &pHashEntry);
pEntryHandle->dwHashEntryIndex++) pEntryHandle->dwHashEntryIndex++)
{ {
const URL_CACHEFILE_ENTRY *pUrlEntry; const entry_url *pUrlEntry;
const entry_header *pEntry = (const entry_header*)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); const entry_header *pEntry = (const entry_header*)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry);
if (pEntry->signature != URL_SIGNATURE) if (pEntry->signature != URL_SIGNATURE)
continue; continue;
pUrlEntry = (const URL_CACHEFILE_ENTRY *)pEntry; pUrlEntry = (const entry_url *)pEntry;
TRACE("Found URL: %s\n", TRACE("Found URL: %s\n",
debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetUrl)); debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->url_off));
TRACE("Header info: %s\n", TRACE("Header info: %s\n",
debugstr_an((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetHeaderInfo, debugstr_an((LPCSTR)pUrlEntry + pUrlEntry->header_info_off,
pUrlEntry->dwHeaderInfoSize)); pUrlEntry->header_info_size));
error = URLCache_CopyEntry( error = URLCache_CopyEntry(
pContainer, pContainer,
...@@ -3998,8 +3996,8 @@ static BOOL FindNextUrlCacheEntryInternal( ...@@ -3998,8 +3996,8 @@ static BOOL FindNextUrlCacheEntryInternal(
SetLastError(error); SetLastError(error);
return FALSE; return FALSE;
} }
if(pUrlEntry->dwOffsetLocalName) if(pUrlEntry->local_name_off)
TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetLocalName)); TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->local_name_off));
/* increment the current index so that next time the function /* increment the current index so that next time the function
* is called the next entry is returned */ * is called the next entry is returned */
...@@ -4255,16 +4253,16 @@ DWORD WINAPI DeleteIE3Cache(HWND hWnd, HINSTANCE hInst, LPSTR lpszCmdLine, int n ...@@ -4255,16 +4253,16 @@ DWORD WINAPI DeleteIE3Cache(HWND hWnd, HINSTANCE hInst, LPSTR lpszCmdLine, int n
return 0; return 0;
} }
static BOOL IsUrlCacheEntryExpiredInternal(const URL_CACHEFILE_ENTRY *pUrlEntry, static BOOL IsUrlCacheEntryExpiredInternal(const entry_url *pUrlEntry,
FILETIME *pftLastModified) FILETIME *pftLastModified)
{ {
BOOL ret; BOOL ret;
FILETIME now, expired; FILETIME now, expired;
*pftLastModified = pUrlEntry->LastModifiedTime; *pftLastModified = pUrlEntry->modification_time;
GetSystemTimeAsFileTime(&now); GetSystemTimeAsFileTime(&now);
URLCache_DosDateTimeToFileTime(pUrlEntry->wExpiredDate, URLCache_DosDateTimeToFileTime(pUrlEntry->expire_date,
pUrlEntry->wExpiredTime, &expired); pUrlEntry->expire_time, &expired);
/* If the expired time is 0, it's interpreted as not expired */ /* If the expired time is 0, it's interpreted as not expired */
if (!expired.dwLowDateTime && !expired.dwHighDateTime) if (!expired.dwLowDateTime && !expired.dwHighDateTime)
ret = FALSE; ret = FALSE;
...@@ -4286,7 +4284,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas ...@@ -4286,7 +4284,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas
LPURLCACHE_HEADER pHeader; LPURLCACHE_HEADER pHeader;
struct _HASH_ENTRY * pHashEntry; struct _HASH_ENTRY * pHashEntry;
const entry_header *pEntry; const entry_header *pEntry;
const URL_CACHEFILE_ENTRY * pUrlEntry; const entry_url * pUrlEntry;
URLCACHECONTAINER * pContainer; URLCACHECONTAINER * pContainer;
BOOL expired; BOOL expired;
...@@ -4333,7 +4331,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas ...@@ -4333,7 +4331,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas
return TRUE; return TRUE;
} }
pUrlEntry = (const URL_CACHEFILE_ENTRY *)pEntry; pUrlEntry = (const entry_url *)pEntry;
expired = IsUrlCacheEntryExpiredInternal(pUrlEntry, pftLastModified); expired = IsUrlCacheEntryExpiredInternal(pUrlEntry, pftLastModified);
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
...@@ -4354,7 +4352,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa ...@@ -4354,7 +4352,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa
LPURLCACHE_HEADER pHeader; LPURLCACHE_HEADER pHeader;
struct _HASH_ENTRY * pHashEntry; struct _HASH_ENTRY * pHashEntry;
const entry_header *pEntry; const entry_header *pEntry;
const URL_CACHEFILE_ENTRY * pUrlEntry; const entry_url * pUrlEntry;
URLCACHECONTAINER * pContainer; URLCACHECONTAINER * pContainer;
BOOL expired; BOOL expired;
...@@ -4409,7 +4407,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa ...@@ -4409,7 +4407,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa
return TRUE; return TRUE;
} }
pUrlEntry = (const URL_CACHEFILE_ENTRY *)pEntry; pUrlEntry = (const entry_url *)pEntry;
expired = IsUrlCacheEntryExpiredInternal(pUrlEntry, pftLastModified); expired = IsUrlCacheEntryExpiredInternal(pUrlEntry, pftLastModified);
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment