Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a448427b
Commit
a448427b
authored
Mar 13, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 13, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Rename URL_CACHEFILE_ENTRY to entry_url.
parent
9d98ced7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
190 additions
and
192 deletions
+190
-192
urlcache.c
dlls/wininet/urlcache.c
+190
-192
No files found.
dlls/wininet/urlcache.c
View file @
a448427b
...
...
@@ -106,42 +106,42 @@ typedef struct
DWORD
blocks_used
;
/* number of 128byte blocks used by this entry */
}
entry_header
;
typedef
struct
_URL_CACHEFILE_ENTRY
typedef
struct
{
entry_header
CacheFileEntry
;
FILETIME
LastModifiedT
ime
;
FILETIME
LastAccessT
ime
;
WORD
wExpiredD
ate
;
/* expire date in dos format */
WORD
wExpiredT
ime
;
/* expire time in dos format */
DWORD
dwUnknown
1
;
/* usually zero */
entry_header
header
;
FILETIME
modification_t
ime
;
FILETIME
access_t
ime
;
WORD
expire_d
ate
;
/* expire date in dos format */
WORD
expire_t
ime
;
/* expire time in dos format */
DWORD
unk
1
;
/* usually zero */
ULARGE_INTEGER
size
;
/* see INTERNET_CACHE_ENTRY_INFO::dwSizeLow/High */
DWORD
dwUnknown
2
;
/* usually zero */
DWORD
dwExemptD
elta
;
/* see INTERNET_CACHE_ENTRY_INFO::dwExemptDelta */
DWORD
dwUnknown
3
;
/* usually 0x60 */
DWORD
dwOffsetUrl
;
/* offset of start of url from start of entry */
BYTE
CacheD
ir
;
/* index of cache directory this url is stored in */
BYTE
Unknown
4
;
/* usually zero */
WORD
wUnknown
5
;
/* usually 0x1010 */
DWORD
dwOffsetLocalName
;
/* offset of start of local filename from start of entry */
DWORD
CacheEntryT
ype
;
/* see INTERNET_CACHE_ENTRY_INFO::CacheEntryType */
DWORD
dwOffsetHeaderInfo
;
/* offset of start of header info from start of entry */
DWORD
dwHeaderInfoS
ize
;
DWORD
dwOffsetFileExtension
;
/* offset of start of file extension from start of entry */
WORD
wLastSyncD
ate
;
/* last sync date in dos format */
WORD
wLastSyncT
ime
;
/* last sync time in dos format */
DWORD
dwHitR
ate
;
/* see INTERNET_CACHE_ENTRY_INFO::dwHitRate */
DWORD
dwUseC
ount
;
/* see INTERNET_CACHE_ENTRY_INFO::dwUseCount */
WORD
LastWriteD
ate
;
WORD
LastWriteT
ime
;
DWORD
dwUnknown
7
;
/* usually zero */
DWORD
dwUnknown
8
;
/* usually zero */
DWORD
unk
2
;
/* usually zero */
DWORD
exempt_d
elta
;
/* see INTERNET_CACHE_ENTRY_INFO::dwExemptDelta */
DWORD
unk
3
;
/* usually 0x60 */
DWORD
url_off
;
/* offset of start of url from start of entry */
BYTE
cache_d
ir
;
/* index of cache directory this url is stored in */
BYTE
unk
4
;
/* usually zero */
WORD
unk
5
;
/* usually 0x1010 */
DWORD
local_name_off
;
/* offset of start of local filename from start of entry */
DWORD
cache_entry_t
ype
;
/* see INTERNET_CACHE_ENTRY_INFO::CacheEntryType */
DWORD
header_info_off
;
/* offset of start of header info from start of entry */
DWORD
header_info_s
ize
;
DWORD
file_extension_off
;
/* offset of start of file extension from start of entry */
WORD
sync_d
ate
;
/* last sync date in dos format */
WORD
sync_t
ime
;
/* last sync time in dos format */
DWORD
hit_r
ate
;
/* see INTERNET_CACHE_ENTRY_INFO::dwHitRate */
DWORD
use_c
ount
;
/* see INTERNET_CACHE_ENTRY_INFO::dwUseCount */
WORD
write_d
ate
;
WORD
write_t
ime
;
DWORD
unk
7
;
/* usually zero */
DWORD
unk
8
;
/* usually zero */
/* packing to dword align start of next field */
/* CHAR szSourceUrlName[]; (url) */
/* packing to dword align start of next field */
/* CHAR szLocalFileName[]; (local file name excluding path) */
/* packing to dword align start of next field */
/* CHAR szHeaderInfo[]; (header info) */
}
URL_CACHEFILE_ENTRY
;
}
entry_url
;
struct
_HASH_ENTRY
{
...
...
@@ -1038,7 +1038,7 @@ static void URLCache_FileTimeToDosDateTime(const FILETIME *ft, WORD *fatdate,
* URLCache_DeleteFile (Internal)
*/
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
;
WCHAR
path
[
MAX_PATH
];
...
...
@@ -1046,18 +1046,18 @@ static DWORD URLCache_DeleteFile(const URLCACHECONTAINER *container,
DWORD
err
;
WORD
date
,
time
;
if
(
!
url_entry
->
dwOffsetLocalName
)
if
(
!
url_entry
->
local_name_off
)
goto
succ
;
if
(
!
URLCache_LocalFileNameToPathW
(
container
,
header
,
(
LPCSTR
)
url_entry
+
url_entry
->
dwOffsetLocalName
,
url_entry
->
CacheD
ir
,
path
,
&
path_size
))
(
LPCSTR
)
url_entry
+
url_entry
->
local_name_off
,
url_entry
->
cache_d
ir
,
path
,
&
path_size
))
goto
succ
;
if
(
!
GetFileAttributesExW
(
path
,
GetFileExInfoStandard
,
&
attr
))
goto
succ
;
URLCache_FileTimeToDosDateTime
(
&
attr
.
ftLastWriteTime
,
&
date
,
&
time
);
if
(
date
!=
url_entry
->
LastWriteDate
||
time
!=
url_entry
->
LastWriteT
ime
)
if
(
date
!=
url_entry
->
write_date
||
time
!=
url_entry
->
write_t
ime
)
goto
succ
;
err
=
(
DeleteFileW
(
path
)
?
ERROR_SUCCESS
:
GetLastError
());
...
...
@@ -1065,12 +1065,12 @@ static DWORD URLCache_DeleteFile(const URLCACHECONTAINER *container,
return
err
;
succ:
if
(
url_entry
->
CacheD
ir
<
header
->
DirectoryCount
)
if
(
url_entry
->
cache_d
ir
<
header
->
DirectoryCount
)
{
if
(
header
->
directory_data
[
url_entry
->
CacheD
ir
].
dwNumFiles
)
header
->
directory_data
[
url_entry
->
CacheD
ir
].
dwNumFiles
--
;
if
(
header
->
directory_data
[
url_entry
->
cache_d
ir
].
dwNumFiles
)
header
->
directory_data
[
url_entry
->
cache_d
ir
].
dwNumFiles
--
;
}
if
(
url_entry
->
CacheEntryT
ype
&
STICKY_CACHE_ENTRY
)
if
(
url_entry
->
cache_entry_t
ype
&
STICKY_CACHE_ENTRY
)
{
if
(
url_entry
->
size
.
QuadPart
<
header
->
ExemptUsage
.
QuadPart
)
header
->
ExemptUsage
.
QuadPart
-=
url_entry
->
size
.
QuadPart
;
...
...
@@ -1095,14 +1095,14 @@ static BOOL urlcache_clean_leaked_entries(URLCACHECONTAINER *container, URLCACHE
leak_off
=
&
header
->
options
[
CACHE_HEADER_DATA_ROOT_LEAK_OFFSET
];
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
)))
{
*
leak_off
=
url_entry
->
dwExemptD
elta
;
URLCache_DeleteEntry
(
header
,
&
url_entry
->
CacheFileEntry
);
*
leak_off
=
url_entry
->
exempt_d
elta
;
URLCache_DeleteEntry
(
header
,
&
url_entry
->
header
);
freed
=
TRUE
;
}
else
{
leak_off
=
&
url_entry
->
dwExemptD
elta
;
leak_off
=
&
url_entry
->
exempt_d
elta
;
}
}
...
...
@@ -1176,7 +1176,7 @@ static DWORD URLCache_CopyEntry(
LPCURLCACHE_HEADER
pHeader
,
LPINTERNET_CACHE_ENTRY_INFOA
lpCacheEntryInfo
,
LPDWORD
lpdwBufferSize
,
const
URL_CACHEFILE_ENTRY
*
pUrlEntry
,
const
entry_url
*
pUrlEntry
,
BOOL
bUnicode
)
{
int
lenUrl
;
...
...
@@ -1188,29 +1188,27 @@ static DWORD URLCache_CopyEntry(
lpCacheEntryInfo
->
lpszFileExtension
=
NULL
;
lpCacheEntryInfo
->
lpszLocalFileName
=
NULL
;
lpCacheEntryInfo
->
lpszSourceUrlName
=
NULL
;
lpCacheEntryInfo
->
CacheEntryType
=
pUrlEntry
->
CacheEntryT
ype
;
lpCacheEntryInfo
->
u
.
dwExemptDelta
=
pUrlEntry
->
dwExemptD
elta
;
lpCacheEntryInfo
->
dwHeaderInfoSize
=
pUrlEntry
->
dwHeaderInfoS
ize
;
lpCacheEntryInfo
->
dwHitRate
=
pUrlEntry
->
dwHitR
ate
;
lpCacheEntryInfo
->
CacheEntryType
=
pUrlEntry
->
cache_entry_t
ype
;
lpCacheEntryInfo
->
u
.
dwExemptDelta
=
pUrlEntry
->
exempt_d
elta
;
lpCacheEntryInfo
->
dwHeaderInfoSize
=
pUrlEntry
->
header_info_s
ize
;
lpCacheEntryInfo
->
dwHitRate
=
pUrlEntry
->
hit_r
ate
;
lpCacheEntryInfo
->
dwSizeHigh
=
pUrlEntry
->
size
.
u
.
HighPart
;
lpCacheEntryInfo
->
dwSizeLow
=
pUrlEntry
->
size
.
u
.
LowPart
;
lpCacheEntryInfo
->
dwStructSize
=
sizeof
(
*
lpCacheEntryInfo
);
lpCacheEntryInfo
->
dwUseCount
=
pUrlEntry
->
dwUseCount
;
URLCache_DosDateTimeToFileTime
(
pUrlEntry
->
wExpiredDate
,
pUrlEntry
->
wExpiredTime
,
&
lpCacheEntryInfo
->
ExpireTime
);
lpCacheEntryInfo
->
LastAccessTime
.
dwHighDateTime
=
pUrlEntry
->
LastAccessTime
.
dwHighDateTime
;
lpCacheEntryInfo
->
LastAccessTime
.
dwLowDateTime
=
pUrlEntry
->
LastAccessTime
.
dwLowDateTime
;
lpCacheEntryInfo
->
LastModifiedTime
.
dwHighDateTime
=
pUrlEntry
->
LastModifiedTime
.
dwHighDateTime
;
lpCacheEntryInfo
->
LastModifiedTime
.
dwLowDateTime
=
pUrlEntry
->
LastModifiedTime
.
dwLowDateTime
;
URLCache_DosDateTimeToFileTime
(
pUrlEntry
->
wLastSyncDate
,
pUrlEntry
->
wLastSyncTime
,
&
lpCacheEntryInfo
->
LastSyncTime
);
lpCacheEntryInfo
->
dwUseCount
=
pUrlEntry
->
use_count
;
URLCache_DosDateTimeToFileTime
(
pUrlEntry
->
expire_date
,
pUrlEntry
->
expire_time
,
&
lpCacheEntryInfo
->
ExpireTime
);
lpCacheEntryInfo
->
LastAccessTime
=
pUrlEntry
->
access_time
;
lpCacheEntryInfo
->
LastModifiedTime
=
pUrlEntry
->
modification_time
;
URLCache_DosDateTimeToFileTime
(
pUrlEntry
->
sync_date
,
pUrlEntry
->
sync_time
,
&
lpCacheEntryInfo
->
LastSyncTime
);
}
if
((
dwRequiredSize
%
4
)
&&
(
dwRequiredSize
<
*
lpdwBufferSize
))
ZeroMemory
((
LPBYTE
)
lpCacheEntryInfo
+
dwRequiredSize
,
4
-
(
dwRequiredSize
%
4
));
dwRequiredSize
=
DWORD_ALIGN
(
dwRequiredSize
);
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
lenUrl
=
strlen
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetUrl
);
lenUrl
=
strlen
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
url_off
);
dwRequiredSize
+=
(
lenUrl
+
1
)
*
(
bUnicode
?
sizeof
(
WCHAR
)
:
sizeof
(
CHAR
));
/* FIXME: is source url optional? */
...
...
@@ -1220,23 +1218,23 @@ static DWORD URLCache_CopyEntry(
lpCacheEntryInfo
->
lpszSourceUrlName
=
(
LPSTR
)
lpCacheEntryInfo
+
dwRequiredSize
-
lenUrlBytes
;
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
memcpy
(
lpCacheEntryInfo
->
lpszSourceUrlName
,
(
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetUrl
,
lenUrlBytes
);
memcpy
(
lpCacheEntryInfo
->
lpszSourceUrlName
,
(
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
url_off
,
lenUrlBytes
);
}
if
((
dwRequiredSize
%
4
)
&&
(
dwRequiredSize
<
*
lpdwBufferSize
))
ZeroMemory
((
LPBYTE
)
lpCacheEntryInfo
+
dwRequiredSize
,
4
-
(
dwRequiredSize
%
4
));
dwRequiredSize
=
DWORD_ALIGN
(
dwRequiredSize
);
if
(
pUrlEntry
->
dwOffsetLocalName
)
if
(
pUrlEntry
->
local_name_off
)
{
LONG
nLocalFilePathSize
;
LPSTR
lpszLocalFileName
;
lpszLocalFileName
=
(
LPSTR
)
lpCacheEntryInfo
+
dwRequiredSize
;
nLocalFilePathSize
=
*
lpdwBufferSize
-
dwRequiredSize
;
if
((
bUnicode
&&
URLCache_LocalFileNameToPathW
(
pContainer
,
pHeader
,
(
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetLocalName
,
pUrlEntry
->
CacheD
ir
,
(
LPWSTR
)
lpszLocalFileName
,
&
nLocalFilePathSize
))
||
(
!
bUnicode
&&
URLCache_LocalFileNameToPathA
(
pContainer
,
pHeader
,
(
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetLocalName
,
pUrlEntry
->
CacheD
ir
,
lpszLocalFileName
,
&
nLocalFilePathSize
)))
if
((
bUnicode
&&
URLCache_LocalFileNameToPathW
(
pContainer
,
pHeader
,
(
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
local_name_off
,
pUrlEntry
->
cache_d
ir
,
(
LPWSTR
)
lpszLocalFileName
,
&
nLocalFilePathSize
))
||
(
!
bUnicode
&&
URLCache_LocalFileNameToPathA
(
pContainer
,
pHeader
,
(
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
local_name_off
,
pUrlEntry
->
cache_d
ir
,
lpszLocalFileName
,
&
nLocalFilePathSize
)))
{
lpCacheEntryInfo
->
lpszLocalFileName
=
lpszLocalFileName
;
}
...
...
@@ -1246,35 +1244,35 @@ static DWORD URLCache_CopyEntry(
ZeroMemory
((
LPBYTE
)
lpCacheEntryInfo
+
dwRequiredSize
,
4
-
(
dwRequiredSize
%
4
));
dwRequiredSize
=
DWORD_ALIGN
(
dwRequiredSize
);
}
dwRequiredSize
+=
pUrlEntry
->
dwHeaderInfoS
ize
+
1
;
dwRequiredSize
+=
pUrlEntry
->
header_info_s
ize
+
1
;
if
(
*
lpdwBufferSize
>=
dwRequiredSize
)
{
lpCacheEntryInfo
->
lpHeaderInfo
=
(
LPBYTE
)
lpCacheEntryInfo
+
dwRequiredSize
-
pUrlEntry
->
dwHeaderInfoS
ize
-
1
;
memcpy
(
lpCacheEntryInfo
->
lpHeaderInfo
,
(
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetHeaderInfo
,
pUrlEntry
->
dwHeaderInfoS
ize
);
lpCacheEntryInfo
->
lpHeaderInfo
=
(
LPBYTE
)
lpCacheEntryInfo
+
dwRequiredSize
-
pUrlEntry
->
header_info_s
ize
-
1
;
memcpy
(
lpCacheEntryInfo
->
lpHeaderInfo
,
(
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
header_info_off
,
pUrlEntry
->
header_info_s
ize
);
((
LPBYTE
)
lpCacheEntryInfo
)[
dwRequiredSize
-
1
]
=
'\0'
;
}
if
((
dwRequiredSize
%
4
)
&&
(
dwRequiredSize
<
*
lpdwBufferSize
))
ZeroMemory
((
LPBYTE
)
lpCacheEntryInfo
+
dwRequiredSize
,
4
-
(
dwRequiredSize
%
4
));
dwRequiredSize
=
DWORD_ALIGN
(
dwRequiredSize
);
if
(
pUrlEntry
->
dwOffsetFileExtension
)
if
(
pUrlEntry
->
file_extension_off
)
{
int
lenExtension
;
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
lenExtension
=
strlen
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetFileExtension
)
+
1
;
lenExtension
=
strlen
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
file_extension_off
)
+
1
;
dwRequiredSize
+=
lenExtension
*
(
bUnicode
?
sizeof
(
WCHAR
)
:
sizeof
(
CHAR
));
if
(
*
lpdwBufferSize
>=
dwRequiredSize
)
{
lpCacheEntryInfo
->
lpszFileExtension
=
(
LPSTR
)
lpCacheEntryInfo
+
dwRequiredSize
-
lenExtension
;
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
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
))
...
...
@@ -1302,24 +1300,24 @@ static DWORD URLCache_CopyEntry(
* 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
)
pUrlEntry
->
LastAccessT
ime
=
lpCacheEntryInfo
->
LastAccessTime
;
pUrlEntry
->
access_t
ime
=
lpCacheEntryInfo
->
LastAccessTime
;
if
(
dwFieldControl
&
CACHE_ENTRY_ATTRIBUTE_FC
)
pUrlEntry
->
CacheEntryT
ype
=
lpCacheEntryInfo
->
CacheEntryType
;
pUrlEntry
->
cache_entry_t
ype
=
lpCacheEntryInfo
->
CacheEntryType
;
if
(
dwFieldControl
&
CACHE_ENTRY_EXEMPT_DELTA_FC
)
pUrlEntry
->
dwExemptD
elta
=
lpCacheEntryInfo
->
u
.
dwExemptDelta
;
pUrlEntry
->
exempt_d
elta
=
lpCacheEntryInfo
->
u
.
dwExemptDelta
;
if
(
dwFieldControl
&
CACHE_ENTRY_EXPTIME_FC
)
URLCache_FileTimeToDosDateTime
(
&
lpCacheEntryInfo
->
ExpireTime
,
&
pUrlEntry
->
wExpiredDate
,
&
pUrlEntry
->
wExpiredT
ime
);
URLCache_FileTimeToDosDateTime
(
&
lpCacheEntryInfo
->
ExpireTime
,
&
pUrlEntry
->
expire_date
,
&
pUrlEntry
->
expire_t
ime
);
if
(
dwFieldControl
&
CACHE_ENTRY_HEADERINFO_FC
)
FIXME
(
"CACHE_ENTRY_HEADERINFO_FC unimplemented
\n
"
);
if
(
dwFieldControl
&
CACHE_ENTRY_HITRATE_FC
)
pUrlEntry
->
dwHitR
ate
=
lpCacheEntryInfo
->
dwHitRate
;
pUrlEntry
->
hit_r
ate
=
lpCacheEntryInfo
->
dwHitRate
;
if
(
dwFieldControl
&
CACHE_ENTRY_MODTIME_FC
)
pUrlEntry
->
LastModifiedT
ime
=
lpCacheEntryInfo
->
LastModifiedTime
;
pUrlEntry
->
modification_t
ime
=
lpCacheEntryInfo
->
LastModifiedTime
;
if
(
dwFieldControl
&
CACHE_ENTRY_SYNCTIME_FC
)
URLCache_FileTimeToDosDateTime
(
&
lpCacheEntryInfo
->
LastAccessTime
,
&
pUrlEntry
->
wLastSyncDate
,
&
pUrlEntry
->
wLastSyncT
ime
);
URLCache_FileTimeToDosDateTime
(
&
lpCacheEntryInfo
->
LastAccessTime
,
&
pUrlEntry
->
sync_date
,
&
pUrlEntry
->
sync_t
ime
);
return
ERROR_SUCCESS
;
}
...
...
@@ -1704,7 +1702,7 @@ static BOOL URLCache_DeleteCacheDirectory(LPCWSTR lpszPath)
*
* 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
;
ULARGE_INTEGER
acc_time
,
time
;
...
...
@@ -1716,15 +1714,15 @@ static BOOL URLCache_IsLocked(struct _HASH_ENTRY *hash_entry, URL_CACHEFILE_ENTR
time
.
u
.
LowPart
=
cur_time
.
dwLowDateTime
;
time
.
u
.
HighPart
=
cur_time
.
dwHighDateTime
;
acc_time
.
u
.
LowPart
=
url_entry
->
LastAccessT
ime
.
dwLowDateTime
;
acc_time
.
u
.
HighPart
=
url_entry
->
LastAccessT
ime
.
dwHighDateTime
;
acc_time
.
u
.
LowPart
=
url_entry
->
access_t
ime
.
dwLowDateTime
;
acc_time
.
u
.
HighPart
=
url_entry
->
access_t
ime
.
dwHighDateTime
;
time
.
QuadPart
-=
acc_time
.
QuadPart
;
/* check if entry was locked for at least a day */
if
(
time
.
QuadPart
>
(
ULONGLONG
)
24
*
60
*
60
*
FILETIME_SECOND
)
{
URLCache_HashEntrySetFlags
(
hash_entry
,
HASHTABLE_URL
);
url_entry
->
dwUseC
ount
=
0
;
url_entry
->
use_c
ount
=
0
;
return
FALSE
;
}
...
...
@@ -1747,7 +1745,7 @@ BOOL WINAPI GetUrlCacheEntryInfoExA(
LPURLCACHE_HEADER
pHeader
;
struct
_HASH_ENTRY
*
pHashEntry
;
const
entry_header
*
pEntry
;
const
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
const
entry_url
*
pUrlEntry
;
URLCACHECONTAINER
*
pContainer
;
DWORD
error
;
...
...
@@ -1806,12 +1804,12 @@ BOOL WINAPI GetUrlCacheEntryInfoExA(
return
FALSE
;
}
pUrlEntry
=
(
const
URL_CACHEFILE_ENTRY
*
)
pEntry
;
TRACE
(
"Found URL: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetUrl
));
pUrlEntry
=
(
const
entry_url
*
)
pEntry
;
TRACE
(
"Found URL: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
url_off
));
TRACE
(
"Header info: %s
\n
"
,
debugstr_an
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetHeaderInfo
,
pUrlEntry
->
dwHeaderInfoS
ize
));
pUrlEntry
->
header_info_off
,
pUrlEntry
->
header_info_s
ize
));
if
((
dwFlags
&
GET_INSTALLED_ENTRY
)
&&
!
(
pUrlEntry
->
CacheEntryT
ype
&
INSTALLED_CACHE_ENTRY
))
if
((
dwFlags
&
GET_INSTALLED_ENTRY
)
&&
!
(
pUrlEntry
->
cache_entry_t
ype
&
INSTALLED_CACHE_ENTRY
))
{
cache_container_unlock_index
(
pContainer
,
pHeader
);
SetLastError
(
ERROR_FILE_NOT_FOUND
);
...
...
@@ -1836,8 +1834,8 @@ BOOL WINAPI GetUrlCacheEntryInfoExA(
SetLastError
(
error
);
return
FALSE
;
}
if
(
pUrlEntry
->
dwOffsetLocalName
)
TRACE
(
"Local File Name: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetLocalName
));
if
(
pUrlEntry
->
local_name_off
)
TRACE
(
"Local File Name: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
local_name_off
));
}
cache_container_unlock_index
(
pContainer
,
pHeader
);
...
...
@@ -1887,7 +1885,7 @@ BOOL WINAPI GetUrlCacheEntryInfoExW(
LPURLCACHE_HEADER
pHeader
;
struct
_HASH_ENTRY
*
pHashEntry
;
const
entry_header
*
pEntry
;
const
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
const
entry_url
*
pUrlEntry
;
URLCACHECONTAINER
*
pContainer
;
DWORD
error
;
...
...
@@ -1949,10 +1947,10 @@ BOOL WINAPI GetUrlCacheEntryInfoExW(
return
FALSE
;
}
pUrlEntry
=
(
const
URL_CACHEFILE_ENTRY
*
)
pEntry
;
TRACE
(
"Found URL: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetUrl
));
pUrlEntry
=
(
const
entry_url
*
)
pEntry
;
TRACE
(
"Found URL: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
url_off
));
TRACE
(
"Header info: %s
\n
"
,
debugstr_an
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetHeaderInfo
,
pUrlEntry
->
dwHeaderInfoS
ize
));
pUrlEntry
->
header_info_off
,
pUrlEntry
->
header_info_s
ize
));
if
(
lpdwCacheEntryInfoBufSize
)
{
...
...
@@ -1972,8 +1970,8 @@ BOOL WINAPI GetUrlCacheEntryInfoExW(
SetLastError
(
error
);
return
FALSE
;
}
if
(
pUrlEntry
->
dwOffsetLocalName
)
TRACE
(
"Local File Name: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetLocalName
));
if
(
pUrlEntry
->
local_name_off
)
TRACE
(
"Local File Name: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
local_name_off
));
}
cache_container_unlock_index
(
pContainer
,
pHeader
);
...
...
@@ -2032,7 +2030,7 @@ BOOL WINAPI SetUrlCacheEntryInfoA(
}
URLCache_SetEntryInfo
(
(
URL_CACHEFILE_ENTRY
*
)
pEntry
,
(
entry_url
*
)
pEntry
,
(
const
INTERNET_CACHE_ENTRY_INFOW
*
)
lpCacheEntryInfo
,
dwFieldControl
);
...
...
@@ -2089,7 +2087,7 @@ BOOL WINAPI SetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW
}
URLCache_SetEntryInfo
(
(
URL_CACHEFILE_ENTRY
*
)
pEntry
,
(
entry_url
*
)
pEntry
,
lpCacheEntryInfo
,
dwFieldControl
);
...
...
@@ -2112,7 +2110,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA(
LPURLCACHE_HEADER
pHeader
;
struct
_HASH_ENTRY
*
pHashEntry
;
entry_header
*
pEntry
;
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
entry_url
*
pUrlEntry
;
URLCACHECONTAINER
*
pContainer
;
DWORD
error
;
...
...
@@ -2163,17 +2161,17 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA(
return
FALSE
;
}
pUrlEntry
=
(
URL_CACHEFILE_ENTRY
*
)
pEntry
;
if
(
!
pUrlEntry
->
dwOffsetLocalName
)
pUrlEntry
=
(
entry_url
*
)
pEntry
;
if
(
!
pUrlEntry
->
local_name_off
)
{
cache_container_unlock_index
(
pContainer
,
pHeader
);
SetLastError
(
ERROR_INVALID_DATA
);
return
FALSE
;
}
TRACE
(
"Found URL: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetUrl
));
TRACE
(
"Header info: %s
\n
"
,
debugstr_an
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetHeaderInfo
,
pUrlEntry
->
dwHeaderInfoS
ize
));
TRACE
(
"Found URL: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
url_off
));
TRACE
(
"Header info: %s
\n
"
,
debugstr_an
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
header_info_off
,
pUrlEntry
->
header_info_s
ize
));
error
=
URLCache_CopyEntry
(
pContainer
,
pHeader
,
lpCacheEntryInfo
,
lpdwCacheEntryInfoBufferSize
,
pUrlEntry
,
...
...
@@ -2184,12 +2182,12 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA(
SetLastError
(
error
);
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
->
dwHitR
ate
++
;
pUrlEntry
->
dwUseC
ount
++
;
pUrlEntry
->
hit_r
ate
++
;
pUrlEntry
->
use_c
ount
++
;
URLCache_HashEntrySetFlags
(
pHashEntry
,
HASHTABLE_LOCK
);
GetSystemTimeAsFileTime
(
&
pUrlEntry
->
LastAccessT
ime
);
GetSystemTimeAsFileTime
(
&
pUrlEntry
->
access_t
ime
);
cache_container_unlock_index
(
pContainer
,
pHeader
);
...
...
@@ -2210,7 +2208,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW(
LPURLCACHE_HEADER
pHeader
;
struct
_HASH_ENTRY
*
pHashEntry
;
entry_header
*
pEntry
;
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
entry_url
*
pUrlEntry
;
URLCACHECONTAINER
*
pContainer
;
DWORD
error
;
...
...
@@ -2261,17 +2259,17 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW(
return
FALSE
;
}
pUrlEntry
=
(
URL_CACHEFILE_ENTRY
*
)
pEntry
;
if
(
!
pUrlEntry
->
dwOffsetLocalName
)
pUrlEntry
=
(
entry_url
*
)
pEntry
;
if
(
!
pUrlEntry
->
local_name_off
)
{
cache_container_unlock_index
(
pContainer
,
pHeader
);
SetLastError
(
ERROR_INVALID_DATA
);
return
FALSE
;
}
TRACE
(
"Found URL: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetUrl
));
TRACE
(
"Header info: %s
\n
"
,
debugstr_an
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetHeaderInfo
,
pUrlEntry
->
dwHeaderInfoS
ize
));
TRACE
(
"Found URL: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
url_off
));
TRACE
(
"Header info: %s
\n
"
,
debugstr_an
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
header_info_off
,
pUrlEntry
->
header_info_s
ize
));
error
=
URLCache_CopyEntry
(
pContainer
,
...
...
@@ -2286,12 +2284,12 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW(
SetLastError
(
error
);
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
->
dwHitR
ate
++
;
pUrlEntry
->
dwUseC
ount
++
;
pUrlEntry
->
hit_r
ate
++
;
pUrlEntry
->
use_c
ount
++
;
URLCache_HashEntrySetFlags
(
pHashEntry
,
HASHTABLE_LOCK
);
GetSystemTimeAsFileTime
(
&
pUrlEntry
->
LastAccessT
ime
);
GetSystemTimeAsFileTime
(
&
pUrlEntry
->
access_t
ime
);
cache_container_unlock_index
(
pContainer
,
pHeader
);
...
...
@@ -2302,7 +2300,7 @@ static BOOL DeleteUrlCacheEntryInternal(const URLCACHECONTAINER * pContainer,
LPURLCACHE_HEADER
pHeader
,
struct
_HASH_ENTRY
*
pHashEntry
)
{
entry_header
*
pEntry
;
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
entry_url
*
pUrlEntry
;
pEntry
=
(
entry_header
*
)((
LPBYTE
)
pHeader
+
pHashEntry
->
dwOffsetEntry
);
if
(
pEntry
->
signature
!=
URL_SIGNATURE
)
...
...
@@ -2313,11 +2311,11 @@ static BOOL DeleteUrlCacheEntryInternal(const URLCACHECONTAINER * pContainer,
return
FALSE
;
}
pUrlEntry
=
(
URL_CACHEFILE_ENTRY
*
)
pEntry
;
pUrlEntry
=
(
entry_url
*
)
pEntry
;
if
(
URLCache_IsLocked
(
pHashEntry
,
pUrlEntry
))
{
TRACE
(
"Trying to delete locked entry
\n
"
);
pUrlEntry
->
CacheEntryT
ype
|=
PENDING_DELETE_CACHE_ENTRY
;
pUrlEntry
->
cache_entry_t
ype
|=
PENDING_DELETE_CACHE_ENTRY
;
SetLastError
(
ERROR_SHARING_VIOLATION
);
return
FALSE
;
}
...
...
@@ -2329,8 +2327,8 @@ static BOOL DeleteUrlCacheEntryInternal(const URLCACHECONTAINER * pContainer,
else
{
/* Add entry to leaked files list */
pUrlEntry
->
CacheFileEntry
.
signature
=
LEAK_SIGNATURE
;
pUrlEntry
->
dwExemptD
elta
=
pHeader
->
options
[
CACHE_HEADER_DATA_ROOT_LEAK_OFFSET
];
pUrlEntry
->
header
.
signature
=
LEAK_SIGNATURE
;
pUrlEntry
->
exempt_d
elta
=
pHeader
->
options
[
CACHE_HEADER_DATA_ROOT_LEAK_OFFSET
];
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,
*
* 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
;
DWORD
rating
;
access_time
.
u
.
LowPart
=
url_entry
->
LastAccessT
ime
.
dwLowDateTime
;
access_time
.
u
.
HighPart
=
url_entry
->
LastAccessT
ime
.
dwHighDateTime
;
access_time
.
u
.
LowPart
=
url_entry
->
access_t
ime
.
dwLowDateTime
;
access_time
.
u
.
HighPart
=
url_entry
->
access_t
ime
.
dwHighDateTime
;
time
.
u
.
LowPart
=
cur_time
->
dwLowDateTime
;
time
.
u
.
HighPart
=
cur_time
->
dwHighDateTime
;
...
...
@@ -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
)
return
-
1
;
if
(
url_entry
->
CacheEntryT
ype
&
STICKY_CACHE_ENTRY
)
if
(
time
.
QuadPart
<
access_time
.
QuadPart
+
(
ULONGLONG
)
url_entry
->
dwExemptD
elta
*
FILETIME_SECOND
)
if
(
url_entry
->
cache_entry_t
ype
&
STICKY_CACHE_ENTRY
)
if
(
time
.
QuadPart
<
access_time
.
QuadPart
+
(
ULONGLONG
)
url_entry
->
exempt_d
elta
*
FILETIME_SECOND
)
return
-
1
;
time
.
QuadPart
=
(
time
.
QuadPart
-
access_time
.
QuadPart
)
/
FILETIME_SECOND
;
rating
=
400
*
60
*
60
*
24
/
(
60
*
60
*
24
+
time
.
QuadPart
);
if
(
url_entry
->
dwHitR
ate
>
100
)
if
(
url_entry
->
hit_r
ate
>
100
)
rating
+=
100
;
else
rating
+=
url_entry
->
dwHitR
ate
;
rating
+=
url_entry
->
hit_r
ate
;
return
rating
;
}
...
...
@@ -2522,7 +2520,7 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter)
URLCACHE_HEADER
*
header
;
struct
_HASH_ENTRY
*
hash_entry
;
entry_header
*
entry
;
URL_CACHEFILE_ENTRY
*
url_entry
;
entry_url
*
url_entry
;
ULONGLONG
desired_size
,
cur_size
;
DWORD
delete_factor
,
hash_table_off
,
hash_table_entry
;
DWORD
rate
[
100
],
rate_no
;
...
...
@@ -2566,8 +2564,8 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter)
continue
;
}
url_entry
=
(
URL_CACHEFILE_ENTRY
*
)
entry
;
if
(
url_entry
->
CacheEntryT
ype
&
filter
)
url_entry
=
(
entry_url
*
)
entry
;
if
(
url_entry
->
cache_entry_t
ype
&
filter
)
continue
;
rate
[
rate_no
]
=
urlcache_rate_entry
(
url_entry
,
&
cur_time
);
...
...
@@ -2592,12 +2590,12 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter)
if
(
entry
->
signature
!=
URL_SIGNATURE
)
continue
;
url_entry
=
(
URL_CACHEFILE_ENTRY
*
)
entry
;
if
(
url_entry
->
CacheEntryT
ype
&
filter
)
url_entry
=
(
entry_url
*
)
entry
;
if
(
url_entry
->
cache_entry_t
ype
&
filter
)
continue
;
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
);
if
(
header
->
CacheUsage
.
QuadPart
+
header
->
ExemptUsage
.
QuadPart
<=
desired_size
)
...
...
@@ -2650,7 +2648,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileA(
LPURLCACHE_HEADER
pHeader
;
struct
_HASH_ENTRY
*
pHashEntry
;
entry_header
*
pEntry
;
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
entry_url
*
pUrlEntry
;
URLCACHECONTAINER
*
pContainer
;
DWORD
error
;
...
...
@@ -2697,18 +2695,18 @@ BOOL WINAPI UnlockUrlCacheEntryFileA(
return
FALSE
;
}
pUrlEntry
=
(
URL_CACHEFILE_ENTRY
*
)
pEntry
;
pUrlEntry
=
(
entry_url
*
)
pEntry
;
if
(
pUrlEntry
->
dwUseC
ount
==
0
)
if
(
pUrlEntry
->
use_c
ount
==
0
)
{
cache_container_unlock_index
(
pContainer
,
pHeader
);
return
FALSE
;
}
pUrlEntry
->
dwUseC
ount
--
;
if
(
!
pUrlEntry
->
dwUseC
ount
)
pUrlEntry
->
use_c
ount
--
;
if
(
!
pUrlEntry
->
use_c
ount
)
{
URLCache_HashEntrySetFlags
(
pHashEntry
,
HASHTABLE_URL
);
if
(
pUrlEntry
->
CacheEntryT
ype
&
PENDING_DELETE_CACHE_ENTRY
)
if
(
pUrlEntry
->
cache_entry_t
ype
&
PENDING_DELETE_CACHE_ENTRY
)
DeleteUrlCacheEntryInternal
(
pContainer
,
pHeader
,
pHashEntry
);
}
...
...
@@ -2726,7 +2724,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileW( LPCWSTR lpszUrlName, DWORD dwReserved )
LPURLCACHE_HEADER
pHeader
;
struct
_HASH_ENTRY
*
pHashEntry
;
entry_header
*
pEntry
;
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
entry_url
*
pUrlEntry
;
URLCACHECONTAINER
*
pContainer
;
DWORD
error
;
...
...
@@ -2773,15 +2771,15 @@ BOOL WINAPI UnlockUrlCacheEntryFileW( LPCWSTR lpszUrlName, DWORD dwReserved )
return
FALSE
;
}
pUrlEntry
=
(
URL_CACHEFILE_ENTRY
*
)
pEntry
;
pUrlEntry
=
(
entry_url
*
)
pEntry
;
if
(
pUrlEntry
->
dwUseC
ount
==
0
)
if
(
pUrlEntry
->
use_c
ount
==
0
)
{
cache_container_unlock_index
(
pContainer
,
pHeader
);
return
FALSE
;
}
pUrlEntry
->
dwUseC
ount
--
;
if
(
!
pUrlEntry
->
dwUseC
ount
)
pUrlEntry
->
use_c
ount
--
;
if
(
!
pUrlEntry
->
use_c
ount
)
URLCache_HashEntrySetFlags
(
pHashEntry
,
HASHTABLE_URL
);
cache_container_unlock_index
(
pContainer
,
pHeader
);
...
...
@@ -3077,7 +3075,7 @@ static BOOL CommitUrlCacheEntryInternal(
LPURLCACHE_HEADER
pHeader
;
struct
_HASH_ENTRY
*
pHashEntry
;
entry_header
*
pEntry
;
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
entry_url
*
pUrlEntry
;
DWORD
url_entry_offset
;
DWORD
dwBytesNeeded
=
DWORD_ALIGN
(
sizeof
(
*
pUrlEntry
));
DWORD
dwOffsetLocalFileName
=
0
;
...
...
@@ -3152,7 +3150,7 @@ static BOOL CommitUrlCacheEntryInternal(
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
))
{
TRACE
(
"Trying to overwrite locked entry
\n
"
);
...
...
@@ -3160,8 +3158,8 @@ static BOOL CommitUrlCacheEntryInternal(
goto
cleanup
;
}
hit_rate
=
pUrlEntry
->
dwHitR
ate
;
exempt_delta
=
pUrlEntry
->
dwExemptD
elta
;
hit_rate
=
pUrlEntry
->
hit_r
ate
;
exempt_delta
=
pUrlEntry
->
exempt_d
elta
;
DeleteUrlCacheEntryInternal
(
pContainer
,
pHeader
,
pHashEntry
);
}
...
...
@@ -3245,42 +3243,42 @@ static BOOL CommitUrlCacheEntryInternal(
goto
cleanup
;
/* FindFirstFreeEntry fills in blocks used */
pUrlEntry
=
(
URL_CACHEFILE_ENTRY
*
)
pEntry
;
pUrlEntry
=
(
entry_url
*
)
pEntry
;
url_entry_offset
=
(
LPBYTE
)
pUrlEntry
-
(
LPBYTE
)
pHeader
;
pUrlEntry
->
CacheFileEntry
.
signature
=
URL_SIGNATURE
;
pUrlEntry
->
CacheD
ir
=
cDirectory
;
pUrlEntry
->
CacheEntryT
ype
=
CacheEntryType
|
pContainer
->
default_entry_type
;
pUrlEntry
->
dwHeaderInfoS
ize
=
dwHeaderSize
;
pUrlEntry
->
header
.
signature
=
URL_SIGNATURE
;
pUrlEntry
->
cache_d
ir
=
cDirectory
;
pUrlEntry
->
cache_entry_t
ype
=
CacheEntryType
|
pContainer
->
default_entry_type
;
pUrlEntry
->
header_info_s
ize
=
dwHeaderSize
;
if
((
CacheEntryType
&
STICKY_CACHE_ENTRY
)
&&
!
exempt_delta
)
{
/* Sticky entries have a default exempt time of one day */
exempt_delta
=
86400
;
}
pUrlEntry
->
dwExemptD
elta
=
exempt_delta
;
pUrlEntry
->
dwHitR
ate
=
hit_rate
+
1
;
pUrlEntry
->
dwOffsetFileExtension
=
dwOffsetFileExtension
;
pUrlEntry
->
dwOffsetHeaderInfo
=
dwOffsetHeader
;
pUrlEntry
->
dwOffsetLocalName
=
dwOffsetLocalFileName
;
pUrlEntry
->
dwOffsetUrl
=
DWORD_ALIGN
(
sizeof
(
*
pUrlEntry
));
pUrlEntry
->
exempt_d
elta
=
exempt_delta
;
pUrlEntry
->
hit_r
ate
=
hit_rate
+
1
;
pUrlEntry
->
file_extension_off
=
dwOffsetFileExtension
;
pUrlEntry
->
header_info_off
=
dwOffsetHeader
;
pUrlEntry
->
local_name_off
=
dwOffsetLocalFileName
;
pUrlEntry
->
url_off
=
DWORD_ALIGN
(
sizeof
(
*
pUrlEntry
));
pUrlEntry
->
size
.
QuadPart
=
file_size
.
QuadPart
;
pUrlEntry
->
dwUseC
ount
=
0
;
GetSystemTimeAsFileTime
(
&
pUrlEntry
->
LastAccessT
ime
);
pUrlEntry
->
LastModifiedT
ime
=
LastModifiedTime
;
URLCache_FileTimeToDosDateTime
(
&
pUrlEntry
->
LastAccessTime
,
&
pUrlEntry
->
wLastSyncDate
,
&
pUrlEntry
->
wLastSyncT
ime
);
URLCache_FileTimeToDosDateTime
(
&
ExpireTime
,
&
pUrlEntry
->
wExpiredDate
,
&
pUrlEntry
->
wExpiredT
ime
);
URLCache_FileTimeToDosDateTime
(
&
file_attr
.
ftLastWriteTime
,
&
pUrlEntry
->
LastWriteDate
,
&
pUrlEntry
->
LastWriteT
ime
);
pUrlEntry
->
use_c
ount
=
0
;
GetSystemTimeAsFileTime
(
&
pUrlEntry
->
access_t
ime
);
pUrlEntry
->
modification_t
ime
=
LastModifiedTime
;
URLCache_FileTimeToDosDateTime
(
&
pUrlEntry
->
access_time
,
&
pUrlEntry
->
sync_date
,
&
pUrlEntry
->
sync_t
ime
);
URLCache_FileTimeToDosDateTime
(
&
ExpireTime
,
&
pUrlEntry
->
expire_date
,
&
pUrlEntry
->
expire_t
ime
);
URLCache_FileTimeToDosDateTime
(
&
file_attr
.
ftLastWriteTime
,
&
pUrlEntry
->
write_date
,
&
pUrlEntry
->
write_t
ime
);
/*** Unknowns ***/
pUrlEntry
->
dwUnknown
1
=
0
;
pUrlEntry
->
dwUnknown
2
=
0
;
pUrlEntry
->
dwUnknown
3
=
0x60
;
pUrlEntry
->
Unknown
4
=
0
;
pUrlEntry
->
wUnknown
5
=
0x1010
;
pUrlEntry
->
dwUnknown
7
=
0
;
pUrlEntry
->
dwUnknown
8
=
0
;
pUrlEntry
->
unk
1
=
0
;
pUrlEntry
->
unk
2
=
0
;
pUrlEntry
->
unk
3
=
0x60
;
pUrlEntry
->
unk
4
=
0
;
pUrlEntry
->
unk
5
=
0x1010
;
pUrlEntry
->
unk
7
=
0
;
pUrlEntry
->
unk
8
=
0
;
strcpy
((
LPSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetUrl
,
lpszUrlNameA
);
strcpy
((
LPSTR
)
pUrlEntry
+
pUrlEntry
->
url_off
,
lpszUrlNameA
);
if
(
dwOffsetLocalFileName
)
strcpy
((
LPSTR
)((
LPBYTE
)
pUrlEntry
+
dwOffsetLocalFileName
),
pchLocalFileName
);
if
(
dwOffsetHeader
)
...
...
@@ -3294,17 +3292,17 @@ static BOOL CommitUrlCacheEntryInternal(
error
=
cache_container_clean_index
(
pContainer
,
&
pHeader
);
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
,
url_entry_offset
,
HASHTABLE_URL
);
}
}
if
(
error
!=
ERROR_SUCCESS
)
URLCache_DeleteEntry
(
pHeader
,
&
pUrlEntry
->
CacheFileEntry
);
URLCache_DeleteEntry
(
pHeader
,
&
pUrlEntry
->
header
);
else
{
if
(
pUrlEntry
->
CacheD
ir
<
pHeader
->
DirectoryCount
)
pHeader
->
directory_data
[
pUrlEntry
->
CacheD
ir
].
dwNumFiles
++
;
if
(
pUrlEntry
->
cache_d
ir
<
pHeader
->
DirectoryCount
)
pHeader
->
directory_data
[
pUrlEntry
->
cache_d
ir
].
dwNumFiles
++
;
if
(
CacheEntryType
&
STICKY_CACHE_ENTRY
)
pHeader
->
ExemptUsage
.
QuadPart
+=
file_size
.
QuadPart
;
else
...
...
@@ -3972,18 +3970,18 @@ static BOOL FindNextUrlCacheEntryInternal(
for
(;
URLCache_EnumHashTableEntries
(
pHeader
,
pHashTableEntry
,
&
pEntryHandle
->
dwHashEntryIndex
,
&
pHashEntry
);
pEntryHandle
->
dwHashEntryIndex
++
)
{
const
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
const
entry_url
*
pUrlEntry
;
const
entry_header
*
pEntry
=
(
const
entry_header
*
)((
LPBYTE
)
pHeader
+
pHashEntry
->
dwOffsetEntry
);
if
(
pEntry
->
signature
!=
URL_SIGNATURE
)
continue
;
pUrlEntry
=
(
const
URL_CACHEFILE_ENTRY
*
)
pEntry
;
pUrlEntry
=
(
const
entry_url
*
)
pEntry
;
TRACE
(
"Found URL: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetUrl
));
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
url_off
));
TRACE
(
"Header info: %s
\n
"
,
debugstr_an
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetHeaderInfo
,
pUrlEntry
->
dwHeaderInfoS
ize
));
debugstr_an
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
header_info_off
,
pUrlEntry
->
header_info_s
ize
));
error
=
URLCache_CopyEntry
(
pContainer
,
...
...
@@ -3998,8 +3996,8 @@ static BOOL FindNextUrlCacheEntryInternal(
SetLastError
(
error
);
return
FALSE
;
}
if
(
pUrlEntry
->
dwOffsetLocalName
)
TRACE
(
"Local File Name: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
dwOffsetLocalName
));
if
(
pUrlEntry
->
local_name_off
)
TRACE
(
"Local File Name: %s
\n
"
,
debugstr_a
((
LPCSTR
)
pUrlEntry
+
pUrlEntry
->
local_name_off
));
/* increment the current index so that next time the function
* is called the next entry is returned */
...
...
@@ -4255,16 +4253,16 @@ DWORD WINAPI DeleteIE3Cache(HWND hWnd, HINSTANCE hInst, LPSTR lpszCmdLine, int n
return
0
;
}
static
BOOL
IsUrlCacheEntryExpiredInternal
(
const
URL_CACHEFILE_ENTRY
*
pUrlEntry
,
static
BOOL
IsUrlCacheEntryExpiredInternal
(
const
entry_url
*
pUrlEntry
,
FILETIME
*
pftLastModified
)
{
BOOL
ret
;
FILETIME
now
,
expired
;
*
pftLastModified
=
pUrlEntry
->
LastModifiedT
ime
;
*
pftLastModified
=
pUrlEntry
->
modification_t
ime
;
GetSystemTimeAsFileTime
(
&
now
);
URLCache_DosDateTimeToFileTime
(
pUrlEntry
->
wExpiredD
ate
,
pUrlEntry
->
wExpiredT
ime
,
&
expired
);
URLCache_DosDateTimeToFileTime
(
pUrlEntry
->
expire_d
ate
,
pUrlEntry
->
expire_t
ime
,
&
expired
);
/* If the expired time is 0, it's interpreted as not expired */
if
(
!
expired
.
dwLowDateTime
&&
!
expired
.
dwHighDateTime
)
ret
=
FALSE
;
...
...
@@ -4286,7 +4284,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas
LPURLCACHE_HEADER
pHeader
;
struct
_HASH_ENTRY
*
pHashEntry
;
const
entry_header
*
pEntry
;
const
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
const
entry_url
*
pUrlEntry
;
URLCACHECONTAINER
*
pContainer
;
BOOL
expired
;
...
...
@@ -4333,7 +4331,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas
return
TRUE
;
}
pUrlEntry
=
(
const
URL_CACHEFILE_ENTRY
*
)
pEntry
;
pUrlEntry
=
(
const
entry_url
*
)
pEntry
;
expired
=
IsUrlCacheEntryExpiredInternal
(
pUrlEntry
,
pftLastModified
);
cache_container_unlock_index
(
pContainer
,
pHeader
);
...
...
@@ -4354,7 +4352,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa
LPURLCACHE_HEADER
pHeader
;
struct
_HASH_ENTRY
*
pHashEntry
;
const
entry_header
*
pEntry
;
const
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
const
entry_url
*
pUrlEntry
;
URLCACHECONTAINER
*
pContainer
;
BOOL
expired
;
...
...
@@ -4409,7 +4407,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa
return
TRUE
;
}
pUrlEntry
=
(
const
URL_CACHEFILE_ENTRY
*
)
pEntry
;
pUrlEntry
=
(
const
entry_url
*
)
pEntry
;
expired
=
IsUrlCacheEntryExpiredInternal
(
pUrlEntry
,
pftLastModified
);
cache_container_unlock_index
(
pContainer
,
pHeader
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment