Commit 3c31cc58 authored by Alexandre Julliard's avatar Alexandre Julliard

wininet: Build with msvcrt.

parent cee281a0
......@@ -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 \
......
......@@ -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);
......
......@@ -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;
......
......@@ -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,
......
......@@ -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"
......
......@@ -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)
......
......@@ -32,7 +32,6 @@
#include <stdio.h>
#include <assert.h>
#include "wine/library.h"
#include "windef.h"
#include "winbase.h"
#include "wininet.h"
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment