Changelog: - 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) Alberto Index: wininet.h =================================================================== RCS file: /home/wine/wine/include/wininet.h,v retrieving revision 1.13 diff -u -r1.13 wininet.h --- wininet.h 18 Nov 2002 19:43:10 -0000 1.13 +++ wininet.h 4 Dec 2002 16:43:58 -0000 @@ -447,8 +447,11 @@ #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 Index: internet.c =================================================================== RCS file: /home/wine/wine/dlls/wininet/internet.c,v retrieving revision 1.46 diff -u -r1.46 internet.c --- internet.c 27 Nov 2002 20:25:12 -0000 1.46 +++ internet.c 4 Dec 2002 16:30:21 -0000 @@ -887,31 +887,6 @@ } /*********************************************************************** - * 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,16 +1114,9 @@ } /*********************************************************************** - * InternetQueryOptionA (WININET.@) - * - * Queries an options on the specified handle - * - * RETURNS - * TRUE on success - * FALSE on failure - * + * QueryOptionHelper (internal) */ -BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, +BOOL QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength) { LPWININETHANDLEHEADER lpwhh; @@ -1212,8 +1180,15 @@ 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 @@ 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 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 QueryOptionHelper(FALSE, hInternet, dwOption, lpBuffer, lpdwBufferLength); +} + /*********************************************************************** * InternetSetOptionW (WININET.@) @@ -1253,27 +1260,50 @@ 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 @@ LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex); SetLastError(dwError); - lpwite->dwError = dwError; + if(lpwite) + lpwite->dwError = dwError; } @@ -2143,3 +2174,52 @@ /* 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); +} + Index: urlcache.c =================================================================== RCS file: /home/wine/wine/dlls/wininet/urlcache.c,v retrieving revision 1.5 diff -u -r1.5 urlcache.c --- urlcache.c 13 Nov 2002 04:08:26 -0000 1.5 +++ urlcache.c 4 Dec 2002 16:30:22 -0000 @@ -89,6 +89,32 @@ } /*********************************************************************** + * 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.@) * */ @@ -102,6 +128,24 @@ DWORD dwFlags) { FIXME(" url=%s, flags=%ld\n",lpszUrl,dwFlags); + 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; } Index: wininet.spec =================================================================== RCS file: /home/wine/wine/dlls/wininet/wininet.spec,v retrieving revision 1.28 diff -u -r1.28 wininet.spec --- wininet.spec 27 Nov 2002 20:25:12 -0000 1.28 +++ wininet.spec 4 Dec 2002 16:30:22 -0000 @@ -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