mirror of
https://github.com/reactos/reactos.git
synced 2024-12-12 12:53:29 +08:00
[WININET]
- Sync to Wine 1.5.4. Resource files left untouched. - Fix INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT if SSL support unavailable (already applied upstream) See issue #7117 for more details. svn path=/trunk/; revision=56760
This commit is contained in:
parent
b2ba0a3a03
commit
d0111bd3a0
@ -30,7 +30,7 @@ add_library(wininet SHARED
|
||||
|
||||
set_module_type(wininet win32dll)
|
||||
target_link_libraries(wininet wine ${PSEH_LIB} zlib)
|
||||
add_delay_importlibs(wininet secur32 crypt32)
|
||||
add_delay_importlibs(wininet secur32 crypt32 cryptui)
|
||||
add_importlibs(wininet mpr shlwapi shell32 user32 advapi32 ws2_32 msvcrt kernel32 ntdll)
|
||||
add_cd_file(TARGET wininet DESTINATION reactos/system32 FOR all)
|
||||
|
||||
|
@ -132,14 +132,14 @@ static cookie *COOKIE_findCookie(cookie_domain *domain, LPCWSTR lpszCookieName)
|
||||
/* removes a cookie from the list, if its the last cookie we also remove the domain */
|
||||
static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieName);
|
||||
HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieData);
|
||||
heap_free(deadCookie->lpCookieName);
|
||||
heap_free(deadCookie->lpCookieData);
|
||||
list_remove(&deadCookie->entry);
|
||||
|
||||
/* special case: last cookie, lets remove the domain to save memory */
|
||||
if (list_empty(&deadCookie->parent->cookie_list) && deleteDomain)
|
||||
COOKIE_deleteDomain(deadCookie->parent);
|
||||
HeapFree(GetProcessHeap(), 0, deadCookie);
|
||||
heap_free(deadCookie);
|
||||
}
|
||||
|
||||
/* allocates a domain and adds it to the end */
|
||||
@ -251,13 +251,12 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain)
|
||||
COOKIE_deleteCookie(LIST_ENTRY(cursor, cookie, entry), FALSE);
|
||||
list_remove(cursor);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, deadDomain->lpCookieDomain);
|
||||
HeapFree(GetProcessHeap(), 0, deadDomain->lpCookiePath);
|
||||
heap_free(deadDomain->lpCookieDomain);
|
||||
heap_free(deadDomain->lpCookiePath);
|
||||
|
||||
list_remove(&deadDomain->entry);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, deadDomain);
|
||||
heap_free(deadDomain);
|
||||
}
|
||||
|
||||
BOOL get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD *size)
|
||||
@ -406,11 +405,9 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
|
||||
lpCookieData, *lpdwSize, NULL, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, szCookieData );
|
||||
HeapFree( GetProcessHeap(), 0, name );
|
||||
HeapFree( GetProcessHeap(), 0, url );
|
||||
|
||||
heap_free( szCookieData );
|
||||
heap_free( name );
|
||||
heap_free( url );
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -447,12 +444,11 @@ BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cooki
|
||||
if (!(ptr = strchrW(ptr,';'))) break;
|
||||
*ptr++ = 0;
|
||||
|
||||
if (value != data)
|
||||
HeapFree(GetProcessHeap(), 0, value);
|
||||
if (value != data) heap_free(value);
|
||||
value = heap_alloc((ptr - data) * sizeof(WCHAR));
|
||||
if (value == NULL)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
heap_free(data);
|
||||
ERR("could not allocate the cookie value buffer\n");
|
||||
return FALSE;
|
||||
}
|
||||
@ -521,8 +517,8 @@ BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cooki
|
||||
thisCookieDomain = COOKIE_addDomain(domain, path);
|
||||
else
|
||||
{
|
||||
HeapFree(GetProcessHeap(),0,data);
|
||||
if (value != data) HeapFree(GetProcessHeap(), 0, value);
|
||||
heap_free(data);
|
||||
if (value != data) heap_free(value);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -535,13 +531,12 @@ BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cooki
|
||||
|
||||
if (!expired && !COOKIE_addCookie(thisCookieDomain, cookie_name, value, expiry))
|
||||
{
|
||||
HeapFree(GetProcessHeap(),0,data);
|
||||
if (value != data) HeapFree(GetProcessHeap(), 0, value);
|
||||
heap_free(data);
|
||||
if (value != data) heap_free(value);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(),0,data);
|
||||
if (value != data) HeapFree(GetProcessHeap(), 0, value);
|
||||
heap_free(data);
|
||||
if (value != data) heap_free(value);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -559,7 +554,7 @@ BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
||||
LPCWSTR lpCookieData)
|
||||
{
|
||||
BOOL ret;
|
||||
WCHAR hostName[2048], path[2048];
|
||||
WCHAR hostName[INTERNET_MAX_HOST_NAME_LENGTH], path[INTERNET_MAX_PATH_LENGTH];
|
||||
|
||||
TRACE("(%s,%s,%s)\n", debugstr_w(lpszUrl),
|
||||
debugstr_w(lpszCookieName), debugstr_w(lpCookieData));
|
||||
@ -593,7 +588,7 @@ BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
||||
|
||||
ret = set_cookie(hostName, path, cookie, data);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, cookie);
|
||||
heap_free(cookie);
|
||||
return ret;
|
||||
}
|
||||
return set_cookie(hostName, path, lpszCookieName, lpCookieData);
|
||||
@ -625,10 +620,9 @@ BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
|
||||
|
||||
r = InternetSetCookieW( url, name, data );
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, data );
|
||||
HeapFree( GetProcessHeap(), 0, name );
|
||||
HeapFree( GetProcessHeap(), 0, url );
|
||||
|
||||
heap_free( data );
|
||||
heap_free( name );
|
||||
heap_free( url );
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -170,6 +170,10 @@ static BOOL WININET_GetAuthRealm( HINTERNET hRequest, LPWSTR szBuf, DWORD sz, BO
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* These two are not defined in the public headers */
|
||||
extern DWORD WINAPI WNetCachePassword(LPSTR,WORD,LPSTR,WORD,BYTE,WORD);
|
||||
extern DWORD WINAPI WNetGetCachedPassword(LPSTR,WORD,LPSTR,LPWORD,BYTE);
|
||||
|
||||
/***********************************************************************
|
||||
* WININET_GetSetPassword
|
||||
*/
|
||||
@ -264,7 +268,7 @@ static BOOL WININET_SetAuthorization( HINTERNET hRequest, LPWSTR username,
|
||||
q = heap_strdupW(password);
|
||||
if( !q )
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, username);
|
||||
heap_free(username);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -272,18 +276,18 @@ static BOOL WININET_SetAuthorization( HINTERNET hRequest, LPWSTR username,
|
||||
{
|
||||
appinfo_t *hIC = session->appInfo;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, hIC->proxyUsername);
|
||||
heap_free(hIC->proxyUsername);
|
||||
hIC->proxyUsername = p;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, hIC->proxyPassword);
|
||||
heap_free(hIC->proxyPassword);
|
||||
hIC->proxyPassword = q;
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, session->userName);
|
||||
heap_free(session->userName);
|
||||
session->userName = p;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, session->password);
|
||||
heap_free(session->password);
|
||||
session->password = q;
|
||||
}
|
||||
|
||||
|
@ -246,8 +246,8 @@ BOOL WINAPI FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
|
||||
lpwzNewRemoteFile = heap_strdupAtoW(lpszNewRemoteFile);
|
||||
ret = FtpPutFileW(hConnect, lpwzLocalFile, lpwzNewRemoteFile,
|
||||
dwFlags, dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzLocalFile);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzNewRemoteFile);
|
||||
heap_free(lpwzLocalFile);
|
||||
heap_free(lpwzNewRemoteFile);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -261,8 +261,8 @@ static void AsyncFtpPutFileProc(WORKREQUEST *workRequest)
|
||||
FTP_FtpPutFileW(lpwfs, req->lpszLocalFile,
|
||||
req->lpszNewRemoteFile, req->dwFlags, req->dwContext);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszLocalFile);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszNewRemoteFile);
|
||||
heap_free(req->lpszLocalFile);
|
||||
heap_free(req->lpszNewRemoteFile);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -432,7 +432,7 @@ BOOL WINAPI FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
|
||||
|
||||
lpwzDirectory = heap_strdupAtoW(lpszDirectory);
|
||||
ret = FtpSetCurrentDirectoryW(hConnect, lpwzDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzDirectory);
|
||||
heap_free(lpwzDirectory);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -445,7 +445,7 @@ static void AsyncFtpSetCurrentDirectoryProc(WORKREQUEST *workRequest)
|
||||
TRACE("%p\n", lpwfs);
|
||||
|
||||
FTP_FtpSetCurrentDirectoryW(lpwfs, req->lpszDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
||||
heap_free(req->lpszDirectory);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -578,7 +578,7 @@ BOOL WINAPI FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
|
||||
|
||||
lpwzDirectory = heap_strdupAtoW(lpszDirectory);
|
||||
ret = FtpCreateDirectoryW(hConnect, lpwzDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzDirectory);
|
||||
heap_free(lpwzDirectory);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -591,7 +591,7 @@ static void AsyncFtpCreateDirectoryProc(WORKREQUEST *workRequest)
|
||||
TRACE(" %p\n", lpwfs);
|
||||
|
||||
FTP_FtpCreateDirectoryW(lpwfs, req->lpszDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
||||
heap_free(req->lpszDirectory);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -728,7 +728,7 @@ HINTERNET WINAPI FtpFindFirstFileA(HINTERNET hConnect,
|
||||
lpwzSearchFile = heap_strdupAtoW(lpszSearchFile);
|
||||
lpFindFileDataW = lpFindFileData?&wfd:NULL;
|
||||
ret = FtpFindFirstFileW(hConnect, lpwzSearchFile, lpFindFileDataW, dwFlags, dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzSearchFile);
|
||||
heap_free(lpwzSearchFile);
|
||||
|
||||
if (ret && lpFindFileData)
|
||||
WININET_find_data_WtoA(lpFindFileDataW, lpFindFileData);
|
||||
@ -746,7 +746,7 @@ static void AsyncFtpFindFirstFileProc(WORKREQUEST *workRequest)
|
||||
|
||||
FTP_FtpFindFirstFileW(lpwfs, req->lpszSearchFile,
|
||||
req->lpFindFileData, req->dwFlags, req->dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszSearchFile);
|
||||
heap_free(req->lpszSearchFile);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -930,7 +930,7 @@ BOOL WINAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDire
|
||||
WideCharToMultiByte(CP_ACP, 0, dir, -1, lpszCurrentDirectory, len, NULL, NULL);
|
||||
|
||||
if (lpdwCurrentDirectory) *lpdwCurrentDirectory = len;
|
||||
HeapFree(GetProcessHeap(), 0, dir);
|
||||
heap_free(dir);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1076,7 +1076,7 @@ static BOOL FTP_FtpGetCurrentDirectoryW(ftp_session_t *lpwfs, LPWSTR lpszCurrent
|
||||
}
|
||||
else INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpszResponseBuffer);
|
||||
heap_free(lpszResponseBuffer);
|
||||
}
|
||||
else
|
||||
FTP_SetResponseError(nResCode);
|
||||
@ -1115,7 +1115,7 @@ static void FTPFILE_Destroy(object_header_t *hdr)
|
||||
if (lpwh->cache_file_handle != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(lpwh->cache_file_handle);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpwh->cache_file);
|
||||
heap_free(lpwh->cache_file);
|
||||
|
||||
if (!lpwh->session_deleted)
|
||||
lpwfs->download_in_progress = NULL;
|
||||
@ -1297,7 +1297,7 @@ static const object_vtbl_t FTPFILEVtbl = {
|
||||
FTPFILE_Destroy,
|
||||
NULL,
|
||||
FTPFILE_QueryOption,
|
||||
NULL,
|
||||
INET_SetOption,
|
||||
FTPFILE_ReadFile,
|
||||
FTPFILE_ReadFileExA,
|
||||
FTPFILE_ReadFileExW,
|
||||
@ -1393,13 +1393,13 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs,
|
||||
if (lpwh->cache_file_handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
WARN("Could not create cache file: %u\n", GetLastError());
|
||||
HeapFree(GetProcessHeap(), 0, lpwh->cache_file);
|
||||
heap_free(lpwh->cache_file);
|
||||
lpwh->cache_file = NULL;
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, url);
|
||||
heap_free(url);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, uc.lpszUrlPath);
|
||||
heap_free(uc.lpszUrlPath);
|
||||
}
|
||||
|
||||
hIC = lpwfs->lpAppInfo;
|
||||
@ -1425,11 +1425,8 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs,
|
||||
}
|
||||
}
|
||||
|
||||
if(!bSuccess) {
|
||||
if(lpwh)
|
||||
WININET_Release( &lpwh->hdr );
|
||||
if(!bSuccess)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return lpwh->hdr.hInternet;
|
||||
}
|
||||
@ -1454,7 +1451,7 @@ HINTERNET WINAPI FtpOpenFileA(HINTERNET hFtpSession,
|
||||
|
||||
lpwzFileName = heap_strdupAtoW(lpszFileName);
|
||||
ret = FtpOpenFileW(hFtpSession, lpwzFileName, fdwAccess, dwFlags, dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzFileName);
|
||||
heap_free(lpwzFileName);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1468,7 +1465,7 @@ static void AsyncFtpOpenFileProc(WORKREQUEST *workRequest)
|
||||
|
||||
FTP_FtpOpenFileW(lpwfs, req->lpszFilename,
|
||||
req->dwAccess, req->dwFlags, req->dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszFilename);
|
||||
heap_free(req->lpszFilename);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -1570,8 +1567,8 @@ BOOL WINAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN
|
||||
lpwzNewFile = heap_strdupAtoW(lpszNewFile);
|
||||
ret = FtpGetFileW(hInternet, lpwzRemoteFile, lpwzNewFile, fFailIfExists,
|
||||
dwLocalFlagsAttribute, dwInternetFlags, dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzRemoteFile);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzNewFile);
|
||||
heap_free(lpwzRemoteFile);
|
||||
heap_free(lpwzNewFile);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1586,8 +1583,8 @@ static void AsyncFtpGetFileProc(WORKREQUEST *workRequest)
|
||||
FTP_FtpGetFileW(lpwfs, req->lpszRemoteFile,
|
||||
req->lpszNewFile, req->fFailIfExists,
|
||||
req->dwLocalFlagsAttribute, req->dwFlags, req->dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszRemoteFile);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszNewFile);
|
||||
heap_free(req->lpszRemoteFile);
|
||||
heap_free(req->lpszNewFile);
|
||||
}
|
||||
|
||||
|
||||
@ -1778,7 +1775,7 @@ BOOL WINAPI FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
|
||||
|
||||
lpwzFileName = heap_strdupAtoW(lpszFileName);
|
||||
ret = FtpDeleteFileW(hFtpSession, lpwzFileName);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzFileName);
|
||||
heap_free(lpwzFileName);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1790,7 +1787,7 @@ static void AsyncFtpDeleteFileProc(WORKREQUEST *workRequest)
|
||||
TRACE("%p\n", lpwfs);
|
||||
|
||||
FTP_FtpDeleteFileW(lpwfs, req->lpszFilename);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszFilename);
|
||||
heap_free(req->lpszFilename);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -1923,7 +1920,7 @@ BOOL WINAPI FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
|
||||
|
||||
lpwzDirectory = heap_strdupAtoW(lpszDirectory);
|
||||
ret = FtpRemoveDirectoryW(hFtpSession, lpwzDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzDirectory);
|
||||
heap_free(lpwzDirectory);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1935,7 +1932,7 @@ static void AsyncFtpRemoveDirectoryProc(WORKREQUEST *workRequest)
|
||||
TRACE("%p\n", lpwfs);
|
||||
|
||||
FTP_FtpRemoveDirectoryW(lpwfs, req->lpszDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
||||
heap_free(req->lpszDirectory);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -2071,8 +2068,8 @@ BOOL WINAPI FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDes
|
||||
lpwzSrc = heap_strdupAtoW(lpszSrc);
|
||||
lpwzDest = heap_strdupAtoW(lpszDest);
|
||||
ret = FtpRenameFileW(hFtpSession, lpwzSrc, lpwzDest);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzSrc);
|
||||
HeapFree(GetProcessHeap(), 0, lpwzDest);
|
||||
heap_free(lpwzSrc);
|
||||
heap_free(lpwzDest);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2084,8 +2081,8 @@ static void AsyncFtpRenameFileProc(WORKREQUEST *workRequest)
|
||||
TRACE("%p\n", lpwfs);
|
||||
|
||||
FTP_FtpRenameFileW(lpwfs, req->lpszSrcFile, req->lpszDestFile);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszSrcFile);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDestFile);
|
||||
heap_free(req->lpszSrcFile);
|
||||
heap_free(req->lpszDestFile);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -2239,7 +2236,7 @@ BOOL WINAPI FtpCommandA( HINTERNET hConnect, BOOL fExpectResponse, DWORD dwFlags
|
||||
|
||||
r = FtpCommandW(hConnect, fExpectResponse, dwFlags, cmdW, dwContext, phFtpCommand);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, cmdW);
|
||||
heap_free(cmdW);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -2323,7 +2320,7 @@ BOOL WINAPI FtpCommandW( HINTERNET hConnect, BOOL fExpectResponse, DWORD dwFlags
|
||||
|
||||
lend:
|
||||
WININET_Release( &lpwfs->hdr );
|
||||
HeapFree(GetProcessHeap(), 0, cmd);
|
||||
heap_free( cmd );
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -2341,9 +2338,9 @@ static void FTPSESSION_Destroy(object_header_t *hdr)
|
||||
|
||||
WININET_Release(&lpwfs->lpAppInfo->hdr);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpwfs->lpszPassword);
|
||||
HeapFree(GetProcessHeap(), 0, lpwfs->lpszUserName);
|
||||
HeapFree(GetProcessHeap(), 0, lpwfs->servername);
|
||||
heap_free(lpwfs->lpszPassword);
|
||||
heap_free(lpwfs->lpszUserName);
|
||||
heap_free(lpwfs->servername);
|
||||
}
|
||||
|
||||
static void FTPSESSION_CloseConnection(object_header_t *hdr)
|
||||
@ -2392,7 +2389,7 @@ static const object_vtbl_t FTPSESSIONVtbl = {
|
||||
FTPSESSION_Destroy,
|
||||
FTPSESSION_CloseConnection,
|
||||
FTPSESSION_QueryOption,
|
||||
NULL,
|
||||
INET_SetOption,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
@ -2651,7 +2648,7 @@ static BOOL FTP_SendCommandA(INT nSocket, FTP_COMMAND ftpCmd, LPCSTR lpszParam,
|
||||
int nRC = 0;
|
||||
DWORD dwParamLen;
|
||||
|
||||
TRACE("%d: (%s) %d\n", ftpCmd, lpszParam, nSocket);
|
||||
TRACE("%d: (%s) %d\n", ftpCmd, debugstr_a(lpszParam), nSocket);
|
||||
|
||||
if (lpfnStatusCB)
|
||||
{
|
||||
@ -2674,8 +2671,7 @@ static BOOL FTP_SendCommandA(INT nSocket, FTP_COMMAND ftpCmd, LPCSTR lpszParam,
|
||||
nRC = send(nSocket, buf+nBytesSent, len - nBytesSent, 0);
|
||||
nBytesSent += nRC;
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)buf);
|
||||
heap_free(buf);
|
||||
|
||||
if (lpfnStatusCB)
|
||||
{
|
||||
@ -2703,7 +2699,7 @@ static BOOL FTP_SendCommand(INT nSocket, FTP_COMMAND ftpCmd, LPCWSTR lpszParam,
|
||||
BOOL ret;
|
||||
LPSTR lpszParamA = heap_strdupWtoA(lpszParam);
|
||||
ret = FTP_SendCommandA(nSocket, ftpCmd, lpszParamA, lpfnStatusCB, hdr, dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, lpszParamA);
|
||||
heap_free(lpszParamA);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3279,8 +3275,7 @@ static BOOL FTP_SendData(ftp_session_t *lpwfs, INT nDataSocket, HANDLE hFile)
|
||||
|
||||
TRACE("file transfer complete!\n");
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpszBuffer);
|
||||
|
||||
heap_free(lpszBuffer);
|
||||
return nTotalSent;
|
||||
}
|
||||
|
||||
@ -3371,9 +3366,8 @@ static BOOL FTP_RetrieveFileData(ftp_session_t *lpwfs, INT nDataSocket, HANDLE h
|
||||
TRACE("Data transfer complete\n");
|
||||
|
||||
recv_end:
|
||||
HeapFree(GetProcessHeap(), 0, lpszBuffer);
|
||||
|
||||
return (nRC != -1);
|
||||
heap_free(lpszBuffer);
|
||||
return (nRC != -1);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -3392,10 +3386,9 @@ static void FTPFINDNEXT_Destroy(object_header_t *hdr)
|
||||
|
||||
for (i = 0; i < lpwfn->size; i++)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, lpwfn->lpafp[i].lpszName);
|
||||
heap_free(lpwfn->lpafp[i].lpszName);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpwfn->lpafp);
|
||||
heap_free(lpwfn->lpafp);
|
||||
}
|
||||
|
||||
static DWORD FTPFINDNEXT_FindNextFileProc(WININETFTPFINDNEXTW *find, LPVOID data)
|
||||
@ -3481,7 +3474,7 @@ static const object_vtbl_t FTPFINDNEXTVtbl = {
|
||||
FTPFINDNEXT_Destroy,
|
||||
NULL,
|
||||
FTPFINDNEXT_QueryOption,
|
||||
NULL,
|
||||
INET_SetOption,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
@ -3725,7 +3718,7 @@ static BOOL FTP_ParseNextFile(INT nSocket, LPCWSTR lpszSearchFile, LPFILEPROPERT
|
||||
TRACE("Matched: %s\n", debugstr_w(lpfp->lpszName));
|
||||
}
|
||||
else {
|
||||
HeapFree(GetProcessHeap(), 0, lpfp->lpszName);
|
||||
heap_free(lpfp->lpszName);
|
||||
lpfp->lpszName = NULL;
|
||||
}
|
||||
}
|
||||
@ -3788,7 +3781,7 @@ static BOOL FTP_ParseDirectory(ftp_session_t *lpwfs, INT nSocket, LPCWSTR lpszSe
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, *lpafp);
|
||||
heap_free(*lpafp);
|
||||
INTERNET_SetLastError(ERROR_NO_MORE_FILES);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,8 +29,6 @@
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#define MAXHOSTNAME 100 /* from http.c */
|
||||
|
||||
#if defined(__MINGW32__) || defined (_MSC_VER)
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
@ -105,11 +103,13 @@ static UINT_PTR handle_table_size;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD dwProxyEnabled;
|
||||
LPWSTR lpszProxyServer;
|
||||
LPWSTR lpszProxyBypass;
|
||||
DWORD proxyEnabled;
|
||||
LPWSTR proxy;
|
||||
LPWSTR proxyBypass;
|
||||
} proxyinfo_t;
|
||||
|
||||
static ULONG max_conns = 2, max_1_0_conns = 4;
|
||||
|
||||
static const WCHAR szInternetSettings[] =
|
||||
{ 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
|
||||
'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
||||
@ -289,40 +289,38 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
|
||||
g_dwTlsErrIndex = TlsAlloc();
|
||||
|
||||
if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES)
|
||||
return FALSE;
|
||||
if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES)
|
||||
return FALSE;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
URLCacheContainers_CreateDefaults();
|
||||
#endif
|
||||
|
||||
WININET_hModule = hinstDLL;
|
||||
break;
|
||||
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
|
||||
{
|
||||
LPVOID lpwite = TlsGetValue(g_dwTlsErrIndex);
|
||||
HeapFree(GetProcessHeap(), 0, lpwite);
|
||||
}
|
||||
break;
|
||||
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
|
||||
{
|
||||
heap_free(TlsGetValue(g_dwTlsErrIndex));
|
||||
}
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
collect_connections(TRUE);
|
||||
NETCON_unload();
|
||||
URLCacheContainers_DeleteAll();
|
||||
|
||||
URLCacheContainers_DeleteAll();
|
||||
|
||||
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, TlsGetValue(g_dwTlsErrIndex));
|
||||
TlsFree(g_dwTlsErrIndex);
|
||||
}
|
||||
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
|
||||
{
|
||||
heap_free(TlsGetValue(g_dwTlsErrIndex));
|
||||
TlsFree(g_dwTlsErrIndex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -342,15 +340,15 @@ static LONG INTERNET_SaveProxySettings( proxyinfo_t *lpwpi )
|
||||
if ((ret = RegOpenKeyW( HKEY_CURRENT_USER, szInternetSettings, &key )))
|
||||
return ret;
|
||||
|
||||
if ((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE*)&lpwpi->dwProxyEnabled, sizeof(DWORD))))
|
||||
if ((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE*)&lpwpi->proxyEnabled, sizeof(DWORD))))
|
||||
{
|
||||
RegCloseKey( key );
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (lpwpi->lpszProxyServer)
|
||||
if (lpwpi->proxy)
|
||||
{
|
||||
if ((ret = RegSetValueExW( key, szProxyServer, 0, REG_SZ, (BYTE*)lpwpi->lpszProxyServer, sizeof(WCHAR) * (lstrlenW(lpwpi->lpszProxyServer) + 1))))
|
||||
if ((ret = RegSetValueExW( key, szProxyServer, 0, REG_SZ, (BYTE*)lpwpi->proxy, sizeof(WCHAR) * (lstrlenW(lpwpi->proxy) + 1))))
|
||||
{
|
||||
RegCloseKey( key );
|
||||
return ret;
|
||||
@ -499,14 +497,28 @@ BOOL WINAPI DetectAutoProxyUrl(LPSTR lpszAutoProxyUrl,
|
||||
|
||||
static void FreeProxyInfo( proxyinfo_t *lpwpi )
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, lpwpi->lpszProxyServer);
|
||||
HeapFree(GetProcessHeap(), 0, lpwpi->lpszProxyBypass);
|
||||
heap_free(lpwpi->proxy);
|
||||
heap_free(lpwpi->proxyBypass);
|
||||
}
|
||||
|
||||
static proxyinfo_t *global_proxy;
|
||||
|
||||
static void free_global_proxy( void )
|
||||
{
|
||||
EnterCriticalSection( &WININET_cs );
|
||||
if (global_proxy)
|
||||
{
|
||||
FreeProxyInfo( global_proxy );
|
||||
heap_free( global_proxy );
|
||||
}
|
||||
LeaveCriticalSection( &WININET_cs );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* INTERNET_LoadProxySettings
|
||||
*
|
||||
* Loads proxy information from the registry or environment into lpwpi.
|
||||
* Loads proxy information from process-wide global settings, the registry,
|
||||
* or the environment into lpwpi.
|
||||
*
|
||||
* The caller should call FreeProxyInfo when done with lpwpi.
|
||||
*
|
||||
@ -521,21 +533,30 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi )
|
||||
LPCSTR envproxy;
|
||||
LONG ret;
|
||||
|
||||
EnterCriticalSection( &WININET_cs );
|
||||
if (global_proxy)
|
||||
{
|
||||
lpwpi->proxyEnabled = global_proxy->proxyEnabled;
|
||||
lpwpi->proxy = heap_strdupW( global_proxy->proxy );
|
||||
lpwpi->proxyBypass = heap_strdupW( global_proxy->proxyBypass );
|
||||
}
|
||||
LeaveCriticalSection( &WININET_cs );
|
||||
|
||||
if ((ret = RegOpenKeyW( HKEY_CURRENT_USER, szInternetSettings, &key )))
|
||||
return ret;
|
||||
|
||||
len = sizeof(DWORD);
|
||||
if (RegQueryValueExW( key, szProxyEnable, NULL, &type, (BYTE *)&lpwpi->dwProxyEnabled, &len ) || type != REG_DWORD)
|
||||
if (RegQueryValueExW( key, szProxyEnable, NULL, &type, (BYTE *)&lpwpi->proxyEnabled, &len ) || type != REG_DWORD)
|
||||
{
|
||||
lpwpi->dwProxyEnabled = 0;
|
||||
if((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE *)&lpwpi->dwProxyEnabled, sizeof(DWORD) )))
|
||||
lpwpi->proxyEnabled = 0;
|
||||
if((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE *)&lpwpi->proxyEnabled, sizeof(DWORD) )))
|
||||
{
|
||||
RegCloseKey( key );
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(envproxy = getenv( "http_proxy" )) || lpwpi->dwProxyEnabled)
|
||||
if (!(envproxy = getenv( "http_proxy" )) || lpwpi->proxyEnabled)
|
||||
{
|
||||
TRACE("Proxy is enabled.\n");
|
||||
|
||||
@ -562,14 +583,14 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi )
|
||||
p = strchrW( szProxy, ' ' );
|
||||
if (p) *p = 0;
|
||||
|
||||
lpwpi->lpszProxyServer = szProxy;
|
||||
lpwpi->proxy = szProxy;
|
||||
|
||||
TRACE("http proxy = %s\n", debugstr_w(lpwpi->lpszProxyServer));
|
||||
TRACE("http proxy = %s\n", debugstr_w(lpwpi->proxy));
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("No proxy server settings in registry.\n");
|
||||
lpwpi->lpszProxyServer = NULL;
|
||||
lpwpi->proxy = NULL;
|
||||
}
|
||||
}
|
||||
else if (envproxy)
|
||||
@ -581,14 +602,14 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi )
|
||||
return ERROR_OUTOFMEMORY;
|
||||
MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len );
|
||||
|
||||
lpwpi->dwProxyEnabled = 1;
|
||||
lpwpi->lpszProxyServer = envproxyW;
|
||||
lpwpi->proxyEnabled = 1;
|
||||
lpwpi->proxy = envproxyW;
|
||||
|
||||
TRACE("http proxy (from environment) = %s\n", debugstr_w(lpwpi->lpszProxyServer));
|
||||
TRACE("http proxy (from environment) = %s\n", debugstr_w(lpwpi->proxy));
|
||||
}
|
||||
RegCloseKey( key );
|
||||
|
||||
lpwpi->lpszProxyBypass = NULL;
|
||||
lpwpi->proxyBypass = NULL;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
@ -603,11 +624,49 @@ static BOOL INTERNET_ConfigureProxy( appinfo_t *lpwai )
|
||||
if (INTERNET_LoadProxySettings( &wpi ))
|
||||
return FALSE;
|
||||
|
||||
if (wpi.dwProxyEnabled)
|
||||
if (wpi.proxyEnabled)
|
||||
{
|
||||
lpwai->accessType = INTERNET_OPEN_TYPE_PROXY;
|
||||
lpwai->proxy = wpi.lpszProxyServer;
|
||||
return TRUE;
|
||||
WCHAR proxyurl[INTERNET_MAX_URL_LENGTH];
|
||||
WCHAR username[INTERNET_MAX_USER_NAME_LENGTH];
|
||||
WCHAR password[INTERNET_MAX_PASSWORD_LENGTH];
|
||||
WCHAR hostname[INTERNET_MAX_HOST_NAME_LENGTH];
|
||||
URL_COMPONENTSW UrlComponents;
|
||||
|
||||
UrlComponents.dwStructSize = sizeof UrlComponents;
|
||||
UrlComponents.dwSchemeLength = 0;
|
||||
UrlComponents.lpszHostName = hostname;
|
||||
UrlComponents.dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH;
|
||||
UrlComponents.lpszUserName = username;
|
||||
UrlComponents.dwUserNameLength = INTERNET_MAX_USER_NAME_LENGTH;
|
||||
UrlComponents.lpszPassword = password;
|
||||
UrlComponents.dwPasswordLength = INTERNET_MAX_PASSWORD_LENGTH;
|
||||
UrlComponents.dwUrlPathLength = 0;
|
||||
UrlComponents.dwExtraInfoLength = 0;
|
||||
|
||||
if(InternetCrackUrlW(wpi.proxy, 0, 0, &UrlComponents))
|
||||
{
|
||||
static const WCHAR szFormat[] = { 'h','t','t','p',':','/','/','%','s',':','%','u',0 };
|
||||
|
||||
if(UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER)
|
||||
UrlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT;
|
||||
sprintfW(proxyurl, szFormat, hostname, UrlComponents.nPort);
|
||||
|
||||
lpwai->accessType = INTERNET_OPEN_TYPE_PROXY;
|
||||
lpwai->proxy = heap_strdupW(proxyurl);
|
||||
if (UrlComponents.dwUserNameLength)
|
||||
{
|
||||
lpwai->proxyUsername = heap_strdupW(UrlComponents.lpszUserName);
|
||||
lpwai->proxyPassword = heap_strdupW(UrlComponents.lpszPassword);
|
||||
}
|
||||
|
||||
TRACE("http proxy = %s\n", debugstr_w(lpwai->proxy));
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Failed to parse proxy: %s\n", debugstr_w(wpi.proxy));
|
||||
lpwai->proxy = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
lpwai->accessType = INTERNET_OPEN_TYPE_DIRECT;
|
||||
@ -683,11 +742,11 @@ static VOID APPINFO_Destroy(object_header_t *hdr)
|
||||
|
||||
TRACE("%p\n",lpwai);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpwai->agent);
|
||||
HeapFree(GetProcessHeap(), 0, lpwai->proxy);
|
||||
HeapFree(GetProcessHeap(), 0, lpwai->proxyBypass);
|
||||
HeapFree(GetProcessHeap(), 0, lpwai->proxyUsername);
|
||||
HeapFree(GetProcessHeap(), 0, lpwai->proxyPassword);
|
||||
heap_free(lpwai->agent);
|
||||
heap_free(lpwai->proxy);
|
||||
heap_free(lpwai->proxyBypass);
|
||||
heap_free(lpwai->proxyUsername);
|
||||
heap_free(lpwai->proxyPassword);
|
||||
}
|
||||
|
||||
static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
|
||||
@ -749,6 +808,7 @@ static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffe
|
||||
}
|
||||
|
||||
case INTERNET_OPTION_PROXY:
|
||||
if(!size) return ERROR_INVALID_PARAMETER;
|
||||
if (unicode) {
|
||||
INTERNET_PROXY_INFOW *pi = (INTERNET_PROXY_INFOW *)buffer;
|
||||
DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
|
||||
@ -825,7 +885,7 @@ static const object_vtbl_t APPINFOVtbl = {
|
||||
APPINFO_Destroy,
|
||||
NULL,
|
||||
APPINFO_QueryOption,
|
||||
NULL,
|
||||
INET_SetOption,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
@ -927,10 +987,9 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
|
||||
|
||||
rc = InternetOpenW(szAgent, dwAccessType, szProxy, szBypass, dwFlags);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, szAgent);
|
||||
HeapFree(GetProcessHeap(), 0, szProxy);
|
||||
HeapFree(GetProcessHeap(), 0, szBypass);
|
||||
|
||||
heap_free(szAgent);
|
||||
heap_free(szProxy);
|
||||
heap_free(szBypass);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -1095,10 +1154,8 @@ BOOL WINAPI InternetGetConnectedStateExA(LPDWORD lpdwStatus, LPSTR lpszConnectio
|
||||
{
|
||||
WideCharToMultiByte(CP_ACP,0,lpwszConnectionName,-1,lpszConnectionName,
|
||||
dwNameLen, NULL, NULL);
|
||||
|
||||
HeapFree(GetProcessHeap(),0,lpwszConnectionName);
|
||||
heap_free(lpwszConnectionName);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -1194,9 +1251,9 @@ HINTERNET WINAPI InternetConnectA(HINTERNET hInternet,
|
||||
rc = InternetConnectW(hInternet, szServerName, nServerPort,
|
||||
szUserName, szPassword, dwService, dwFlags, dwContext);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, szServerName);
|
||||
HeapFree(GetProcessHeap(), 0, szUserName);
|
||||
HeapFree(GetProcessHeap(), 0, szPassword);
|
||||
heap_free(szServerName);
|
||||
heap_free(szUserName);
|
||||
heap_free(szPassword);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -1443,13 +1500,13 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
|
||||
debugstr_an(lpUrlComponents->lpszUrlPath, lpUrlComponents->dwUrlPathLength),
|
||||
debugstr_an(lpUrlComponents->lpszExtraInfo, lpUrlComponents->dwExtraInfoLength));
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, lpwszUrl);
|
||||
HeapFree(GetProcessHeap(), 0, hostname);
|
||||
HeapFree(GetProcessHeap(), 0, username);
|
||||
HeapFree(GetProcessHeap(), 0, password);
|
||||
HeapFree(GetProcessHeap(), 0, path);
|
||||
HeapFree(GetProcessHeap(), 0, scheme);
|
||||
HeapFree(GetProcessHeap(), 0, extra);
|
||||
heap_free(lpwszUrl);
|
||||
heap_free(hostname);
|
||||
heap_free(username);
|
||||
heap_free(password);
|
||||
heap_free(path);
|
||||
heap_free(scheme);
|
||||
heap_free(extra);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1583,7 +1640,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
|
||||
url_tmp[dwUrlLength] = 0;
|
||||
if (!(lpszUrl_decode = heap_alloc(len * sizeof(WCHAR))))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, url_tmp);
|
||||
heap_free(url_tmp);
|
||||
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
@ -1592,7 +1649,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
|
||||
dwUrlLength = len;
|
||||
lpszUrl = lpszUrl_decode;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, url_tmp);
|
||||
heap_free(url_tmp);
|
||||
}
|
||||
lpszap = lpszUrl;
|
||||
|
||||
@ -1850,7 +1907,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
|
||||
debugstr_wn(lpUC->lpszUrlPath,lpUC->dwUrlPathLength),
|
||||
debugstr_wn(lpUC->lpszExtraInfo,lpUC->dwExtraInfoLength));
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpszUrl_decode );
|
||||
heap_free( lpszUrl_decode );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2055,7 +2112,7 @@ INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(
|
||||
DWORD WINAPI InternetSetFilePointer(HINTERNET hFile, LONG lDistanceToMove,
|
||||
PVOID pReserved, DWORD dwMoveContext, DWORD_PTR dwContext)
|
||||
{
|
||||
FIXME("stub\n");
|
||||
FIXME("(%p %d %p %d %lx): stub\n", hFile, lDistanceToMove, pReserved, dwMoveContext, dwContext);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -2222,10 +2279,10 @@ BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer,
|
||||
return res == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
|
||||
static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL unicode)
|
||||
{
|
||||
static BOOL warn = TRUE;
|
||||
|
||||
/* FIXME: This function currently handles more options than it should. Options requiring
|
||||
* proper handles should be moved to proper functions */
|
||||
switch(option) {
|
||||
case INTERNET_OPTION_REQUEST_FLAGS:
|
||||
TRACE("INTERNET_OPTION_REQUEST_FLAGS\n");
|
||||
@ -2252,10 +2309,8 @@ DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
case INTERNET_OPTION_CONNECTED_STATE:
|
||||
if (warn) {
|
||||
FIXME("INTERNET_OPTION_CONNECTED_STATE: semi-stub\n");
|
||||
warn = FALSE;
|
||||
}
|
||||
FIXME("INTERNET_OPTION_CONNECTED_STATE: semi-stub\n");
|
||||
|
||||
if (*size < sizeof(ULONG))
|
||||
return ERROR_INSUFFICIENT_BUFFER;
|
||||
|
||||
@ -2283,7 +2338,7 @@ DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *
|
||||
if (*size < sizeof(ULONG))
|
||||
return ERROR_INSUFFICIENT_BUFFER;
|
||||
|
||||
*(ULONG*)buffer = 2;
|
||||
*(ULONG*)buffer = max_conns;
|
||||
*size = sizeof(ULONG);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
@ -2294,7 +2349,7 @@ DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *
|
||||
if (*size < sizeof(ULONG))
|
||||
return ERROR_INSUFFICIENT_BUFFER;
|
||||
|
||||
*(ULONG*)buffer = 4;
|
||||
*(ULONG*)buffer = max_1_0_conns;
|
||||
*size = sizeof(ULONG);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
@ -2341,7 +2396,7 @@ DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *
|
||||
|
||||
switch (optionW->dwOption) {
|
||||
case INTERNET_PER_CONN_FLAGS:
|
||||
if(pi.dwProxyEnabled)
|
||||
if(pi.proxyEnabled)
|
||||
optionW->Value.dwValue = PROXY_TYPE_PROXY;
|
||||
else
|
||||
optionW->Value.dwValue = PROXY_TYPE_DIRECT;
|
||||
@ -2349,16 +2404,16 @@ DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *
|
||||
|
||||
case INTERNET_PER_CONN_PROXY_SERVER:
|
||||
if (unicode)
|
||||
optionW->Value.pszValue = heap_strdupW(pi.lpszProxyServer);
|
||||
optionW->Value.pszValue = heap_strdupW(pi.proxy);
|
||||
else
|
||||
optionA->Value.pszValue = heap_strdupWtoA(pi.lpszProxyServer);
|
||||
optionA->Value.pszValue = heap_strdupWtoA(pi.proxy);
|
||||
break;
|
||||
|
||||
case INTERNET_PER_CONN_PROXY_BYPASS:
|
||||
if (unicode)
|
||||
optionW->Value.pszValue = heap_strdupW(pi.lpszProxyBypass);
|
||||
optionW->Value.pszValue = heap_strdupW(pi.proxyBypass);
|
||||
else
|
||||
optionA->Value.pszValue = heap_strdupWtoA(pi.lpszProxyBypass);
|
||||
optionA->Value.pszValue = heap_strdupWtoA(pi.proxyBypass);
|
||||
break;
|
||||
|
||||
case INTERNET_PER_CONN_AUTOCONFIG_URL:
|
||||
@ -2385,15 +2440,20 @@ DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *
|
||||
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
||||
case INTERNET_OPTION_POLICY:
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
FIXME("Stub for %d\n", option);
|
||||
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
||||
}
|
||||
|
||||
DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
|
||||
{
|
||||
switch(option) {
|
||||
case INTERNET_OPTION_CONTEXT_VALUE:
|
||||
{
|
||||
if (!hdr)
|
||||
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
||||
if (!size)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (*size < sizeof(DWORD_PTR))
|
||||
{
|
||||
if (*size < sizeof(DWORD_PTR)) {
|
||||
*size = sizeof(DWORD_PTR);
|
||||
return ERROR_INSUFFICIENT_BUFFER;
|
||||
}
|
||||
@ -2403,11 +2463,15 @@ DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *
|
||||
*(DWORD_PTR *)buffer = hdr->dwContext;
|
||||
*size = sizeof(DWORD_PTR);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
case INTERNET_OPTION_MAX_CONNS_PER_SERVER:
|
||||
case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER:
|
||||
WARN("Called on global option %u\n", option);
|
||||
return ERROR_INTERNET_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
FIXME("Stub for %d\n", option);
|
||||
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
||||
/* FIXME: we shouldn't call it here */
|
||||
return query_global_option(option, buffer, size, unicode);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -2435,7 +2499,7 @@ BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption,
|
||||
WININET_Release(hdr);
|
||||
}
|
||||
}else {
|
||||
res = INET_QueryOption(NULL, dwOption, lpBuffer, lpdwBufferLength, TRUE);
|
||||
res = query_global_option(dwOption, lpBuffer, lpdwBufferLength, TRUE);
|
||||
}
|
||||
|
||||
if(res != ERROR_SUCCESS)
|
||||
@ -2468,7 +2532,7 @@ BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
|
||||
WININET_Release(hdr);
|
||||
}
|
||||
}else {
|
||||
res = INET_QueryOption(NULL, dwOption, lpBuffer, lpdwBufferLength, FALSE);
|
||||
res = query_global_option(dwOption, lpBuffer, lpdwBufferLength, FALSE);
|
||||
}
|
||||
|
||||
if(res != ERROR_SUCCESS)
|
||||
@ -2476,6 +2540,53 @@ BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
|
||||
return res == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
DWORD INET_SetOption(object_header_t *hdr, DWORD option, void *buf, DWORD size)
|
||||
{
|
||||
switch(option) {
|
||||
case INTERNET_OPTION_CALLBACK:
|
||||
WARN("Not settable option %u\n", option);
|
||||
return ERROR_INTERNET_OPTION_NOT_SETTABLE;
|
||||
case INTERNET_OPTION_MAX_CONNS_PER_SERVER:
|
||||
case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER:
|
||||
WARN("Called on global option %u\n", option);
|
||||
return ERROR_INTERNET_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
return ERROR_INTERNET_INVALID_OPTION;
|
||||
}
|
||||
|
||||
static DWORD set_global_option(DWORD option, void *buf, DWORD size)
|
||||
{
|
||||
switch(option) {
|
||||
case INTERNET_OPTION_CALLBACK:
|
||||
WARN("Not global option %u\n", option);
|
||||
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
||||
|
||||
case INTERNET_OPTION_MAX_CONNS_PER_SERVER:
|
||||
TRACE("INTERNET_OPTION_MAX_CONNS_PER_SERVER\n");
|
||||
|
||||
if(size != sizeof(max_conns))
|
||||
return ERROR_INTERNET_BAD_OPTION_LENGTH;
|
||||
if(!*(ULONG*)buf)
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
|
||||
max_conns = *(ULONG*)buf;
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER:
|
||||
TRACE("INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER\n");
|
||||
|
||||
if(size != sizeof(max_1_0_conns))
|
||||
return ERROR_INTERNET_BAD_OPTION_LENGTH;
|
||||
if(!*(ULONG*)buf)
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
|
||||
max_1_0_conns = *(ULONG*)buf;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
return ERROR_INTERNET_INVALID_OPTION;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetSetOptionW (WININET.@)
|
||||
@ -2492,37 +2603,28 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
|
||||
{
|
||||
object_header_t *lpwhh;
|
||||
BOOL ret = TRUE;
|
||||
DWORD res;
|
||||
|
||||
TRACE("(%p %d %p %d)\n", hInternet, dwOption, lpBuffer, dwBufferLength);
|
||||
|
||||
lpwhh = (object_header_t*) get_handle_object( hInternet );
|
||||
if(lpwhh && lpwhh->vtbl->SetOption) {
|
||||
DWORD res;
|
||||
|
||||
if(lpwhh)
|
||||
res = lpwhh->vtbl->SetOption(lpwhh, dwOption, lpBuffer, dwBufferLength);
|
||||
if(res != ERROR_INTERNET_INVALID_OPTION) {
|
||||
WININET_Release( lpwhh );
|
||||
else
|
||||
res = set_global_option(dwOption, lpBuffer, dwBufferLength);
|
||||
|
||||
if(res != ERROR_SUCCESS)
|
||||
SetLastError(res);
|
||||
if(res != ERROR_INTERNET_INVALID_OPTION) {
|
||||
if(lpwhh)
|
||||
WININET_Release(lpwhh);
|
||||
|
||||
return res == ERROR_SUCCESS;
|
||||
}
|
||||
if(res != ERROR_SUCCESS)
|
||||
SetLastError(res);
|
||||
|
||||
return res == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
switch (dwOption)
|
||||
{
|
||||
case INTERNET_OPTION_CALLBACK:
|
||||
{
|
||||
if (!lpwhh)
|
||||
{
|
||||
SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
||||
return FALSE;
|
||||
}
|
||||
WININET_Release(lpwhh);
|
||||
SetLastError(ERROR_INTERNET_OPTION_NOT_SETTABLE);
|
||||
return FALSE;
|
||||
}
|
||||
case INTERNET_OPTION_HTTP_VERSION:
|
||||
{
|
||||
HTTP_VERSION_INFO* pVersion=(HTTP_VERSION_INFO*)lpBuffer;
|
||||
@ -2546,6 +2648,48 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
|
||||
lpwhh->ErrorMask = *(ULONG*)lpBuffer;
|
||||
}
|
||||
break;
|
||||
case INTERNET_OPTION_PROXY:
|
||||
{
|
||||
INTERNET_PROXY_INFOW *info = lpBuffer;
|
||||
|
||||
if (!lpBuffer || dwBufferLength < sizeof(INTERNET_PROXY_INFOW))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
if (!hInternet)
|
||||
{
|
||||
EnterCriticalSection( &WININET_cs );
|
||||
free_global_proxy();
|
||||
global_proxy = heap_alloc( sizeof(proxyinfo_t) );
|
||||
if (global_proxy)
|
||||
{
|
||||
if (info->dwAccessType == INTERNET_OPEN_TYPE_PROXY)
|
||||
{
|
||||
global_proxy->proxyEnabled = 1;
|
||||
global_proxy->proxy = heap_strdupW( info->lpszProxy );
|
||||
global_proxy->proxyBypass = heap_strdupW( info->lpszProxyBypass );
|
||||
}
|
||||
else
|
||||
{
|
||||
global_proxy->proxyEnabled = 0;
|
||||
global_proxy->proxy = global_proxy->proxyBypass = NULL;
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection( &WININET_cs );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* In general, each type of object should handle
|
||||
* INTERNET_OPTION_PROXY directly. This FIXME ensures it doesn't
|
||||
* get silently dropped.
|
||||
*/
|
||||
FIXME("INTERNET_OPTION_PROXY unimplemented\n");
|
||||
SetLastError(ERROR_INTERNET_INVALID_OPTION);
|
||||
ret = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case INTERNET_OPTION_CODEPAGE:
|
||||
{
|
||||
ULONG codepage = *(ULONG *)lpBuffer;
|
||||
@ -2570,18 +2714,6 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
|
||||
FIXME("Option INTERNET_OPTION_DATA_RECEIVE_TIMEOUT (%d): STUB\n", receivetimeout);
|
||||
}
|
||||
break;
|
||||
case INTERNET_OPTION_MAX_CONNS_PER_SERVER:
|
||||
{
|
||||
ULONG conns = *(ULONG *)lpBuffer;
|
||||
FIXME("Option INTERNET_OPTION_MAX_CONNS_PER_SERVER (%d): STUB\n", conns);
|
||||
}
|
||||
break;
|
||||
case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER:
|
||||
{
|
||||
ULONG conns = *(ULONG *)lpBuffer;
|
||||
FIXME("Option INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER (%d): STUB\n", conns);
|
||||
}
|
||||
break;
|
||||
case INTERNET_OPTION_RESET_URLCACHE_SESSION:
|
||||
FIXME("Option INTERNET_OPTION_RESET_URLCACHE_SESSION: STUB\n");
|
||||
break;
|
||||
@ -2677,18 +2809,18 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
|
||||
|
||||
switch (option->dwOption) {
|
||||
case INTERNET_PER_CONN_PROXY_SERVER:
|
||||
HeapFree(GetProcessHeap(), 0, pi.lpszProxyServer);
|
||||
pi.lpszProxyServer = heap_strdupW(option->Value.pszValue);
|
||||
heap_free(pi.proxy);
|
||||
pi.proxy = heap_strdupW(option->Value.pszValue);
|
||||
break;
|
||||
|
||||
case INTERNET_PER_CONN_FLAGS:
|
||||
if(option->Value.dwValue & PROXY_TYPE_PROXY)
|
||||
pi.dwProxyEnabled = 1;
|
||||
pi.proxyEnabled = 1;
|
||||
else
|
||||
{
|
||||
if(option->Value.dwValue != PROXY_TYPE_DIRECT)
|
||||
FIXME("Unhandled flags: 0x%x\n", option->Value.dwValue);
|
||||
pi.dwProxyEnabled = 0;
|
||||
pi.proxyEnabled = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2750,19 +2882,6 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption,
|
||||
|
||||
switch( dwOption )
|
||||
{
|
||||
case INTERNET_OPTION_CALLBACK:
|
||||
{
|
||||
object_header_t *lpwh;
|
||||
|
||||
if (!(lpwh = get_handle_object(hInternet)))
|
||||
{
|
||||
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
||||
return FALSE;
|
||||
}
|
||||
WININET_Release(lpwh);
|
||||
INTERNET_SetLastError(ERROR_INTERNET_OPTION_NOT_SETTABLE);
|
||||
return FALSE;
|
||||
}
|
||||
case INTERNET_OPTION_PROXY:
|
||||
{
|
||||
LPINTERNET_PROXY_INFOA pi = (LPINTERNET_PROXY_INFOA) lpBuffer;
|
||||
@ -2872,15 +2991,15 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption,
|
||||
case INTERNET_PER_CONN_PROXY_SERVER:
|
||||
case INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL:
|
||||
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL:
|
||||
HeapFree( GetProcessHeap(), 0, opt->Value.pszValue );
|
||||
heap_free( opt->Value.pszValue );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, list->pOptions );
|
||||
heap_free( list->pOptions );
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, wbuffer );
|
||||
heap_free( wbuffer );
|
||||
}
|
||||
|
||||
return r;
|
||||
@ -2997,7 +3116,7 @@ BOOL WINAPI InternetTimeToSystemTimeA( LPCSTR string, SYSTEMTIME* time, DWORD re
|
||||
if (stringW)
|
||||
{
|
||||
ret = InternetTimeToSystemTimeW( stringW, time, reserved );
|
||||
HeapFree( GetProcessHeap(), 0, stringW );
|
||||
heap_free( stringW );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -3104,7 +3223,7 @@ BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRe
|
||||
static const CHAR ping[] = "ping -c 1 ";
|
||||
static const CHAR redirect[] = " >/dev/null 2>/dev/null";
|
||||
CHAR *command = NULL;
|
||||
WCHAR hostW[1024];
|
||||
WCHAR hostW[INTERNET_MAX_HOST_NAME_LENGTH];
|
||||
DWORD len;
|
||||
INTERNET_PORT port;
|
||||
int status = -1;
|
||||
@ -3132,7 +3251,7 @@ BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRe
|
||||
|
||||
ZeroMemory(&components,sizeof(URL_COMPONENTSW));
|
||||
components.lpszHostName = (LPWSTR)hostW;
|
||||
components.dwHostNameLength = 1024;
|
||||
components.dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH;
|
||||
|
||||
if (!InternetCrackUrlW(lpszUrl,0,0,&components))
|
||||
goto End;
|
||||
@ -3181,8 +3300,7 @@ BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRe
|
||||
}
|
||||
|
||||
End:
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, command );
|
||||
heap_free( command );
|
||||
if (rc == FALSE)
|
||||
INTERNET_SetLastError(ERROR_NOT_CONNECTED);
|
||||
|
||||
@ -3213,7 +3331,7 @@ BOOL WINAPI InternetCheckConnectionA(LPCSTR lpszUrl, DWORD dwFlags, DWORD dwRese
|
||||
|
||||
rc = InternetCheckConnectionW(url, dwFlags, dwReserved);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, url);
|
||||
heap_free(url);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -3230,8 +3348,12 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl,
|
||||
LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
|
||||
{
|
||||
URL_COMPONENTSW urlComponents;
|
||||
WCHAR protocol[32], hostName[MAXHOSTNAME], userName[1024];
|
||||
WCHAR password[1024], path[2048], extra[1024];
|
||||
WCHAR protocol[INTERNET_MAX_SCHEME_LENGTH];
|
||||
WCHAR hostName[INTERNET_MAX_HOST_NAME_LENGTH];
|
||||
WCHAR userName[INTERNET_MAX_USER_NAME_LENGTH];
|
||||
WCHAR password[INTERNET_MAX_PASSWORD_LENGTH];
|
||||
WCHAR path[INTERNET_MAX_PATH_LENGTH];
|
||||
WCHAR extra[1024];
|
||||
HINTERNET client = NULL, client1 = NULL;
|
||||
DWORD res;
|
||||
|
||||
@ -3240,15 +3362,15 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl,
|
||||
|
||||
urlComponents.dwStructSize = sizeof(URL_COMPONENTSW);
|
||||
urlComponents.lpszScheme = protocol;
|
||||
urlComponents.dwSchemeLength = 32;
|
||||
urlComponents.dwSchemeLength = INTERNET_MAX_SCHEME_LENGTH;
|
||||
urlComponents.lpszHostName = hostName;
|
||||
urlComponents.dwHostNameLength = MAXHOSTNAME;
|
||||
urlComponents.dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH;
|
||||
urlComponents.lpszUserName = userName;
|
||||
urlComponents.dwUserNameLength = 1024;
|
||||
urlComponents.dwUserNameLength = INTERNET_MAX_USER_NAME_LENGTH;
|
||||
urlComponents.lpszPassword = password;
|
||||
urlComponents.dwPasswordLength = 1024;
|
||||
urlComponents.dwPasswordLength = INTERNET_MAX_PASSWORD_LENGTH;
|
||||
urlComponents.lpszUrlPath = path;
|
||||
urlComponents.dwUrlPathLength = 2048;
|
||||
urlComponents.dwUrlPathLength = INTERNET_MAX_PATH_LENGTH;
|
||||
urlComponents.lpszExtraInfo = extra;
|
||||
urlComponents.dwExtraInfoLength = 1024;
|
||||
if(!InternetCrackUrlW(lpszUrl, strlenW(lpszUrl), 0, &urlComponents))
|
||||
@ -3300,7 +3422,7 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl,
|
||||
strcpyW(path_extra, urlComponents.lpszUrlPath);
|
||||
strcatW(path_extra, urlComponents.lpszExtraInfo);
|
||||
client1 = HttpOpenRequestW(client, NULL, path_extra, NULL, NULL, accept, dwFlags, dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, path_extra);
|
||||
heap_free(path_extra);
|
||||
}
|
||||
else
|
||||
client1 = HttpOpenRequestW(client, NULL, path, NULL, NULL, accept, dwFlags, dwContext);
|
||||
@ -3347,8 +3469,8 @@ static void AsyncInternetOpenUrlProc(WORKREQUEST *workRequest)
|
||||
|
||||
INTERNET_InternetOpenUrlW(hIC, req->lpszUrl,
|
||||
req->lpszHeaders, req->dwHeadersLength, req->dwFlags, req->dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszUrl);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszHeaders);
|
||||
heap_free(req->lpszUrl);
|
||||
heap_free(req->lpszHeaders);
|
||||
}
|
||||
|
||||
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
|
||||
@ -3434,7 +3556,7 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
||||
lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, NULL, 0 );
|
||||
szHeaders = heap_alloc(lenHeaders*sizeof(WCHAR));
|
||||
if(!szHeaders) {
|
||||
HeapFree(GetProcessHeap(), 0, szUrl);
|
||||
heap_free(szUrl);
|
||||
return NULL;
|
||||
}
|
||||
MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, szHeaders, lenHeaders);
|
||||
@ -3443,9 +3565,8 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
||||
rc = InternetOpenUrlW(hInternet, szUrl, szHeaders,
|
||||
lenHeaders, dwFlags, dwContext);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, szUrl);
|
||||
HeapFree(GetProcessHeap(), 0, szHeaders);
|
||||
|
||||
heap_free(szUrl);
|
||||
heap_free(szHeaders);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -3462,10 +3583,9 @@ static LPWITHREADERROR INTERNET_AllocThreadError(void)
|
||||
|
||||
if (!TlsSetValue(g_dwTlsErrIndex, lpwite))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, lpwite);
|
||||
heap_free(lpwite);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return lpwite;
|
||||
}
|
||||
|
||||
@ -3525,14 +3645,14 @@ static DWORD CALLBACK INTERNET_WorkerThreadFunc(LPVOID lpvParam)
|
||||
TRACE("\n");
|
||||
|
||||
workRequest = *lpRequest;
|
||||
HeapFree(GetProcessHeap(), 0, lpRequest);
|
||||
heap_free(lpRequest);
|
||||
|
||||
workRequest.asyncproc(&workRequest);
|
||||
WININET_Release( workRequest.hdr );
|
||||
|
||||
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, TlsGetValue(g_dwTlsErrIndex));
|
||||
heap_free(TlsGetValue(g_dwTlsErrIndex));
|
||||
TlsSetValue(g_dwTlsErrIndex, NULL);
|
||||
}
|
||||
return TRUE;
|
||||
@ -3563,10 +3683,9 @@ DWORD INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest)
|
||||
bSuccess = QueueUserWorkItem(INTERNET_WorkerThreadFunc, lpNewRequest, WT_EXECUTELONGFUNCTION);
|
||||
if (!bSuccess)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, lpNewRequest);
|
||||
heap_free(lpNewRequest);
|
||||
return ERROR_INTERNET_ASYNC_THREAD_FAILED;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
@ -4034,14 +4153,13 @@ BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags,
|
||||
if (ret)
|
||||
WideCharToMultiByte(CP_ACP, 0, urlW, -1, lpszUrl, *lpdwUrlLength + 1, NULL, NULL);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, urlCompW.lpszScheme);
|
||||
HeapFree(GetProcessHeap(), 0, urlCompW.lpszHostName);
|
||||
HeapFree(GetProcessHeap(), 0, urlCompW.lpszUserName);
|
||||
HeapFree(GetProcessHeap(), 0, urlCompW.lpszPassword);
|
||||
HeapFree(GetProcessHeap(), 0, urlCompW.lpszUrlPath);
|
||||
HeapFree(GetProcessHeap(), 0, urlCompW.lpszExtraInfo);
|
||||
HeapFree(GetProcessHeap(), 0, urlW);
|
||||
|
||||
heap_free(urlCompW.lpszScheme);
|
||||
heap_free(urlCompW.lpszHostName);
|
||||
heap_free(urlCompW.lpszUserName);
|
||||
heap_free(urlCompW.lpszPassword);
|
||||
heap_free(urlCompW.lpszUrlPath);
|
||||
heap_free(urlCompW.lpszExtraInfo);
|
||||
heap_free(urlW);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -4295,3 +4413,9 @@ BOOL WINAPI InternetQueryFortezzaStatus(DWORD *a, DWORD_PTR b)
|
||||
FIXME("(%p, %08lx) stub\n", a, b);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD WINAPI ShowClientAuthCerts(HWND parent)
|
||||
{
|
||||
FIXME("%p: stub\n", parent);
|
||||
return 0;
|
||||
}
|
||||
|
@ -265,6 +265,9 @@ typedef struct
|
||||
LPWSTR password;
|
||||
INTERNET_PORT hostPort; /* the final destination port of the request */
|
||||
INTERNET_PORT serverPort; /* the port of the server we directly connect to */
|
||||
DWORD connect_timeout;
|
||||
DWORD send_timeout;
|
||||
DWORD receive_timeout;
|
||||
} http_session_t;
|
||||
|
||||
#define HDR_ISREQUEST 0x0001
|
||||
@ -305,7 +308,11 @@ typedef struct
|
||||
LPWSTR rawHeaders;
|
||||
netconn_t *netconn;
|
||||
DWORD security_flags;
|
||||
DWORD connect_timeout;
|
||||
DWORD send_timeout;
|
||||
DWORD receive_timeout;
|
||||
LPWSTR version;
|
||||
DWORD status_code;
|
||||
LPWSTR statusText;
|
||||
DWORD bytesToWrite;
|
||||
DWORD bytesWritten;
|
||||
@ -480,7 +487,8 @@ object_header_t *get_handle_object( HINTERNET hinternet ) DECLSPEC_HIDDEN;
|
||||
object_header_t *WININET_AddRef( object_header_t *info ) DECLSPEC_HIDDEN;
|
||||
BOOL WININET_Release( object_header_t *info ) DECLSPEC_HIDDEN;
|
||||
|
||||
DWORD INET_QueryOption( object_header_t *, DWORD, void *, DWORD *, BOOL ) DECLSPEC_HIDDEN;
|
||||
DWORD INET_QueryOption(object_header_t*,DWORD,void*,DWORD*,BOOL) DECLSPEC_HIDDEN;
|
||||
DWORD INET_SetOption(object_header_t*,DWORD,void*,DWORD) DECLSPEC_HIDDEN;
|
||||
|
||||
time_t ConvertTimeString(LPCWSTR asctime) DECLSPEC_HIDDEN;
|
||||
|
||||
@ -515,10 +523,10 @@ VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext,
|
||||
DWORD dwStatusInfoLength) DECLSPEC_HIDDEN;
|
||||
BOOL INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto, WCHAR *foundProxy, DWORD *foundProxyLen) DECLSPEC_HIDDEN;
|
||||
|
||||
DWORD create_netconn(BOOL,server_t*,DWORD,netconn_t**) DECLSPEC_HIDDEN;
|
||||
DWORD create_netconn(BOOL, server_t *, DWORD, DWORD, netconn_t **) DECLSPEC_HIDDEN;
|
||||
void free_netconn(netconn_t*) DECLSPEC_HIDDEN;
|
||||
void NETCON_unload(void) DECLSPEC_HIDDEN;
|
||||
DWORD NETCON_secure_connect(netconn_t *connection, LPWSTR hostname) DECLSPEC_HIDDEN;
|
||||
DWORD NETCON_secure_connect(netconn_t *connection) DECLSPEC_HIDDEN;
|
||||
DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags,
|
||||
int *sent /* out */) DECLSPEC_HIDDEN;
|
||||
DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, int flags,
|
||||
@ -527,7 +535,7 @@ BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available) DECLSP
|
||||
BOOL NETCON_is_alive(netconn_t*) DECLSPEC_HIDDEN;
|
||||
LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN;
|
||||
int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN;
|
||||
DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, int value) DECLSPEC_HIDDEN;
|
||||
DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC_HIDDEN;
|
||||
#ifndef __REACTOS__
|
||||
int sock_get_error(int) DECLSPEC_HIDDEN;
|
||||
#else
|
||||
|
@ -114,7 +114,6 @@ static const SSL_METHOD *meth;
|
||||
static SSL_METHOD *meth;
|
||||
#endif
|
||||
static SSL_CTX *ctx;
|
||||
static int hostname_idx;
|
||||
static int error_idx;
|
||||
static int conn_idx;
|
||||
|
||||
@ -210,7 +209,7 @@ static PCCERT_CONTEXT X509_to_cert_context(X509 *cert)
|
||||
if (malloced)
|
||||
free(buffer);
|
||||
else
|
||||
HeapFree(GetProcessHeap(),0,buffer);
|
||||
heap_free(buffer);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -238,6 +237,7 @@ static DWORD netconn_verify_cert(PCCERT_CONTEXT cert, HCERTSTORE store,
|
||||
static const DWORD supportedErrors =
|
||||
CERT_TRUST_IS_NOT_TIME_VALID |
|
||||
CERT_TRUST_IS_UNTRUSTED_ROOT |
|
||||
CERT_TRUST_IS_PARTIAL_CHAIN |
|
||||
CERT_TRUST_IS_OFFLINE_REVOCATION |
|
||||
CERT_TRUST_REVOCATION_STATUS_UNKNOWN |
|
||||
CERT_TRUST_IS_REVOKED |
|
||||
@ -247,7 +247,7 @@ static DWORD netconn_verify_cert(PCCERT_CONTEXT cert, HCERTSTORE store,
|
||||
!(security_flags & SECURITY_FLAG_IGNORE_CERT_DATE_INVALID))
|
||||
err = ERROR_INTERNET_SEC_CERT_DATE_INVALID;
|
||||
else if (chain->TrustStatus.dwErrorStatus &
|
||||
CERT_TRUST_IS_UNTRUSTED_ROOT &&
|
||||
(CERT_TRUST_IS_UNTRUSTED_ROOT | CERT_TRUST_IS_PARTIAL_CHAIN) &&
|
||||
!(security_flags & SECURITY_FLAG_IGNORE_UNKNOWN_CA))
|
||||
err = ERROR_INTERNET_INVALID_CA;
|
||||
else if (!(security_flags & SECURITY_FLAG_IGNORE_REVOCATION) &&
|
||||
@ -308,7 +308,6 @@ static DWORD netconn_verify_cert(PCCERT_CONTEXT cert, HCERTSTORE store,
|
||||
static int netconn_secure_verify(int preverify_ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
SSL *ssl;
|
||||
WCHAR *server;
|
||||
BOOL ret = FALSE;
|
||||
HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
|
||||
CERT_STORE_CREATE_NEW_FLAG, NULL);
|
||||
@ -316,7 +315,6 @@ static int netconn_secure_verify(int preverify_ok, X509_STORE_CTX *ctx)
|
||||
|
||||
ssl = pX509_STORE_CTX_get_ex_data(ctx,
|
||||
pSSL_get_ex_data_X509_STORE_CTX_idx());
|
||||
server = pSSL_get_ex_data(ssl, hostname_idx);
|
||||
conn = pSSL_get_ex_data(ssl, conn_idx);
|
||||
if (store)
|
||||
{
|
||||
@ -333,19 +331,15 @@ static int netconn_secure_verify(int preverify_ok, X509_STORE_CTX *ctx)
|
||||
cert = (X509 *)psk_value(chain, i);
|
||||
if ((context = X509_to_cert_context(cert)))
|
||||
{
|
||||
if (i == 0)
|
||||
ret = CertAddCertificateContextToStore(store, context,
|
||||
CERT_STORE_ADD_ALWAYS, &endCert);
|
||||
else
|
||||
ret = CertAddCertificateContextToStore(store, context,
|
||||
CERT_STORE_ADD_ALWAYS, NULL);
|
||||
ret = CertAddCertificateContextToStore(store, context,
|
||||
CERT_STORE_ADD_ALWAYS, i ? NULL : &endCert);
|
||||
CertFreeCertificateContext(context);
|
||||
}
|
||||
}
|
||||
if (!endCert) ret = FALSE;
|
||||
if (ret)
|
||||
{
|
||||
DWORD_PTR err = netconn_verify_cert(endCert, store, server,
|
||||
DWORD_PTR err = netconn_verify_cert(endCert, store, conn->server->name,
|
||||
conn->security_flags);
|
||||
|
||||
if (err)
|
||||
@ -460,12 +454,6 @@ static DWORD init_openssl(void)
|
||||
return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
hostname_idx = pSSL_get_ex_new_index(0, (void *)"hostname index", NULL, NULL, NULL);
|
||||
if(hostname_idx == -1) {
|
||||
ERR("SSL_get_ex_new_index failed; %s\n", pERR_error_string(pERR_get_error(), 0));
|
||||
return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
error_idx = pSSL_get_ex_new_index(0, (void *)"error index", NULL, NULL, NULL);
|
||||
if(error_idx == -1) {
|
||||
ERR("SSL_get_ex_new_index failed; %s\n", pERR_error_string(pERR_get_error(), 0));
|
||||
@ -482,12 +470,15 @@ static DWORD init_openssl(void)
|
||||
|
||||
pCRYPTO_set_id_callback(ssl_thread_id);
|
||||
num_ssl_locks = pCRYPTO_num_locks();
|
||||
ssl_locks = HeapAlloc(GetProcessHeap(), 0, num_ssl_locks * sizeof(CRITICAL_SECTION));
|
||||
ssl_locks = heap_alloc(num_ssl_locks * sizeof(CRITICAL_SECTION));
|
||||
if(!ssl_locks)
|
||||
return ERROR_OUTOFMEMORY;
|
||||
|
||||
for(i = 0; i < num_ssl_locks; i++)
|
||||
{
|
||||
InitializeCriticalSection(&ssl_locks[i]);
|
||||
ssl_locks[i].DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ssl_locks");
|
||||
}
|
||||
pCRYPTO_set_locking_callback(ssl_lock_callback);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
@ -497,7 +488,7 @@ static DWORD init_openssl(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
DWORD create_netconn(BOOL useSSL, server_t *server, DWORD security_flags, netconn_t **ret)
|
||||
DWORD create_netconn(BOOL useSSL, server_t *server, DWORD security_flags, DWORD timeout, netconn_t **ret)
|
||||
{
|
||||
netconn_t *netconn;
|
||||
int result, flag;
|
||||
@ -526,9 +517,43 @@ DWORD create_netconn(BOOL useSSL, server_t *server, DWORD security_flags, netcon
|
||||
assert(server->addr_len);
|
||||
result = netconn->socketFD = socket(server->addr.ss_family, SOCK_STREAM, 0);
|
||||
if(result != -1) {
|
||||
flag = 1;
|
||||
ioctlsocket(netconn->socketFD, FIONBIO, &flag);
|
||||
result = connect(netconn->socketFD, (struct sockaddr*)&server->addr, server->addr_len);
|
||||
if(result == -1)
|
||||
{
|
||||
if (sock_get_error(errno) == WSAEINPROGRESS) {
|
||||
// ReactOS: use select instead of poll
|
||||
fd_set outfd;
|
||||
struct timeval tv;
|
||||
int res;
|
||||
|
||||
FD_ZERO(&outfd);
|
||||
FD_SET(netconn->socketFD, &outfd);
|
||||
tv.tv_sec = timeout / 1000;
|
||||
tv.tv_usec = (timeout % 1000) * 1000;
|
||||
res = select(0, NULL, &outfd, NULL, &tv);
|
||||
if (!res)
|
||||
{
|
||||
closesocket(netconn->socketFD);
|
||||
heap_free(netconn);
|
||||
return ERROR_INTERNET_CANNOT_CONNECT;
|
||||
}
|
||||
else if (res > 0)
|
||||
{
|
||||
int err;
|
||||
socklen_t len = sizeof(err);
|
||||
if (!getsockopt(netconn->socketFD, SOL_SOCKET, SO_ERROR, &err, &len) && !err)
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(result == -1)
|
||||
closesocket(netconn->socketFD);
|
||||
else {
|
||||
flag = 0;
|
||||
ioctlsocket(netconn->socketFD, FIONBIO, &flag);
|
||||
}
|
||||
}
|
||||
if(result == -1) {
|
||||
heap_free(netconn);
|
||||
@ -581,8 +606,12 @@ void NETCON_unload(void)
|
||||
if (ssl_locks)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < num_ssl_locks; i++) DeleteCriticalSection(&ssl_locks[i]);
|
||||
HeapFree(GetProcessHeap(), 0, ssl_locks);
|
||||
for (i = 0; i < num_ssl_locks; i++)
|
||||
{
|
||||
ssl_locks[i].DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&ssl_locks[i]);
|
||||
}
|
||||
heap_free(ssl_locks);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -660,12 +689,12 @@ int sock_get_error( int err )
|
||||
* NETCON_secure_connect
|
||||
* Initiates a secure connection over an existing plaintext connection.
|
||||
*/
|
||||
DWORD NETCON_secure_connect(netconn_t *connection, LPWSTR hostname)
|
||||
DWORD NETCON_secure_connect(netconn_t *connection)
|
||||
{
|
||||
void *ssl_s;
|
||||
DWORD res = ERROR_NOT_SUPPORTED;
|
||||
|
||||
#ifdef SONAME_LIBSSL
|
||||
void *ssl_s;
|
||||
|
||||
/* can't connect if we are already connected */
|
||||
if (connection->ssl_s)
|
||||
{
|
||||
@ -689,13 +718,6 @@ DWORD NETCON_secure_connect(netconn_t *connection, LPWSTR hostname)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!pSSL_set_ex_data(ssl_s, hostname_idx, hostname))
|
||||
{
|
||||
ERR("SSL_set_ex_data failed: %s\n",
|
||||
pERR_error_string(pERR_get_error(), 0));
|
||||
res = ERROR_INTERNET_SECURITY_CHANNEL_ERROR;
|
||||
goto fail;
|
||||
}
|
||||
if (!pSSL_set_ex_data(ssl_s, conn_idx, connection))
|
||||
{
|
||||
ERR("SSL_set_ex_data failed: %s\n",
|
||||
@ -895,24 +917,29 @@ int NETCON_GetCipherStrength(netconn_t *connection)
|
||||
#endif
|
||||
}
|
||||
|
||||
DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, int value)
|
||||
DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value)
|
||||
{
|
||||
int result;
|
||||
struct timeval tv;
|
||||
|
||||
/* value is in milliseconds, convert to struct timeval */
|
||||
tv.tv_sec = value / 1000;
|
||||
tv.tv_usec = (value % 1000) * 1000;
|
||||
|
||||
if (value == INFINITE)
|
||||
{
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tv.tv_sec = value / 1000;
|
||||
tv.tv_usec = (value % 1000) * 1000;
|
||||
}
|
||||
result = setsockopt(connection->socketFD, SOL_SOCKET,
|
||||
send ? SO_SNDTIMEO : SO_RCVTIMEO, (void*)&tv,
|
||||
sizeof(tv));
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
WARN("setsockopt failed (%s)\n", strerror(errno));
|
||||
return sock_get_error(errno);
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
@ -60,17 +60,24 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
||||
|
||||
#define ENTRY_START_OFFSET 0x4000
|
||||
#define DIR_LENGTH 8
|
||||
#define BLOCKSIZE 128
|
||||
#define HASHTABLE_SIZE 448
|
||||
#define HASHTABLE_BLOCKSIZE 7
|
||||
#define HASHTABLE_FREE 3
|
||||
#define ENTRY_START_OFFSET 0x4000
|
||||
#define DIR_LENGTH 8
|
||||
#define BLOCKSIZE 128
|
||||
#define HASHTABLE_SIZE 448
|
||||
#define HASHTABLE_NUM_ENTRIES 64 /* this needs to be power of 2, that divides HASHTABLE_SIZE */
|
||||
#define HASHTABLE_BLOCKSIZE (HASHTABLE_SIZE / HASHTABLE_NUM_ENTRIES)
|
||||
#define ALLOCATION_TABLE_OFFSET 0x250
|
||||
#define ALLOCATION_TABLE_SIZE (0x1000 - ALLOCATION_TABLE_OFFSET)
|
||||
#define HASHTABLE_NUM_ENTRIES (HASHTABLE_SIZE / HASHTABLE_BLOCKSIZE)
|
||||
#define NEWFILE_NUM_BLOCKS 0xd80
|
||||
#define NEWFILE_SIZE (NEWFILE_NUM_BLOCKS * BLOCKSIZE + ENTRY_START_OFFSET)
|
||||
#define ALLOCATION_TABLE_SIZE (ENTRY_START_OFFSET - ALLOCATION_TABLE_OFFSET)
|
||||
#define MIN_BLOCK_NO 0x80
|
||||
#define MAX_BLOCK_NO (ALLOCATION_TABLE_SIZE * 8)
|
||||
#define FILE_SIZE(blocks) ((blocks) * BLOCKSIZE + ENTRY_START_OFFSET)
|
||||
|
||||
#define HASHTABLE_URL 0
|
||||
#define HASHTABLE_DEL 1
|
||||
#define HASHTABLE_LOCK 2
|
||||
#define HASHTABLE_FREE 3
|
||||
#define HASHTABLE_REDR 5
|
||||
#define HASHTABLE_FLAG_BITS 5
|
||||
|
||||
#define DWORD_SIG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24))
|
||||
#define URL_SIGNATURE DWORD_SIG('U','R','L',' ')
|
||||
@ -217,11 +224,11 @@ static void URLCache_PathToObjectName(LPWSTR lpszPath, WCHAR replace)
|
||||
* Any other Win32 error code if failed
|
||||
*
|
||||
*/
|
||||
static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer)
|
||||
static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer, DWORD blocks_no)
|
||||
{
|
||||
HANDLE hFile;
|
||||
WCHAR wszFilePath[MAX_PATH];
|
||||
DWORD dwFileSize;
|
||||
DWORD dwFileSize, new_file_size;
|
||||
|
||||
static const WCHAR wszIndex[] = {'i','n','d','e','x','.','d','a','t',0};
|
||||
static const WCHAR wszMappingFormat[] = {'%','s','%','s','_','%','l','u',0};
|
||||
@ -257,7 +264,13 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer)
|
||||
return GetLastError();
|
||||
}
|
||||
|
||||
if (dwFileSize == 0)
|
||||
if (blocks_no < MIN_BLOCK_NO)
|
||||
blocks_no = MIN_BLOCK_NO;
|
||||
else if (blocks_no > MAX_BLOCK_NO)
|
||||
blocks_no = MAX_BLOCK_NO;
|
||||
new_file_size = FILE_SIZE(blocks_no);
|
||||
|
||||
if (dwFileSize < new_file_size)
|
||||
{
|
||||
static const CHAR szCacheContent[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Cache\\Content";
|
||||
HKEY key;
|
||||
@ -265,17 +278,21 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer)
|
||||
DWORD dwOffset;
|
||||
DWORD dwError = ERROR_SUCCESS;
|
||||
|
||||
if (SetFilePointer(hFile, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER)
|
||||
dwError = GetLastError();
|
||||
|
||||
/* Write zeroes to the entire file so we can safely map it without
|
||||
* fear of getting a SEGV because the disk is full.
|
||||
*/
|
||||
memset(achZeroes, 0, sizeof(achZeroes));
|
||||
for (dwOffset = 0; dwOffset < NEWFILE_SIZE; dwOffset += sizeof(achZeroes))
|
||||
for (dwOffset = dwFileSize; dwOffset<new_file_size && dwError==ERROR_SUCCESS;
|
||||
dwOffset += sizeof(achZeroes))
|
||||
{
|
||||
DWORD dwWrite = sizeof(achZeroes);
|
||||
DWORD dwWritten;
|
||||
|
||||
if (NEWFILE_SIZE - dwOffset < dwWrite)
|
||||
dwWrite = NEWFILE_SIZE - dwOffset;
|
||||
if (new_file_size - dwOffset < dwWrite)
|
||||
dwWrite = new_file_size - dwOffset;
|
||||
if (!WriteFile(hFile, achZeroes, dwWrite, &dwWritten, 0) ||
|
||||
dwWritten != dwWrite)
|
||||
{
|
||||
@ -284,33 +301,34 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer)
|
||||
* longer there, if possible.
|
||||
*/
|
||||
dwError = GetLastError();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dwError == ERROR_SUCCESS)
|
||||
{
|
||||
HANDLE hMapping = CreateFileMappingW(hFile, NULL, PAGE_READWRITE, 0, NEWFILE_SIZE, NULL);
|
||||
HANDLE hMapping = CreateFileMappingW(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
|
||||
|
||||
if (hMapping)
|
||||
{
|
||||
URLCACHE_HEADER *pHeader = MapViewOfFile(hMapping, FILE_MAP_WRITE, 0, 0, NEWFILE_SIZE);
|
||||
URLCACHE_HEADER *pHeader = MapViewOfFile(hMapping, FILE_MAP_WRITE, 0, 0, 0);
|
||||
|
||||
if (pHeader)
|
||||
if (pHeader && dwFileSize)
|
||||
{
|
||||
pHeader->dwFileSize = new_file_size;
|
||||
pHeader->dwIndexCapacityInBlocks = blocks_no;
|
||||
}
|
||||
else if (pHeader)
|
||||
{
|
||||
WCHAR *pwchDir;
|
||||
WCHAR wszDirPath[MAX_PATH];
|
||||
FILETIME ft;
|
||||
int i, j;
|
||||
HASH_CACHEFILE_ENTRY *pHashEntry;
|
||||
|
||||
dwFileSize = NEWFILE_SIZE;
|
||||
|
||||
/* First set some constants and defaults in the header */
|
||||
strcpy(pHeader->szSignature, "WINE URLCache Ver 0.2005001");
|
||||
pHeader->dwFileSize = dwFileSize;
|
||||
pHeader->dwIndexCapacityInBlocks = NEWFILE_NUM_BLOCKS;
|
||||
pHeader->dwFileSize = new_file_size;
|
||||
pHeader->dwIndexCapacityInBlocks = blocks_no;
|
||||
/* 127MB - taken from default for Windows 2000 */
|
||||
pHeader->CacheLimit.QuadPart = 0x07ff5400;
|
||||
/* Copied from a Windows 2000 cache index */
|
||||
@ -404,6 +422,7 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer)
|
||||
{
|
||||
dwError = GetLastError();
|
||||
}
|
||||
dwFileSize = new_file_size;
|
||||
CloseHandle(hMapping);
|
||||
}
|
||||
else
|
||||
@ -422,6 +441,7 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer)
|
||||
|
||||
}
|
||||
|
||||
pContainer->file_size = dwFileSize;
|
||||
wsprintfW(wszFilePath, wszMappingFormat, pContainer->path, wszIndex, dwFileSize);
|
||||
URLCache_PathToObjectName(wszFilePath, '_');
|
||||
pContainer->hMapping = OpenFileMappingW(FILE_MAP_WRITE, FALSE, wszFilePath);
|
||||
@ -471,15 +491,15 @@ static BOOL URLCacheContainers_AddContainer(LPCWSTR cache_prefix, LPCWSTR path,
|
||||
pContainer->path = heap_strdupW(path);
|
||||
if (!pContainer->path)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pContainer);
|
||||
heap_free(pContainer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pContainer->cache_prefix = heap_alloc((cache_prefix_len + 1) * sizeof(WCHAR));
|
||||
if (!pContainer->cache_prefix)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pContainer->path);
|
||||
HeapFree(GetProcessHeap(), 0, pContainer);
|
||||
heap_free(pContainer->path);
|
||||
heap_free(pContainer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -491,8 +511,8 @@ static BOOL URLCacheContainers_AddContainer(LPCWSTR cache_prefix, LPCWSTR path,
|
||||
if ((pContainer->hMutex = CreateMutexW(NULL, FALSE, mutex_name)) == NULL)
|
||||
{
|
||||
ERR("couldn't create mutex (error is %d)\n", GetLastError());
|
||||
HeapFree(GetProcessHeap(), 0, pContainer->path);
|
||||
HeapFree(GetProcessHeap(), 0, pContainer);
|
||||
heap_free(pContainer->path);
|
||||
heap_free(pContainer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -507,9 +527,9 @@ static void URLCacheContainer_DeleteContainer(URLCACHECONTAINER * pContainer)
|
||||
|
||||
URLCacheContainer_CloseIndex(pContainer);
|
||||
CloseHandle(pContainer->hMutex);
|
||||
HeapFree(GetProcessHeap(), 0, pContainer->path);
|
||||
HeapFree(GetProcessHeap(), 0, pContainer->cache_prefix);
|
||||
HeapFree(GetProcessHeap(), 0, pContainer);
|
||||
heap_free(pContainer->path);
|
||||
heap_free(pContainer->cache_prefix);
|
||||
heap_free(pContainer);
|
||||
}
|
||||
|
||||
void URLCacheContainers_CreateDefaults(void)
|
||||
@ -622,7 +642,7 @@ static DWORD URLCacheContainers_FindContainerA(LPCSTR lpszUrl, URLCACHECONTAINER
|
||||
return ERROR_OUTOFMEMORY;
|
||||
|
||||
ret = URLCacheContainers_FindContainerW(url, ppContainer);
|
||||
HeapFree(GetProcessHeap(), 0, url);
|
||||
heap_free(url);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -702,7 +722,7 @@ static LPURLCACHE_HEADER URLCacheContainer_LockIndex(URLCACHECONTAINER * pContai
|
||||
{
|
||||
UnmapViewOfFile( pHeader );
|
||||
URLCacheContainer_CloseIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
ReleaseMutex(pContainer->hMutex);
|
||||
@ -741,6 +761,43 @@ static BOOL URLCacheContainer_UnlockIndex(URLCACHECONTAINER * pContainer, LPURLC
|
||||
return UnmapViewOfFile(pHeader);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* URLCacheContainer_CleanIndex (Internal)
|
||||
*
|
||||
* This function is meant to make place in index file by removing old
|
||||
* entries and resizing the file.
|
||||
*
|
||||
* CAUTION: file view may get mapped to new memory
|
||||
* TODO: implement entries cleaning
|
||||
*
|
||||
* RETURNS
|
||||
* ERROR_SUCCESS when new memory is available
|
||||
* error code otherwise
|
||||
*/
|
||||
static DWORD URLCacheContainer_CleanIndex(URLCACHECONTAINER *container, URLCACHE_HEADER **file_view)
|
||||
{
|
||||
URLCACHE_HEADER *header = *file_view;
|
||||
DWORD ret;
|
||||
|
||||
FIXME("(%s %s) semi-stub\n", debugstr_w(container->cache_prefix), debugstr_w(container->path));
|
||||
|
||||
if(header->dwFileSize >= ALLOCATION_TABLE_SIZE*8*BLOCKSIZE + ENTRY_START_OFFSET) {
|
||||
WARN("index file has maximal size\n");
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
URLCacheContainer_CloseIndex(container);
|
||||
ret = URLCacheContainer_OpenIndex(container, header->dwIndexCapacityInBlocks*2);
|
||||
if(ret != ERROR_SUCCESS)
|
||||
return ret;
|
||||
header = MapViewOfFile(container->hMapping, FILE_MAP_WRITE, 0, 0, 0);
|
||||
if(!header)
|
||||
return GetLastError();
|
||||
|
||||
UnmapViewOfFile(*file_view);
|
||||
*file_view = header;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
#define CHAR_BIT (8 * sizeof(CHAR))
|
||||
@ -799,11 +856,11 @@ static inline void URLCache_Allocation_BlockAllocate(BYTE * AllocationTable, DWO
|
||||
* sets ppEntry to point to it.
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE if it had enough space
|
||||
* FALSE if it couldn't find enough space
|
||||
* ERROR_SUCCESS when free memory block was found
|
||||
* Any other Win32 error code if the entry could not be added
|
||||
*
|
||||
*/
|
||||
static BOOL URLCache_FindFirstFreeEntry(URLCACHE_HEADER * pHeader, DWORD dwBlocksNeeded, CACHEFILE_ENTRY ** ppEntry)
|
||||
static DWORD URLCache_FindFirstFreeEntry(URLCACHE_HEADER * pHeader, DWORD dwBlocksNeeded, CACHEFILE_ENTRY ** ppEntry)
|
||||
{
|
||||
LPBYTE AllocationTable = (LPBYTE)pHeader + ALLOCATION_TABLE_OFFSET;
|
||||
DWORD dwBlockNumber;
|
||||
@ -824,12 +881,14 @@ static BOOL URLCache_FindFirstFreeEntry(URLCACHE_HEADER * pHeader, DWORD dwBlock
|
||||
for (index = 0; index < dwBlocksNeeded; index++)
|
||||
URLCache_Allocation_BlockAllocate(AllocationTable, dwBlockNumber + index);
|
||||
*ppEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + ENTRY_START_OFFSET + dwBlockNumber * BLOCKSIZE);
|
||||
for (index = 0; index < dwBlocksNeeded * BLOCKSIZE / sizeof(DWORD); index++)
|
||||
((DWORD*)*ppEntry)[index] = 0xdeadbeef;
|
||||
(*ppEntry)->dwBlocksUsed = dwBlocksNeeded;
|
||||
return TRUE;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
FIXME("Grow file\n");
|
||||
return FALSE;
|
||||
|
||||
return ERROR_HANDLE_DISK_FULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -849,11 +908,10 @@ static BOOL URLCache_DeleteEntry(LPURLCACHE_HEADER pHeader, CACHEFILE_ENTRY * pE
|
||||
BYTE * AllocationTable = (LPBYTE)pHeader + ALLOCATION_TABLE_OFFSET;
|
||||
|
||||
/* update allocation table */
|
||||
dwStartBlock = ((DWORD)((BYTE *)pEntry - (BYTE *)pHeader)) / BLOCKSIZE;
|
||||
dwStartBlock = ((DWORD)((BYTE *)pEntry - (BYTE *)pHeader) - ENTRY_START_OFFSET) / BLOCKSIZE;
|
||||
for (dwBlock = dwStartBlock; dwBlock < dwStartBlock + pEntry->dwBlocksUsed; dwBlock++)
|
||||
URLCache_Allocation_BlockFree(AllocationTable, dwBlock);
|
||||
|
||||
ZeroMemory(pEntry, pEntry->dwBlocksUsed * BLOCKSIZE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1189,7 +1247,7 @@ static DWORD URLCache_HashKey(LPCSTR lpszKey)
|
||||
DWORD i;
|
||||
|
||||
for (i = 0; i < sizeof(key) / sizeof(key[0]); i++)
|
||||
key[i] = lookupTable[i];
|
||||
key[i] = lookupTable[(*lpszKey + i) & 0xFF];
|
||||
|
||||
for (lpszKey++; *lpszKey && ((lpszKey[0] != '/') || (lpszKey[1] != 0)); lpszKey++)
|
||||
{
|
||||
@ -1219,19 +1277,19 @@ static BOOL URLCache_FindHash(LPCURLCACHE_HEADER pHeader, LPCSTR lpszUrl, struct
|
||||
* each block therefore contains a chain of 7 key/offset pairs
|
||||
* how position in table is calculated:
|
||||
* 1. the url is hashed in helper function
|
||||
* 2. the key % 64 * 8 is the offset
|
||||
* 3. the key in the hash table is the hash key aligned to 64
|
||||
* 2. the key % HASHTABLE_NUM_ENTRIES is the bucket number
|
||||
* 3. bucket number * HASHTABLE_BLOCKSIZE is offset of the bucket
|
||||
*
|
||||
* note:
|
||||
* there can be multiple hash tables in the file and the offset to
|
||||
* the next one is stored in the header of the hash table
|
||||
*/
|
||||
DWORD key = URLCache_HashKey(lpszUrl);
|
||||
DWORD offset = (key % HASHTABLE_NUM_ENTRIES) * sizeof(struct _HASH_ENTRY);
|
||||
DWORD offset = (key & (HASHTABLE_NUM_ENTRIES-1)) * HASHTABLE_BLOCKSIZE;
|
||||
HASH_CACHEFILE_ENTRY * pHashEntry;
|
||||
DWORD dwHashTableNumber = 0;
|
||||
|
||||
key = (key / HASHTABLE_NUM_ENTRIES) * HASHTABLE_NUM_ENTRIES;
|
||||
key >>= HASHTABLE_FLAG_BITS;
|
||||
|
||||
for (pHashEntry = URLCache_HashEntryFromOffset(pHeader, pHeader->dwOffsetFirstHashTable);
|
||||
URLCache_IsHashEntryValid(pHeader, pHashEntry);
|
||||
@ -1253,7 +1311,7 @@ static BOOL URLCache_FindHash(LPCURLCACHE_HEADER pHeader, LPCSTR lpszUrl, struct
|
||||
for (i = 0; i < HASHTABLE_BLOCKSIZE; i++)
|
||||
{
|
||||
struct _HASH_ENTRY * pHashElement = &pHashEntry->HashTable[offset + i];
|
||||
if (key == (pHashElement->dwHashKey / HASHTABLE_NUM_ENTRIES) * HASHTABLE_NUM_ENTRIES)
|
||||
if (key == pHashElement->dwHashKey>>HASHTABLE_FLAG_BITS)
|
||||
{
|
||||
/* FIXME: we should make sure that this is the right element
|
||||
* before returning and claiming that it is. We can do this
|
||||
@ -1282,25 +1340,22 @@ static BOOL URLCache_FindHashW(LPCURLCACHE_HEADER pHeader, LPCWSTR lpszUrl, stru
|
||||
}
|
||||
|
||||
ret = URLCache_FindHash(pHeader, urlA, ppHashEntry);
|
||||
HeapFree(GetProcessHeap(), 0, urlA);
|
||||
heap_free(urlA);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* URLCache_HashEntrySetUse (Internal)
|
||||
* URLCache_HashEntrySetFlags (Internal)
|
||||
*
|
||||
* Searches all the hash tables in the index for the given URL and
|
||||
* sets the use count (stored or'ed with key)
|
||||
* Sets special bits in hash key
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE if the entry was found
|
||||
* FALSE if the entry could not be found
|
||||
* nothing
|
||||
*
|
||||
*/
|
||||
static BOOL URLCache_HashEntrySetUse(struct _HASH_ENTRY * pHashEntry, DWORD dwUseCount)
|
||||
static void URLCache_HashEntrySetFlags(struct _HASH_ENTRY * pHashEntry, DWORD dwFlag)
|
||||
{
|
||||
pHashEntry->dwHashKey = dwUseCount | (pHashEntry->dwHashKey / HASHTABLE_NUM_ENTRIES) * HASHTABLE_NUM_ENTRIES;
|
||||
return TRUE;
|
||||
pHashEntry->dwHashKey = (pHashEntry->dwHashKey >> HASHTABLE_FLAG_BITS << HASHTABLE_FLAG_BITS) | dwFlag;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -1316,8 +1371,7 @@ static BOOL URLCache_HashEntrySetUse(struct _HASH_ENTRY * pHashEntry, DWORD dwUs
|
||||
*/
|
||||
static BOOL URLCache_DeleteEntryFromHash(struct _HASH_ENTRY * pHashEntry)
|
||||
{
|
||||
pHashEntry->dwHashKey = HASHTABLE_FREE;
|
||||
pHashEntry->dwOffsetEntry = HASHTABLE_FREE;
|
||||
pHashEntry->dwHashKey = HASHTABLE_DEL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1333,23 +1387,25 @@ static BOOL URLCache_DeleteEntryFromHash(struct _HASH_ENTRY * pHashEntry)
|
||||
* Any other Win32 error code if the entry could not be added
|
||||
*
|
||||
*/
|
||||
static DWORD URLCache_AddEntryToHash(LPURLCACHE_HEADER pHeader, LPCSTR lpszUrl, DWORD dwOffsetEntry)
|
||||
static DWORD URLCache_AddEntryToHash(LPURLCACHE_HEADER pHeader, LPCSTR lpszUrl, DWORD dwOffsetEntry, DWORD dwFieldType)
|
||||
{
|
||||
/* see URLCache_FindEntryInHash for structure of hash tables */
|
||||
|
||||
DWORD key = URLCache_HashKey(lpszUrl);
|
||||
DWORD offset = (key % HASHTABLE_NUM_ENTRIES) * sizeof(struct _HASH_ENTRY);
|
||||
HASH_CACHEFILE_ENTRY * pHashEntry;
|
||||
DWORD offset = (key & (HASHTABLE_NUM_ENTRIES-1)) * HASHTABLE_BLOCKSIZE;
|
||||
HASH_CACHEFILE_ENTRY * pHashEntry, *pHashPrev = NULL;
|
||||
DWORD dwHashTableNumber = 0;
|
||||
DWORD error;
|
||||
|
||||
key = (key / HASHTABLE_NUM_ENTRIES) * HASHTABLE_NUM_ENTRIES;
|
||||
key = ((key >> HASHTABLE_FLAG_BITS) << HASHTABLE_FLAG_BITS) + dwFieldType;
|
||||
|
||||
for (pHashEntry = URLCache_HashEntryFromOffset(pHeader, pHeader->dwOffsetFirstHashTable);
|
||||
URLCache_IsHashEntryValid(pHeader, pHashEntry);
|
||||
pHashEntry = URLCache_HashEntryFromOffset(pHeader, pHashEntry->dwAddressNext))
|
||||
{
|
||||
int i;
|
||||
pHashPrev = pHashEntry;
|
||||
|
||||
if (pHashEntry->dwHashTableNumber != dwHashTableNumber++)
|
||||
{
|
||||
ERR("not right hash table number (%d) expected %d\n", pHashEntry->dwHashTableNumber, dwHashTableNumber);
|
||||
@ -1365,7 +1421,7 @@ static DWORD URLCache_AddEntryToHash(LPURLCACHE_HEADER pHeader, LPCSTR lpszUrl,
|
||||
for (i = 0; i < HASHTABLE_BLOCKSIZE; i++)
|
||||
{
|
||||
struct _HASH_ENTRY * pHashElement = &pHashEntry->HashTable[offset + i];
|
||||
if (pHashElement->dwHashKey == HASHTABLE_FREE) /* if the slot is free */
|
||||
if (pHashElement->dwHashKey==HASHTABLE_FREE || pHashElement->dwHashKey==HASHTABLE_DEL) /* if the slot is free */
|
||||
{
|
||||
pHashElement->dwHashKey = key;
|
||||
pHashElement->dwOffsetEntry = dwOffsetEntry;
|
||||
@ -1373,7 +1429,7 @@ static DWORD URLCache_AddEntryToHash(LPURLCACHE_HEADER pHeader, LPCSTR lpszUrl,
|
||||
}
|
||||
}
|
||||
}
|
||||
error = URLCache_CreateHashTable(pHeader, pHashEntry, &pHashEntry);
|
||||
error = URLCache_CreateHashTable(pHeader, pHashPrev, &pHashEntry);
|
||||
if (error != ERROR_SUCCESS)
|
||||
return error;
|
||||
|
||||
@ -1395,14 +1451,11 @@ static DWORD URLCache_AddEntryToHash(LPURLCACHE_HEADER pHeader, LPCSTR lpszUrl,
|
||||
*/
|
||||
static DWORD URLCache_CreateHashTable(LPURLCACHE_HEADER pHeader, HASH_CACHEFILE_ENTRY *pPrevHash, HASH_CACHEFILE_ENTRY **ppHash)
|
||||
{
|
||||
DWORD dwOffset;
|
||||
DWORD dwOffset, error;
|
||||
int i;
|
||||
|
||||
if (!URLCache_FindFirstFreeEntry(pHeader, 0x20, (CACHEFILE_ENTRY **)ppHash))
|
||||
{
|
||||
FIXME("no free space for hash table\n");
|
||||
return ERROR_DISK_FULL;
|
||||
}
|
||||
if ((error = URLCache_FindFirstFreeEntry(pHeader, 0x20, (CACHEFILE_ENTRY **)ppHash)) != ERROR_SUCCESS)
|
||||
return error;
|
||||
|
||||
dwOffset = (BYTE *)*ppHash - (BYTE *)pHeader;
|
||||
|
||||
@ -1412,10 +1465,11 @@ static DWORD URLCache_CreateHashTable(LPURLCACHE_HEADER pHeader, HASH_CACHEFILE_
|
||||
pHeader->dwOffsetFirstHashTable = dwOffset;
|
||||
(*ppHash)->CacheFileEntry.dwSignature = HASH_SIGNATURE;
|
||||
(*ppHash)->CacheFileEntry.dwBlocksUsed = 0x20;
|
||||
(*ppHash)->dwAddressNext = 0;
|
||||
(*ppHash)->dwHashTableNumber = pPrevHash ? pPrevHash->dwHashTableNumber + 1 : 0;
|
||||
for (i = 0; i < HASHTABLE_SIZE; i++)
|
||||
{
|
||||
(*ppHash)->HashTable[i].dwOffsetEntry = 0;
|
||||
(*ppHash)->HashTable[i].dwOffsetEntry = HASHTABLE_FREE;
|
||||
(*ppHash)->HashTable[i].dwHashKey = HASHTABLE_FREE;
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
@ -1470,7 +1524,7 @@ static BOOL URLCache_EnumHashTableEntries(LPCURLCACHE_HEADER pHeader, const HASH
|
||||
{
|
||||
for (; *index < HASHTABLE_SIZE ; (*index)++)
|
||||
{
|
||||
if (pHashEntry->HashTable[*index].dwHashKey == HASHTABLE_FREE)
|
||||
if (pHashEntry->HashTable[*index].dwHashKey==HASHTABLE_FREE || pHashEntry->HashTable[*index].dwHashKey==HASHTABLE_DEL)
|
||||
continue;
|
||||
|
||||
*ppHashEntry = &pHashEntry->HashTable[*index];
|
||||
@ -1560,7 +1614,7 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR lpszCachePath, DWORD dwSize, DWORD dwSize
|
||||
/* unlock, delete, recreate and lock cache */
|
||||
URLCacheContainer_CloseIndex(pContainer);
|
||||
ret_del = URLCache_DeleteCacheDirectory(pContainer->path);
|
||||
ret_open = URLCacheContainer_OpenIndex(pContainer);
|
||||
ret_open = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
|
||||
ReleaseMutex(pContainer->hMutex);
|
||||
return ret_del && (ret_open == ERROR_SUCCESS);
|
||||
@ -1649,7 +1703,7 @@ BOOL WINAPI GetUrlCacheEntryInfoA(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -1731,7 +1785,7 @@ BOOL WINAPI GetUrlCacheEntryInfoW(LPCWSTR lpszUrl,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -1850,7 +1904,7 @@ BOOL WINAPI SetUrlCacheEntryInfoA(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -1907,7 +1961,7 @@ BOOL WINAPI SetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -1982,7 +2036,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -2033,7 +2087,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA(
|
||||
|
||||
pUrlEntry->dwHitRate++;
|
||||
pUrlEntry->dwUseCount++;
|
||||
URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount);
|
||||
URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_LOCK);
|
||||
GetSystemTimeAsFileTime(&pUrlEntry->LastAccessTime);
|
||||
|
||||
URLCacheContainer_UnlockIndex(pContainer, pHeader);
|
||||
@ -2079,7 +2133,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -2134,7 +2188,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW(
|
||||
|
||||
pUrlEntry->dwHitRate++;
|
||||
pUrlEntry->dwUseCount++;
|
||||
URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount);
|
||||
URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_LOCK);
|
||||
GetSystemTimeAsFileTime(&pUrlEntry->LastAccessTime);
|
||||
|
||||
URLCacheContainer_UnlockIndex(pContainer, pHeader);
|
||||
@ -2156,7 +2210,17 @@ static BOOL DeleteUrlCacheEntryInternal(LPURLCACHE_HEADER pHeader,
|
||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry;
|
||||
if ((pHashEntry->dwHashKey & ((1<<HASHTABLE_FLAG_BITS)-1)) == HASHTABLE_LOCK)
|
||||
{
|
||||
/* FIXME: implement timeout object unlocking */
|
||||
TRACE("Trying to delete locked entry\n");
|
||||
pUrlEntry->CacheEntryType |= DELETED_CACHE_ENTRY;
|
||||
SetLastError(ERROR_SHARING_VIOLATION);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pUrlEntry->CacheDir < pHeader->DirectoryCount)
|
||||
{
|
||||
if (pHeader->directory_data[pUrlEntry->CacheDir].dwNumFiles)
|
||||
@ -2215,7 +2279,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileA(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -2250,7 +2314,12 @@ BOOL WINAPI UnlockUrlCacheEntryFileA(
|
||||
return FALSE;
|
||||
}
|
||||
pUrlEntry->dwUseCount--;
|
||||
URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount);
|
||||
if (!pUrlEntry->dwUseCount)
|
||||
{
|
||||
URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_URL);
|
||||
if (pUrlEntry->CacheEntryType & DELETED_CACHE_ENTRY)
|
||||
DeleteUrlCacheEntryInternal(pHeader, pHashEntry);
|
||||
}
|
||||
|
||||
URLCacheContainer_UnlockIndex(pContainer, pHeader);
|
||||
|
||||
@ -2286,7 +2355,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileW( LPCWSTR lpszUrlName, DWORD dwReserved )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -2321,7 +2390,8 @@ BOOL WINAPI UnlockUrlCacheEntryFileW( LPCWSTR lpszUrlName, DWORD dwReserved )
|
||||
return FALSE;
|
||||
}
|
||||
pUrlEntry->dwUseCount--;
|
||||
URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount);
|
||||
if (!pUrlEntry->dwUseCount)
|
||||
URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_URL);
|
||||
|
||||
URLCacheContainer_UnlockIndex(pContainer, pHeader);
|
||||
|
||||
@ -2351,32 +2421,31 @@ BOOL WINAPI CreateUrlCacheEntryA(
|
||||
|
||||
if (lpszUrlName && (url_name = heap_strdupAtoW(lpszUrlName)))
|
||||
{
|
||||
if (!lpszFileExtension || (file_extension = heap_strdupAtoW(lpszFileExtension)))
|
||||
{
|
||||
if (CreateUrlCacheEntryW(url_name, dwExpectedFileSize, file_extension, file_name, dwReserved))
|
||||
{
|
||||
if (WideCharToMultiByte(CP_ACP, 0, file_name, -1, lpszFileName, MAX_PATH, NULL, NULL) < MAX_PATH)
|
||||
{
|
||||
bSuccess = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwError = GetLastError();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dwError = GetLastError();
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, file_extension);
|
||||
}
|
||||
else
|
||||
{
|
||||
dwError = GetLastError();
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, url_name);
|
||||
if (!bSuccess)
|
||||
SetLastError(dwError);
|
||||
if (!lpszFileExtension || (file_extension = heap_strdupAtoW(lpszFileExtension)))
|
||||
{
|
||||
if (CreateUrlCacheEntryW(url_name, dwExpectedFileSize, file_extension, file_name, dwReserved))
|
||||
{
|
||||
if (WideCharToMultiByte(CP_ACP, 0, file_name, -1, lpszFileName, MAX_PATH, NULL, NULL) < MAX_PATH)
|
||||
{
|
||||
bSuccess = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwError = GetLastError();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dwError = GetLastError();
|
||||
}
|
||||
heap_free(file_extension);
|
||||
}
|
||||
else
|
||||
{
|
||||
dwError = GetLastError();
|
||||
}
|
||||
heap_free(url_name);
|
||||
if (!bSuccess) SetLastError(dwError);
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
@ -2476,7 +2545,7 @@ BOOL WINAPI CreateUrlCacheEntryW(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -2596,6 +2665,7 @@ static BOOL CommitUrlCacheEntryInternal(
|
||||
struct _HASH_ENTRY * pHashEntry;
|
||||
CACHEFILE_ENTRY * pEntry;
|
||||
URL_CACHEFILE_ENTRY * pUrlEntry;
|
||||
DWORD url_entry_offset;
|
||||
DWORD dwBytesNeeded = DWORD_ALIGN(sizeof(*pUrlEntry));
|
||||
DWORD dwOffsetLocalFileName = 0;
|
||||
DWORD dwOffsetHeader = 0;
|
||||
@ -2655,7 +2725,7 @@ static BOOL CommitUrlCacheEntryInternal(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -2680,6 +2750,14 @@ static BOOL CommitUrlCacheEntryInternal(
|
||||
|
||||
if (URLCache_FindHash(pHeader, lpszUrlNameA, &pHashEntry))
|
||||
{
|
||||
if ((pHashEntry->dwHashKey & ((1<<HASHTABLE_FLAG_BITS)-1)) == HASHTABLE_LOCK)
|
||||
{
|
||||
/* FIXME: implement timeout object unlocking */
|
||||
FIXME("Trying to overwrite locked entry\n");
|
||||
SetLastError(ERROR_SHARING_VIOLATION);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
FIXME("entry already in cache - don't know what to do!\n");
|
||||
/*
|
||||
* SetLastError(ERROR_FILE_NOT_FOUND);
|
||||
@ -2721,7 +2799,8 @@ static BOOL CommitUrlCacheEntryInternal(
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
lpszLocalFileName += (DIR_LENGTH + 1); /* "1234WXYZ\" */
|
||||
lpszLocalFileName += DIR_LENGTH + 1;
|
||||
pchLocalFileName += DIR_LENGTH + 1;
|
||||
}
|
||||
|
||||
dwBytesNeeded = DWORD_ALIGN(dwBytesNeeded + strlen(lpszUrlNameA) + 1);
|
||||
@ -2748,15 +2827,19 @@ static BOOL CommitUrlCacheEntryInternal(
|
||||
dwBytesNeeded += BLOCKSIZE;
|
||||
}
|
||||
|
||||
if (!URLCache_FindFirstFreeEntry(pHeader, dwBytesNeeded / BLOCKSIZE, &pEntry))
|
||||
error = URLCache_FindFirstFreeEntry(pHeader, dwBytesNeeded / BLOCKSIZE, &pEntry);
|
||||
while (error == ERROR_HANDLE_DISK_FULL)
|
||||
{
|
||||
ERR("no free entries\n");
|
||||
error = ERROR_DISK_FULL;
|
||||
goto cleanup;
|
||||
error = URLCacheContainer_CleanIndex(pContainer, &pHeader);
|
||||
if (error == ERROR_SUCCESS)
|
||||
error = URLCache_FindFirstFreeEntry(pHeader, dwBytesNeeded / BLOCKSIZE, &pEntry);
|
||||
}
|
||||
if (error != ERROR_SUCCESS)
|
||||
goto cleanup;
|
||||
|
||||
/* FindFirstFreeEntry fills in blocks used */
|
||||
pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry;
|
||||
url_entry_offset = (LPBYTE)pUrlEntry - (LPBYTE)pHeader;
|
||||
pUrlEntry->CacheFileEntry.dwSignature = URL_SIGNATURE;
|
||||
pUrlEntry->CacheDir = cDirectory;
|
||||
pUrlEntry->CacheEntryType = CacheEntryType;
|
||||
@ -2794,14 +2877,23 @@ static BOOL CommitUrlCacheEntryInternal(
|
||||
|
||||
strcpy((LPSTR)pUrlEntry + pUrlEntry->dwOffsetUrl, lpszUrlNameA);
|
||||
if (dwOffsetLocalFileName)
|
||||
strcpy((LPSTR)((LPBYTE)pUrlEntry + dwOffsetLocalFileName), pchLocalFileName + DIR_LENGTH + 1);
|
||||
strcpy((LPSTR)((LPBYTE)pUrlEntry + dwOffsetLocalFileName), pchLocalFileName);
|
||||
if (dwOffsetHeader)
|
||||
memcpy((LPBYTE)pUrlEntry + dwOffsetHeader, lpHeaderInfo, dwHeaderSize);
|
||||
if (dwOffsetFileExtension)
|
||||
strcpy((LPSTR)((LPBYTE)pUrlEntry + dwOffsetFileExtension), lpszFileExtensionA);
|
||||
|
||||
error = URLCache_AddEntryToHash(pHeader, lpszUrlNameA,
|
||||
(DWORD)((LPBYTE)pUrlEntry - (LPBYTE)pHeader));
|
||||
error = URLCache_AddEntryToHash(pHeader, lpszUrlNameA, url_entry_offset, HASHTABLE_URL);
|
||||
while (error == ERROR_HANDLE_DISK_FULL)
|
||||
{
|
||||
error = URLCacheContainer_CleanIndex(pContainer, &pHeader);
|
||||
if (error == ERROR_SUCCESS)
|
||||
{
|
||||
pUrlEntry = (URL_CACHEFILE_ENTRY *)((LPBYTE)pHeader + url_entry_offset);
|
||||
error = URLCache_AddEntryToHash(pHeader, lpszUrlNameA,
|
||||
url_entry_offset, HASHTABLE_URL);
|
||||
}
|
||||
}
|
||||
if (error != ERROR_SUCCESS)
|
||||
URLCache_DeleteEntry(pHeader, &pUrlEntry->CacheFileEntry);
|
||||
else
|
||||
@ -2819,8 +2911,8 @@ static BOOL CommitUrlCacheEntryInternal(
|
||||
|
||||
cleanup:
|
||||
URLCacheContainer_UnlockIndex(pContainer, pHeader);
|
||||
HeapFree(GetProcessHeap(), 0, lpszUrlNameA);
|
||||
HeapFree(GetProcessHeap(), 0, lpszFileExtensionA);
|
||||
heap_free(lpszUrlNameA);
|
||||
heap_free(lpszFileExtensionA);
|
||||
|
||||
if (error == ERROR_SUCCESS)
|
||||
return TRUE;
|
||||
@ -2890,11 +2982,10 @@ BOOL WINAPI CommitUrlCacheEntryA(
|
||||
file_extension, original_url);
|
||||
|
||||
cleanup:
|
||||
HeapFree(GetProcessHeap(), 0, original_url);
|
||||
HeapFree(GetProcessHeap(), 0, file_extension);
|
||||
HeapFree(GetProcessHeap(), 0, local_file_name);
|
||||
HeapFree(GetProcessHeap(), 0, url_name);
|
||||
|
||||
heap_free(original_url);
|
||||
heap_free(file_extension);
|
||||
heap_free(local_file_name);
|
||||
heap_free(url_name);
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
@ -2941,7 +3032,7 @@ BOOL WINAPI CommitUrlCacheEntryW(
|
||||
}
|
||||
if (header_info)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, header_info);
|
||||
heap_free(header_info);
|
||||
if (!bSuccess)
|
||||
SetLastError(dwError);
|
||||
}
|
||||
@ -3126,12 +3217,8 @@ BOOL WINAPI UnlockUrlCacheEntryStream(
|
||||
if (!UnlockUrlCacheEntryFileA(pStream->lpszUrl, 0))
|
||||
return FALSE;
|
||||
|
||||
/* close file handle */
|
||||
CloseHandle(pStream->hFile);
|
||||
|
||||
/* free allocated space */
|
||||
HeapFree(GetProcessHeap(), 0, pStream);
|
||||
|
||||
heap_free(pStream);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -3157,7 +3244,7 @@ BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -3207,22 +3294,22 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
|
||||
error = URLCacheContainers_FindContainerW(lpszUrlName, &pContainer);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, urlA);
|
||||
heap_free(urlA);
|
||||
SetLastError(error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, urlA);
|
||||
heap_free(urlA);
|
||||
SetLastError(error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(pHeader = URLCacheContainer_LockIndex(pContainer)))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, urlA);
|
||||
heap_free(urlA);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -3230,7 +3317,7 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
|
||||
{
|
||||
URLCacheContainer_UnlockIndex(pContainer, pHeader);
|
||||
TRACE("entry %s not found!\n", debugstr_a(urlA));
|
||||
HeapFree(GetProcessHeap(), 0, urlA);
|
||||
heap_free(urlA);
|
||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||
return FALSE;
|
||||
}
|
||||
@ -3238,8 +3325,7 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
|
||||
ret = DeleteUrlCacheEntryInternal(pHeader, pHashEntry);
|
||||
|
||||
URLCacheContainer_UnlockIndex(pContainer, pHeader);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, urlA);
|
||||
heap_free(urlA);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3383,7 +3469,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR lpszUrlSearchPattern,
|
||||
pEntryHandle->lpszUrlSearchPattern = heap_strdupAtoW(lpszUrlSearchPattern);
|
||||
if (!pEntryHandle->lpszUrlSearchPattern)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pEntryHandle);
|
||||
heap_free(pEntryHandle);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -3395,7 +3481,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR lpszUrlSearchPattern,
|
||||
|
||||
if (!FindNextUrlCacheEntryA(pEntryHandle, lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pEntryHandle);
|
||||
heap_free(pEntryHandle);
|
||||
return NULL;
|
||||
}
|
||||
return pEntryHandle;
|
||||
@ -3422,7 +3508,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryW(LPCWSTR lpszUrlSearchPattern,
|
||||
pEntryHandle->lpszUrlSearchPattern = heap_strdupW(lpszUrlSearchPattern);
|
||||
if (!pEntryHandle->lpszUrlSearchPattern)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pEntryHandle);
|
||||
heap_free(pEntryHandle);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -3434,7 +3520,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryW(LPCWSTR lpszUrlSearchPattern,
|
||||
|
||||
if (!FindNextUrlCacheEntryW(pEntryHandle, lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pEntryHandle);
|
||||
heap_free(pEntryHandle);
|
||||
return NULL;
|
||||
}
|
||||
return pEntryHandle;
|
||||
@ -3462,7 +3548,7 @@ static BOOL FindNextUrlCacheEntryInternal(
|
||||
HASH_CACHEFILE_ENTRY *pHashTableEntry;
|
||||
DWORD error;
|
||||
|
||||
error = URLCacheContainer_OpenIndex(pContainer);
|
||||
error = URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO);
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(error);
|
||||
@ -3568,9 +3654,8 @@ BOOL WINAPI FindCloseUrlCache(HANDLE hEnumHandle)
|
||||
}
|
||||
|
||||
pEntryHandle->dwMagic = 0;
|
||||
HeapFree(GetProcessHeap(), 0, pEntryHandle->lpszUrlSearchPattern);
|
||||
HeapFree(GetProcessHeap(), 0, pEntryHandle);
|
||||
|
||||
heap_free(pEntryHandle->lpszUrlSearchPattern);
|
||||
heap_free(pEntryHandle);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -3801,7 +3886,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (URLCacheContainer_OpenIndex(pContainer))
|
||||
if (URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO))
|
||||
{
|
||||
memset(pftLastModified, 0, sizeof(*pftLastModified));
|
||||
return TRUE;
|
||||
@ -3869,7 +3954,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (URLCacheContainer_OpenIndex(pContainer))
|
||||
if (URLCacheContainer_OpenIndex(pContainer, MIN_BLOCK_NO))
|
||||
{
|
||||
memset(pftLastModified, 0, sizeof(*pftLastModified));
|
||||
return TRUE;
|
||||
@ -3956,3 +4041,13 @@ BOOL WINAPI IncrementUrlCacheHeaderData(DWORD index, LPDWORD data)
|
||||
FIXME("(%u, %p)\n", index, data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RunOnceUrlCache (WININET.@)
|
||||
*/
|
||||
|
||||
DWORD WINAPI RunOnceUrlCache(HWND hwnd, HINSTANCE hinst, LPSTR cmd, int cmdshow)
|
||||
{
|
||||
FIXME("(%p, %p, %s, %d): stub\n", hwnd, hinst, debugstr_a(cmd), cmdshow);
|
||||
return 0;
|
||||
}
|
||||
|
@ -184,17 +184,17 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
|
||||
hints.ai_family = AF_INET;
|
||||
|
||||
ret = getaddrinfo( name, NULL, &hints, &res );
|
||||
HeapFree( GetProcessHeap(), 0, name );
|
||||
if (ret != 0)
|
||||
{
|
||||
TRACE("failed to get IPv4 address of %s (%s), retrying with IPv6\n", debugstr_w(lpszServerName), gai_strerror(ret));
|
||||
hints.ai_family = AF_INET6;
|
||||
ret = getaddrinfo( name, NULL, &hints, &res );
|
||||
if (ret != 0)
|
||||
{
|
||||
TRACE("failed to get address of %s (%s)\n", debugstr_w(lpszServerName), gai_strerror(ret));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
heap_free( name );
|
||||
if (ret != 0)
|
||||
{
|
||||
TRACE("failed to get address of %s (%s)\n", debugstr_w(lpszServerName), gai_strerror(ret));
|
||||
return FALSE;
|
||||
}
|
||||
if (*sa_len < res->ai_addrlen)
|
||||
{
|
||||
@ -219,7 +219,7 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
|
||||
#else
|
||||
EnterCriticalSection( &cs_gethostbyname );
|
||||
phe = gethostbyname(name);
|
||||
HeapFree( GetProcessHeap(), 0, name );
|
||||
heap_free( name );
|
||||
|
||||
if (NULL == phe)
|
||||
{
|
||||
@ -341,7 +341,7 @@ VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext,
|
||||
TRACE(" end callback().\n");
|
||||
|
||||
if(lpvNewInfo != lpvStatusInfo)
|
||||
HeapFree(GetProcessHeap(), 0, lpvNewInfo);
|
||||
heap_free(lpvNewInfo);
|
||||
}
|
||||
|
||||
static void SendAsyncCallbackProc(WORKREQUEST *workRequest)
|
||||
@ -355,7 +355,7 @@ static void SendAsyncCallbackProc(WORKREQUEST *workRequest)
|
||||
req->dwStatusInfoLength);
|
||||
|
||||
/* And frees the copy of the status info */
|
||||
HeapFree(GetProcessHeap(), 0, req->lpvStatusInfo);
|
||||
heap_free(req->lpvStatusInfo);
|
||||
}
|
||||
|
||||
void SendAsyncCallback(object_header_t *hdr, DWORD_PTR dwContext,
|
||||
|
@ -16,8 +16,8 @@
|
||||
122 stub -noname FreeP3PObject
|
||||
123 stub -noname GetP3PRequestStatus
|
||||
|
||||
@ stdcall CommitUrlCacheEntryA(str str double double long str long str str)
|
||||
@ stdcall CommitUrlCacheEntryW(wstr wstr double double long wstr long wstr wstr)
|
||||
@ stdcall CommitUrlCacheEntryA(str str int64 int64 long str long str str)
|
||||
@ stdcall CommitUrlCacheEntryW(wstr wstr int64 int64 long wstr long wstr wstr)
|
||||
@ stdcall CreateMD5SSOHash(wstr wstr wstr ptr)
|
||||
@ stdcall CreateUrlCacheContainerA(long long long long long long long long)
|
||||
@ stdcall CreateUrlCacheContainerW(long long long long long long long long)
|
||||
@ -30,15 +30,15 @@
|
||||
@ stdcall DeleteUrlCacheEntry(str) DeleteUrlCacheEntryA
|
||||
@ stdcall DeleteUrlCacheEntryA(str)
|
||||
@ stdcall DeleteUrlCacheEntryW(wstr)
|
||||
@ stdcall DeleteUrlCacheGroup(double long ptr)
|
||||
@ stdcall DeleteUrlCacheGroup(int64 long ptr)
|
||||
@ stdcall DetectAutoProxyUrl(str long long)
|
||||
@ stdcall -private DllInstall(long wstr)
|
||||
@ stdcall FindCloseUrlCache(long)
|
||||
@ stdcall FindFirstUrlCacheContainerA(ptr ptr ptr long)
|
||||
@ stdcall FindFirstUrlCacheContainerW(ptr ptr ptr long)
|
||||
@ stdcall FindFirstUrlCacheEntryA(str ptr ptr)
|
||||
@ stdcall FindFirstUrlCacheEntryExA(str long long double ptr ptr ptr ptr ptr)
|
||||
@ stdcall FindFirstUrlCacheEntryExW(wstr long long double ptr ptr ptr ptr ptr)
|
||||
@ stdcall FindFirstUrlCacheEntryExA(str long long int64 ptr ptr ptr ptr ptr)
|
||||
@ stdcall FindFirstUrlCacheEntryExW(wstr long long int64 ptr ptr ptr ptr ptr)
|
||||
@ stdcall FindFirstUrlCacheEntryW(wstr ptr ptr)
|
||||
@ stdcall FindFirstUrlCacheGroup(long long ptr long ptr ptr)
|
||||
@ stdcall FindNextUrlCacheContainerA(long ptr ptr)
|
||||
@ -83,8 +83,8 @@
|
||||
@ stdcall GetUrlCacheEntryInfoExA(str ptr ptr str ptr ptr long)
|
||||
@ stdcall GetUrlCacheEntryInfoExW(wstr ptr ptr wstr ptr ptr long)
|
||||
@ stdcall GetUrlCacheEntryInfoW(wstr ptr long)
|
||||
@ stdcall GetUrlCacheGroupAttributeA(double long long ptr ptr ptr)
|
||||
@ stdcall GetUrlCacheGroupAttributeW(double long long ptr ptr ptr)
|
||||
@ stdcall GetUrlCacheGroupAttributeA(int64 long long ptr ptr ptr)
|
||||
@ stdcall GetUrlCacheGroupAttributeW(int64 long long ptr ptr ptr)
|
||||
@ stub GetUrlCacheHeaderData
|
||||
@ stdcall GopherCreateLocatorA(str long str str long str ptr)
|
||||
@ stdcall GopherCreateLocatorW(wstr long wstr wstr long wstr ptr)
|
||||
@ -222,21 +222,21 @@
|
||||
@ stdcall RetrieveUrlCacheEntryFileW(wstr ptr ptr long)
|
||||
@ stdcall RetrieveUrlCacheEntryStreamA(str ptr ptr long long)
|
||||
@ stdcall RetrieveUrlCacheEntryStreamW(wstr ptr ptr long long)
|
||||
@ stub RunOnceUrlCache
|
||||
@ stdcall RunOnceUrlCache(ptr ptr str long)
|
||||
@ stdcall SetUrlCacheConfigInfoA(ptr long)
|
||||
@ stdcall SetUrlCacheConfigInfoW(ptr long)
|
||||
@ stdcall SetUrlCacheEntryGroup(str long double ptr long ptr) SetUrlCacheEntryGroupA
|
||||
@ stdcall SetUrlCacheEntryGroupA(str long double ptr long ptr)
|
||||
@ stdcall SetUrlCacheEntryGroupW(wstr long double ptr long ptr)
|
||||
@ stdcall SetUrlCacheEntryGroup(str long int64 ptr long ptr) SetUrlCacheEntryGroupA
|
||||
@ stdcall SetUrlCacheEntryGroupA(str long int64 ptr long ptr)
|
||||
@ stdcall SetUrlCacheEntryGroupW(wstr long int64 ptr long ptr)
|
||||
@ stdcall SetUrlCacheEntryInfoA(str ptr long)
|
||||
@ stdcall SetUrlCacheEntryInfoW(wstr ptr long)
|
||||
@ stdcall SetUrlCacheGroupAttributeA(double long long ptr ptr)
|
||||
@ stdcall SetUrlCacheGroupAttributeW(double long long ptr ptr)
|
||||
@ stdcall SetUrlCacheGroupAttributeA(int64 long long ptr ptr)
|
||||
@ stdcall SetUrlCacheGroupAttributeW(int64 long long ptr ptr)
|
||||
@ stub SetUrlCacheHeaderData
|
||||
@ stub ShowCertificate
|
||||
@ stub ShowClientAuthCerts
|
||||
@ stdcall ShowClientAuthCerts(ptr)
|
||||
@ stub ShowSecurityInfo
|
||||
@ stub ShowX509EncodedCertificate
|
||||
@ stdcall ShowX509EncodedCertificate(ptr ptr long)
|
||||
@ stdcall UnlockUrlCacheEntryFile(str long) UnlockUrlCacheEntryFileA
|
||||
@ stdcall UnlockUrlCacheEntryFileA(str long)
|
||||
@ stdcall UnlockUrlCacheEntryFileW(wstr long)
|
||||
|
@ -1,9 +1,9 @@
|
||||
--- wine-1.3.21/dlls/wininet/internet.h 2012-06-20 13:23:07 +0200
|
||||
+++ dll/win32/wininet/internet.h 2012-06-20 13:58:16 +0200
|
||||
@@ -528,7 +528,11 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPE
|
||||
--- wine-1.5.4/Wine/dlls/wininet/internet.h 2012-06-20 14:38:39 +0200
|
||||
+++ dll/win32/wininet/internet.h 2012-06-20 14:51:41 +0200
|
||||
@@ -536,7 +536,11 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPE
|
||||
LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN;
|
||||
int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN;
|
||||
DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, int value) DECLSPEC_HIDDEN;
|
||||
DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC_HIDDEN;
|
||||
+#ifndef __REACTOS__
|
||||
int sock_get_error(int) DECLSPEC_HIDDEN;
|
||||
+#else
|
||||
@ -12,9 +12,30 @@
|
||||
|
||||
extern void URLCacheContainers_CreateDefaults(void) DECLSPEC_HIDDEN;
|
||||
extern void URLCacheContainers_DeleteAll(void) DECLSPEC_HIDDEN;
|
||||
--- wine-1.3.21/dlls/wininet/netconnection.c 2012-06-20 13:23:07 +0200
|
||||
+++ dll/win32/wininet/netconnection.c 2012-06-20 13:40:10 +0200
|
||||
@@ -587,6 +587,7 @@ void NETCON_unload(void)
|
||||
--- wine-1.5.4/Wine/dlls/wininet/netconnection.c 2012-06-20 14:38:39 +0200
|
||||
+++ dll/win32/wininet/netconnection.c 2012-06-20 14:52:22 +0200
|
||||
@@ -523,12 +523,16 @@ DWORD create_netconn(BOOL useSSL, server
|
||||
if(result == -1)
|
||||
{
|
||||
if (sock_get_error(errno) == WSAEINPROGRESS) {
|
||||
- struct pollfd pfd;
|
||||
+ // ReactOS: use select instead of poll
|
||||
+ fd_set outfd;
|
||||
+ struct timeval tv;
|
||||
int res;
|
||||
|
||||
- pfd.fd = netconn->socketFD;
|
||||
- pfd.events = POLLOUT;
|
||||
- res = poll(&pfd, 1, timeout);
|
||||
+ FD_ZERO(&outfd);
|
||||
+ FD_SET(netconn->socketFD, &outfd);
|
||||
+ tv.tv_sec = timeout / 1000;
|
||||
+ tv.tv_usec = (timeout % 1000) * 1000;
|
||||
+ res = select(0, NULL, &outfd, NULL, &tv);
|
||||
if (!res)
|
||||
{
|
||||
closesocket(netconn->socketFD);
|
||||
@@ -612,6 +616,7 @@ void NETCON_unload(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -22,7 +43,7 @@
|
||||
/* translate a unix error code into a winsock one */
|
||||
int sock_get_error( int err )
|
||||
{
|
||||
@@ -653,6 +654,7 @@ int sock_get_error( int err )
|
||||
@@ -678,6 +683,7 @@ int sock_get_error( int err )
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
@ -30,19 +51,19 @@
|
||||
|
||||
/******************************************************************************
|
||||
* NETCON_secure_connect
|
||||
--- wine-1.3.21/dlls/wininet/internet.c 2012-06-20 13:23:07 +0200
|
||||
+++ dll/win32/wininet/internet.c 2012-06-20 13:39:47 +0200
|
||||
--- wine-1.5.4/Wine/dlls/wininet/internet.c 2012-06-20 14:38:38 +0200
|
||||
+++ dll/win32/wininet/internet.c 2012-06-20 14:58:51 +0200
|
||||
@@ -292,7 +292,9 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL,
|
||||
if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES)
|
||||
return FALSE;
|
||||
if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES)
|
||||
return FALSE;
|
||||
|
||||
+#ifndef __REACTOS__
|
||||
URLCacheContainers_CreateDefaults();
|
||||
+#endif
|
||||
|
||||
WININET_hModule = hinstDLL;
|
||||
|
||||
@@ -3597,19 +3599,23 @@ LPSTR INTERNET_GetResponseBuffer(void)
|
||||
break;
|
||||
@@ -3716,19 +3718,23 @@ LPSTR INTERNET_GetResponseBuffer(void)
|
||||
|
||||
LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen)
|
||||
{
|
||||
@ -72,9 +93,9 @@
|
||||
{
|
||||
Index: dll/win32/wininet/urlcache.c
|
||||
===================================================================
|
||||
--- wine-1.3.21/dlls/wininet/urlcache.c 2012-06-20 13:23:07 +0200
|
||||
+++ dll/win32/wininet/urlcache.c 2012-06-20 13:41:43 +0200
|
||||
@@ -182,6 +182,8 @@ typedef struct _URLCACHECONTAINER
|
||||
--- wine-1.5.4/Wine/dlls/wininet/urlcache.c 2012-06-20 14:30:41 +0200
|
||||
+++ dll/win32/wininet/urlcache.c 2012-06-20 14:54:06 +0200
|
||||
@@ -189,6 +189,8 @@ typedef struct _URLCACHECONTAINER
|
||||
|
||||
/* List of all containers available */
|
||||
static struct list UrlContainers = LIST_INIT(UrlContainers);
|
||||
@ -83,7 +104,7 @@ Index: dll/win32/wininet/urlcache.c
|
||||
|
||||
static DWORD URLCache_CreateHashTable(LPURLCACHE_HEADER pHeader, HASH_CACHEFILE_ENTRY *pPrevHash, HASH_CACHEFILE_ENTRY **ppHash);
|
||||
|
||||
@@ -518,6 +520,8 @@ void URLCacheContainers_CreateDefaults(v
|
||||
@@ -538,6 +540,8 @@ void URLCacheContainers_CreateDefaults(v
|
||||
static const WCHAR HistoryPrefix[] = {'V','i','s','i','t','e','d',':',0};
|
||||
static const WCHAR CookieSuffix[] = {0};
|
||||
static const WCHAR CookiePrefix[] = {'C','o','o','k','i','e',':',0};
|
||||
@ -92,7 +113,7 @@ Index: dll/win32/wininet/urlcache.c
|
||||
static const struct
|
||||
{
|
||||
int nFolder; /* CSIDL_* constant */
|
||||
@@ -531,6 +535,13 @@ void URLCacheContainers_CreateDefaults(v
|
||||
@@ -551,6 +555,13 @@ void URLCacheContainers_CreateDefaults(v
|
||||
};
|
||||
DWORD i;
|
||||
|
||||
@ -106,7 +127,7 @@ Index: dll/win32/wininet/urlcache.c
|
||||
for (i = 0; i < sizeof(DefaultContainerData) / sizeof(DefaultContainerData[0]); i++)
|
||||
{
|
||||
WCHAR wszCachePath[MAX_PATH];
|
||||
@@ -584,6 +595,10 @@ static DWORD URLCacheContainers_FindCont
|
||||
@@ -604,6 +615,10 @@ static DWORD URLCacheContainers_FindCont
|
||||
if(!lpwszUrl)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
@ -117,7 +138,7 @@ Index: dll/win32/wininet/urlcache.c
|
||||
LIST_FOR_EACH_ENTRY(pContainer, &UrlContainers, URLCACHECONTAINER, entry)
|
||||
{
|
||||
int prefix_len = strlenW(pContainer->cache_prefix);
|
||||
@@ -622,6 +637,10 @@ static BOOL URLCacheContainers_Enum(LPCW
|
||||
@@ -642,6 +657,10 @@ static BOOL URLCacheContainers_Enum(LPCW
|
||||
if (lpwszSearchPattern && dwIndex > 0)
|
||||
return FALSE;
|
||||
|
||||
@ -128,7 +149,7 @@ Index: dll/win32/wininet/urlcache.c
|
||||
LIST_FOR_EACH_ENTRY(pContainer, &UrlContainers, URLCACHECONTAINER, entry)
|
||||
{
|
||||
if (lpwszSearchPattern)
|
||||
@@ -1525,6 +1544,10 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR l
|
||||
@@ -1579,6 +1598,10 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR l
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -141,9 +162,9 @@ Index: dll/win32/wininet/urlcache.c
|
||||
/* The URL cache has prefix L"" (unlike Cookies and History) */
|
||||
Index: dll/win32/wininet/http.c
|
||||
===================================================================
|
||||
--- wine-1.3.21/dlls/wininet/http.c 2012-06-20 13:37:39 +0200
|
||||
+++ dll/win32/wininet/http.c 2012-06-20 13:52:44 +0200
|
||||
@@ -71,6 +71,9 @@
|
||||
--- wine-1.5.4/Wine/dlls/wininet/http.c 2012-06-20 14:38:38 +0200
|
||||
+++ dll/win32/wininet/http.c 2012-06-20 14:49:11 +0200
|
||||
@@ -73,6 +73,9 @@
|
||||
#include "wine/exception.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
@ -153,7 +174,7 @@ Index: dll/win32/wininet/http.c
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
||||
|
||||
static const WCHAR g_szHttp1_0[] = {'H','T','T','P','/','1','.','0',0};
|
||||
@@ -243,8 +246,17 @@ void server_release(server_t *server)
|
||||
@@ -241,8 +244,17 @@ void server_release(server_t *server)
|
||||
if(InterlockedDecrement(&server->ref))
|
||||
return;
|
||||
|
||||
@ -172,7 +193,7 @@ Index: dll/win32/wininet/http.c
|
||||
}
|
||||
|
||||
static server_t *get_server(const WCHAR *name, INTERNET_PORT port)
|
||||
@@ -290,7 +302,7 @@ BOOL collect_connections(BOOL collect_al
|
||||
@@ -288,7 +300,7 @@ BOOL collect_connections(BOOL collect_al
|
||||
BOOL remaining = FALSE;
|
||||
DWORD64 now;
|
||||
|
||||
@ -181,7 +202,7 @@ Index: dll/win32/wininet/http.c
|
||||
|
||||
LIST_FOR_EACH_ENTRY_SAFE(server, server_safe, &connection_pool, server_t, entry) {
|
||||
LIST_FOR_EACH_ENTRY_SAFE(netconn, netconn_safe, &server->conn_pool, netconn_t, pool_entry) {
|
||||
@@ -1859,13 +1871,14 @@ static void http_release_netconn(http_re
|
||||
@@ -1854,13 +1866,14 @@ static void http_release_netconn(http_re
|
||||
if(!req->netconn)
|
||||
return;
|
||||
|
||||
@ -197,7 +218,7 @@ Index: dll/win32/wininet/http.c
|
||||
req->netconn = NULL;
|
||||
|
||||
run_collector = !collector_running;
|
||||
@@ -1893,6 +1906,7 @@ static void http_release_netconn(http_re
|
||||
@@ -1888,6 +1901,7 @@ static void http_release_netconn(http_re
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
/* FIXME: #include <iedial.h> */
|
||||
#include <schannel.h>
|
||||
#include <sspi.h>
|
||||
|
||||
typedef struct _INTERNET_CACHE_CONFIG_PATH_ENTRYA
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ reactos/dll/win32/wer # Autosync
|
||||
reactos/dll/win32/windowscodecs # Autosync
|
||||
reactos/dll/win32/winemp3.acm # Synced to Wine-1.3.37
|
||||
reactos/dll/win32/winhttp # Autosync
|
||||
reactos/dll/win32/wininet # Autosync
|
||||
reactos/dll/win32/wininet # Synced to Wine-1.5.4
|
||||
reactos/dll/win32/winmm # Forked at Wine-20050628
|
||||
reactos/dll/win32/winmm/midimap # Forked at Wine-20050628
|
||||
reactos/dll/win32/winmm/wavemap # Forked at Wine-20050628
|
||||
|
Loading…
Reference in New Issue
Block a user