Piotr Caban : wininet: Support Punycode in UnlockUrlCacheEntryFileW.

Alexandre Julliard julliard at winehq.org
Mon Apr 1 13:48:42 CDT 2013


Module: wine
Branch: master
Commit: 6f35d68f42e84147a1367a6dd58266125d448adc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6f35d68f42e84147a1367a6dd58266125d448adc

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Apr  1 13:16:09 2013 +0200

wininet: Support Punycode in UnlockUrlCacheEntryFileW.

---

 dlls/wininet/urlcache.c |   74 +++++-----------------------------------------
 1 files changed, 8 insertions(+), 66 deletions(-)

diff --git a/dlls/wininet/urlcache.c b/dlls/wininet/urlcache.c
index f5f86c5..23ff308 100644
--- a/dlls/wininet/urlcache.c
+++ b/dlls/wininet/urlcache.c
@@ -2495,10 +2495,7 @@ BOOL WINAPI FreeUrlCacheSpaceA(LPCSTR lpszCachePath, DWORD dwSize, DWORD dwFilte
  *           UnlockUrlCacheEntryFileA (WININET.@)
  *
  */
-BOOL WINAPI UnlockUrlCacheEntryFileA(
-    IN LPCSTR lpszUrlName, 
-    IN DWORD dwReserved
-    )
+BOOL WINAPI UnlockUrlCacheEntryFileA(LPCSTR lpszUrlName, DWORD dwReserved)
 {
     urlcache_header *pHeader;
     struct hash_entry *pHashEntry;
@@ -2574,72 +2571,17 @@ BOOL WINAPI UnlockUrlCacheEntryFileA(
  *           UnlockUrlCacheEntryFileW (WININET.@)
  *
  */
-BOOL WINAPI UnlockUrlCacheEntryFileW( LPCWSTR lpszUrlName, DWORD dwReserved )
+BOOL WINAPI UnlockUrlCacheEntryFileW(LPCWSTR lpszUrlName, DWORD dwReserved)
 {
-    urlcache_header *pHeader;
-    struct hash_entry *pHashEntry;
-    entry_header *pEntry;
-    entry_url * pUrlEntry;
-    cache_container *pContainer;
-    DWORD error;
-
-    TRACE("(%s, 0x%08x)\n", debugstr_w(lpszUrlName), dwReserved);
-
-    if (dwReserved)
-    {
-        ERR("dwReserved != 0\n");
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
-
-    error = cache_containers_findW(lpszUrlName, &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, lpszUrlName, &pHashEntry))
-    {
-        cache_container_unlock_index(pContainer, pHeader);
-        TRACE("entry %s not found!\n", debugstr_w(lpszUrlName));
-        SetLastError(ERROR_FILE_NOT_FOUND);
-        return FALSE;
-    }
-
-    pEntry = (entry_header*)((LPBYTE)pHeader + pHashEntry->offset);
-    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;
-    }
-
-    pUrlEntry = (entry_url *)pEntry;
+    char *url;
+    BOOL ret;
 
-    if (pUrlEntry->use_count == 0)
-    {
-        cache_container_unlock_index(pContainer, pHeader);
+    if(!urlcache_encode_url_alloc(lpszUrlName, &url))
         return FALSE;
-    }
-    pUrlEntry->use_count--;
-    if (!pUrlEntry->use_count)
-        urlcache_hash_entry_set_flags(pHashEntry, HASHTABLE_URL);
-
-    cache_container_unlock_index(pContainer, pHeader);
 
-    return TRUE;
+    ret = UnlockUrlCacheEntryFileA(url, dwReserved);
+    heap_free(url);
+    return ret;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list