diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 7f422daf0b4..c5b6a9f5014 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -2049,8 +2049,9 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d } case INTERNET_OPTION_URL: - case INTERNET_OPTION_DATAFILE_NAME: { + TRACE("INTERNET_OPTION_URL\n"); + if (!lpwhh) { WARN("Invalid hInternet handle\n"); @@ -2094,6 +2095,52 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d } break; } + + case INTERNET_OPTION_DATAFILE_NAME: + { + TRACE("INTERNET_OPTION_DATAFILE_NAME\n"); + if (!lpwhh) + { + WARN("Invalid hInternet handle\n"); + INTERNET_SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + if (lpwhh->htype == WH_HHTTPREQ) + { + LPWININETHTTPREQW lpreq = (LPWININETHTTPREQW) lpwhh; + DWORD size; + + if(!lpreq->lpszCacheFile) { + *lpdwBufferLength = 0; + INTERNET_SetLastError(ERROR_INTERNET_ITEM_NOT_FOUND); + } + else if(bIsUnicode) + { + size = (lstrlenW(lpreq->lpszCacheFile)+1) * sizeof(WCHAR); + if (*lpdwBufferLength < size) + INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER); + else + { + memcpy(lpBuffer, lpreq->lpszCacheFile, size); + bSuccess = TRUE; + } + *lpdwBufferLength = size; + } + else + { + size = WideCharToMultiByte(CP_ACP, 0, lpreq->lpszCacheFile, -1, NULL, 0, NULL, NULL); + if (size > *lpdwBufferLength) { + INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER); + }else { + *lpdwBufferLength = WideCharToMultiByte(CP_ACP, 0, lpreq->lpszCacheFile, + -1, lpBuffer, *lpdwBufferLength, NULL, NULL); + bSuccess = TRUE; + } + } + } + break; + } + case INTERNET_OPTION_HTTP_VERSION: { if (*lpdwBufferLength < sizeof(HTTP_VERSION_INFO))