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, ...@@ -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.@) * InternetAttemptConnect (WININET.@)
* *
* Attempt to make a connection to the internet * Attempt to make a connection to the internet
...@@ -1139,16 +1114,9 @@ BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, ...@@ -1139,16 +1114,9 @@ BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer,
} }
/*********************************************************************** /***********************************************************************
* InternetQueryOptionA (WININET.@) * INET_QueryOptionHelper (internal)
*
* Queries an options on the specified handle
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/ */
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD dwOption,
LPVOID lpBuffer, LPDWORD lpdwBufferLength) LPVOID lpBuffer, LPDWORD lpdwBufferLength)
{ {
LPWININETHANDLEHEADER lpwhh; LPWININETHANDLEHEADER lpwhh;
...@@ -1212,8 +1180,15 @@ BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, ...@@ -1212,8 +1180,15 @@ BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER); INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
else else
{ {
if(bIsUnicode)
{
*lpdwBufferLength=MultiByteToWideChar(CP_ACP,0,url,-1,lpBuffer,*lpdwBufferLength);
}
else
{
memcpy(lpBuffer, url, strlen(url)+1); memcpy(lpBuffer, url, strlen(url)+1);
*lpdwBufferLength = strlen(url)+1; *lpdwBufferLength = strlen(url)+1;
}
bSuccess = TRUE; bSuccess = TRUE;
} }
} }
...@@ -1238,6 +1213,38 @@ BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, ...@@ -1238,6 +1213,38 @@ BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
return bSuccess; 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.@) * InternetSetOptionW (WININET.@)
...@@ -1253,7 +1260,6 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, ...@@ -1253,7 +1260,6 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
LPVOID lpBuffer, DWORD dwBufferLength) LPVOID lpBuffer, DWORD dwBufferLength)
{ {
LPWININETHANDLEHEADER lpwhh; LPWININETHANDLEHEADER lpwhh;
BOOL bSuccess = FALSE;
TRACE("0x%08lx\n", dwOption); TRACE("0x%08lx\n", dwOption);
...@@ -1267,13 +1273,37 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, ...@@ -1267,13 +1273,37 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
switch (dwOption) 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: default:
FIXME("Option %ld STUB\n",dwOption);
INTERNET_SetLastError(ERROR_INVALID_PARAMETER); INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
FIXME("STUB\n"); return FALSE;
break;
} }
return bSuccess; return TRUE;
} }
...@@ -1653,6 +1683,7 @@ void INTERNET_SetLastError(DWORD dwError) ...@@ -1653,6 +1683,7 @@ void INTERNET_SetLastError(DWORD dwError)
LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex); LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex);
SetLastError(dwError); SetLastError(dwError);
if(lpwite)
lpwite->dwError = dwError; lpwite->dwError = dwError;
} }
...@@ -2143,3 +2174,51 @@ BOOL WINAPI InternetAutodialHangup(DWORD dwReserved) ...@@ -2143,3 +2174,51 @@ BOOL WINAPI InternetAutodialHangup(DWORD dwReserved)
/* we didn't dial, we don't disconnect */ /* we didn't dial, we don't disconnect */
return TRUE; 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, ...@@ -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.@) * GetUrlCacheEntryInfoExA (WININET.@)
* *
*/ */
...@@ -105,3 +131,21 @@ BOOL WINAPI GetUrlCacheEntryInfoExA( ...@@ -105,3 +131,21 @@ BOOL WINAPI GetUrlCacheEntryInfoExA(
INTERNET_SetLastError(ERROR_FILE_NOT_FOUND); INTERNET_SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE; 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 @@ ...@@ -52,7 +52,7 @@
@ stub GetUrlCacheConfigInfoW @ stub GetUrlCacheConfigInfoW
@ stdcall GetUrlCacheEntryInfoA(str ptr long) GetUrlCacheEntryInfoA @ stdcall GetUrlCacheEntryInfoA(str ptr long) GetUrlCacheEntryInfoA
@ stdcall GetUrlCacheEntryInfoExA(str ptr ptr str ptr ptr long) GetUrlCacheEntryInfoExA @ 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 GetUrlCacheEntryInfoW
@ stub GetUrlCacheHeaderData @ stub GetUrlCacheHeaderData
@ stub GopherCreateLocatorA @ stub GopherCreateLocatorA
...@@ -87,8 +87,8 @@ ...@@ -87,8 +87,8 @@
@ stdcall InternetCheckConnectionA(ptr long long) InternetCheckConnectionA @ stdcall InternetCheckConnectionA(ptr long long) InternetCheckConnectionA
@ stdcall InternetCheckConnectionW(ptr long long) InternetCheckConnectionW @ stdcall InternetCheckConnectionW(ptr long long) InternetCheckConnectionW
@ stdcall InternetCloseHandle(long) InternetCloseHandle @ stdcall InternetCloseHandle(long) InternetCloseHandle
@ stub InternetCombineUrlA @ stdcall InternetCombineUrlA(str str str ptr long) InternetCombineUrlA
@ stub InternetCombineUrlW @ stdcall InternetCombineUrlW(wstr wstr wstr ptr long) InternetCombineUrlW
@ stub InternetConfirmZoneCrossing @ stub InternetConfirmZoneCrossing
@ stdcall InternetConnectA(ptr str long str str long long long) InternetConnectA @ stdcall InternetConnectA(ptr str long str str long long long) InternetConnectA
@ stdcall InternetConnectW(ptr wstr long wstr wstr long long long) InternetConnectW @ stdcall InternetConnectW(ptr wstr long wstr wstr long long long) InternetConnectW
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
@ stdcall InternetOpenUrlW(ptr wstr wstr long long long) InternetOpenUrlW @ stdcall InternetOpenUrlW(ptr wstr wstr long long long) InternetOpenUrlW
@ stdcall InternetQueryDataAvailable(ptr ptr long long) InternetQueryDataAvailable @ stdcall InternetQueryDataAvailable(ptr ptr long long) InternetQueryDataAvailable
@ stdcall InternetQueryOptionA(ptr long ptr ptr) InternetQueryOptionA @ stdcall InternetQueryOptionA(ptr long ptr ptr) InternetQueryOptionA
@ stub InternetQueryOptionW @ stdcall InternetQueryOptionW(ptr long ptr ptr) InternetQueryOptionW
@ stdcall InternetReadFile(ptr ptr long ptr) InternetReadFile @ stdcall InternetReadFile(ptr ptr long ptr) InternetReadFile
@ stdcall InternetReadFileExA(ptr ptr long long) InternetReadFileExA @ stdcall InternetReadFileExA(ptr ptr long long) InternetReadFileExA
@ stdcall InternetReadFileExW(ptr ptr long long) InternetReadFileExW @ stdcall InternetReadFileExW(ptr ptr long long) InternetReadFileExW
......
...@@ -447,8 +447,11 @@ BOOLAPI InternetUnlockRequestFile(HANDLE); ...@@ -447,8 +447,11 @@ BOOLAPI InternetUnlockRequestFile(HANDLE);
#define INTERNET_OPTION_HTTP_VERSION 59 #define INTERNET_OPTION_HTTP_VERSION 59
#define INTERNET_OPTION_RESET_URLCACHE_SESSION 60 #define INTERNET_OPTION_RESET_URLCACHE_SESSION 60
#define INTERNET_OPTION_ERROR_MASK 62 #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_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_PRIORITY_FOREGROUND 1000
#define INTERNET_HANDLE_TYPE_INTERNET 1 #define INTERNET_HANDLE_TYPE_INTERNET 1
#define INTERNET_HANDLE_TYPE_CONNECT_FTP 2 #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