wininet: Convert file size in cache entry to a large integer.

This commit is contained in:
Alexandre Julliard 2011-03-09 12:23:05 +01:00
parent f0cd3de5c1
commit d790688afa
1 changed files with 8 additions and 12 deletions

View File

@ -96,8 +96,7 @@ typedef struct _URL_CACHEFILE_ENTRY
WORD wExpiredDate; /* expire date in dos format */ WORD wExpiredDate; /* expire date in dos format */
WORD wExpiredTime; /* expire time in dos format */ WORD wExpiredTime; /* expire time in dos format */
DWORD dwUnknown1; /* usually zero */ DWORD dwUnknown1; /* usually zero */
DWORD dwSizeLow; /* see INTERNET_CACHE_ENTRY_INFO::dwSizeLow */ ULARGE_INTEGER size; /* see INTERNET_CACHE_ENTRY_INFO::dwSizeLow/High */
DWORD dwSizeHigh; /* see INTERNET_CACHE_ENTRY_INFO::dwSizeHigh */
DWORD dwUnknown2; /* usually zero */ DWORD dwUnknown2; /* usually zero */
DWORD dwExemptDelta; /* see INTERNET_CACHE_ENTRY_INFO::dwExemptDelta */ DWORD dwExemptDelta; /* see INTERNET_CACHE_ENTRY_INFO::dwExemptDelta */
DWORD dwUnknown3; /* usually 0x60 */ DWORD dwUnknown3; /* usually 0x60 */
@ -959,8 +958,8 @@ static DWORD URLCache_CopyEntry(
lpCacheEntryInfo->u.dwExemptDelta = pUrlEntry->dwExemptDelta; lpCacheEntryInfo->u.dwExemptDelta = pUrlEntry->dwExemptDelta;
lpCacheEntryInfo->dwHeaderInfoSize = pUrlEntry->dwHeaderInfoSize; lpCacheEntryInfo->dwHeaderInfoSize = pUrlEntry->dwHeaderInfoSize;
lpCacheEntryInfo->dwHitRate = pUrlEntry->dwHitRate; lpCacheEntryInfo->dwHitRate = pUrlEntry->dwHitRate;
lpCacheEntryInfo->dwSizeHigh = pUrlEntry->dwSizeHigh; lpCacheEntryInfo->dwSizeHigh = pUrlEntry->size.u.HighPart;
lpCacheEntryInfo->dwSizeLow = pUrlEntry->dwSizeLow; lpCacheEntryInfo->dwSizeLow = pUrlEntry->size.u.LowPart;
lpCacheEntryInfo->dwStructSize = sizeof(*lpCacheEntryInfo); lpCacheEntryInfo->dwStructSize = sizeof(*lpCacheEntryInfo);
lpCacheEntryInfo->dwUseCount = pUrlEntry->dwUseCount; lpCacheEntryInfo->dwUseCount = pUrlEntry->dwUseCount;
DosDateTimeToFileTime(pUrlEntry->wExpiredDate, pUrlEntry->wExpiredTime, &lpCacheEntryInfo->ExpireTime); DosDateTimeToFileTime(pUrlEntry->wExpiredDate, pUrlEntry->wExpiredTime, &lpCacheEntryInfo->ExpireTime);
@ -2432,8 +2431,7 @@ static BOOL CommitUrlCacheEntryInternal(
DWORD dwOffsetLocalFileName = 0; DWORD dwOffsetLocalFileName = 0;
DWORD dwOffsetHeader = 0; DWORD dwOffsetHeader = 0;
DWORD dwOffsetFileExtension = 0; DWORD dwOffsetFileExtension = 0;
DWORD dwFileSizeLow = 0; LARGE_INTEGER file_size;
DWORD dwFileSizeHigh = 0;
BYTE cDirectory = 0; BYTE cDirectory = 0;
char achFile[MAX_PATH]; char achFile[MAX_PATH];
LPSTR lpszUrlNameA = NULL; LPSTR lpszUrlNameA = NULL;
@ -2452,7 +2450,8 @@ static BOOL CommitUrlCacheEntryInternal(
if (lpszOriginalUrl) if (lpszOriginalUrl)
WARN(": lpszOriginalUrl ignored\n"); WARN(": lpszOriginalUrl ignored\n");
file_size.QuadPart = 0;
if (lpszLocalFileName) if (lpszLocalFileName)
{ {
HANDLE hFile; HANDLE hFile;
@ -2465,8 +2464,7 @@ static BOOL CommitUrlCacheEntryInternal(
} }
/* Get file size */ /* Get file size */
dwFileSizeLow = GetFileSize(hFile, &dwFileSizeHigh); if (!GetFileSizeEx(hFile, &file_size))
if ((dwFileSizeLow == INVALID_FILE_SIZE) && (GetLastError() != NO_ERROR))
{ {
ERR("couldn't get file size (error is %d)\n", GetLastError()); ERR("couldn't get file size (error is %d)\n", GetLastError());
CloseHandle(hFile); CloseHandle(hFile);
@ -2595,9 +2593,7 @@ static BOOL CommitUrlCacheEntryInternal(
pUrlEntry->dwOffsetHeaderInfo = dwOffsetHeader; pUrlEntry->dwOffsetHeaderInfo = dwOffsetHeader;
pUrlEntry->dwOffsetLocalName = dwOffsetLocalFileName; pUrlEntry->dwOffsetLocalName = dwOffsetLocalFileName;
pUrlEntry->dwOffsetUrl = DWORD_ALIGN(sizeof(*pUrlEntry)); pUrlEntry->dwOffsetUrl = DWORD_ALIGN(sizeof(*pUrlEntry));
pUrlEntry->dwSizeHigh = 0; pUrlEntry->size.QuadPart = file_size.QuadPart;
pUrlEntry->dwSizeLow = dwFileSizeLow;
pUrlEntry->dwSizeHigh = dwFileSizeHigh;
pUrlEntry->dwUseCount = 0; pUrlEntry->dwUseCount = 0;
GetSystemTimeAsFileTime(&pUrlEntry->LastAccessTime); GetSystemTimeAsFileTime(&pUrlEntry->LastAccessTime);
pUrlEntry->LastModifiedTime = LastModifiedTime; pUrlEntry->LastModifiedTime = LastModifiedTime;