Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e3a2e3a1
Commit
e3a2e3a1
authored
Sep 19, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Don't delete files that were modified after adding to cache.
parent
b7010348
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
34 deletions
+28
-34
urlcache.c
dlls/wininet/urlcache.c
+28
-34
No files found.
dlls/wininet/urlcache.c
View file @
e3a2e3a1
...
...
@@ -127,8 +127,8 @@ typedef struct _URL_CACHEFILE_ENTRY
WORD
wLastSyncTime
;
/* last sync time in dos format */
DWORD
dwHitRate
;
/* see INTERNET_CACHE_ENTRY_INFO::dwHitRate */
DWORD
dwUseCount
;
/* see INTERNET_CACHE_ENTRY_INFO::dwUseCount */
WORD
wUnknownDate
;
/* usually same as wLastSyncDate */
WORD
wUnknownTime
;
/* usually same as wLastSyncTime */
WORD
LastWriteDate
;
WORD
LastWriteTime
;
DWORD
dwUnknown7
;
/* usually zero */
DWORD
dwUnknown8
;
/* usually zero */
/* packing to dword align start of next field */
...
...
@@ -960,15 +960,29 @@ static BOOL URLCache_LocalFileNameToPathA(
return
FALSE
;
}
/* Just like FileTimeToDosDateTime, except that it also maps the special
* case of a filetime of (0,0) to a DOS date/time of (0,0).
*/
static
void
URLCache_FileTimeToDosDateTime
(
const
FILETIME
*
ft
,
WORD
*
fatdate
,
WORD
*
fattime
)
{
if
(
!
ft
->
dwLowDateTime
&&
!
ft
->
dwHighDateTime
)
*
fatdate
=
*
fattime
=
0
;
else
FileTimeToDosDateTime
(
ft
,
fatdate
,
fattime
);
}
/***********************************************************************
* URLCache_DeleteFile (Internal)
*/
static
DWORD
URLCache_DeleteFile
(
const
URLCACHECONTAINER
*
container
,
URLCACHE_HEADER
*
header
,
URL_CACHEFILE_ENTRY
*
url_entry
)
{
WIN32_FILE_ATTRIBUTE_DATA
attr
;
WCHAR
path
[
MAX_PATH
];
LONG
path_size
=
sizeof
(
path
);
DWORD
err
;
WORD
date
,
time
;
if
(
!
url_entry
->
dwOffsetLocalName
)
goto
succ
;
...
...
@@ -978,6 +992,12 @@ static DWORD URLCache_DeleteFile(const URLCACHECONTAINER *container,
url_entry
->
CacheDir
,
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
->
LastWriteTime
)
goto
succ
;
err
=
(
DeleteFileW
(
path
)
?
ERROR_SUCCESS
:
GetLastError
());
if
(
err
==
ERROR_ACCESS_DENIED
||
err
==
ERROR_SHARING_VIOLATION
)
return
err
;
...
...
@@ -1203,18 +1223,6 @@ static DWORD URLCache_CopyEntry(
return
ERROR_SUCCESS
;
}
/* Just like FileTimeToDosDateTime, except that it also maps the special
* case of a filetime of (0,0) to a DOS date/time of (0,0).
*/
static
void
URLCache_FileTimeToDosDateTime
(
const
FILETIME
*
ft
,
WORD
*
fatdate
,
WORD
*
fattime
)
{
if
(
!
ft
->
dwLowDateTime
&&
!
ft
->
dwHighDateTime
)
*
fatdate
=
*
fattime
=
0
;
else
FileTimeToDosDateTime
(
ft
,
fatdate
,
fattime
);
}
/***********************************************************************
* URLCache_SetEntryInfo (Internal)
*
...
...
@@ -2741,6 +2749,7 @@ static BOOL CommitUrlCacheEntryInternal(
DWORD
dwOffsetLocalFileName
=
0
;
DWORD
dwOffsetHeader
=
0
;
DWORD
dwOffsetFileExtension
=
0
;
WIN32_FILE_ATTRIBUTE_DATA
file_attr
;
LARGE_INTEGER
file_size
;
BYTE
cDirectory
=
0
;
char
achFile
[
MAX_PATH
];
...
...
@@ -2768,28 +2777,14 @@ static BOOL CommitUrlCacheEntryInternal(
if
(
lpszOriginalUrl
)
WARN
(
": lpszOriginalUrl ignored
\n
"
);
file_size
.
QuadPart
=
0
;
memset
(
&
file_attr
,
0
,
sizeof
(
file_attr
))
;
if
(
lpszLocalFileName
)
{
HANDLE
hFile
;
hFile
=
CreateFileW
(
lpszLocalFileName
,
FILE_READ_ATTRIBUTES
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
{
ERR
(
"couldn't open file %s (error is %d)
\n
"
,
debugstr_w
(
lpszLocalFileName
),
GetLastError
());
if
(
!
GetFileAttributesExW
(
lpszLocalFileName
,
GetFileExInfoStandard
,
&
file_attr
))
return
FALSE
;
}
/* Get file size */
if
(
!
GetFileSizeEx
(
hFile
,
&
file_size
))
{
ERR
(
"couldn't get file size (error is %d)
\n
"
,
GetLastError
());
CloseHandle
(
hFile
);
return
FALSE
;
}
CloseHandle
(
hFile
);
}
file_size
.
u
.
LowPart
=
file_attr
.
nFileSizeLow
;
file_size
.
u
.
HighPart
=
file_attr
.
nFileSizeHigh
;
error
=
URLCacheContainers_FindContainerW
(
lpszUrlName
,
&
pContainer
);
if
(
error
!=
ERROR_SUCCESS
)
...
...
@@ -2931,8 +2926,7 @@ static BOOL CommitUrlCacheEntryInternal(
pUrlEntry
->
LastModifiedTime
=
LastModifiedTime
;
URLCache_FileTimeToDosDateTime
(
&
pUrlEntry
->
LastAccessTime
,
&
pUrlEntry
->
wLastSyncDate
,
&
pUrlEntry
->
wLastSyncTime
);
URLCache_FileTimeToDosDateTime
(
&
ExpireTime
,
&
pUrlEntry
->
wExpiredDate
,
&
pUrlEntry
->
wExpiredTime
);
pUrlEntry
->
wUnknownDate
=
pUrlEntry
->
wLastSyncDate
;
pUrlEntry
->
wUnknownTime
=
pUrlEntry
->
wLastSyncTime
;
URLCache_FileTimeToDosDateTime
(
&
file_attr
.
ftLastWriteTime
,
&
pUrlEntry
->
LastWriteDate
,
&
pUrlEntry
->
LastWriteTime
);
/*** Unknowns ***/
pUrlEntry
->
dwUnknown1
=
0
;
...
...
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