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
cb0a5c91
Commit
cb0a5c91
authored
Mar 09, 2011
by
Juan Lang
Committed by
Alexandre Julliard
Mar 10, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Implement DeleteUrlCacheEntryA/W with a helper function.
parent
190acb9e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
72 deletions
+47
-72
urlcache.c
dlls/wininet/urlcache.c
+47
-72
No files found.
dlls/wininet/urlcache.c
View file @
cb0a5c91
...
...
@@ -2039,6 +2039,47 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW(
return
TRUE
;
}
static
BOOL
DeleteUrlCacheEntryInternal
(
LPURLCACHE_HEADER
pHeader
,
struct
_HASH_ENTRY
*
pHashEntry
)
{
CACHEFILE_ENTRY
*
pEntry
;
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
pEntry
=
(
CACHEFILE_ENTRY
*
)((
LPBYTE
)
pHeader
+
pHashEntry
->
dwOffsetEntry
);
if
(
pEntry
->
dwSignature
!=
URL_SIGNATURE
)
{
FIXME
(
"Trying to delete entry of unknown format %s
\n
"
,
debugstr_an
((
LPCSTR
)
&
pEntry
->
dwSignature
,
sizeof
(
DWORD
)));
SetLastError
(
ERROR_FILE_NOT_FOUND
);
return
FALSE
;
}
pUrlEntry
=
(
URL_CACHEFILE_ENTRY
*
)
pEntry
;
if
(
pUrlEntry
->
CacheDir
<
pHeader
->
DirectoryCount
)
{
if
(
pHeader
->
directory_data
[
pUrlEntry
->
CacheDir
].
dwNumFiles
)
pHeader
->
directory_data
[
pUrlEntry
->
CacheDir
].
dwNumFiles
--
;
}
if
(
pUrlEntry
->
CacheEntryType
&
STICKY_CACHE_ENTRY
)
{
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
ExemptUsage
.
QuadPart
)
pHeader
->
ExemptUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
else
pHeader
->
ExemptUsage
.
QuadPart
=
0
;
}
else
{
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
CacheUsage
.
QuadPart
)
pHeader
->
CacheUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
else
pHeader
->
CacheUsage
.
QuadPart
=
0
;
}
URLCache_DeleteEntry
(
pHeader
,
pEntry
);
URLCache_DeleteEntryFromHash
(
pHashEntry
);
return
TRUE
;
}
/***********************************************************************
* UnlockUrlCacheEntryFileA (WININET.@)
*
...
...
@@ -3001,9 +3042,8 @@ BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName)
URLCACHECONTAINER
*
pContainer
;
LPURLCACHE_HEADER
pHeader
;
struct
_HASH_ENTRY
*
pHashEntry
;
CACHEFILE_ENTRY
*
pEntry
;
const
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
DWORD
error
;
BOOL
ret
;
TRACE
(
"(%s)
\n
"
,
debugstr_a
(
lpszUrlName
));
...
...
@@ -3032,43 +3072,11 @@ BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName)
return
FALSE
;
}
pEntry
=
(
CACHEFILE_ENTRY
*
)((
LPBYTE
)
pHeader
+
pHashEntry
->
dwOffsetEntry
);
if
(
pEntry
->
dwSignature
!=
URL_SIGNATURE
)
{
URLCacheContainer_UnlockIndex
(
pContainer
,
pHeader
);
FIXME
(
"Trying to delete entry of unknown format %s
\n
"
,
debugstr_an
((
LPCSTR
)
&
pEntry
->
dwSignature
,
sizeof
(
DWORD
)));
SetLastError
(
ERROR_FILE_NOT_FOUND
);
return
FALSE
;
}
pUrlEntry
=
(
const
URL_CACHEFILE_ENTRY
*
)
pEntry
;
if
(
pUrlEntry
->
CacheDir
<
pHeader
->
DirectoryCount
)
{
if
(
pHeader
->
directory_data
[
pUrlEntry
->
CacheDir
].
dwNumFiles
)
pHeader
->
directory_data
[
pUrlEntry
->
CacheDir
].
dwNumFiles
--
;
}
if
(
pUrlEntry
->
CacheEntryType
&
STICKY_CACHE_ENTRY
)
{
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
ExemptUsage
.
QuadPart
)
pHeader
->
ExemptUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
else
pHeader
->
ExemptUsage
.
QuadPart
=
0
;
}
else
{
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
CacheUsage
.
QuadPart
)
pHeader
->
CacheUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
else
pHeader
->
CacheUsage
.
QuadPart
=
0
;
}
URLCache_DeleteEntry
(
pHeader
,
pEntry
);
URLCache_DeleteEntryFromHash
(
pHashEntry
);
ret
=
DeleteUrlCacheEntryInternal
(
pHeader
,
pHashEntry
);
URLCacheContainer_UnlockIndex
(
pContainer
,
pHeader
);
return
TRUE
;
return
ret
;
}
/***********************************************************************
...
...
@@ -3080,10 +3088,9 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
URLCACHECONTAINER
*
pContainer
;
LPURLCACHE_HEADER
pHeader
;
struct
_HASH_ENTRY
*
pHashEntry
;
CACHEFILE_ENTRY
*
pEntry
;
const
URL_CACHEFILE_ENTRY
*
pUrlEntry
;
LPSTR
urlA
;
DWORD
error
;
BOOL
ret
;
TRACE
(
"(%s)
\n
"
,
debugstr_w
(
lpszUrlName
));
...
...
@@ -3125,44 +3132,12 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
return
FALSE
;
}
pEntry
=
(
CACHEFILE_ENTRY
*
)((
LPBYTE
)
pHeader
+
pHashEntry
->
dwOffsetEntry
);
if
(
pEntry
->
dwSignature
!=
URL_SIGNATURE
)
{
URLCacheContainer_UnlockIndex
(
pContainer
,
pHeader
);
FIXME
(
"Trying to delete entry of unknown format %s
\n
"
,
debugstr_an
((
LPCSTR
)
&
pEntry
->
dwSignature
,
sizeof
(
DWORD
)));
SetLastError
(
ERROR_FILE_NOT_FOUND
);
return
FALSE
;
}
pUrlEntry
=
(
const
URL_CACHEFILE_ENTRY
*
)
pEntry
;
if
(
pUrlEntry
->
CacheDir
<
pHeader
->
DirectoryCount
)
{
if
(
pHeader
->
directory_data
[
pUrlEntry
->
CacheDir
].
dwNumFiles
)
pHeader
->
directory_data
[
pUrlEntry
->
CacheDir
].
dwNumFiles
--
;
}
if
(
pUrlEntry
->
CacheEntryType
&
STICKY_CACHE_ENTRY
)
{
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
ExemptUsage
.
QuadPart
)
pHeader
->
ExemptUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
else
pHeader
->
ExemptUsage
.
QuadPart
=
0
;
}
else
{
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
CacheUsage
.
QuadPart
)
pHeader
->
CacheUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
else
pHeader
->
CacheUsage
.
QuadPart
=
0
;
}
URLCache_DeleteEntry
(
pHeader
,
pEntry
);
URLCache_DeleteEntryFromHash
(
pHashEntry
);
ret
=
DeleteUrlCacheEntryInternal
(
pHeader
,
pHashEntry
);
URLCacheContainer_UnlockIndex
(
pContainer
,
pHeader
);
HeapFree
(
GetProcessHeap
(),
0
,
urlA
);
return
TRUE
;
return
ret
;
}
BOOL
WINAPI
DeleteUrlCacheContainerA
(
DWORD
d1
,
DWORD
d2
)
...
...
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