Commit f08e79ce authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

wininet: Support Punycode in SetUrlCacheEntryInfoW.

parent 940176d8
...@@ -1351,31 +1351,31 @@ static DWORD urlcache_copy_entry( ...@@ -1351,31 +1351,31 @@ static DWORD urlcache_copy_entry(
* urlcache_set_entry_info (Internal) * urlcache_set_entry_info (Internal)
* *
* Helper for SetUrlCacheEntryInfo{A,W}. Sets fields in URL entry * Helper for SetUrlCacheEntryInfo{A,W}. Sets fields in URL entry
* according to the flags set by dwFieldControl. * according to the flags set by field_control.
* *
* RETURNS * RETURNS
* ERROR_SUCCESS if the buffer was big enough * ERROR_SUCCESS if the buffer was big enough
* ERROR_INSUFFICIENT_BUFFER if the buffer was too small * ERROR_INSUFFICIENT_BUFFER if the buffer was too small
* *
*/ */
static DWORD urlcache_set_entry_info(entry_url * pUrlEntry, const INTERNET_CACHE_ENTRY_INFOW * lpCacheEntryInfo, DWORD dwFieldControl) static DWORD urlcache_set_entry_info(entry_url *url_entry, const INTERNET_CACHE_ENTRY_INFOA *entry_info, DWORD field_control)
{ {
if (dwFieldControl & CACHE_ENTRY_ACCTIME_FC) if (field_control & CACHE_ENTRY_ACCTIME_FC)
pUrlEntry->access_time = lpCacheEntryInfo->LastAccessTime; url_entry->access_time = entry_info->LastAccessTime;
if (dwFieldControl & CACHE_ENTRY_ATTRIBUTE_FC) if (field_control & CACHE_ENTRY_ATTRIBUTE_FC)
pUrlEntry->cache_entry_type = lpCacheEntryInfo->CacheEntryType; url_entry->cache_entry_type = entry_info->CacheEntryType;
if (dwFieldControl & CACHE_ENTRY_EXEMPT_DELTA_FC) if (field_control & CACHE_ENTRY_EXEMPT_DELTA_FC)
pUrlEntry->exempt_delta = lpCacheEntryInfo->u.dwExemptDelta; url_entry->exempt_delta = entry_info->u.dwExemptDelta;
if (dwFieldControl & CACHE_ENTRY_EXPTIME_FC) if (field_control & CACHE_ENTRY_EXPTIME_FC)
file_time_to_dos_date_time(&lpCacheEntryInfo->ExpireTime, &pUrlEntry->expire_date, &pUrlEntry->expire_time); file_time_to_dos_date_time(&entry_info->ExpireTime, &url_entry->expire_date, &url_entry->expire_time);
if (dwFieldControl & CACHE_ENTRY_HEADERINFO_FC) if (field_control & CACHE_ENTRY_HEADERINFO_FC)
FIXME("CACHE_ENTRY_HEADERINFO_FC unimplemented\n"); FIXME("CACHE_ENTRY_HEADERINFO_FC unimplemented\n");
if (dwFieldControl & CACHE_ENTRY_HITRATE_FC) if (field_control & CACHE_ENTRY_HITRATE_FC)
pUrlEntry->hit_rate = lpCacheEntryInfo->dwHitRate; url_entry->hit_rate = entry_info->dwHitRate;
if (dwFieldControl & CACHE_ENTRY_MODTIME_FC) if (field_control & CACHE_ENTRY_MODTIME_FC)
pUrlEntry->modification_time = lpCacheEntryInfo->LastModifiedTime; url_entry->modification_time = entry_info->LastModifiedTime;
if (dwFieldControl & CACHE_ENTRY_SYNCTIME_FC) if (field_control & CACHE_ENTRY_SYNCTIME_FC)
file_time_to_dos_date_time(&lpCacheEntryInfo->LastAccessTime, &pUrlEntry->sync_date, &pUrlEntry->sync_time); file_time_to_dos_date_time(&entry_info->LastAccessTime, &url_entry->sync_date, &url_entry->sync_time);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -1973,10 +1973,9 @@ BOOL WINAPI GetUrlCacheEntryInfoW(LPCWSTR lpszUrl, ...@@ -1973,10 +1973,9 @@ BOOL WINAPI GetUrlCacheEntryInfoW(LPCWSTR lpszUrl,
/*********************************************************************** /***********************************************************************
* SetUrlCacheEntryInfoA (WININET.@) * SetUrlCacheEntryInfoA (WININET.@)
*/ */
BOOL WINAPI SetUrlCacheEntryInfoA( BOOL WINAPI SetUrlCacheEntryInfoA(LPCSTR lpszUrlName,
LPCSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo,
LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo, DWORD dwFieldControl)
DWORD dwFieldControl)
{ {
urlcache_header *pHeader; urlcache_header *pHeader;
struct hash_entry *pHashEntry; struct hash_entry *pHashEntry;
...@@ -2020,10 +2019,7 @@ BOOL WINAPI SetUrlCacheEntryInfoA( ...@@ -2020,10 +2019,7 @@ BOOL WINAPI SetUrlCacheEntryInfoA(
return FALSE; return FALSE;
} }
urlcache_set_entry_info( urlcache_set_entry_info((entry_url*)pEntry, lpCacheEntryInfo, dwFieldControl);
(entry_url *)pEntry,
(const INTERNET_CACHE_ENTRY_INFOW *)lpCacheEntryInfo,
dwFieldControl);
cache_container_unlock_index(pContainer, pHeader); cache_container_unlock_index(pContainer, pHeader);
...@@ -2033,58 +2029,19 @@ BOOL WINAPI SetUrlCacheEntryInfoA( ...@@ -2033,58 +2029,19 @@ BOOL WINAPI SetUrlCacheEntryInfoA(
/*********************************************************************** /***********************************************************************
* SetUrlCacheEntryInfoW (WININET.@) * SetUrlCacheEntryInfoW (WININET.@)
*/ */
BOOL WINAPI SetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, DWORD dwFieldControl) BOOL WINAPI SetUrlCacheEntryInfoW(LPCWSTR lpszUrl,
LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo,
DWORD dwFieldControl)
{ {
urlcache_header *pHeader; char *url;
struct hash_entry *pHashEntry; BOOL ret;
entry_header *pEntry;
cache_container *pContainer;
DWORD error;
TRACE("(%s, %p, 0x%08x)\n", debugstr_w(lpszUrl), lpCacheEntryInfo, dwFieldControl);
error = cache_containers_findW(lpszUrl, &pContainer);
if (error != ERROR_SUCCESS)
{
SetLastError(error);
return FALSE;
}
error = cache_container_open_index(pContainer, MIN_BLOCK_NO);
if (error != ERROR_SUCCESS)
{
SetLastError(error);
return FALSE;
}
if (!(pHeader = cache_container_lock_index(pContainer)))
return FALSE;
if (!urlcache_find_hash_entryW(pHeader, lpszUrl, &pHashEntry))
{
cache_container_unlock_index(pContainer, pHeader);
WARN("entry %s not found!\n", debugstr_w(lpszUrl));
SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE;
}
pEntry = (entry_header*)((LPBYTE)pHeader + pHashEntry->offset); if(!urlcache_encode_url_alloc(lpszUrl, &url))
if (pEntry->signature != URL_SIGNATURE)
{
cache_container_unlock_index(pContainer, pHeader);
FIXME("Trying to retrieve entry of unknown format %s\n", debugstr_an((LPSTR)&pEntry->signature, sizeof(DWORD)));
SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE; return FALSE;
}
urlcache_set_entry_info(
(entry_url *)pEntry,
lpCacheEntryInfo,
dwFieldControl);
cache_container_unlock_index(pContainer, pHeader);
return TRUE; ret = SetUrlCacheEntryInfoA(url, (INTERNET_CACHE_ENTRY_INFOA*)lpCacheEntryInfo, dwFieldControl);
heap_free(url);
return ret;
} }
/*********************************************************************** /***********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment