Commit adae4350 authored by Alberto Massari's avatar Alberto Massari Committed by Alexandre Julliard

- Moved GetUrlCacheEntryInfoA and CommitUrlCacheEntryA to urlcache.c.

- Added stub implementation of GetUrlCacheEntryInfoExW. - Implemented InternetQueryOptionW, InternetCombineUrl[A|W]. - InternetSetOptionW prints FIXMEs with more informations. - INTERNET_SetLastError was crashing if called after the thread local storage area had already been deleted (it happens if you close Internet Explorer while the download is still in progress).
parent 26d64888
......@@ -887,31 +887,6 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
}
/***********************************************************************
* GetUrlCacheEntryInfoA (WININET.@)
*
*/
BOOL WINAPI GetUrlCacheEntryInfoA(LPCSTR lpszUrl,
LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntry,
LPDWORD lpCacheEntrySize)
{
FIXME("stub\n");
return FALSE;
}
/***********************************************************************
* CommitUrlCacheEntryA (WININET.@)
*
*/
BOOL WINAPI CommitUrlCacheEntryA(LPCSTR lpszUrl, LPCSTR lpszLocalName,
FILETIME ExpireTime, FILETIME lastModified, DWORD cacheEntryType,
LPBYTE lpHeaderInfo, DWORD headerSize, LPCSTR fileExtension,
DWORD originalUrl)
{
FIXME("stub\n");
return FALSE;
}
/***********************************************************************
* InternetAttemptConnect (WININET.@)
*
* Attempt to make a connection to the internet
......@@ -1139,17 +1114,10 @@ BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer,
}
/***********************************************************************
* InternetQueryOptionA (WININET.@)
*
* Queries an options on the specified handle
*
* RETURNS
* TRUE on success
* FALSE on failure
*
* INET_QueryOptionHelper (internal)
*/
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD dwOption,
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
{
LPWININETHANDLEHEADER lpwhh;
BOOL bSuccess = FALSE;
......@@ -1212,8 +1180,15 @@ BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
else
{
memcpy(lpBuffer, url, strlen(url)+1);
if(bIsUnicode)
{
*lpdwBufferLength=MultiByteToWideChar(CP_ACP,0,url,-1,lpBuffer,*lpdwBufferLength);
}
else
{
memcpy(lpBuffer, url, strlen(url)+1);
*lpdwBufferLength = strlen(url)+1;
}
bSuccess = TRUE;
}
}
......@@ -1238,6 +1213,38 @@ BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
return bSuccess;
}
/***********************************************************************
* InternetQueryOptionW (WININET.@)
*
* Queries an options on the specified handle
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption,
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
{
return INET_QueryOptionHelper(TRUE, hInternet, dwOption, lpBuffer, lpdwBufferLength);
}
/***********************************************************************
* InternetQueryOptionA (WININET.@)
*
* Queries an options on the specified handle
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
{
return INET_QueryOptionHelper(FALSE, hInternet, dwOption, lpBuffer, lpdwBufferLength);
}
/***********************************************************************
* InternetSetOptionW (WININET.@)
......@@ -1253,27 +1260,50 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
LPVOID lpBuffer, DWORD dwBufferLength)
{
LPWININETHANDLEHEADER lpwhh;
BOOL bSuccess = FALSE;
TRACE("0x%08lx\n", dwOption);
if (NULL == hInternet)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
return FALSE;
}
lpwhh = (LPWININETHANDLEHEADER) hInternet;
switch (dwOption)
{
case INTERNET_OPTION_HTTP_VERSION:
{
HTTP_VERSION_INFO* pVersion=(HTTP_VERSION_INFO*)lpBuffer;
FIXME("Option INTERNET_OPTION_HTTP_VERSION(%ld,%ld): STUB\n",pVersion->dwMajorVersion,pVersion->dwMinorVersion);
}
break;
case INTERNET_OPTION_ERROR_MASK:
{
unsigned long flags=*(unsigned long*)lpBuffer;
FIXME("Option INTERNET_OPTION_ERROR_MASK(%ld): STUB\n",flags);
}
break;
case INTERNET_OPTION_CODEPAGE:
{
unsigned long codepage=*(unsigned long*)lpBuffer;
FIXME("Option INTERNET_OPTION_CODEPAGE (%ld): STUB\n",codepage);
}
break;
case INTERNET_OPTION_REQUEST_PRIORITY:
{
unsigned long priority=*(unsigned long*)lpBuffer;
FIXME("Option INTERNET_OPTION_REQUEST_PRIORITY (%ld): STUB\n",priority);
}
break;
default:
FIXME("Option %ld STUB\n",dwOption);
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
FIXME("STUB\n");
break;
return FALSE;
}
return bSuccess;
return TRUE;
}
......@@ -1653,7 +1683,8 @@ void INTERNET_SetLastError(DWORD dwError)
LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex);
SetLastError(dwError);
lpwite->dwError = dwError;
if(lpwite)
lpwite->dwError = dwError;
}
......@@ -2143,3 +2174,51 @@ BOOL WINAPI InternetAutodialHangup(DWORD dwReserved)
/* we didn't dial, we don't disconnect */
return TRUE;
}
/***********************************************************************
*
* InternetCombineUrlA
*
* Combine a base URL with a relative URL
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL WINAPI InternetCombineUrlA(LPCSTR lpszBaseUrl, LPCSTR lpszRelativeUrl,
LPSTR lpszBuffer, LPDWORD lpdwBufferLength,
DWORD dwFlags)
{
HRESULT hr=S_OK;
/* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
dwFlags ^= ICU_NO_ENCODE;
hr=UrlCombineA(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
return (hr==S_OK);
}
/***********************************************************************
*
* InternetCombineUrlW
*
* Combine a base URL with a relative URL
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL WINAPI InternetCombineUrlW(LPCWSTR lpszBaseUrl, LPCWSTR lpszRelativeUrl,
LPWSTR lpszBuffer, LPDWORD lpdwBufferLength,
DWORD dwFlags)
{
HRESULT hr=S_OK;
/* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
dwFlags ^= ICU_NO_ENCODE;
hr=UrlCombineW(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
return (hr==S_OK);
}
......@@ -89,6 +89,32 @@ BOOL WINAPI SetUrlCacheEntryGroup(LPCSTR lpszUrlName, DWORD dwFlags,
}
/***********************************************************************
* CommitUrlCacheEntryA (WININET.@)
*
*/
BOOL WINAPI CommitUrlCacheEntryA(LPCSTR lpszUrl, LPCSTR lpszLocalName,
FILETIME ExpireTime, FILETIME lastModified, DWORD cacheEntryType,
LPBYTE lpHeaderInfo, DWORD headerSize, LPCSTR fileExtension,
DWORD originalUrl)
{
FIXME("stub\n");
return FALSE;
}
/***********************************************************************
* GetUrlCacheEntryInfoA (WININET.@)
*
*/
BOOL WINAPI GetUrlCacheEntryInfoA(LPCSTR lpszUrl,
LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntry,
LPDWORD lpCacheEntrySize)
{
FIXME("(%s) stub\n",lpszUrl);
SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE;
}
/***********************************************************************
* GetUrlCacheEntryInfoExA (WININET.@)
*
*/
......@@ -105,3 +131,21 @@ BOOL WINAPI GetUrlCacheEntryInfoExA(
INTERNET_SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE;
}
/***********************************************************************
* GetUrlCacheEntryInfoExW (WININET.@)
*
*/
BOOL WINAPI GetUrlCacheEntryInfoExW(
LPCWSTR lpszUrl,
LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo,
LPDWORD lpdwCacheEntryInfoBufSize,
LPWSTR lpszReserved,
LPDWORD lpdwReserved,
LPVOID lpReserved,
DWORD dwFlags)
{
FIXME(" url=%s, flags=%ld\n",debugstr_w(lpszUrl),dwFlags);
INTERNET_SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE;
}
......@@ -52,7 +52,7 @@
@ stub GetUrlCacheConfigInfoW
@ stdcall GetUrlCacheEntryInfoA(str ptr long) GetUrlCacheEntryInfoA
@ stdcall GetUrlCacheEntryInfoExA(str ptr ptr str ptr ptr long) GetUrlCacheEntryInfoExA
@ stub GetUrlCacheEntryInfoExW
@ stdcall GetUrlCacheEntryInfoExW(wstr ptr ptr wstr ptr ptr long) GetUrlCacheEntryInfoExW
@ stub GetUrlCacheEntryInfoW
@ stub GetUrlCacheHeaderData
@ stub GopherCreateLocatorA
......@@ -87,8 +87,8 @@
@ stdcall InternetCheckConnectionA(ptr long long) InternetCheckConnectionA
@ stdcall InternetCheckConnectionW(ptr long long) InternetCheckConnectionW
@ stdcall InternetCloseHandle(long) InternetCloseHandle
@ stub InternetCombineUrlA
@ stub InternetCombineUrlW
@ stdcall InternetCombineUrlA(str str str ptr long) InternetCombineUrlA
@ stdcall InternetCombineUrlW(wstr wstr wstr ptr long) InternetCombineUrlW
@ stub InternetConfirmZoneCrossing
@ stdcall InternetConnectA(ptr str long str str long long long) InternetConnectA
@ stdcall InternetConnectW(ptr wstr long wstr wstr long long long) InternetConnectW
......@@ -117,7 +117,7 @@
@ stdcall InternetOpenUrlW(ptr wstr wstr long long long) InternetOpenUrlW
@ stdcall InternetQueryDataAvailable(ptr ptr long long) InternetQueryDataAvailable
@ stdcall InternetQueryOptionA(ptr long ptr ptr) InternetQueryOptionA
@ stub InternetQueryOptionW
@ stdcall InternetQueryOptionW(ptr long ptr ptr) InternetQueryOptionW
@ stdcall InternetReadFile(ptr ptr long ptr) InternetReadFile
@ stdcall InternetReadFileExA(ptr ptr long long) InternetReadFileExA
@ stdcall InternetReadFileExW(ptr ptr long long) InternetReadFileExW
......
......@@ -447,8 +447,11 @@ BOOLAPI InternetUnlockRequestFile(HANDLE);
#define INTERNET_OPTION_HTTP_VERSION 59
#define INTERNET_OPTION_RESET_URLCACHE_SESSION 60
#define INTERNET_OPTION_ERROR_MASK 62
#define INTERNET_OPTION_CODEPAGE 68
#define INTERNET_OPTION_PROXY_SETTINGS_CHANGED 95
#define INTERNET_FIRST_OPTION INTERNET_OPTION_CALLBACK
#define INTERNET_LAST_OPTION INTERNET_OPTION_ERROR_MASK
#define INTERNET_LAST_OPTION INTERNET_OPTION_PROXY_SETTINGS_CHANGED
#define INTERNET_PRIORITY_FOREGROUND 1000
#define INTERNET_HANDLE_TYPE_INTERNET 1
#define INTERNET_HANDLE_TYPE_CONNECT_FTP 2
......
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