https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5f12c8d726177015c5b631...
commit 5f12c8d726177015c5b6313426e449f343237f29 Author: winesync ros-dev@reactos.org AuthorDate: Tue Dec 8 18:00:24 2020 +0100 Commit: Jérôme Gardou zefklop@users.noreply.github.com CommitDate: Tue Jan 5 11:03:13 2021 +0100
[WINESYNC] wininet: Build with msvcrt.
Signed-off-by: Alexandre Julliard julliard@winehq.org
wine commit id 3c31cc5836026b45a40818ec874bbbcc4d6ad982 by Alexandre Julliard julliard@winehq.org --- dll/win32/wininet/CMakeLists.txt | 16 +- dll/win32/wininet/cookie.c | 47 +++--- dll/win32/wininet/dialogs.c | 27 +-- dll/win32/wininet/ftp.c | 66 ++++---- dll/win32/wininet/gopher.c | 11 +- dll/win32/wininet/http.c | 334 +++++++++++++++++++------------------- dll/win32/wininet/internet.c | 96 +++++------ dll/win32/wininet/internet.h | 5 +- dll/win32/wininet/netconnection.c | 6 +- dll/win32/wininet/precomp.h | 52 ++---- dll/win32/wininet/urlcache.c | 48 +++--- dll/win32/wininet/utility.c | 14 +- sdk/tools/winesync/wininet.cfg | 2 +- 13 files changed, 361 insertions(+), 363 deletions(-)
diff --git a/dll/win32/wininet/CMakeLists.txt b/dll/win32/wininet/CMakeLists.txt index 574db0a0f0e..eb4b9d12992 100644 --- a/dll/win32/wininet/CMakeLists.txt +++ b/dll/win32/wininet/CMakeLists.txt @@ -11,8 +11,6 @@ add_definitions( -D_WINE -Dclose=_close)
-include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) - spec2def(wininet.dll wininet.spec ADD_IMPORTLIB)
list(APPEND SOURCE @@ -21,23 +19,29 @@ list(APPEND SOURCE ftp.c gopher.c http.c - inflate.c internet.c - netconnection.c - urlcache.c utility.c)
list(APPEND PCH_SKIP_SOURCE + # Sometimes wine uses nameless structs & unions. Sometimes not... */ + netconnection.c + urlcache.c ${CMAKE_CURRENT_BINARY_DIR}/wininet_stubs.c)
+add_library(wininet_inflate OBJECT inflate.c) +target_include_directories(wininet_inflate BEFORE PRIVATE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) +add_dependencies(wininet_inflate psdk) + add_library(wininet MODULE ${SOURCE} ${PCH_SKIP_SOURCE} + $<TARGET_OBJECTS:wininet_inflate> rsrc.rc ${CMAKE_CURRENT_BINARY_DIR}/wininet.def)
set_module_type(wininet win32dll) -target_link_libraries(wininet wine ${PSEH_LIB}) +target_link_libraries(wininet wine ${PSEH_LIB} oldnames) + add_delay_importlibs(wininet secur32 crypt32 cryptui iphlpapi dhcpcsvc) add_importlibs(wininet mpr shlwapi shell32 user32 advapi32 ws2_32 normaliz kernel32_vista msvcrt kernel32 ntdll) add_pch(wininet precomp.h "${PCH_SKIP_SOURCE}") diff --git a/dll/win32/wininet/cookie.c b/dll/win32/wininet/cookie.c index 2af752110c0..98a5e0e2a45 100644 --- a/dll/win32/wininet/cookie.c +++ b/dll/win32/wininet/cookie.c @@ -1,3 +1,6 @@ +#ifdef __REACTOS__ +#include "precomp.h" +#else /* * Wininet - cookie handling stuff * @@ -27,6 +30,7 @@ #include <stdlib.h> #include <string.h> #include <assert.h> +#include <wchar.h>
#include "windef.h" #include "winbase.h" @@ -36,6 +40,7 @@
#include "wine/debug.h" #include "internet.h" +#endif /* defined(__REACTOS__) */
#define RESPONSE_TIMEOUT 30 /* FROM internet.c */
@@ -173,7 +178,7 @@ static WCHAR *create_cookie_url(substr_t domain, substr_t path, substr_t *ret_pa p += domain.len;
for(i=0; i < path.len; i++) - p[i] = tolowerW(path.str[i]); + p[i] = towlower(path.str[i]); p[path.len] = 0;
ret_path->str = p; @@ -194,7 +199,7 @@ static cookie_container_t *get_cookie_container(substr_t domain, substr_t path, if(cookie_container->path.len < path.len) break;
- if(path.len == cookie_container->path.len && !strncmpiW(cookie_container->path.str, path.str, path.len)) + if(path.len == cookie_container->path.len && !wcsnicmp(cookie_container->path.str, path.str, path.len)) return cookie_container; }
@@ -265,7 +270,7 @@ static cookie_t *find_cookie(cookie_container_t *container, substr_t name) cookie_t *iter;
LIST_FOR_EACH_ENTRY(iter, &container->cookie_list, cookie_t, entry) { - if(strlenW(iter->name) == name.len && !strncmpiW(iter->name, name.str, name.len)) + if(lstrlenW(iter->name) == name.len && !wcsnicmp(iter->name, name.str, name.len)) return iter; }
@@ -294,7 +299,7 @@ static void replace_cookie(cookie_container_t *container, cookie_t *new_cookie)
static BOOL cookie_match_path(cookie_container_t *container, substr_t path) { - return path.len >= container->path.len && !strncmpiW(container->path.str, path.str, container->path.len); + return path.len >= container->path.len && !wcsnicmp(container->path.str, path.str, container->path.len); }
static BOOL load_persistent_cookie(substr_t domain, substr_t path) @@ -603,9 +608,9 @@ static DWORD get_cookie(substr_t host, substr_t path, DWORD flags, cookie_set_t res->string_len += 2; /* '; ' */ res->cookies[res->cnt++] = cookie_iter;
- res->string_len += strlenW(cookie_iter->name); + res->string_len += lstrlenW(cookie_iter->name); if(*cookie_iter->data) - res->string_len += 1 /* = */ + strlenW(cookie_iter->data); + res->string_len += 1 /* = */ + lstrlenW(cookie_iter->data); } } } @@ -624,13 +629,13 @@ static void cookie_set_to_string(const cookie_set_t *cookie_set, WCHAR *str) *ptr++ = ' '; }
- len = strlenW(cookie_set->cookies[i]->name); + len = lstrlenW(cookie_set->cookies[i]->name); memcpy(ptr, cookie_set->cookies[i]->name, len*sizeof(WCHAR)); ptr += len;
if(*cookie_set->cookies[i]->data) { *ptr++ = '='; - len = strlenW(cookie_set->cookies[i]->data); + len = lstrlenW(cookie_set->cookies[i]->data); memcpy(ptr, cookie_set->cookies[i]->data, len*sizeof(WCHAR)); ptr += len; } @@ -872,11 +877,11 @@ static BOOL is_domain_legal_for_cookie(substr_t domain, substr_t full_domain) return FALSE; }
- if(domain.len > full_domain.len || !memchrW(domain.str, '.', domain.len) || !memchrW(full_domain.str, '.', full_domain.len)) + if(domain.len > full_domain.len || !wmemchr(domain.str, '.', domain.len) || !wmemchr(full_domain.str, '.', full_domain.len)) return FALSE;
ptr = full_domain.str + full_domain.len - domain.len; - if (strncmpiW(domain.str, ptr, domain.len) || (full_domain.len > domain.len && ptr[-1] != '.')) { + if (wcsnicmp(domain.str, ptr, domain.len) || (full_domain.len > domain.len && ptr[-1] != '.')) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } @@ -924,7 +929,7 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D
/* lots of information can be parsed out of the cookie value */
- if(!(end_ptr = memchrW(data.str, ';', data.len))) + if(!(end_ptr = wmemchr(data.str, ';', data.len))) end_ptr = data.str + data.len; value = substr(data.str, end_ptr-data.str); data.str += value.len; @@ -949,10 +954,10 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D if(!data.len) break;
- if(!(end_ptr = memchrW(data.str, ';', data.len))) + if(!(end_ptr = wmemchr(data.str, ';', data.len))) end_ptr = data.str + data.len;
- if(data.len >= (len = ARRAY_SIZE(szDomain)) && !strncmpiW(data.str, szDomain, len)) { + if(data.len >= (len = ARRAY_SIZE(szDomain)) && !wcsnicmp(data.str, szDomain, len)) { substr_skip(&data, len);
if(data.len && *data.str == '.') @@ -963,11 +968,11 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D
domain = substr(data.str, end_ptr-data.str); TRACE("Parsing new domain %s\n", debugstr_wn(domain.str, domain.len)); - }else if(data.len >= (len = ARRAY_SIZE(szPath)) && !strncmpiW(data.str, szPath, len)) { + }else if(data.len >= (len = ARRAY_SIZE(szPath)) && !wcsnicmp(data.str, szPath, len)) { substr_skip(&data, len); path = substr(data.str, end_ptr - data.str); TRACE("Parsing new path %s\n", debugstr_wn(path.str, path.len)); - }else if(data.len >= (len = ARRAY_SIZE(szExpires)) && !strncmpiW(data.str, szExpires, len)) { + }else if(data.len >= (len = ARRAY_SIZE(szExpires)) && !wcsnicmp(data.str, szExpires, len)) { SYSTEMTIME st; WCHAR buf[128];
@@ -986,10 +991,10 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D } } } - }else if(data.len >= (len = ARRAY_SIZE(szSecure)) && !strncmpiW(data.str, szSecure, len)) { + }else if(data.len >= (len = ARRAY_SIZE(szSecure)) && !wcsnicmp(data.str, szSecure, len)) { substr_skip(&data, len); FIXME("secure not handled\n"); - }else if(data.len >= (len = ARRAY_SIZE(szHttpOnly)) && !strncmpiW(data.str, szHttpOnly, len)) { + }else if(data.len >= (len = ARRAY_SIZE(szHttpOnly)) && !wcsnicmp(data.str, szHttpOnly, len)) { substr_skip(&data, len);
if(!(flags & INTERNET_COOKIE_HTTPONLY)) { @@ -999,11 +1004,11 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D }
cookie_flags |= INTERNET_COOKIE_HTTPONLY; - }else if(data.len >= (len = ARRAY_SIZE(szVersion)) && !strncmpiW(data.str, szVersion, len)) { + }else if(data.len >= (len = ARRAY_SIZE(szVersion)) && !wcsnicmp(data.str, szVersion, len)) { substr_skip(&data, len);
FIXME("version not handled (%s)\n",debugstr_wn(data.str, data.len)); - }else if(data.len >= (len = ARRAY_SIZE(max_ageW)) && !strncmpiW(data.str, max_ageW, len)) { + }else if(data.len >= (len = ARRAY_SIZE(max_ageW)) && !wcsnicmp(data.str, max_ageW, len)) { /* Native doesn't support Max-Age attribute. */ WARN("Max-Age ignored\n"); }else if(data.len) { @@ -1098,8 +1103,8 @@ DWORD WINAPI InternetSetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, /* some apps (or is it us??) try to add a cookie with no cookie name, but * the cookie data in the form of name[=data]. */ - if (!(ptr = strchrW(lpCookieData, '='))) - ptr = lpCookieData + strlenW(lpCookieData); + if (!(ptr = wcschr(lpCookieData, '='))) + ptr = lpCookieData + lstrlenW(lpCookieData);
name = substr(lpCookieData, ptr - lpCookieData); data = substrz(*ptr == '=' ? ptr+1 : ptr); diff --git a/dll/win32/wininet/dialogs.c b/dll/win32/wininet/dialogs.c index 5e26c8b7b4d..f381a66041b 100644 --- a/dll/win32/wininet/dialogs.c +++ b/dll/win32/wininet/dialogs.c @@ -1,3 +1,6 @@ +#ifdef __REACTOS__ +#include "precomp.h" +#else /* * Wininet * @@ -35,10 +38,8 @@ #include "cryptuiapi.h"
#include "internet.h" - -#include "wine/unicode.h" - #include "resource.h" +#endif /* defined(__REACTOS__) */
#define MAX_STRING_LEN 1024
@@ -78,8 +79,8 @@ static BOOL WININET_GetAuthRealm( HINTERNET hRequest, LPWSTR szBuf, DWORD sz, BO * FIXME: maybe we should check that we're * dealing with 'Basic' Authentication */ - p = strchrW( szBuf, ' ' ); - if( !p || strncmpW( p+1, szRealm, strlenW(szRealm) ) ) + p = wcschr( szBuf, ' ' ); + if( !p || wcsncmp( p+1, szRealm, lstrlenW(szRealm) ) ) { ERR("response wrong? (%s)\n", debugstr_w(szBuf)); return FALSE; @@ -90,11 +91,11 @@ static BOOL WININET_GetAuthRealm( HINTERNET hRequest, LPWSTR szBuf, DWORD sz, BO if( *p == '"' ) { p++; - q = strrchrW( p, '"' ); + q = wcsrchr( p, '"' ); if( q ) *q = 0; } - strcpyW( szBuf, p ); + lstrcpyW( szBuf, p );
return TRUE; } @@ -106,7 +107,7 @@ extern DWORD WINAPI WNetGetCachedPassword(LPSTR,WORD,LPSTR,LPWORD,BYTE); /*********************************************************************** * WININET_GetSetPassword */ -static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer, +static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer, LPCWSTR szRealm, BOOL bSet ) { WCHAR szResource[0x80], szUserPass[0x40]; @@ -137,11 +138,11 @@ static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer, szUserPass[0] = 0; GetWindowTextW( hUserItem, szUserPass, ARRAY_SIZE( szUserPass ) - 1 ); lstrcatW(szUserPass, szColon); - u_len = strlenW( szUserPass ); + u_len = lstrlenW( szUserPass ); GetWindowTextW( hPassItem, szUserPass+u_len, ARRAY_SIZE( szUserPass ) - u_len );
- r_len = (strlenW( szResource ) + 1)*sizeof(WCHAR); - u_len = (strlenW( szUserPass ) + 1)*sizeof(WCHAR); + r_len = (lstrlenW( szResource ) + 1)*sizeof(WCHAR); + u_len = (lstrlenW( szUserPass ) + 1)*sizeof(WCHAR); r = WNetCachePassword( (CHAR*)szResource, r_len, (CHAR*)szUserPass, u_len, dwMagic, 0 );
@@ -149,13 +150,13 @@ static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer, }
sz = sizeof szUserPass; - r_len = (strlenW( szResource ) + 1)*sizeof(WCHAR); + r_len = (lstrlenW( szResource ) + 1)*sizeof(WCHAR); r = WNetGetCachedPassword( (CHAR*)szResource, r_len, (CHAR*)szUserPass, &sz, dwMagic ); if( r != WN_SUCCESS ) return FALSE;
- p = strchrW( szUserPass, ':' ); + p = wcschr( szUserPass, ':' ); if( p ) { *p = 0; diff --git a/dll/win32/wininet/ftp.c b/dll/win32/wininet/ftp.c index f2a88b741ea..9fa6f818197 100644 --- a/dll/win32/wininet/ftp.c +++ b/dll/win32/wininet/ftp.c @@ -1,3 +1,6 @@ +#ifdef __REACTOS__ +#include "precomp.h" +#else /* * WININET - Ftp implementation * @@ -49,6 +52,7 @@
#include "wine/debug.h" #include "internet.h" +#endif /* defined(__REACTOS__) */
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
@@ -224,7 +228,7 @@ BOOL WINAPI FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile, LPWSTR lpwzLocalFile; LPWSTR lpwzNewRemoteFile; BOOL ret; - + lpwzLocalFile = heap_strdupAtoW(lpszLocalFile); lpwzNewRemoteFile = heap_strdupAtoW(lpszNewRemoteFile); ret = FtpPutFileW(hConnect, lpwzLocalFile, lpwzNewRemoteFile, @@ -417,7 +421,7 @@ BOOL WINAPI FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory) { LPWSTR lpwzDirectory; BOOL ret; - + lpwzDirectory = heap_strdupAtoW(lpszDirectory); ret = FtpSetCurrentDirectoryW(hConnect, lpwzDirectory); heap_free(lpwzDirectory); @@ -564,7 +568,7 @@ BOOL WINAPI FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory) { LPWSTR lpwzDirectory; BOOL ret; - + lpwzDirectory = heap_strdupAtoW(lpszDirectory); ret = FtpCreateDirectoryW(hConnect, lpwzDirectory); heap_free(lpwzDirectory); @@ -710,12 +714,12 @@ HINTERNET WINAPI FtpFindFirstFileA(HINTERNET hConnect, WIN32_FIND_DATAW wfd; LPWIN32_FIND_DATAW lpFindFileDataW; HINTERNET ret; - + lpwzSearchFile = heap_strdupAtoW(lpszSearchFile); lpFindFileDataW = lpFindFileData?&wfd:NULL; ret = FtpFindFirstFileW(hConnect, lpwzSearchFile, lpFindFileDataW, dwFlags, dwContext); heap_free(lpwzSearchFile); - + if (ret && lpFindFileData) WININET_find_data_WtoA(lpFindFileDataW, lpFindFileData);
@@ -834,8 +838,8 @@ static HINTERNET FTP_FtpFindFirstFileW(ftp_session_t *lpwfs, if (lpszSearchFile) { LPCWSTR name = lpszSearchFile, p; - if ((p = strrchrW( name, '\' ))) name = p + 1; - if ((p = strrchrW( name, '/' ))) name = p + 1; + if ((p = wcsrchr( name, '\' ))) name = p + 1; + if ((p = wcsrchr( name, '/' ))) name = p + 1; if (name != lpszSearchFile) { lpszSearchPath = heap_strndupW(lpszSearchFile, name - lpszSearchFile); @@ -1351,7 +1355,7 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs, WININET_AddRef( &lpwfs->hdr ); lpwh->lpFtpSession = lpwfs; list_add_head( &lpwfs->hdr.children, &lpwh->hdr.entry ); - + /* Indicate that a download is currently in progress */ lpwfs->download_in_progress = lpwh; } @@ -1560,7 +1564,7 @@ BOOL WINAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN LPWSTR lpwzRemoteFile; LPWSTR lpwzNewFile; BOOL ret; - + lpwzRemoteFile = heap_strdupAtoW(lpszRemoteFile); lpwzNewFile = heap_strdupAtoW(lpszNewFile); ret = FtpGetFileW(hInternet, lpwzRemoteFile, lpwzNewFile, fFailIfExists, @@ -1642,7 +1646,7 @@ BOOL WINAPI FtpGetFileW(HINTERNET hInternet, LPCWSTR lpszRemoteFile, LPCWSTR lps INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); goto lend; } - + hIC = lpwfs->lpAppInfo; if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) { @@ -1775,7 +1779,7 @@ BOOL WINAPI FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName) { LPWSTR lpwzFileName; BOOL ret; - + lpwzFileName = heap_strdupAtoW(lpszFileName); ret = FtpDeleteFileW(hFtpSession, lpwzFileName); heap_free(lpwzFileName); @@ -1922,7 +1926,7 @@ BOOL WINAPI FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory) { LPWSTR lpwzDirectory; BOOL ret; - + lpwzDirectory = heap_strdupAtoW(lpszDirectory); ret = FtpRemoveDirectoryW(hFtpSession, lpwzDirectory); heap_free(lpwzDirectory); @@ -2066,7 +2070,7 @@ BOOL WINAPI FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDes LPWSTR lpwzSrc; LPWSTR lpwzDest; BOOL ret; - + lpwzSrc = heap_strdupAtoW(lpszSrc); lpwzDest = heap_strdupAtoW(lpszDest); ret = FtpRenameFileW(hFtpSession, lpwzSrc, lpwzDest); @@ -2453,7 +2457,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, INTERNET_SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + lpwfs = alloc_object(&hIC->hdr, &FTPSESSIONVtbl, sizeof(ftp_session_t)); if (NULL == lpwfs) { @@ -2480,7 +2484,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, list_add_head( &hIC->hdr.children, &lpwfs->hdr.entry );
if(hIC->proxy && hIC->accessType == INTERNET_OPEN_TYPE_PROXY) { - if(strchrW(hIC->proxy, ' ')) + if(wcschr(hIC->proxy, ' ')) FIXME("Several proxies not implemented.\n"); if(hIC->proxyBypass) FIXME("Proxy bypass is ignored.\n"); @@ -2497,7 +2501,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, /* Nothing in the registry, get the username and use that as the password */ if (!GetUserNameW(szPassword, &len)) { /* Should never get here, but use an empty password as failsafe */ - strcpyW(szPassword, szEmpty); + lstrcpyW(szPassword, szEmpty); } } RegCloseKey(key); @@ -2510,7 +2514,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, lpwfs->lpszPassword = heap_strdupW(lpszPassword ? lpszPassword : szEmpty); } lpwfs->servername = heap_strdupW(lpszServerName); - + /* Don't send a handle created callback if this handle was created with InternetOpenUrl */ if (!(lpwfs->hdr.dwInternalFlags & INET_OPENURL)) { @@ -2523,9 +2527,9 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, INTERNET_STATUS_HANDLE_CREATED, &iar, sizeof(INTERNET_ASYNC_RESULT)); } - + INTERNET_SendCallback(&hIC->hdr, dwContext, INTERNET_STATUS_RESOLVING_NAME, - (LPWSTR) lpszServerName, (strlenW(lpszServerName)+1) * sizeof(WCHAR)); + (LPWSTR) lpszServerName, (lstrlenW(lpszServerName)+1) * sizeof(WCHAR));
sock_namelen = sizeof(socketAddr); if (!GetAddress(lpszServerName, lpwfs->serverport, (struct sockaddr *)&socketAddr, &sock_namelen, szaddr)) @@ -3067,7 +3071,7 @@ static BOOL FTP_GetFileSize(ftp_session_t *lpwfs, LPCWSTR lpszRemoteFile, DWORD for (i = 0; (lpszResponseBuffer[i] != ' ') && (lpszResponseBuffer[i] != '\0'); i++) ; if (lpszResponseBuffer[i] == '\0') return FALSE; *dwSize = atol(&(lpszResponseBuffer[i + 1])); - + bSuccess = TRUE; } else { FTP_SetResponseError(nResCode); @@ -3098,7 +3102,7 @@ static BOOL FTP_SendPort(ftp_session_t *lpwfs) BOOL bSuccess = FALSE; TRACE("\n");
- sprintfW(szIPAddress, szIPFormat, + swprintf(szIPAddress, ARRAY_SIZE(szIPAddress), szIPFormat, lpwfs->lstnSocketAddress.sin_addr.S_un.S_addr&0x000000FF, (lpwfs->lstnSocketAddress.sin_addr.S_un.S_addr&0x0000FF00)>>8, (lpwfs->lstnSocketAddress.sin_addr.S_un.S_addr&0x00FF0000)>>16, @@ -3603,7 +3607,7 @@ static BOOL FTP_ConvertFileProp(LPFILEPROPERTIESW lpafp, LPWIN32_FIND_DATAW lpFi SystemTimeToFileTime( &lpafp->tmLastModified, &lpFindFileData->ftLastAccessTime ); lpFindFileData->ftLastWriteTime = lpFindFileData->ftLastAccessTime; lpFindFileData->ftCreationTime = lpFindFileData->ftLastAccessTime; - + /* Not all fields are filled in */ lpFindFileData->nFileSizeHigh = 0; /* We do not handle files bigger than 0xFFFFFFFF bytes yet :-) */ lpFindFileData->nFileSizeLow = lpafp->nSize; @@ -3638,12 +3642,12 @@ static BOOL FTP_ParseNextFile(INT nSocket, LPCWSTR lpszSearchFile, LPFILEPROPERT char *pszTmp; BOOL found = FALSE; int i; - + lpfp->lpszName = NULL; do { if(!(pszLine = FTP_GetNextLine(nSocket, &nBufLen))) return FALSE; - + pszToken = strtok(pszLine, szSpace); /* ls format * <Permissions> <NoLinks> <owner> <group> <size> <date> <time or year> <filename> @@ -3667,14 +3671,14 @@ static BOOL FTP_ParseNextFile(INT nSocket, LPCWSTR lpszSearchFile, LPFILEPROPERT TRACE("Size: %s\n", pszToken); lpfp->nSize = atol(pszToken); } - + lpfp->tmLastModified.wSecond = 0; lpfp->tmLastModified.wMinute = 0; lpfp->tmLastModified.wHour = 0; lpfp->tmLastModified.wDay = 0; lpfp->tmLastModified.wMonth = 0; lpfp->tmLastModified.wYear = 0; - + /* Determine month */ pszToken = strtok(NULL, szSpace); if(!pszToken) continue; @@ -3713,14 +3717,14 @@ static BOOL FTP_ParseNextFile(INT nSocket, LPCWSTR lpszSearchFile, LPFILEPROPERT TRACE("File: %s\n", debugstr_w(lpfp->lpszName)); } /* NT way of parsing ... : - + 07-13-03 08:55PM <DIR> sakpatch 05-09-03 06:02PM 12656686 2003-04-21bgm_cmd_e.rgz */ else if(isdigit(pszToken[0]) && 8 == strlen(pszToken)) { int mon, mday, year, hour, min; lpfp->permissions = 0xFFFF; /* No idea, put full permission :-) */ - + sscanf(pszToken, "%d-%d-%d", &mon, &mday, &year); lpfp->tmLastModified.wDay = mday; lpfp->tmLastModified.wMonth = mon; @@ -3755,7 +3759,7 @@ static BOOL FTP_ParseNextFile(INT nSocket, LPCWSTR lpszSearchFile, LPFILEPROPERT lpfp->nSize = atol(pszToken); TRACE("Size: %d\n", lpfp->nSize); } - + pszToken = strtok(NULL, szSpace); if(!pszToken) continue; lpfp->lpszName = heap_strdupAtoW(pszToken); @@ -3765,7 +3769,7 @@ static BOOL FTP_ParseNextFile(INT nSocket, LPCWSTR lpszSearchFile, LPFILEPROPERT else if(pszToken[0] == '+') { FIXME("EPLF Format not implemented\n"); } - + if(lpfp->lpszName) { if((lpszSearchFile == NULL) || (PathMatchSpecW(lpfp->lpszName, lpszSearchFile))) { @@ -3808,7 +3812,7 @@ static BOOL FTP_ParseDirectory(ftp_session_t *lpwfs, INT nSocket, LPCWSTR lpszSe if (indexFilePropArray+1 >= sizeFilePropArray) { LPFILEPROPERTIESW tmpafp; - + sizeFilePropArray *= 2; tmpafp = heap_realloc_zero(*lpafp, sizeof(FILEPROPERTIESW)*sizeFilePropArray); if (NULL == tmpafp) diff --git a/dll/win32/wininet/gopher.c b/dll/win32/wininet/gopher.c index 6688ce7a947..c8e0851ce31 100644 --- a/dll/win32/wininet/gopher.c +++ b/dll/win32/wininet/gopher.c @@ -1,4 +1,6 @@ -/* +#ifdef __REACTOS__ +#include "precomp.h" +#else/* * WININET - Gopher implementation * * Copyright 2003 Kirill Smelkov @@ -18,8 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "config.h" - #include <stdarg.h>
#include "windef.h" @@ -27,6 +27,7 @@ #include "wininet.h"
#include "wine/debug.h" +#endif /* defined(__REACTOS__) */
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
@@ -65,7 +66,7 @@ BOOL WINAPI GopherCreateLocatorA(
/*********************************************************************** * GopherCreateLocatorW (WININET.@) - * + * * See GopherCreateLocatorA. */ BOOL WINAPI GopherCreateLocatorW( @@ -138,7 +139,7 @@ HINTERNET WINAPI GopherFindFirstFileW( * GopherGetAttributeA (WININET.@) * * Retrieves the specific attribute information from the server. - * + * * RETURNS * TRUE on success * FALSE on failure diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c index d595db409fa..46556ee68d9 100644 --- a/dll/win32/wininet/http.c +++ b/dll/win32/wininet/http.c @@ -1,4 +1,7 @@ -/* +#ifdef __REACTOS__ +#include "precomp.h" +#include "zlib.h" +#else/* * Wininet - HTTP Implementation * * Copyright 1999 Corel Corporation @@ -27,8 +30,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "config.h" - #include <stdlib.h>
#include "winsock2.h" @@ -58,7 +59,7 @@ #include "zlib.h" #include "wine/debug.h" #include "wine/exception.h" -#include "wine/unicode.h" +#endif /* defined(__REACTOS__) */
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
@@ -243,19 +244,20 @@ void server_release(server_t *server) static BOOL process_host_port(server_t *server) { BOOL default_port; - size_t name_len; + size_t name_len, len; WCHAR *buf;
static const WCHAR httpW[] = {'h','t','t','p',0}; static const WCHAR httpsW[] = {'h','t','t','p','s',0}; static const WCHAR formatW[] = {'%','s',':','/','/','%','s',':','%','u',0};
- name_len = strlenW(server->name); - buf = heap_alloc((name_len + 10 /* strlen("://:<port>") */)*sizeof(WCHAR) + sizeof(httpsW)); + name_len = lstrlenW(server->name); + len = name_len + 10 /* strlen("://:<port>") */ + ARRAY_SIZE(httpsW); + buf = heap_alloc( len * sizeof(WCHAR) ); if(!buf) return FALSE;
- sprintfW(buf, formatW, server->is_https ? httpsW : httpW, server->name, server->port); + swprintf(buf, len, formatW, server->is_https ? httpsW : httpW, server->name, server->port); server->scheme_host_port = buf;
server->host_port = server->scheme_host_port + 7 /* strlen("http://") */; @@ -274,7 +276,7 @@ server_t *get_server(substr_t name, INTERNET_PORT port, BOOL is_https, BOOL do_c EnterCriticalSection(&connection_pool_cs);
LIST_FOR_EACH_ENTRY(iter, &connection_pool, server_t, entry) { - if(iter->port == port && name.len == strlenW(iter->name) && !strncmpiW(iter->name, name.str, name.len) + if(iter->port == port && name.len == lstrlenW(iter->name) && !wcsnicmp(iter->name, name.str, name.len) && iter->is_https == is_https) { server = iter; server_addref(server); @@ -603,7 +605,7 @@ static void HTTP_FixURL(http_request_t *request) request->path = heap_strdupW(szSlash); else /* remove \r and \n*/ { - int nLen = strlenW(request->path); + int nLen = lstrlenW(request->path); while ((nLen >0 ) && ((request->path[nLen-1] == '\r')||(request->path[nLen-1] == '\n'))) { nLen--; @@ -617,12 +619,12 @@ static void HTTP_FixURL(http_request_t *request) }
if(CSTR_EQUAL != CompareStringW( LOCALE_INVARIANT, NORM_IGNORECASE, - request->path, strlenW(request->path), szHttp, strlenW(szHttp) ) + request->path, lstrlenW(request->path), szHttp, lstrlenW(szHttp) ) && request->path[0] != '/') /* not an absolute path ?? --> fix it !! */ { - WCHAR *fixurl = heap_alloc((strlenW(request->path) + 2)*sizeof(WCHAR)); + WCHAR *fixurl = heap_alloc((lstrlenW(request->path) + 2)*sizeof(WCHAR)); *fixurl = '/'; - strcpyW(fixurl + 1, request->path); + lstrcpyW(fixurl + 1, request->path); heap_free( request->path ); request->path = fixurl; } @@ -710,7 +712,7 @@ static WCHAR* build_response_header(http_request_t *request, BOOL use_cr) if (request->status_code) { req[n++] = request->version; - sprintfW(buf, status_fmt, request->status_code); + swprintf(buf, ARRAY_SIZE(buf), status_fmt, request->status_code); req[n++] = buf; req[n++] = request->statusText; if (use_cr) @@ -721,7 +723,7 @@ static WCHAR* build_response_header(http_request_t *request, BOOL use_cr) for(i = 0; i < request->nCustHeaders; i++) { if(!(request->custHeaders[i].wFlags & HDR_ISREQUEST) - && strcmpW(request->custHeaders[i].lpszField, szStatus)) + && wcscmp(request->custHeaders[i].lpszField, szStatus)) { req[n++] = request->custHeaders[i].lpszField; req[n++] = colonW; @@ -767,7 +769,7 @@ static void HTTP_ProcessCookies( http_request_t *request ) if (!setCookieHeader->lpszValue) continue;
- data = strchrW(setCookieHeader->lpszValue, '='); + data = wcschr(setCookieHeader->lpszValue, '='); if(!data) continue;
@@ -788,9 +790,9 @@ static void strip_spaces(LPWSTR start) str++;
if (str != start) - memmove(start, str, sizeof(WCHAR) * (strlenW(str) + 1)); + memmove(start, str, sizeof(WCHAR) * (lstrlenW(str) + 1));
- end = start + strlenW(start) - 1; + end = start + lstrlenW(start) - 1; while (end >= start && *end == ' ') { *end = '\0'; @@ -803,7 +805,7 @@ static inline BOOL is_basic_auth_value( LPCWSTR pszAuthValue, LPWSTR *pszRealm ) static const WCHAR szBasic[] = {'B','a','s','i','c'}; /* Note: not nul-terminated */ static const WCHAR szRealm[] = {'r','e','a','l','m'}; /* Note: not nul-terminated */ BOOL is_basic; - is_basic = !strncmpiW(pszAuthValue, szBasic, ARRAY_SIZE(szBasic)) && + is_basic = !wcsnicmp(pszAuthValue, szBasic, ARRAY_SIZE(szBasic)) && ((pszAuthValue[ARRAY_SIZE(szBasic)] == ' ') || !pszAuthValue[ARRAY_SIZE(szBasic)]); if (is_basic && pszRealm) { @@ -812,13 +814,13 @@ static inline BOOL is_basic_auth_value( LPCWSTR pszAuthValue, LPWSTR *pszRealm ) LPCWSTR realm; ptr++; *pszRealm=NULL; - token = strchrW(ptr,'='); + token = wcschr(ptr,'='); if (!token) return TRUE; realm = ptr; while (*realm == ' ') realm++; - if(!strncmpiW(realm, szRealm, ARRAY_SIZE(szRealm)) && + if(!wcsnicmp(realm, szRealm, ARRAY_SIZE(szRealm)) && (realm[ARRAY_SIZE(szRealm)] == ' ' || realm[ARRAY_SIZE(szRealm)] == '=')) { token++; @@ -858,7 +860,7 @@ static UINT retrieve_cached_basic_authorization(http_request_t *req, const WCHAR EnterCriticalSection(&authcache_cs); LIST_FOR_EACH_ENTRY(ad, &basicAuthorizationCache, basicAuthorizationData, entry) { - if (!strcmpiW(host, ad->host) && (!realm || !strcmpW(realm, ad->realm))) + if (!wcsicmp(host, ad->host) && (!realm || !wcscmp(realm, ad->realm))) { char *colon; DWORD length; @@ -896,7 +898,7 @@ static void cache_basic_authorization(LPWSTR host, LPWSTR realm, LPSTR auth_data LIST_FOR_EACH(cursor, &basicAuthorizationCache) { basicAuthorizationData *check = LIST_ENTRY(cursor,basicAuthorizationData,entry); - if (!strcmpiW(host,check->host) && !strcmpW(realm,check->realm)) + if (!wcsicmp(host,check->host) && !wcscmp(realm,check->realm)) { ad = check; break; @@ -934,7 +936,7 @@ static BOOL retrieve_cached_authorization(LPWSTR host, LPWSTR scheme,
EnterCriticalSection(&authcache_cs); LIST_FOR_EACH_ENTRY(ad, &authorizationCache, authorizationData, entry) { - if(!strcmpiW(host, ad->host) && !strcmpiW(scheme, ad->scheme)) { + if(!wcsicmp(host, ad->host) && !wcsicmp(scheme, ad->scheme)) { TRACE("Authorization found in cache\n");
nt_auth_identity->User = heap_strdupW(ad->user); @@ -972,7 +974,7 @@ static void cache_authorization(LPWSTR host, LPWSTR scheme,
EnterCriticalSection(&authcache_cs); LIST_FOR_EACH_ENTRY(ad, &authorizationCache, authorizationData, entry) - if(!strcmpiW(host, ad->host) && !strcmpiW(scheme, ad->scheme)) { + if(!wcsicmp(host, ad->host) && !wcsicmp(scheme, ad->scheme)) { found = TRUE; break; } @@ -1098,7 +1100,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
if (domain_and_username) { - WCHAR *user = strchrW(domain_and_username, '\'); + WCHAR *user = wcschr(domain_and_username, '\'); WCHAR *domain = domain_and_username;
/* FIXME: make sure scheme accepts SEC_WINNT_AUTH_IDENTITY before calling AcquireCredentialsHandle */ @@ -1114,11 +1116,11 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
nt_auth_identity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE; nt_auth_identity.User = user; - nt_auth_identity.UserLength = strlenW(nt_auth_identity.User); + nt_auth_identity.UserLength = lstrlenW(nt_auth_identity.User); nt_auth_identity.Domain = domain; nt_auth_identity.DomainLength = domain ? user - domain - 1 : 0; nt_auth_identity.Password = password; - nt_auth_identity.PasswordLength = strlenW(nt_auth_identity.Password); + nt_auth_identity.PasswordLength = lstrlenW(nt_auth_identity.Password);
cache_authorization(host, pAuthInfo->scheme, &nt_auth_identity); } @@ -1164,8 +1166,8 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue, else if (pAuthInfo->finished) return FALSE;
- if ((strlenW(pszAuthValue) < strlenW(pAuthInfo->scheme)) || - strncmpiW(pszAuthValue, pAuthInfo->scheme, strlenW(pAuthInfo->scheme))) + if ((lstrlenW(pszAuthValue) < lstrlenW(pAuthInfo->scheme)) || + wcsnicmp(pszAuthValue, pAuthInfo->scheme, lstrlenW(pAuthInfo->scheme))) { ERR("authentication scheme changed from %s to %s\n", debugstr_w(pAuthInfo->scheme), debugstr_w(pszAuthValue)); @@ -1235,7 +1237,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue, in_desc.cBuffers = 1; in_desc.pBuffers = ∈
- pszAuthData = pszAuthValue + strlenW(pAuthInfo->scheme); + pszAuthData = pszAuthValue + lstrlenW(pAuthInfo->scheme); if (*pszAuthData == ' ') { pszAuthData++; @@ -1301,7 +1303,7 @@ static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *request, TRACE("copying header: %s\n", debugstr_wn(lpszHeader, dwHeaderLength));
if( dwHeaderLength == ~0U ) - len = strlenW(lpszHeader); + len = lstrlenW(lpszHeader); else len = dwHeaderLength; buffer = heap_alloc(sizeof(WCHAR)*(len+1)); @@ -1377,7 +1379,7 @@ BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest,
TRACE("%p, %s, %u, %08x\n", hHttpRequest, debugstr_wn(lpszHeader, dwHeaderLength), dwHeaderLength, dwModifier);
- if (!lpszHeader) + if (!lpszHeader) return TRUE;
request = (http_request_t*) get_handle_object( hHttpRequest ); @@ -1649,7 +1651,7 @@ static UINT HTTP_DecodeBase64( LPCWSTR base64, LPSTR bin ) static WCHAR *encode_auth_data( const WCHAR *scheme, const char *data, UINT data_len ) { WCHAR *ret; - UINT len, scheme_len = strlenW( scheme ); + UINT len, scheme_len = lstrlenW( scheme );
/* scheme + space + base64 encoded data (3/2/1 bytes data -> 4 bytes of characters) */ len = scheme_len + 1 + ((data_len + 2) * 4) / 3; @@ -1681,7 +1683,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn /* clear the data as it isn't valid now that it has been sent to the * server, unless it's Basic authentication which doesn't do * connection tracking */ - if (strcmpiW(pAuthInfo->scheme, wszBasic)) + if (wcsicmp(pAuthInfo->scheme, wszBasic)) { heap_free(pAuthInfo->auth_data); pAuthInfo->auth_data = NULL; @@ -1701,7 +1703,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn char *data;
/* Don't use cached credentials when a username or Authorization was specified */ - if ((request->session->userName && request->session->userName[0]) || strcmpW(header, szAuthorization)) + if ((request->session->userName && request->session->userName[0]) || wcscmp(header, szAuthorization)) return TRUE;
if (!(host = get_host_header(request))) @@ -1735,8 +1737,8 @@ static WCHAR *build_proxy_path_url(http_request_t *req) DWORD size, len; WCHAR *url;
- len = strlenW(req->server->scheme_host_port); - size = len + strlenW(req->path) + 1; + len = lstrlenW(req->server->scheme_host_port); + size = len + lstrlenW(req->path) + 1; if(*req->path != '/') size++; url = heap_alloc(size * sizeof(WCHAR)); @@ -1747,7 +1749,7 @@ static WCHAR *build_proxy_path_url(http_request_t *req) if(*req->path != '/') url[len++] = '/';
- strcpyW(url+len, req->path); + lstrcpyW(url+len, req->path);
TRACE("url=%s\n", debugstr_w(url)); return url; @@ -1759,11 +1761,11 @@ static BOOL HTTP_DomainMatches(LPCWSTR server, substr_t domain) const WCHAR *dot, *ptr; int len;
- if(domain.len == ARRAY_SIZE(localW)-1 && !strncmpiW(domain.str, localW, domain.len) && !strchrW(server, '.' )) + if(domain.len == ARRAY_SIZE(localW)-1 && !wcsnicmp(domain.str, localW, domain.len) && !wcschr(server, '.' )) return TRUE;
if(domain.len && *domain.str != '*') - return domain.len == strlenW(server) && !strncmpiW(server, domain.str, domain.len); + return domain.len == lstrlenW(server) && !wcsnicmp(server, domain.str, domain.len);
if(domain.len < 2 || domain.str[1] != '.') return FALSE; @@ -1772,11 +1774,11 @@ static BOOL HTTP_DomainMatches(LPCWSTR server, substr_t domain) * the wildcard exactly. E.g. if the wildcard is *.a.b, and the * hostname is www.foo.a.b, it matches, but a.b does not. */ - dot = strchrW(server, '.'); + dot = wcschr(server, '.'); if(!dot) return FALSE;
- len = strlenW(dot + 1); + len = lstrlenW(dot + 1); if(len < domain.len - 2) return FALSE;
@@ -1785,7 +1787,7 @@ static BOOL HTTP_DomainMatches(LPCWSTR server, substr_t domain) * server's domain. */ ptr = dot + 1 + len - domain.len + 2; - if(!strncmpiW(ptr, domain.str+2, domain.len-2)) + if(!wcsnicmp(ptr, domain.str+2, domain.len-2)) /* This is only a match if the preceding character is * a '.', i.e. that it is a matching domain. E.g. * if domain is '*.b.c' and server is 'www.ab.c' they @@ -1793,7 +1795,7 @@ static BOOL HTTP_DomainMatches(LPCWSTR server, substr_t domain) */ return *(ptr - 1) == '.';
- return len == domain.len-2 && !strncmpiW(dot + 1, domain.str + 2, len); + return len == domain.len-2 && !wcsnicmp(dot + 1, domain.str + 2, len); }
static BOOL HTTP_ShouldBypassProxy(appinfo_t *lpwai, LPCWSTR server) @@ -1806,11 +1808,11 @@ static BOOL HTTP_ShouldBypassProxy(appinfo_t *lpwai, LPCWSTR server) while(1) { LPCWSTR tmp = ptr;
- ptr = strchrW( ptr, ';' ); + ptr = wcschr( ptr, ';' ); if (!ptr) - ptr = strchrW( tmp, ' ' ); + ptr = wcschr( tmp, ' ' ); if (!ptr) - ptr = tmp + strlenW(tmp); + ptr = tmp + lstrlenW(tmp); ret = HTTP_DomainMatches( server, substr(tmp, ptr-tmp) ); if (ret || !*ptr) break; @@ -1835,14 +1837,14 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req if(!proxy) return FALSE; if(CSTR_EQUAL != CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, - proxy, strlenW(szHttp), szHttp, strlenW(szHttp))) { - WCHAR *proxy_url = heap_alloc(strlenW(proxy)*sizeof(WCHAR) + sizeof(szHttp)); + proxy, lstrlenW(szHttp), szHttp, lstrlenW(szHttp))) { + WCHAR *proxy_url = heap_alloc(lstrlenW(proxy)*sizeof(WCHAR) + sizeof(szHttp)); if(!proxy_url) { heap_free(proxy); return FALSE; } - strcpyW(proxy_url, szHttp); - strcatW(proxy_url, proxy); + lstrcpyW(proxy_url, szHttp); + lstrcatW(proxy_url, proxy); heap_free(proxy); proxy = proxy_url; } @@ -1876,7 +1878,7 @@ static DWORD HTTP_ResolveName(http_request_t *request) INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_RESOLVING_NAME, server->name, - (strlenW(server->name)+1) * sizeof(WCHAR)); + (lstrlenW(server->name)+1) * sizeof(WCHAR));
addr_len = sizeof(server->addr); if (!GetAddress(server->name, server->port, (SOCKADDR*)&server->addr, &addr_len, server->addr_str)) @@ -1906,20 +1908,20 @@ static WCHAR *compose_request_url(http_request_t *req) else scheme = http;
- len = strlenW(scheme) + strlenW(host) + (req->path[0] != '/' ? 1 : 0) + strlenW(req->path); + len = lstrlenW(scheme) + lstrlenW(host) + (req->path[0] != '/' ? 1 : 0) + lstrlenW(req->path); ptr = buf = heap_alloc((len+1) * sizeof(WCHAR)); if(buf) { - strcpyW(ptr, scheme); - ptr += strlenW(ptr); + lstrcpyW(ptr, scheme); + ptr += lstrlenW(ptr);
- strcpyW(ptr, host); - ptr += strlenW(ptr); + lstrcpyW(ptr, host); + ptr += lstrlenW(ptr);
if(req->path[0] != '/') *ptr++ = '/';
- strcpyW(ptr, req->path); - ptr += strlenW(ptr); + lstrcpyW(ptr, req->path); + ptr += lstrlenW(ptr); *ptr = 0; }
@@ -2039,7 +2041,7 @@ static BOOL HTTP_KeepAlive(http_request_t *request) /* as per RFC 2068, S8.1.2.1, if the client is HTTP/1.1 then assume that * the connection is keep-alive by default */ if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_VERSION, szVersion, &dwBufferSize, NULL) == ERROR_SUCCESS - && !strcmpiW(szVersion, g_szHttp1_1)) + && !wcsicmp(szVersion, g_szHttp1_1)) { keepalive = TRUE; } @@ -2048,7 +2050,7 @@ static BOOL HTTP_KeepAlive(http_request_t *request) if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_PROXY_CONNECTION, szConnectionResponse, &dwBufferSize, NULL) == ERROR_SUCCESS || HTTP_HttpQueryInfoW(request, HTTP_QUERY_CONNECTION, szConnectionResponse, &dwBufferSize, NULL) == ERROR_SUCCESS) { - keepalive = !strcmpiW(szConnectionResponse, szKeepAlive); + keepalive = !wcsicmp(szConnectionResponse, szKeepAlive); }
return keepalive; @@ -2068,14 +2070,14 @@ static DWORD str_to_buffer(const WCHAR *str, void *buffer, DWORD *size, BOOL uni { WCHAR *buf = buffer;
- if (str) len = strlenW(str); + if (str) len = lstrlenW(str); else len = 0; if (*size < (len + 1) * sizeof(WCHAR)) { *size = (len + 1) * sizeof(WCHAR); return ERROR_INSUFFICIENT_BUFFER; } - if (str) strcpyW(buf, str); + if (str) lstrcpyW(buf, str); else buf[0] = 0;
*size = len; @@ -2413,7 +2415,7 @@ static void commit_cache_entry(http_request_t *req) req->hCacheFile = NULL;
header = build_response_header(req, TRUE); - header_len = (header ? strlenW(header) : 0); + header_len = (header ? lstrlenW(header) : 0); res = CommitUrlCacheEntryW(req->req_file->url, req->req_file->file_name, req->expires, req->last_modified, NORMAL_CACHE_ENTRY, header, header_len, NULL, 0); @@ -2461,12 +2463,12 @@ static void create_cache_entry(http_request_t *req) while(*ptr==' ' || *ptr=='\t') ptr++;
- end = strchrW(ptr, ','); + end = wcschr(ptr, ','); if(!end) - end = ptr + strlenW(ptr); + end = ptr + lstrlenW(ptr);
- if(!strncmpiW(ptr, no_cacheW, ARRAY_SIZE(no_cacheW)-1) - || !strncmpiW(ptr, no_storeW, ARRAY_SIZE(no_storeW)-1)) { + if(!wcsnicmp(ptr, no_cacheW, ARRAY_SIZE(no_cacheW)-1) + || !wcsnicmp(ptr, no_storeW, ARRAY_SIZE(no_storeW)-1)) { b = FALSE; break; } @@ -2929,7 +2931,7 @@ static DWORD set_content_length(http_request_t *request) WCHAR encoding[20]; DWORD size;
- if(request->status_code == HTTP_STATUS_NO_CONTENT || !strcmpW(request->verb, headW)) { + if(request->status_code == HTTP_STATUS_NO_CONTENT || !wcscmp(request->verb, headW)) { request->contentLength = request->netconn_stream.content_length = 0; return ERROR_SUCCESS; } @@ -2946,7 +2948,7 @@ static DWORD set_content_length(http_request_t *request)
size = sizeof(encoding); if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_TRANSFER_ENCODING, encoding, &size, NULL) == ERROR_SUCCESS && - !strcmpiW(encoding, szChunked)) + !wcsicmp(encoding, szChunked)) { chunked_stream_t *chunked_stream;
@@ -2979,12 +2981,12 @@ static DWORD set_content_length(http_request_t *request)
encoding_idx = HTTP_GetCustomHeaderIndex(request, szContent_Encoding, 0, FALSE); if(encoding_idx != -1) { - if(!strcmpiW(request->custHeaders[encoding_idx].lpszValue, gzipW)) { + if(!wcsicmp(request->custHeaders[encoding_idx].lpszValue, gzipW)) { HTTP_DeleteCustomHeader(request, encoding_idx); LeaveCriticalSection( &request->headers_section ); return init_gzip_stream(request, TRUE); } - if(!strcmpiW(request->custHeaders[encoding_idx].lpszValue, deflateW)) { + if(!wcsicmp(request->custHeaders[encoding_idx].lpszValue, deflateW)) { HTTP_DeleteCustomHeader(request, encoding_idx); LeaveCriticalSection( &request->headers_section ); return init_gzip_stream(request, FALSE); @@ -3083,7 +3085,7 @@ static DWORD drain_content(http_request_t *req, BOOL blocking) if(!is_valid_netconn(req->netconn)) return ERROR_NO_DATA;
- if(!strcmpW(req->verb, szHEAD)) + if(!wcscmp(req->verb, szHEAD)) return ERROR_SUCCESS;
EnterCriticalSection( &req->read_section ); @@ -3397,14 +3399,14 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session, len = 1; rc = UrlCanonicalizeW(lpszObjectName, &dummy, &len, URL_ESCAPE_SPACES_ONLY); if (rc != E_POINTER) - len = strlenW(lpszObjectName)+1; + len = lstrlenW(lpszObjectName)+1; request->path = heap_alloc(len*sizeof(WCHAR)); rc = UrlCanonicalizeW(lpszObjectName, request->path, &len, URL_ESCAPE_SPACES_ONLY); if (rc != S_OK) { ERR("Unable to escape string!(%s) (%d)\n",debugstr_w(lpszObjectName),rc); - strcpyW(request->path,lpszObjectName); + lstrcpyW(request->path,lpszObjectName); } }else { static const WCHAR slashW[] = {'/',0}; @@ -3615,7 +3617,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, return ERROR_OUTOFMEMORY; }
- len = strlenW(headers) * sizeof(WCHAR); + len = lstrlenW(headers) * sizeof(WCHAR); if (len + sizeof(WCHAR) > *lpdwBufferLength) { len += sizeof(WCHAR); @@ -3649,7 +3651,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, return ERROR_OUTOFMEMORY; }
- len = strlenW(headers) * sizeof(WCHAR); + len = lstrlenW(headers) * sizeof(WCHAR); if (len > *lpdwBufferLength) { *lpdwBufferLength = len; @@ -3680,7 +3682,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, case HTTP_QUERY_STATUS_TEXT: if (request->statusText) { - DWORD len = strlenW(request->statusText); + DWORD len = lstrlenW(request->statusText); if (len + 1 > *lpdwBufferLength/sizeof(WCHAR)) { *lpdwBufferLength = (len + 1) * sizeof(WCHAR); @@ -3700,7 +3702,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, case HTTP_QUERY_VERSION: if (request->version) { - DWORD len = strlenW(request->version); + DWORD len = lstrlenW(request->version); if (len + 1 > *lpdwBufferLength/sizeof(WCHAR)) { *lpdwBufferLength = (len + 1) * sizeof(WCHAR); @@ -3744,7 +3746,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, DWORD size; static const WCHAR formatW[] = {'%','u',0};
- size = sprintfW(buf, formatW, request->status_code) * sizeof(WCHAR); + size = swprintf(buf, ARRAY_SIZE(buf), formatW, request->status_code) * sizeof(WCHAR);
if(size <= *lpdwBufferLength) { memcpy(lpBuffer, buf, size+sizeof(WCHAR)); @@ -3790,7 +3792,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, }
errno = 0; - value = strtoulW( lphttpHdr->lpszValue, NULL, 10 ); + value = wcstoul( lphttpHdr->lpszValue, NULL, 10 ); if (value > UINT_MAX || (value == ULONG_MAX && errno == ERANGE)) { LeaveCriticalSection( &request->headers_section ); @@ -3825,7 +3827,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, } else if (lphttpHdr->lpszValue) { - DWORD len = (strlenW(lphttpHdr->lpszValue) + 1) * sizeof(WCHAR); + DWORD len = (lstrlenW(lphttpHdr->lpszValue) + 1) * sizeof(WCHAR);
if (len > *lpdwBufferLength) { @@ -3965,13 +3967,13 @@ BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, info_mod &= ~ modifier_flags[i].val; } } - + if (info_mod) { TRACE(" Unknown (%08x)", info_mod); } TRACE("\n"); } - + request = (http_request_t*) get_handle_object( hHttpRequest ); if (NULL == request || request->hdr.htype != WH_HHTTPREQ) { @@ -4133,7 +4135,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, WCHAR *url) { URL_COMPONENTSW urlComponents = { sizeof(urlComponents) }; http_session_t *session = request->session; - size_t url_len = strlenW(url); + size_t url_len = lstrlenW(url);
if(url[0] == '/') { @@ -4192,7 +4194,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, WCHAR *url)
host = substr(urlComponents.lpszHostName, urlComponents.dwHostNameLength);
- if(host.len != strlenW(request->server->name) || strncmpiW(request->server->name, host.str, host.len) + if(host.len != lstrlenW(request->server->name) || wcsnicmp(request->server->name, host.str, host.len) || request->server->port != urlComponents.nPort) { server_t *new_server;
@@ -4226,7 +4228,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, WCHAR *url) if (rc != S_OK) { ERR("Unable to escape string!(%s) (%d)\n",debugstr_w(path),rc); - strcpyW(request->path, path); + lstrcpyW(request->path, path); } heap_free(path); } @@ -4249,14 +4251,14 @@ static LPWSTR HTTP_build_req( LPCWSTR *list, int len ) LPWSTR str;
for( t = list; *t ; t++ ) - len += strlenW( *t ); + len += lstrlenW( *t ); len++;
str = heap_alloc(len*sizeof(WCHAR)); *str = 0;
for( t = list; *t ; t++ ) - strcatW( str, *t ); + lstrcatW( str, *t );
return str; } @@ -4270,7 +4272,7 @@ static void HTTP_InsertCookies(http_request_t *request) if(res != ERROR_SUCCESS || !cookies) return;
- HTTP_HttpAddRequestHeadersW(request, cookies, strlenW(cookies), + HTTP_HttpAddRequestHeadersW(request, cookies, lstrlenW(cookies), HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD); heap_free(cookies); } @@ -4286,7 +4288,7 @@ static WORD HTTP_ParseWkday(LPCWSTR day) { 's','a','t',0 }}; unsigned int i; for (i = 0; i < ARRAY_SIZE(days); i++) - if (!strcmpiW(day, days[i])) + if (!wcsicmp(day, days[i])) return i;
/* Invalid */ @@ -4308,18 +4310,18 @@ static WORD HTTP_ParseMonth(LPCWSTR month) static const WCHAR nov[] = { 'n','o','v',0 }; static const WCHAR dec[] = { 'd','e','c',0 };
- if (!strcmpiW(month, jan)) return 1; - if (!strcmpiW(month, feb)) return 2; - if (!strcmpiW(month, mar)) return 3; - if (!strcmpiW(month, apr)) return 4; - if (!strcmpiW(month, may)) return 5; - if (!strcmpiW(month, jun)) return 6; - if (!strcmpiW(month, jul)) return 7; - if (!strcmpiW(month, aug)) return 8; - if (!strcmpiW(month, sep)) return 9; - if (!strcmpiW(month, oct)) return 10; - if (!strcmpiW(month, nov)) return 11; - if (!strcmpiW(month, dec)) return 12; + if (!wcsicmp(month, jan)) return 1; + if (!wcsicmp(month, feb)) return 2; + if (!wcsicmp(month, mar)) return 3; + if (!wcsicmp(month, apr)) return 4; + if (!wcsicmp(month, may)) return 5; + if (!wcsicmp(month, jun)) return 6; + if (!wcsicmp(month, jul)) return 7; + if (!wcsicmp(month, aug)) return 8; + if (!wcsicmp(month, sep)) return 9; + if (!wcsicmp(month, oct)) return 10; + if (!wcsicmp(month, nov)) return 11; + if (!wcsicmp(month, dec)) return 12; /* Invalid */ return 0; } @@ -4335,10 +4337,10 @@ static BOOL HTTP_ParseTime(SYSTEMTIME *st, LPCWSTR *str) WCHAR *nextPtr; unsigned long num;
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
- num = strtoulW(ptr, &nextPtr, 10); + num = wcstoul(ptr, &nextPtr, 10); if (!nextPtr || nextPtr <= ptr || *nextPtr != ':') { ERR("unexpected time format %s\n", debugstr_w(ptr)); @@ -4351,7 +4353,7 @@ static BOOL HTTP_ParseTime(SYSTEMTIME *st, LPCWSTR *str) } ptr = nextPtr + 1; st->wHour = (WORD)num; - num = strtoulW(ptr, &nextPtr, 10); + num = wcstoul(ptr, &nextPtr, 10); if (!nextPtr || nextPtr <= ptr || *nextPtr != ':') { ERR("unexpected time format %s\n", debugstr_w(ptr)); @@ -4364,7 +4366,7 @@ static BOOL HTTP_ParseTime(SYSTEMTIME *st, LPCWSTR *str) } ptr = nextPtr + 1; st->wMinute = (WORD)num; - num = strtoulW(ptr, &nextPtr, 10); + num = wcstoul(ptr, &nextPtr, 10); if (!nextPtr || nextPtr <= ptr) { ERR("unexpected time format %s\n", debugstr_w(ptr)); @@ -4388,7 +4390,7 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft) SYSTEMTIME st = { 0 }; unsigned long num;
- for (ptr = value, dayPtr = day; *ptr && !isspaceW(*ptr) && + for (ptr = value, dayPtr = day; *ptr && !iswspace(*ptr) && dayPtr - day < ARRAY_SIZE(day) - 1; ptr++, dayPtr++) *dayPtr = *ptr; *dayPtr = 0; @@ -4399,10 +4401,10 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft) return FALSE; }
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
- for (monthPtr = month; !isspaceW(*ptr) && monthPtr - month < ARRAY_SIZE(month) - 1; + for (monthPtr = month; !iswspace(*ptr) && monthPtr - month < ARRAY_SIZE(month) - 1; monthPtr++, ptr++) *monthPtr = *ptr; *monthPtr = 0; @@ -4413,10 +4415,10 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft) return FALSE; }
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
- num = strtoulW(ptr, &nextPtr, 10); + num = wcstoul(ptr, &nextPtr, 10); if (!nextPtr || nextPtr <= ptr || !num || num > 31) { ERR("unexpected day %s\n", debugstr_w(ptr)); @@ -4425,16 +4427,16 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft) ptr = nextPtr; st.wDay = (WORD)num;
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
if (!HTTP_ParseTime(&st, &ptr)) return FALSE;
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
- num = strtoulW(ptr, &nextPtr, 10); + num = wcstoul(ptr, &nextPtr, 10); if (!nextPtr || nextPtr <= ptr || num < 1601 || num > 30827) { ERR("unexpected year %s\n", debugstr_w(ptr)); @@ -4443,13 +4445,13 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft) ptr = nextPtr; st.wYear = (WORD)num;
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
/* asctime() doesn't report a timezone, but some web servers do, so accept * with or without GMT. */ - if (*ptr && strcmpW(ptr, gmt)) + if (*ptr && wcscmp(ptr, gmt)) { ERR("unexpected timezone %s\n", debugstr_w(ptr)); return FALSE; @@ -4465,7 +4467,7 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft) unsigned long num; SYSTEMTIME st = { 0 };
- ptr = strchrW(value, ','); + ptr = wcschr(value, ','); if (!ptr) return FALSE; if (ptr - value != 3) @@ -4483,10 +4485,10 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft) } ptr++;
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
- num = strtoulW(ptr, &nextPtr, 10); + num = wcstoul(ptr, &nextPtr, 10); if (!nextPtr || nextPtr <= ptr || !num || num > 31) { WARN("unexpected day %s\n", debugstr_w(value)); @@ -4495,10 +4497,10 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft) ptr = nextPtr; st.wDay = (WORD)num;
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
- for (monthPtr = month; !isspaceW(*ptr) && monthPtr - month < ARRAY_SIZE(month) - 1; + for (monthPtr = month; !iswspace(*ptr) && monthPtr - month < ARRAY_SIZE(month) - 1; monthPtr++, ptr++) *monthPtr = *ptr; *monthPtr = 0; @@ -4509,10 +4511,10 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft) return FALSE; }
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
- num = strtoulW(ptr, &nextPtr, 10); + num = wcstoul(ptr, &nextPtr, 10); if (!nextPtr || nextPtr <= ptr || num < 1601 || num > 30827) { ERR("unexpected year %s\n", debugstr_w(value)); @@ -4524,10 +4526,10 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft) if (!HTTP_ParseTime(&st, &ptr)) return FALSE;
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
- if (strcmpW(ptr, gmt)) + if (wcscmp(ptr, gmt)) { ERR("unexpected time zone %s\n", debugstr_w(ptr)); return FALSE; @@ -4546,7 +4548,7 @@ static WORD HTTP_ParseWeekday(LPCWSTR day) { 's','a','t','u','r','d','a','y',0 }}; unsigned int i; for (i = 0; i < ARRAY_SIZE(days); i++) - if (!strcmpiW(day, days[i])) + if (!wcsicmp(day, days[i])) return i;
/* Invalid */ @@ -4561,7 +4563,7 @@ static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft) unsigned long num; SYSTEMTIME st = { 0 };
- ptr = strchrW(value, ','); + ptr = wcschr(value, ','); if (!ptr) return FALSE; if (ptr - value == 3) @@ -4593,10 +4595,10 @@ static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft) } ptr++;
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
- num = strtoulW(ptr, &nextPtr, 10); + num = wcstoul(ptr, &nextPtr, 10); if (!nextPtr || nextPtr <= ptr || !num || num > 31) { ERR("unexpected day %s\n", debugstr_w(value)); @@ -4630,7 +4632,7 @@ static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft) } ptr++;
- num = strtoulW(ptr, &nextPtr, 10); + num = wcstoul(ptr, &nextPtr, 10); if (!nextPtr || nextPtr <= ptr || num < 1601 || num > 30827) { ERR("unexpected year %s\n", debugstr_w(value)); @@ -4642,10 +4644,10 @@ static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft) if (!HTTP_ParseTime(&st, &ptr)) return FALSE;
- while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++;
- if (strcmpW(ptr, gmt)) + if (wcscmp(ptr, gmt)) { ERR("unexpected time zone %s\n", debugstr_w(ptr)); return FALSE; @@ -4658,12 +4660,12 @@ static BOOL HTTP_ParseDate(LPCWSTR value, FILETIME *ft) static const WCHAR zero[] = { '0',0 }; BOOL ret;
- if (!strcmpW(value, zero)) + if (!wcscmp(value, zero)) { ft->dwLowDateTime = ft->dwHighDateTime = 0; ret = TRUE; } - else if (strchrW(value, ',')) + else if (wcschr(value, ',')) { ret = HTTP_ParseRfc1123Date(value, ft); if (!ret) @@ -4700,12 +4702,12 @@ static void HTTP_ProcessExpires(http_request_t *request)
for (ptr = ccHeader->lpszValue; ptr && *ptr; ) { - LPWSTR comma = strchrW(ptr, ','), end, equal; + LPWSTR comma = wcschr(ptr, ','), end, equal;
if (comma) end = comma; else - end = ptr + strlenW(ptr); + end = ptr + lstrlenW(ptr); for (equal = end - 1; equal > ptr && *equal != '='; equal--) ; if (*equal == '=') @@ -4713,12 +4715,12 @@ static void HTTP_ProcessExpires(http_request_t *request) static const WCHAR max_age[] = { 'm','a','x','-','a','g','e',0 };
- if (!strncmpiW(ptr, max_age, equal - ptr - 1)) + if (!wcsnicmp(ptr, max_age, equal - ptr - 1)) { LPWSTR nextPtr; unsigned long age;
- age = strtoulW(equal + 1, &nextPtr, 10); + age = wcstoul(equal + 1, &nextPtr, 10); if (nextPtr > equal + 1) { LARGE_INTEGER ft; @@ -4737,7 +4739,7 @@ static void HTTP_ProcessExpires(http_request_t *request) if (comma) { ptr = comma + 1; - while (isspaceW(*ptr)) + while (iswspace(*ptr)) ptr++; } else @@ -4799,11 +4801,11 @@ static void http_process_keep_alive(http_request_t *req) EnterCriticalSection( &req->headers_section );
if ((index = HTTP_GetCustomHeaderIndex(req, szConnection, 0, FALSE)) != -1) - req->netconn->keep_alive = !strcmpiW(req->custHeaders[index].lpszValue, szKeepAlive); + req->netconn->keep_alive = !wcsicmp(req->custHeaders[index].lpszValue, szKeepAlive); else if ((index = HTTP_GetCustomHeaderIndex(req, szProxy_Connection, 0, FALSE)) != -1) - req->netconn->keep_alive = !strcmpiW(req->custHeaders[index].lpszValue, szKeepAlive); + req->netconn->keep_alive = !wcsicmp(req->custHeaders[index].lpszValue, szKeepAlive); else - req->netconn->keep_alive = !strcmpiW(req->version, g_szHttp1_1); + req->netconn->keep_alive = !wcsicmp(req->version, g_szHttp1_1);
LeaveCriticalSection( &req->headers_section ); } @@ -4902,7 +4904,7 @@ static void set_content_length_header( http_request_t *request, DWORD len, DWORD {'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','u','\r','\n',0}; WCHAR buf[ARRAY_SIZE(fmtW) + 10];
- sprintfW( buf, fmtW, len ); + swprintf( buf, ARRAY_SIZE(buf), fmtW, len ); HTTP_HttpAddRequestHeadersW( request, buf, ~0u, flags ); }
@@ -4936,7 +4938,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, HTTP_ProcessHeader(request, hostW, request->server->canon_host_port, HTTP_ADDREQ_FLAG_ADD_IF_NEW | HTTP_ADDHDR_FLAG_REQ);
- if (dwContentLength || strcmpW(request->verb, szGET)) + if (dwContentLength || wcscmp(request->verb, szGET)) { set_content_length_header(request, dwContentLength, HTTP_ADDREQ_FLAG_ADD_IF_NEW); request->bytesToWrite = dwContentLength; @@ -4947,23 +4949,23 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, static const WCHAR user_agent[] = {'U','s','e','r','-','A','g','e','n','t',':',' ','%','s','\r','\n',0}; int len;
- len = strlenW(request->session->appInfo->agent) + strlenW(user_agent); + len = lstrlenW(request->session->appInfo->agent) + lstrlenW(user_agent); agent_header = heap_alloc(len * sizeof(WCHAR)); - sprintfW(agent_header, user_agent, request->session->appInfo->agent); + swprintf(agent_header, len, user_agent, request->session->appInfo->agent);
- HTTP_HttpAddRequestHeadersW(request, agent_header, strlenW(agent_header), HTTP_ADDREQ_FLAG_ADD_IF_NEW); + HTTP_HttpAddRequestHeadersW(request, agent_header, lstrlenW(agent_header), HTTP_ADDREQ_FLAG_ADD_IF_NEW); heap_free(agent_header); } if (request->hdr.dwFlags & INTERNET_FLAG_PRAGMA_NOCACHE) { static const WCHAR pragma_nocache[] = {'P','r','a','g','m','a',':',' ','n','o','-','c','a','c','h','e','\r','\n',0}; - HTTP_HttpAddRequestHeadersW(request, pragma_nocache, strlenW(pragma_nocache), HTTP_ADDREQ_FLAG_ADD_IF_NEW); + HTTP_HttpAddRequestHeadersW(request, pragma_nocache, lstrlenW(pragma_nocache), HTTP_ADDREQ_FLAG_ADD_IF_NEW); } - if ((request->hdr.dwFlags & INTERNET_FLAG_NO_CACHE_WRITE) && strcmpW(request->verb, szGET)) + if ((request->hdr.dwFlags & INTERNET_FLAG_NO_CACHE_WRITE) && wcscmp(request->verb, szGET)) { static const WCHAR cache_control[] = {'C','a','c','h','e','-','C','o','n','t','r','o','l',':', ' ','n','o','-','c','a','c','h','e','\r','\n',0}; - HTTP_HttpAddRequestHeadersW(request, cache_control, strlenW(cache_control), HTTP_ADDREQ_FLAG_ADD_IF_NEW); + HTTP_HttpAddRequestHeadersW(request, cache_control, lstrlenW(cache_control), HTTP_ADDREQ_FLAG_ADD_IF_NEW); }
/* add the headers the caller supplied */ @@ -5084,7 +5086,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0); - + if (HTTP_GetResponseHeaders(request, &responseLen)) { http_release_netconn(request, FALSE); @@ -5128,7 +5130,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, if(!new_url) break;
- if (strcmpW(request->verb, szGET) && strcmpW(request->verb, szHEAD) && + if (wcscmp(request->verb, szGET) && wcscmp(request->verb, szHEAD) && request->status_code != HTTP_STATUS_REDIRECT_KEEP_VERB) { heap_free(request->verb); @@ -5322,7 +5324,7 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_ if(!new_url) break;
- if (strcmpW(request->verb, szGET) && strcmpW(request->verb, szHEAD) && + if (wcscmp(request->verb, szGET) && wcscmp(request->verb, szHEAD) && request->status_code != HTTP_STATUS_REDIRECT_KEEP_VERB) { heap_free(request->verb); @@ -5547,7 +5549,7 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, if (lpBuffersIn->lpcszHeader) { if (lpBuffersIn->dwHeadersLength == ~0u) - size = (strlenW( lpBuffersIn->lpcszHeader ) + 1) * sizeof(WCHAR); + size = (lstrlenW( lpBuffersIn->lpcszHeader ) + 1) * sizeof(WCHAR); else size = lpBuffersIn->dwHeadersLength * sizeof(WCHAR);
@@ -5645,7 +5647,7 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, { DWORD size;
- if (dwHeaderLength == ~0u) size = (strlenW(lpszHeaders) + 1) * sizeof(WCHAR); + if (dwHeaderLength == ~0u) size = (lstrlenW(lpszHeaders) + 1) * sizeof(WCHAR); else size = dwHeaderLength * sizeof(WCHAR);
task->headers = heap_alloc(size); @@ -5974,20 +5976,20 @@ static DWORD HTTP_GetResponseHeaders(http_request_t *request, INT *len) rc += buflen; MultiByteToWideChar( CP_ACP, 0, bufferA, buflen, buffer, MAX_REPLY_LEN ); /* check is this a status code line? */ - if (!strncmpW(buffer, g_szHttp1_0, 4)) + if (!wcsncmp(buffer, g_szHttp1_0, 4)) { /* split the version from the status code */ - status_code = strchrW( buffer, ' ' ); + status_code = wcschr( buffer, ' ' ); if( !status_code ) goto lend; *status_code++=0;
/* split the status code from the status text */ - status_text = strchrW( status_code, ' ' ); + status_text = wcschr( status_code, ' ' ); if( status_text ) *status_text++=0;
- request->status_code = atoiW(status_code); + request->status_code = wcstol(status_code, NULL, 10);
TRACE("version [%s] status code [%s] status text [%s]\n", debugstr_w(buffer), debugstr_w(status_code), debugstr_w(status_text) ); @@ -6080,7 +6082,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer)
pTokenPair = heap_alloc_zero(sizeof(*pTokenPair)*3);
- pszColon = strchrW(buffer, ':'); + pszColon = wcschr(buffer, ':'); /* must have two tokens */ if (!pszColon) { @@ -6101,7 +6103,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer)
/* skip colon */ pszColon++; - len = strlenW(pszColon); + len = lstrlenW(pszColon); pTokenPair[1] = heap_alloc((len + 1) * sizeof(WCHAR)); if (!pTokenPair[1]) { @@ -6210,8 +6212,8 @@ static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR LPWSTR lpsztmp; WCHAR ch = 0; INT len = 0; - INT origlen = strlenW(lphttpHdr->lpszValue); - INT valuelen = strlenW(value); + INT origlen = lstrlenW(lphttpHdr->lpszValue); + INT valuelen = lstrlenW(value);
if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA) { @@ -6269,7 +6271,7 @@ static INT HTTP_GetCustomHeaderIndex(http_request_t *request, LPCWSTR lpszField,
for (index = 0; index < request->nCustHeaders; index++) { - if (strcmpiW(request->custHeaders[index].lpszField, lpszField)) + if (wcsicmp(request->custHeaders[index].lpszField, lpszField)) continue;
if (request_only && !(request->custHeaders[index].wFlags & HDR_ISREQUEST)) diff --git a/dll/win32/wininet/internet.c b/dll/win32/wininet/internet.c index 8cd54d2b8e1..a10ca11ccc9 100644 --- a/dll/win32/wininet/internet.c +++ b/dll/win32/wininet/internet.c @@ -29,8 +29,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "config.h" - #include "winsock2.h" #include "ws2ipdef.h"
@@ -40,6 +38,7 @@ #include <stdlib.h> #include <ctype.h> #include <assert.h> +#include <wchar.h>
#include "windef.h" #include "winbase.h" @@ -60,8 +59,6 @@
#include "internet.h" #include "resource.h" - -#include "wine/unicode.h" #endif /* defined(__REACTOS__) */
WINE_DEFAULT_DEBUG_CHANNEL(wininet); @@ -401,11 +398,11 @@ WCHAR *INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto) { LPCWSTR end, equal;
- if (!(end = strchrW(ptr, ' '))) - end = ptr + strlenW(ptr); - if ((equal = strchrW(ptr, '=')) && equal < end && - equal - ptr == strlenW(proto) && - !strncmpiW(proto, ptr, strlenW(proto))) + if (!(end = wcschr(ptr, ' '))) + end = ptr + lstrlenW(ptr); + if ((equal = wcschr(ptr, '=')) && equal < end && + equal - ptr == lstrlenW(proto) && + !wcsnicmp(proto, ptr, lstrlenW(proto))) { ret = heap_strndupW(equal + 1, end - equal - 1); TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret)); @@ -422,9 +419,9 @@ WCHAR *INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto) { LPCWSTR end;
- if (!(end = strchrW(ptr, ' '))) - end = ptr + strlenW(ptr); - if (!strchrW(ptr, '=')) + if (!(end = wcschr(ptr, ' '))) + end = ptr + lstrlenW(ptr); + if (!wcschr(ptr, '=')) { ret = heap_strndupW(ptr, end - ptr); TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret)); @@ -514,7 +511,7 @@ static BOOL parse_proxy_url( proxyinfo_t *info, const WCHAR *url ) return TRUE; } if (!(info->proxy = heap_alloc( (uc.dwHostNameLength + 12) * sizeof(WCHAR) ))) return FALSE; - sprintfW( info->proxy, fmt, uc.dwHostNameLength, uc.lpszHostName, uc.nPort ); + swprintf( info->proxy, uc.dwHostNameLength + 12, fmt, uc.dwHostNameLength, uc.lpszHostName, uc.nPort );
if (!uc.dwUserNameLength) info->proxyUsername = NULL; else if (!(info->proxyUsername = heap_strndupW( uc.lpszUserName, uc.dwUserNameLength ))) @@ -597,13 +594,13 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi ) RegQueryValueExW( key, szProxyServer, NULL, &type, (BYTE*)szProxy, &len );
/* find the http proxy, and strip away everything else */ - p = strstrW( szProxy, szHttp ); + p = wcsstr( szProxy, szHttp ); if (p) { p += lstrlenW( szHttp ); lstrcpyW( szProxy, p ); } - p = strchrW( szProxy, ';' ); + p = wcschr( szProxy, ';' ); if (p) *p = 0;
FreeProxyInfo( lpwpi ); @@ -830,14 +827,14 @@ static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffe bufsize = *size;
if (unicode) { - DWORD len = ai->agent ? strlenW(ai->agent) : 0; + DWORD len = ai->agent ? lstrlenW(ai->agent) : 0;
*size = (len + 1) * sizeof(WCHAR); if(!buffer || bufsize < *size) return ERROR_INSUFFICIENT_BUFFER;
if (ai->agent) - strcpyW(buffer, ai->agent); + lstrcpyW(buffer, ai->agent); else *(WCHAR *)buffer = 0; /* If the buffer is copied, the returned length doesn't include @@ -1626,7 +1623,7 @@ static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp) return INTERNET_SCHEME_UNKNOWN;
for (i = 0; i < ARRAY_SIZE(url_schemes); i++) - if (!strncmpiW(lpszScheme, url_schemes[i], nMaxCmp)) + if (!wcsnicmp(lpszScheme, url_schemes[i], nMaxCmp)) return INTERNET_SCHEME_FIRST + i;
return INTERNET_SCHEME_UNKNOWN; @@ -1654,7 +1651,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF LPCWSTR lpszcp = NULL, lpszNetLoc;
TRACE("(%s %u %x %p)\n", - lpszUrl ? debugstr_wn(lpszUrl, dwUrlLength ? dwUrlLength : strlenW(lpszUrl)) : "(null)", + lpszUrl ? debugstr_wn(lpszUrl, dwUrlLength ? dwUrlLength : lstrlenW(lpszUrl)) : "(null)", dwUrlLength, dwFlags, lpUC);
if (!lpszUrl || !*lpszUrl || !lpUC) @@ -1662,7 +1659,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - if (!dwUrlLength) dwUrlLength = strlenW(lpszUrl); + if (!dwUrlLength) dwUrlLength = lstrlenW(lpszUrl);
if (dwFlags & ICU_DECODE) { @@ -1701,7 +1698,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF /* Determine if the URI is absolute. */ while (lpszap - lpszUrl < dwUrlLength) { - if (isalnumW(*lpszap) || *lpszap == '+' || *lpszap == '.' || *lpszap == '-') + if (iswalnum(*lpszap) || *lpszap == '+' || *lpszap == '.' || *lpszap == '-') { lpszap++; continue; @@ -1728,9 +1725,9 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF lpUC->nPort = INTERNET_INVALID_PORT_NUMBER;
/* Parse <params> */ - lpszParam = memchrW(lpszap, '?', dwUrlLength - (lpszap - lpszUrl)); + lpszParam = wmemchr(lpszap, '?', dwUrlLength - (lpszap - lpszUrl)); if(!lpszParam) - lpszParam = memchrW(lpszap, '#', dwUrlLength - (lpszap - lpszUrl)); + lpszParam = wmemchr(lpszap, '#', dwUrlLength - (lpszap - lpszUrl));
if(!set_url_component(&lpUC->lpszExtraInfo, &lpUC->dwExtraInfoLength, lpszParam, lpszParam ? dwUrlLength-(lpszParam-lpszUrl) : 0)) @@ -1750,7 +1747,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF { lpszcp += 2;
- lpszNetLoc = memchrW(lpszcp, '/', dwUrlLength - (lpszcp - lpszUrl)); + lpszNetLoc = wmemchr(lpszcp, '/', dwUrlLength - (lpszcp - lpszUrl)); if (lpszParam) { if (lpszNetLoc) @@ -1770,7 +1767,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF /* [<user>[<:password>]@]<host>[:<port>] */ /* First find the user and password if they exist */
- lpszHost = memchrW(lpszcp, '@', dwUrlLength - (lpszcp - lpszUrl)); + lpszHost = wmemchr(lpszcp, '@', dwUrlLength - (lpszcp - lpszUrl)); if (lpszHost == NULL || lpszHost > lpszNetLoc) { /* username and password not specified. */ @@ -1836,7 +1833,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF if(!set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, lpszHost, lpszPort - lpszHost)) return FALSE; if (lpszPort != lpszNetLoc) - lpUC->nPort = atoiW(++lpszPort); + lpUC->nPort = wcstol(++lpszPort, NULL, 10); else switch (lpUC->nScheme) { case INTERNET_SCHEME_HTTP: @@ -1884,7 +1881,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF /* Leave the parameter list in lpszUrlPath. Strip off any trailing * newlines if necessary. */ - LPWSTR lpsznewline = memchrW(lpszcp, '\n', dwUrlLength - (lpszcp - lpszUrl)); + LPWSTR lpsznewline = wmemchr(lpszcp, '\n', dwUrlLength - (lpszcp - lpszUrl)); if (lpsznewline != NULL) len = lpsznewline - lpszcp; else @@ -3364,7 +3361,7 @@ BOOL WINAPI InternetTimeFromSystemTimeW( const SYSTEMTIME* time, DWORD format, L return FALSE; }
- sprintfW( string, date, + swprintf( string, size, date, WININET_wkday[time->wDayOfWeek], time->wDay, WININET_month[time->wMonth - 1], @@ -3415,15 +3412,13 @@ BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD r * a SYSTEMTIME structure. */
- while (*s && !isalphaW( *s )) s++; + while (*s && !iswalpha( *s )) s++; if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE; time->wDayOfWeek = 7;
for (i = 0; i < 7; i++) { - if (toupperW( WININET_wkday[i][0] ) == toupperW( s[0] ) && - toupperW( WININET_wkday[i][1] ) == toupperW( s[1] ) && - toupperW( WININET_wkday[i][2] ) == toupperW( s[2] ) ) + if (!wcsnicmp( WININET_wkday[i], s, 3 )) { time->wDayOfWeek = i; break; @@ -3431,19 +3426,17 @@ BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD r }
if (time->wDayOfWeek > 6) return TRUE; - while (*s && !isdigitW( *s )) s++; - time->wDay = strtolW( s, &end, 10 ); + while (*s && !iswdigit( *s )) s++; + time->wDay = wcstol( s, &end, 10 ); s = end;
- while (*s && !isalphaW( *s )) s++; + while (*s && !iswalpha( *s )) s++; if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE; time->wMonth = 0;
for (i = 0; i < 12; i++) { - if (toupperW( WININET_month[i][0]) == toupperW( s[0] ) && - toupperW( WININET_month[i][1]) == toupperW( s[1] ) && - toupperW( WININET_month[i][2]) == toupperW( s[2] ) ) + if (!wcsnicmp( WININET_month[i], s, 3 )) { time->wMonth = i + 1; break; @@ -3451,24 +3444,24 @@ BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD r } if (time->wMonth == 0) return TRUE;
- while (*s && !isdigitW( *s )) s++; + while (*s && !iswdigit( *s )) s++; if (*s == '\0') return TRUE; - time->wYear = strtolW( s, &end, 10 ); + time->wYear = wcstol( s, &end, 10 ); s = end;
- while (*s && !isdigitW( *s )) s++; + while (*s && !iswdigit( *s )) s++; if (*s == '\0') return TRUE; - time->wHour = strtolW( s, &end, 10 ); + time->wHour = wcstol( s, &end, 10 ); s = end;
- while (*s && !isdigitW( *s )) s++; + while (*s && !iswdigit( *s )) s++; if (*s == '\0') return TRUE; - time->wMinute = strtolW( s, &end, 10 ); + time->wMinute = wcstol( s, &end, 10 ); s = end;
- while (*s && !isdigitW( *s )) s++; + while (*s && !iswdigit( *s )) s++; if (*s == '\0') return TRUE; - time->wSecond = strtolW( s, &end, 10 ); + time->wSecond = wcstol( s, &end, 10 ); s = end;
time->wMilliseconds = 0; @@ -3643,7 +3636,7 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl, urlComponents.dwPasswordLength = 1; urlComponents.dwUrlPathLength = 1; urlComponents.dwExtraInfoLength = 1; - if(!InternetCrackUrlW(lpszUrl, strlenW(lpszUrl), 0, &urlComponents)) + if(!InternetCrackUrlW(lpszUrl, lstrlenW(lpszUrl), 0, &urlComponents)) return NULL;
if ((urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS) && @@ -4191,7 +4184,7 @@ BOOL WINAPI InternetCombineUrlW(LPCWSTR lpszBaseUrl, LPCWSTR lpszRelativeUrl, #define MAX_WORD_DIGITS 5
#define URL_GET_COMP_LENGTH(url, component) ((url)->dw##component##Length ? \ - (url)->dw##component##Length : strlenW((url)->lpsz##component)) + (url)->dw##component##Length : lstrlenW((url)->lpsz##component)) #define URL_GET_COMP_LENGTHA(url, component) ((url)->dw##component##Length ? \ (url)->dw##component##Length : strlen((url)->lpsz##component))
@@ -4263,7 +4256,7 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents, if (nScheme == INTERNET_SCHEME_DEFAULT) nScheme = INTERNET_SCHEME_HTTP; scheme = INTERNET_GetSchemeString(nScheme); - *lpdwUrlLength += strlenW(scheme); + *lpdwUrlLength += lstrlenW(scheme); }
(*lpdwUrlLength)++; /* ':' */ @@ -4454,6 +4447,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, { DWORD dwLen; INTERNET_SCHEME nScheme; + WCHAR *start = lpszUrl;
static const WCHAR slashSlashW[] = {'/','/'}; static const WCHAR fmtW[] = {'%','u',0}; @@ -4498,7 +4492,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, nScheme = INTERNET_SCHEME_HTTP;
scheme = INTERNET_GetSchemeString(nScheme); - dwLen = strlenW(scheme); + dwLen = lstrlenW(scheme); memcpy(lpszUrl, scheme, dwLen * sizeof(WCHAR)); lpszUrl += dwLen; } @@ -4543,7 +4537,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, { *lpszUrl = ':'; lpszUrl++; - lpszUrl += sprintfW(lpszUrl, fmtW, lpUrlComponents->nPort); + lpszUrl += swprintf(lpszUrl, *lpdwUrlLength - (lpszUrl - start), fmtW, lpUrlComponents->nPort); }
/* add slash between hostname and path if necessary */ diff --git a/dll/win32/wininet/internet.h b/dll/win32/wininet/internet.h index 8954d071f9b..0efea473255 100644 --- a/dll/win32/wininet/internet.h +++ b/dll/win32/wininet/internet.h @@ -23,7 +23,6 @@ #ifndef _WINE_INTERNET_H_ #define _WINE_INTERNET_H_
-#include "wine/unicode.h" #include "wine/heap.h" #include "wine/list.h"
@@ -102,7 +101,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str) if(str) { DWORD size;
- size = (strlenW(str)+1)*sizeof(WCHAR); + size = (lstrlenW(str)+1)*sizeof(WCHAR); ret = heap_alloc(size); if(ret) memcpy(ret, str, size); @@ -209,7 +208,7 @@ static inline substr_t substr(const WCHAR *str, size_t len)
static inline substr_t substrz(const WCHAR *str) { - return substr(str, strlenW(str)); + return substr(str, lstrlenW(str)); }
static inline void WININET_find_data_WtoA(LPWIN32_FIND_DATAW dataW, LPWIN32_FIND_DATAA dataA) diff --git a/dll/win32/wininet/netconnection.c b/dll/win32/wininet/netconnection.c index d177d98a2a4..67a2d056a0c 100644 --- a/dll/win32/wininet/netconnection.c +++ b/dll/win32/wininet/netconnection.c @@ -1,3 +1,7 @@ +#ifdef __REACTOS__ +#define NONAMELESSUNION +#include "precomp.h" +#else /* * Wininet - networking layer * @@ -32,7 +36,6 @@ #include <stdio.h> #include <assert.h>
-#include "wine/library.h" #include "windef.h" #include "winbase.h" #include "wininet.h" @@ -40,6 +43,7 @@
#include "wine/debug.h" #include "internet.h" +#endif /* defined(__REACTOS__) */
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
diff --git a/dll/win32/wininet/precomp.h b/dll/win32/wininet/precomp.h index 5c0e05e7da1..6fb8040553e 100644 --- a/dll/win32/wininet/precomp.h +++ b/dll/win32/wininet/precomp.h @@ -1,60 +1,40 @@
#pragma once
-#include <wine/config.h> - #include <assert.h> #include <stdio.h> +#include <wchar.h>
#define _INC_WINDOWS #define COM_NO_WINDOWS_H
+#include <kefuncs.h> + #include <windef.h> #include <winbase.h> #include <winreg.h> #include <winuser.h> +#include <winnls.h> #include <wininet.h> +#include <winnetwk.h> + #define NO_SHLWAPI_STREAM #define NO_SHLWAPI_REG #define NO_SHLWAPI_GDI #include <shlwapi.h> - -#include <wine/debug.h> - -#ifdef HAVE_ARPA_INET_H -# include <arpa/inet.h> -#endif -#ifdef HAVE_NETDB_H -# include <netdb.h> -#endif -#ifdef HAVE_NETINET_IN_H -# include <sys/types.h> -# include <netinet/in.h> -#endif -#ifdef HAVE_SYS_IOCTL_H -# include <sys/ioctl.h> -#endif -#ifdef HAVE_SYS_POLL_H -# include <sys/poll.h> -#endif -#ifdef HAVE_SYS_SOCKET_H -# include <sys/socket.h> -#endif -#ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -#endif -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif - -#if defined(__MINGW32__) || defined (_MSC_VER) #include <ws2tcpip.h> -#else -#define closesocket close -#define ioctlsocket ioctl -#endif /* __MINGW32__ */ #include <iphlpapi.h> #include <dhcpcsdk.h> +#include <shlobj.h> +#include <shellapi.h> + +#include <cryptuiapi.h> + +#include <wine/debug.h> +#include <wine/exception.h>
#include "internet.h" #include "resource.h" + +/* msvcrt/ucrtbase incompatibilities */ +#define swprintf _snwprintf diff --git a/dll/win32/wininet/urlcache.c b/dll/win32/wininet/urlcache.c index 40e2afa49b8..9e3659000f9 100644 --- a/dll/win32/wininet/urlcache.c +++ b/dll/win32/wininet/urlcache.c @@ -1,3 +1,8 @@ +#ifdef __REACTOS__ +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "precomp.h" +#else /* * Wininet - Url Cache functions * @@ -45,9 +50,8 @@ #include "shellapi.h"
#include "internet.h" - -#include "wine/unicode.h" #include "wine/debug.h" +#endif /* defined(__REACTOS__) */
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
@@ -488,8 +492,8 @@ static DWORD cache_container_set_size(cache_container *container, HANDLE file, D urlcache_create_hash_table(header, NULL, &hashtable_entry);
/* Last step - create the directories */ - strcpyW(dir_path, container->path); - dir_name = dir_path + strlenW(dir_path); + lstrcpyW(dir_path, container->path); + dir_name = dir_path + lstrlenW(dir_path); dir_name[8] = 0;
GetSystemTimeAsFileTime(&ft); @@ -613,8 +617,8 @@ static DWORD cache_container_open_index(cache_container *container, DWORD blocks return ERROR_SUCCESS; }
- strcpyW(index_path, container->path); - strcatW(index_path, index_dat); + lstrcpyW(index_path, container->path); + lstrcatW(index_path, index_dat);
file = CreateFileW(index_path, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL); if(file == INVALID_HANDLE_VALUE) { @@ -763,7 +767,7 @@ static void cache_containers_init(void) const WCHAR *shpath_suffix; /* suffix on path returned by SHGetSpecialFolderPath */ const char *cache_prefix; /* prefix used to reference the container */ DWORD default_entry_type; - } DefaultContainerData[] = + } DefaultContainerData[] = { { CSIDL_INTERNET_CACHE, UrlSuffix, "", NORMAL_CACHE_ENTRY }, { CSIDL_HISTORY, HistorySuffix, "Visited:", URLHISTORY_CACHE_ENTRY }, @@ -790,8 +794,8 @@ static void cache_containers_init(void) ERR("Couldn't get path for default container %u\n", i); continue; } - path_len = strlenW(wszCachePath); - suffix_len = strlenW(DefaultContainerData[i].shpath_suffix); + path_len = lstrlenW(wszCachePath); + suffix_len = lstrlenW(DefaultContainerData[i].shpath_suffix);
if (path_len + suffix_len + 2 > MAX_PATH) { @@ -802,8 +806,8 @@ static void cache_containers_init(void) wszCachePath[path_len] = '\'; wszCachePath[path_len+1] = 0;
- strcpyW(wszMutexName, wszCachePath); - + lstrcpyW(wszMutexName, wszCachePath); + if (suffix_len) { memcpy(wszCachePath + path_len + 1, DefaultContainerData[i].shpath_suffix, (suffix_len + 1) * sizeof(WCHAR)); @@ -974,7 +978,7 @@ static urlcache_header* cache_container_lock_index(cache_container *pContainer) { TRACE("Directory[%d] = "%.8s"\n", index, pHeader->directory_data[index].name); } - + return pHeader; }
@@ -1011,7 +1015,7 @@ static BOOL urlcache_create_file_pathW( BOOL trunc_name) { LONG nRequired; - int path_len = strlenW(pContainer->path); + int path_len = lstrlenW(pContainer->path); int file_name_len = MultiByteToWideChar(CP_ACP, 0, szLocalFileName, -1, NULL, 0); if (Directory!=CACHE_CONTAINER_NO_SUBDIR && Directory>=pHeader->dirs_no) { @@ -1468,7 +1472,7 @@ static DWORD urlcache_hash_key(LPCSTR lpszKey) /* NOTE: this uses the same lookup table as SHLWAPI.UrlHash{A,W} * but the algorithm and result are not the same! */ - static const unsigned char lookupTable[256] = + static const unsigned char lookupTable[256] = { 0x01, 0x0E, 0x6E, 0x19, 0x61, 0xAE, 0x84, 0x77, 0x8A, 0xAA, 0x7D, 0x76, 0x1B, 0xE9, 0x8C, 0x33, @@ -1749,10 +1753,10 @@ static BOOL cache_container_delete_dir(LPCWSTR lpszPath) SHFILEOPSTRUCTW shfos; int ret;
- path_len = strlenW(lpszPath); + path_len = lstrlenW(lpszPath); if (path_len >= MAX_PATH) return FALSE; - strcpyW(path, lpszPath); + lstrcpyW(path, lpszPath); path[path_len + 1] = 0; /* double-NUL-terminate path */
shfos.hwnd = NULL; @@ -2358,7 +2362,7 @@ static DWORD urlcache_rate_entry(entry_url *url_entry, FILETIME *cur_time) return rating; }
-static int dword_cmp(const void *p1, const void *p2) +static int __cdecl dword_cmp(const void *p1, const void *p2) { return *(const DWORD*)p1 - *(const DWORD*)p2; } @@ -2394,7 +2398,7 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter) }
if(cache_path) { - path_len = strlenW(cache_path); + path_len = lstrlenW(cache_path); if(cache_path[path_len-1] == '\') path_len--; }else { @@ -2406,7 +2410,7 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter) { /* When cache_path==NULL only clean Temporary Internet Files */ if((!path_len && container->cache_prefix[0]==0) || - (path_len && !strncmpiW(container->path, cache_path, path_len) && + (path_len && !wcsnicmp(container->path, cache_path, path_len) && (container->path[path_len]=='\0' || container->path[path_len]=='\'))) { BOOL ret_del; @@ -2439,7 +2443,7 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter) FILETIME cur_time;
if((path_len || container->cache_prefix[0]!=0) && - (!path_len || strncmpiW(container->path, cache_path, path_len) || + (!path_len || wcsnicmp(container->path, cache_path, path_len) || (container->path[path_len]!='\0' && container->path[path_len]!='\'))) continue;
@@ -2774,7 +2778,7 @@ static BOOL urlcache_entry_create(const char *url, const char *ext, WCHAR *full_
/* Try to generate random name */ GetSystemTimeAsFileTime(&ft); - strcpyW(full_path+full_path_len+8, extW); + lstrcpyW(full_path+full_path_len+8, extW);
for(i=0; i<255; i++) { int j; @@ -2930,7 +2934,7 @@ static BOOL urlcache_entry_commit(const char *url, const WCHAR *file_name, if(file_name) { BOOL bFound = FALSE;
- if(strncmpW(file_name, container->path, lstrlenW(container->path))) { + if(wcsncmp(file_name, container->path, lstrlenW(container->path))) { ERR("path %s must begin with cache content path %s\n", debugstr_w(file_name), debugstr_w(container->path)); cache_container_unlock_index(container, header); SetLastError(ERROR_INVALID_PARAMETER); diff --git a/dll/win32/wininet/utility.c b/dll/win32/wininet/utility.c index 3be370e013f..eaa9b934d8a 100644 --- a/dll/win32/wininet/utility.c +++ b/dll/win32/wininet/utility.c @@ -51,7 +51,7 @@ time_t ConvertTimeString(LPCWSTR asctime) WCHAR tmpChar[TIME_STRING_LEN]; WCHAR *tmpChar2; struct tm t; - int timelen = strlenW(asctime); + int timelen = lstrlenW(asctime);
if(!timelen) return 0; @@ -61,7 +61,7 @@ time_t ConvertTimeString(LPCWSTR asctime) lstrcpynW(tmpChar, asctime, TIME_STRING_LEN);
/* Assert that the string is the expected length */ - if (strlenW(asctime) >= TIME_STRING_LEN) FIXME("\n"); + if (lstrlenW(asctime) >= TIME_STRING_LEN) FIXME("\n");
/* Convert a time such as 'Mon, 15 Nov 1999 16:09:35 GMT' into a SYSTEMTIME structure * We assume the time is in this format @@ -76,11 +76,11 @@ time_t ConvertTimeString(LPCWSTR asctime) tmpChar[25]='\0';
memset( &t, 0, sizeof(t) ); - t.tm_year = atoiW(tmpChar+12) - 1900; - t.tm_mday = atoiW(tmpChar+5); - t.tm_hour = atoiW(tmpChar+17); - t.tm_min = atoiW(tmpChar+20); - t.tm_sec = atoiW(tmpChar+23); + t.tm_year = wcstol(tmpChar+12, NULL, 10) - 1900; + t.tm_mday = wcstol(tmpChar+5, NULL, 10); + t.tm_hour = wcstol(tmpChar+17, NULL, 10); + t.tm_min = wcstol(tmpChar+20, NULL, 10); + t.tm_sec = wcstol(tmpChar+23, NULL, 10);
/* and month */ tmpChar2 = tmpChar + 8; diff --git a/sdk/tools/winesync/wininet.cfg b/sdk/tools/winesync/wininet.cfg index 015dcb79107..4adb963d718 100644 --- a/sdk/tools/winesync/wininet.cfg +++ b/sdk/tools/winesync/wininet.cfg @@ -5,4 +5,4 @@ files: include/wininet.h: sdk/include/psdk/wininet.h include/winineti.h: sdk/include/psdk/winineti.h tags: - wine: cee281a036cf5e9017d5a25e0cbe75c2bcd2c146 + wine: 3c31cc5836026b45a40818ec874bbbcc4d6ad982