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
fa0f0630
Commit
fa0f0630
authored
Sep 26, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Delete cache directory when cache version doesn't match.
parent
d2e5bb30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
2 deletions
+39
-2
urlcache.c
dlls/wininet/urlcache.c
+39
-2
No files found.
dlls/wininet/urlcache.c
View file @
fa0f0630
...
...
@@ -60,6 +60,9 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
wininet
);
static
const
char
urlcache_ver_prefix
[]
=
"WINE URLCache Ver "
;
static
const
char
urlcache_ver
[]
=
"0.2012001"
;
#define ENTRY_START_OFFSET 0x4000
#define DIR_LENGTH 8
#define MAX_DIR_NO 0x20
...
...
@@ -337,7 +340,8 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer, DWORD b
HASH_CACHEFILE_ENTRY
*
pHashEntry
;
/* First set some constants and defaults in the header */
strcpy
(
pHeader
->
szSignature
,
"WINE URLCache Ver 0.2005001"
);
memcpy
(
pHeader
->
szSignature
,
urlcache_ver_prefix
,
sizeof
(
urlcache_ver_prefix
)
-
1
);
memcpy
(
pHeader
->
szSignature
+
sizeof
(
urlcache_ver_prefix
)
-
1
,
urlcache_ver
,
sizeof
(
urlcache_ver
)
-
1
);
pHeader
->
dwFileSize
=
new_file_size
;
pHeader
->
dwIndexCapacityInBlocks
=
blocks_no
;
/* 127MB - taken from default for Windows 2000 */
...
...
@@ -457,8 +461,41 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer, DWORD b
URLCache_PathToObjectName
(
wszFilePath
,
'_'
);
pContainer
->
hMapping
=
OpenFileMappingW
(
FILE_MAP_WRITE
,
FALSE
,
wszFilePath
);
if
(
!
pContainer
->
hMapping
)
{
pContainer
->
hMapping
=
CreateFileMappingW
(
hFile
,
NULL
,
PAGE_READWRITE
,
0
,
0
,
wszFilePath
);
CloseHandle
(
hFile
);
CloseHandle
(
hFile
);
/* Validate cache index file on first open */
if
(
pContainer
->
hMapping
&&
blocks_no
==
MIN_BLOCK_NO
)
{
URLCACHE_HEADER
*
pHeader
=
MapViewOfFile
(
pContainer
->
hMapping
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
if
(
!
pHeader
)
{
ERR
(
"MapViewOfFile failed (error is %d)
\n
"
,
GetLastError
());
CloseHandle
(
pContainer
->
hMapping
);
pContainer
->
hMapping
=
NULL
;
ReleaseMutex
(
pContainer
->
hMutex
);
return
GetLastError
();
}
if
(
!
memcmp
(
pHeader
->
szSignature
,
urlcache_ver_prefix
,
sizeof
(
urlcache_ver_prefix
)
-
1
)
&&
memcmp
(
pHeader
->
szSignature
+
sizeof
(
urlcache_ver_prefix
)
-
1
,
urlcache_ver
,
sizeof
(
urlcache_ver
)
-
1
))
{
TRACE
(
"detected wrong version of cache: %s, expected %s
\n
"
,
pHeader
->
szSignature
,
urlcache_ver
);
UnmapViewOfFile
(
pHeader
);
FreeUrlCacheSpaceW
(
pContainer
->
path
,
100
,
0
);
}
else
{
UnmapViewOfFile
(
pHeader
);
}
}
}
else
{
CloseHandle
(
hFile
);
}
if
(
!
pContainer
->
hMapping
)
{
ERR
(
"Couldn't create file mapping (error is %d)
\n
"
,
GetLastError
());
...
...
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