wininet: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-11-25 13:30:14 +01:00
parent cee281a036
commit 3c31cc5836
11 changed files with 268 additions and 282 deletions

View file

@ -4,6 +4,8 @@ IMPORTLIB = wininet
IMPORTS = mpr shlwapi shell32 user32 ws2_32 advapi32
DELAYIMPORTS = secur32 crypt32 cryptui dhcpcsvc iphlpapi
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
cookie.c \
dialogs.c \

View file

@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <wchar.h>
#include "windef.h"
#include "winbase.h"
@ -173,7 +174,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 +195,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 +266,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 +295,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 +604,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 +625,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 +873,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 +925,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 +950,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 +964,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 +987,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 +1000,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 +1099,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);

View file

@ -35,9 +35,6 @@
#include "cryptuiapi.h"
#include "internet.h"
#include "wine/unicode.h"
#include "resource.h"
#define MAX_STRING_LEN 1024
@ -78,8 +75,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 +87,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;
}
@ -137,11 +134,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 +146,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;

View file

@ -834,8 +834,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);
@ -2480,7 +2480,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 +2497,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);
@ -2525,7 +2525,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
}
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))
@ -3098,7 +3098,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,

View file

@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"

File diff suppressed because it is too large Load diff

View file

@ -26,8 +26,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "winsock2.h"
#include "ws2ipdef.h"
@ -37,6 +35,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include <wchar.h>
#include "windef.h"
#include "winbase.h"
@ -58,8 +57,6 @@
#include "internet.h"
#include "resource.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
typedef struct
@ -397,11 +394,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));
@ -418,9 +415,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));
@ -510,7 +507,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 )))
@ -593,13 +590,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 );
@ -826,14 +823,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
@ -1619,7 +1616,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;
@ -1647,7 +1644,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)
@ -1655,7 +1652,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)
{
@ -1694,7 +1691,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;
@ -1721,9 +1718,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))
@ -1743,7 +1740,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)
@ -1763,7 +1760,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. */
@ -1829,7 +1826,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:
@ -1877,7 +1874,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
@ -3347,7 +3344,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],
@ -3398,15 +3395,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;
@ -3414,19 +3409,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;
@ -3434,24 +3427,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;
@ -3626,7 +3619,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) &&
@ -4174,7 +4167,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))
@ -4246,7 +4239,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)++; /* ':' */
@ -4437,6 +4430,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};
@ -4481,7 +4475,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;
}
@ -4526,7 +4520,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 */

View file

@ -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)

View file

@ -32,7 +32,6 @@
#include <stdio.h>
#include <assert.h>
#include "wine/library.h"
#include "windef.h"
#include "winbase.h"
#include "wininet.h"

View file

@ -45,8 +45,6 @@
#include "shellapi.h"
#include "internet.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
@ -486,8 +484,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);
@ -611,8 +609,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) {
@ -779,8 +777,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)
{
@ -791,7 +789,7 @@ static void cache_containers_init(void)
wszCachePath[path_len] = '\\';
wszCachePath[path_len+1] = 0;
strcpyW(wszMutexName, wszCachePath);
lstrcpyW(wszMutexName, wszCachePath);
if (suffix_len)
{
@ -984,7 +982,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)
{
@ -1722,10 +1720,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;
@ -2331,7 +2329,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;
}
@ -2367,7 +2365,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 {
@ -2379,7 +2377,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;
@ -2412,7 +2410,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;
@ -2747,7 +2745,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;
@ -2903,7 +2901,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);

View file

@ -46,7 +46,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;
@ -56,7 +56,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
@ -71,11 +71,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;