urlmon: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
dac2ea3e70
commit
42d2477edf
|
@ -4,6 +4,8 @@ IMPORTS = uuid ole32 oleaut32 shell32 rpcrt4 shlwapi wininet user32 advapi32
|
||||||
EXTRADEFS = -D_URLMON_
|
EXTRADEFS = -D_URLMON_
|
||||||
DELAYIMPORTS = advpack
|
DELAYIMPORTS = advpack
|
||||||
|
|
||||||
|
EXTRADLLFLAGS = -mno-cygwin
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
axinstall.c \
|
axinstall.c \
|
||||||
bindctx.c \
|
bindctx.c \
|
||||||
|
|
|
@ -84,8 +84,8 @@ static HRESULT extract_cab_file(install_ctx_t *ctx)
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
path_len = strlenW(ctx->tmp_dir);
|
path_len = lstrlenW(ctx->tmp_dir);
|
||||||
file_len = strlenW(ctx->file_name);
|
file_len = lstrlenW(ctx->file_name);
|
||||||
ctx->install_file = heap_alloc((path_len+file_len+2)*sizeof(WCHAR));
|
ctx->install_file = heap_alloc((path_len+file_len+2)*sizeof(WCHAR));
|
||||||
if(!ctx->install_file)
|
if(!ctx->install_file)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -149,13 +149,13 @@ static void expand_command(install_ctx_t *ctx, const WCHAR *cmd, WCHAR *buf, siz
|
||||||
|
|
||||||
static const WCHAR expand_dirW[] = {'%','E','X','T','R','A','C','T','_','D','I','R','%'};
|
static const WCHAR expand_dirW[] = {'%','E','X','T','R','A','C','T','_','D','I','R','%'};
|
||||||
|
|
||||||
while((ptr = strchrW(ptr, '%'))) {
|
while((ptr = wcschr(ptr, '%'))) {
|
||||||
if(buf)
|
if(buf)
|
||||||
memcpy(buf+len, prev_ptr, ptr-prev_ptr);
|
memcpy(buf+len, prev_ptr, ptr-prev_ptr);
|
||||||
len += ptr-prev_ptr;
|
len += ptr-prev_ptr;
|
||||||
|
|
||||||
if(!strncmpiW(ptr, expand_dirW, ARRAY_SIZE(expand_dirW))) {
|
if(!wcsnicmp(ptr, expand_dirW, ARRAY_SIZE(expand_dirW))) {
|
||||||
len2 = strlenW(ctx->tmp_dir);
|
len2 = lstrlenW(ctx->tmp_dir);
|
||||||
if(buf)
|
if(buf)
|
||||||
memcpy(buf+len, ctx->tmp_dir, len2*sizeof(WCHAR));
|
memcpy(buf+len, ctx->tmp_dir, len2*sizeof(WCHAR));
|
||||||
len += len2;
|
len += len2;
|
||||||
|
@ -172,8 +172,8 @@ static void expand_command(install_ctx_t *ctx, const WCHAR *cmd, WCHAR *buf, siz
|
||||||
}
|
}
|
||||||
|
|
||||||
if(buf)
|
if(buf)
|
||||||
strcpyW(buf+len, prev_ptr);
|
lstrcpyW(buf+len, prev_ptr);
|
||||||
*size = len + strlenW(prev_ptr) + 1;
|
*size = len + lstrlenW(prev_ptr) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
|
static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
|
||||||
|
@ -189,8 +189,8 @@ static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
|
||||||
if(!len)
|
if(!len)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
for(key = buf; *key; key += strlenW(key)+1) {
|
for(key = buf; *key; key += lstrlenW(key)+1) {
|
||||||
if(!strcmpiW(key, runW)) {
|
if(!wcsicmp(key, runW)) {
|
||||||
WCHAR *cmd;
|
WCHAR *cmd;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ static HRESULT install_inf_file(install_ctx_t *ctx)
|
||||||
if(len) {
|
if(len) {
|
||||||
default_install = FALSE;
|
default_install = FALSE;
|
||||||
|
|
||||||
for(key = buf; *key; key += strlenW(key)+1) {
|
for(key = buf; *key; key += lstrlenW(key)+1) {
|
||||||
TRACE("[Setup Hooks] key: %s\n", debugstr_w(key));
|
TRACE("[Setup Hooks] key: %s\n", debugstr_w(key));
|
||||||
|
|
||||||
len = GetPrivateProfileStringW(setup_hooksW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
|
len = GetPrivateProfileStringW(setup_hooksW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
|
||||||
|
@ -253,7 +253,7 @@ static HRESULT install_inf_file(install_ctx_t *ctx)
|
||||||
if(len) {
|
if(len) {
|
||||||
default_install = FALSE;
|
default_install = FALSE;
|
||||||
|
|
||||||
for(key = buf; *key; key += strlenW(key)+1) {
|
for(key = buf; *key; key += lstrlenW(key)+1) {
|
||||||
TRACE("[Add.Code] key: %s\n", debugstr_w(key));
|
TRACE("[Add.Code] key: %s\n", debugstr_w(key));
|
||||||
|
|
||||||
len = GetPrivateProfileStringW(add_codeW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
|
len = GetPrivateProfileStringW(add_codeW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
|
||||||
|
@ -343,7 +343,7 @@ static void update_counter(install_ctx_t *ctx, HWND hwnd)
|
||||||
}else {
|
}else {
|
||||||
WCHAR buf[100];
|
WCHAR buf[100];
|
||||||
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALLN, buf, ARRAY_SIZE(buf));
|
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALLN, buf, ARRAY_SIZE(buf));
|
||||||
sprintfW(text, buf, ctx->counter);
|
swprintf(text, ARRAY_SIZE(text), buf, ctx->counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDlgItemTextW(hwnd, ID_AXINSTALL_INSTALL_BTN, text);
|
SetDlgItemTextW(hwnd, ID_AXINSTALL_INSTALL_BTN, text);
|
||||||
|
@ -445,22 +445,22 @@ static HRESULT install_file(install_ctx_t *ctx, const WCHAR *cache_file)
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
const WCHAR *ptr, *ptr2, *ext;
|
const WCHAR *ptr, *ptr2, *ext;
|
||||||
|
|
||||||
ptr = strrchrW(path, '/');
|
ptr = wcsrchr(path, '/');
|
||||||
if(!ptr)
|
if(!ptr)
|
||||||
ptr = path;
|
ptr = path;
|
||||||
else
|
else
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
ptr2 = strrchrW(ptr, '\\');
|
ptr2 = wcsrchr(ptr, '\\');
|
||||||
if(ptr2)
|
if(ptr2)
|
||||||
ptr = ptr2+1;
|
ptr = ptr2+1;
|
||||||
|
|
||||||
ctx->file_name = ptr;
|
ctx->file_name = ptr;
|
||||||
ext = strrchrW(ptr, '.');
|
ext = wcsrchr(ptr, '.');
|
||||||
if(!ext)
|
if(!ext)
|
||||||
ext = ptr;
|
ext = ptr;
|
||||||
|
|
||||||
if(!strcmpiW(ext, cab_extW)) {
|
if(!wcsicmp(ext, cab_extW)) {
|
||||||
hres = install_cab_file(ctx);
|
hres = install_cab_file(ctx);
|
||||||
}else {
|
}else {
|
||||||
FIXME("Unsupported extension %s\n", debugstr_w(ext));
|
FIXME("Unsupported extension %s\n", debugstr_w(ext));
|
||||||
|
@ -477,7 +477,7 @@ static void failure_msgbox(install_ctx_t *ctx, HRESULT hres)
|
||||||
WCHAR buf[1024], fmt[1024];
|
WCHAR buf[1024], fmt[1024];
|
||||||
|
|
||||||
LoadStringW(urlmon_instance, IDS_AXINSTALL_FAILURE, fmt, ARRAY_SIZE(fmt));
|
LoadStringW(urlmon_instance, IDS_AXINSTALL_FAILURE, fmt, ARRAY_SIZE(fmt));
|
||||||
sprintfW(buf, fmt, hres);
|
swprintf(buf, ARRAY_SIZE(buf), fmt, hres);
|
||||||
MessageBoxW(ctx->hwnd, buf, NULL, MB_OK);
|
MessageBoxW(ctx->hwnd, buf, NULL, MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,10 +199,10 @@ static LPWSTR get_mime_clsid(LPCWSTR mime, CLSID *clsid)
|
||||||
'C','o','n','t','e','n','t',' ','T','y','p','e','\\'};
|
'C','o','n','t','e','n','t',' ','T','y','p','e','\\'};
|
||||||
static const WCHAR clsidW[] = {'C','L','S','I','D',0};
|
static const WCHAR clsidW[] = {'C','L','S','I','D',0};
|
||||||
|
|
||||||
len = strlenW(mime)+1;
|
len = lstrlenW(mime)+1;
|
||||||
key_name = heap_alloc(sizeof(mime_keyW) + len*sizeof(WCHAR));
|
key_name = heap_alloc(sizeof(mime_keyW) + len*sizeof(WCHAR));
|
||||||
memcpy(key_name, mime_keyW, sizeof(mime_keyW));
|
memcpy(key_name, mime_keyW, sizeof(mime_keyW));
|
||||||
strcpyW(key_name + ARRAY_SIZE(mime_keyW), mime);
|
lstrcpyW(key_name + ARRAY_SIZE(mime_keyW), mime);
|
||||||
|
|
||||||
res = RegOpenKeyW(HKEY_CLASSES_ROOT, key_name, &hkey);
|
res = RegOpenKeyW(HKEY_CLASSES_ROOT, key_name, &hkey);
|
||||||
heap_free(key_name);
|
heap_free(key_name);
|
||||||
|
|
|
@ -312,7 +312,7 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
|
||||||
|
|
||||||
file_handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL,
|
file_handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if(file_handle == INVALID_HANDLE_VALUE && (ptr = strrchrW(path, '#'))) {
|
if(file_handle == INVALID_HANDLE_VALUE && (ptr = wcsrchr(path, '#'))) {
|
||||||
/* If path contains fragment part, try without it. */
|
/* If path contains fragment part, try without it. */
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
file_handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL,
|
file_handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||||
|
@ -333,7 +333,7 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
|
||||||
hres = IUri_GetExtension(pUri, &ext);
|
hres = IUri_GetExtension(pUri, &ext);
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
if(hres == S_OK && *ext) {
|
if(hres == S_OK && *ext) {
|
||||||
if((ptr = strchrW(ext, '#')))
|
if((ptr = wcschr(ext, '#')))
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
hres = find_mime_from_ext(ext, &mime);
|
hres = find_mime_from_ext(ext, &mime);
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
|
|
|
@ -246,7 +246,7 @@ static ULONG send_http_request(HttpProtocol *This)
|
||||||
BOOL res;
|
BOOL res;
|
||||||
|
|
||||||
send_buffer.lpcszHeader = This->full_header;
|
send_buffer.lpcszHeader = This->full_header;
|
||||||
send_buffer.dwHeadersLength = send_buffer.dwHeadersTotal = strlenW(This->full_header);
|
send_buffer.dwHeadersLength = send_buffer.dwHeadersTotal = lstrlenW(This->full_header);
|
||||||
|
|
||||||
if(This->base.bind_info.dwBindVerb != BINDVERB_GET) {
|
if(This->base.bind_info.dwBindVerb != BINDVERB_GET) {
|
||||||
switch(This->base.bind_info.stgmedData.tymed) {
|
switch(This->base.bind_info.stgmedData.tymed) {
|
||||||
|
@ -408,7 +408,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = addl_header ? strlenW(addl_header) : 0;
|
len = addl_header ? lstrlenW(addl_header) : 0;
|
||||||
|
|
||||||
This->full_header = heap_alloc(len*sizeof(WCHAR)+sizeof(default_headersW));
|
This->full_header = heap_alloc(len*sizeof(WCHAR)+sizeof(default_headersW));
|
||||||
if(!This->full_header) {
|
if(!This->full_header) {
|
||||||
|
@ -561,7 +561,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
|
||||||
content_type = query_http_info(This, HTTP_QUERY_CONTENT_TYPE);
|
content_type = query_http_info(This, HTTP_QUERY_CONTENT_TYPE);
|
||||||
if(content_type) {
|
if(content_type) {
|
||||||
/* remove the charset, if present */
|
/* remove the charset, if present */
|
||||||
LPWSTR p = strchrW(content_type, ';');
|
LPWSTR p = wcschr(content_type, ';');
|
||||||
if (p) *p = '\0';
|
if (p) *p = '\0';
|
||||||
|
|
||||||
IInternetProtocolSink_ReportProgress(This->base.protocol_sink,
|
IInternetProtocolSink_ReportProgress(This->base.protocol_sink,
|
||||||
|
@ -579,7 +579,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
|
||||||
|
|
||||||
content_length = query_http_info(This, HTTP_QUERY_CONTENT_LENGTH);
|
content_length = query_http_info(This, HTTP_QUERY_CONTENT_LENGTH);
|
||||||
if(content_length) {
|
if(content_length) {
|
||||||
This->base.content_length = atoiW(content_length);
|
This->base.content_length = wcstol(content_length, NULL, 10);
|
||||||
heap_free(content_length);
|
heap_free(content_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ static HRESULT parse_schema(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size,
|
||||||
if(flags)
|
if(flags)
|
||||||
ERR("wrong flags\n");
|
ERR("wrong flags\n");
|
||||||
|
|
||||||
ptr = strchrW(url, ':');
|
ptr = wcschr(url, ':');
|
||||||
if(ptr)
|
if(ptr)
|
||||||
len = ptr-url;
|
len = ptr-url;
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ static HRESULT load_process_feature(INTERNETFEATURELIST feature)
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
process_name = strrchrW(module_name, '\\');
|
process_name = wcsrchr(module_name, '\\');
|
||||||
if(!process_name) {
|
if(!process_name) {
|
||||||
ERR("Invalid module file name: %s\n", debugstr_w(module_name));
|
ERR("Invalid module file name: %s\n", debugstr_w(module_name));
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
|
|
|
@ -548,12 +548,12 @@ static BOOL is_known_mime_type(const WCHAR *mime)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
|
for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
|
||||||
if(!strcmpW(mime, mime_filters_any_pos[i].mime))
|
if(!wcscmp(mime, mime_filters_any_pos[i].mime))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
|
for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
|
||||||
if(!strcmpW(mime, mime_filters[i].mime))
|
if(!wcscmp(mime, mime_filters[i].mime))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
|
||||||
if(!proposed_mime)
|
if(!proposed_mime)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
len = strlenW(proposed_mime)+1;
|
len = lstrlenW(proposed_mime)+1;
|
||||||
*ret_mime = CoTaskMemAlloc(len*sizeof(WCHAR));
|
*ret_mime = CoTaskMemAlloc(len*sizeof(WCHAR));
|
||||||
if(!*ret_mime)
|
if(!*ret_mime)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -578,15 +578,15 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(proposed_mime && (!strcmpW(proposed_mime, app_octetstreamW)
|
if(proposed_mime && (!wcscmp(proposed_mime, app_octetstreamW)
|
||||||
|| !strcmpW(proposed_mime, text_plainW)))
|
|| !wcscmp(proposed_mime, text_plainW)))
|
||||||
proposed_mime = NULL;
|
proposed_mime = NULL;
|
||||||
|
|
||||||
if(proposed_mime) {
|
if(proposed_mime) {
|
||||||
ret = proposed_mime;
|
ret = proposed_mime;
|
||||||
|
|
||||||
for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
|
for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
|
||||||
if(!strcmpW(proposed_mime, mime_filters_any_pos[i].mime)) {
|
if(!wcscmp(proposed_mime, mime_filters_any_pos[i].mime)) {
|
||||||
any_pos_mime = i;
|
any_pos_mime = i;
|
||||||
for(len=size; len>0; len--) {
|
for(len=size; len>0; len--) {
|
||||||
if(mime_filters_any_pos[i].filter(buf+size-len, len))
|
if(mime_filters_any_pos[i].filter(buf+size-len, len))
|
||||||
|
@ -600,7 +600,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
|
||||||
|
|
||||||
if(i == ARRAY_SIZE(mime_filters_any_pos)) {
|
if(i == ARRAY_SIZE(mime_filters_any_pos)) {
|
||||||
for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
|
for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
|
||||||
if(!strcmpW(proposed_mime, mime_filters[i].mime)) {
|
if(!wcscmp(proposed_mime, mime_filters[i].mime)) {
|
||||||
if(!mime_filters[i].filter(buf, size))
|
if(!mime_filters[i].filter(buf, size))
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
break;
|
break;
|
||||||
|
@ -663,7 +663,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
|
||||||
|
|
||||||
TRACE("found %s for %s\n", debugstr_w(ret), debugstr_an((const char*)buf, min(32, size)));
|
TRACE("found %s for %s\n", debugstr_w(ret), debugstr_an((const char*)buf, min(32, size)));
|
||||||
|
|
||||||
len = strlenW(ret)+1;
|
len = lstrlenW(ret)+1;
|
||||||
*ret_mime = CoTaskMemAlloc(len*sizeof(WCHAR));
|
*ret_mime = CoTaskMemAlloc(len*sizeof(WCHAR));
|
||||||
if(!*ret_mime)
|
if(!*ret_mime)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
|
@ -286,13 +286,13 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri,
|
||||||
}
|
}
|
||||||
|
|
||||||
progid = path+1; /* skip '@' symbol */
|
progid = path+1; /* skip '@' symbol */
|
||||||
colon_ptr = strchrW(path, ':');
|
colon_ptr = wcschr(path, ':');
|
||||||
if(!colon_ptr) {
|
if(!colon_ptr) {
|
||||||
SysFreeString(path);
|
SysFreeString(path);
|
||||||
return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER);
|
return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlenW(path);
|
len = lstrlenW(path);
|
||||||
display_name = heap_alloc((len+1)*sizeof(WCHAR));
|
display_name = heap_alloc((len+1)*sizeof(WCHAR));
|
||||||
memcpy(display_name, path, (len+1)*sizeof(WCHAR));
|
memcpy(display_name, path, (len+1)*sizeof(WCHAR));
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ HINTERNET get_internet_session(IInternetBindInfo *bind_info)
|
||||||
void update_user_agent(WCHAR *user_agent)
|
void update_user_agent(WCHAR *user_agent)
|
||||||
{
|
{
|
||||||
if(internet_session)
|
if(internet_session)
|
||||||
InternetSetOptionW(internet_session, INTERNET_OPTION_USER_AGENT, user_agent, strlenW(user_agent));
|
InternetSetOptionW(internet_session, INTERNET_OPTION_USER_AGENT, user_agent, lstrlenW(user_agent));
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT protocol_start(Protocol *protocol, IInternetProtocol *prot, IUri *uri,
|
HRESULT protocol_start(Protocol *protocol, IInternetProtocol *prot, IUri *uri,
|
||||||
|
|
|
@ -65,7 +65,7 @@ static const WCHAR wszZoneMapDomainsKey[] = {'S','o','f','t','w','a','r','e','\\
|
||||||
|
|
||||||
static inline BOOL is_drive_path(const WCHAR *path)
|
static inline BOOL is_drive_path(const WCHAR *path)
|
||||||
{
|
{
|
||||||
return isalphaW(*path) && *(path+1) == ':';
|
return iswalpha(*path) && *(path+1) == ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* List of schemes types Windows seems to expect to be hierarchical. */
|
/* List of schemes types Windows seems to expect to be hierarchical. */
|
||||||
|
@ -184,8 +184,8 @@ static HRESULT get_zone_from_reg(LPCWSTR schema, DWORD *zone)
|
||||||
static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_wildcard, LPCWSTR *matched)
|
static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_wildcard, LPCWSTR *matched)
|
||||||
{
|
{
|
||||||
BOOL matches = FALSE;
|
BOOL matches = FALSE;
|
||||||
DWORD pattern_len = strlenW(pattern);
|
DWORD pattern_len = lstrlenW(pattern);
|
||||||
DWORD str_len = strlenW(str);
|
DWORD str_len = lstrlenW(str);
|
||||||
|
|
||||||
TRACE("(%d) Checking if %s matches %s\n", implicit_wildcard, debugstr_w(str), debugstr_w(pattern));
|
TRACE("(%d) Checking if %s matches %s\n", implicit_wildcard, debugstr_w(str), debugstr_w(pattern));
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
|
||||||
* So in this case 'str' would have to end with ".google.com" in order
|
* So in this case 'str' would have to end with ".google.com" in order
|
||||||
* to map to this pattern.
|
* to map to this pattern.
|
||||||
*/
|
*/
|
||||||
if(str_len >= pattern_len+1 && !strcmpiW(str+(str_len-pattern_len+1), pattern+1)) {
|
if(str_len >= pattern_len+1 && !wcsicmp(str+(str_len-pattern_len+1), pattern+1)) {
|
||||||
/* Check if there's another '.' inside of the "unmatched" portion
|
/* Check if there's another '.' inside of the "unmatched" portion
|
||||||
* of 'str'.
|
* of 'str'.
|
||||||
*
|
*
|
||||||
|
@ -215,14 +215,10 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
|
||||||
* a match.
|
* a match.
|
||||||
*/
|
*/
|
||||||
const WCHAR *ptr;
|
const WCHAR *ptr;
|
||||||
if(str_len > pattern_len+1 && (ptr = memrchrW(str, '.', str_len-pattern_len-2))) {
|
for (ptr = str + str_len - pattern_len; ptr > str; ptr--) if (ptr[-1] == '.') break;
|
||||||
if(implicit_wildcard) {
|
if (ptr == str || implicit_wildcard) {
|
||||||
matches = TRUE;
|
|
||||||
*matched = ptr+1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
matches = TRUE;
|
matches = TRUE;
|
||||||
*matched = str;
|
*matched = ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(implicit_wildcard && str_len > pattern_len) {
|
} else if(implicit_wildcard && str_len > pattern_len) {
|
||||||
|
@ -241,7 +237,7 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
|
||||||
*
|
*
|
||||||
* Doesn't match the pattern.
|
* Doesn't match the pattern.
|
||||||
*/
|
*/
|
||||||
if(str[str_len-pattern_len-1] == '.' && !strcmpiW(str+(str_len-pattern_len), pattern)) {
|
if(str[str_len-pattern_len-1] == '.' && !wcsicmp(str+(str_len-pattern_len), pattern)) {
|
||||||
matches = TRUE;
|
matches = TRUE;
|
||||||
*matched = str+(str_len-pattern_len);
|
*matched = str+(str_len-pattern_len);
|
||||||
}
|
}
|
||||||
|
@ -249,7 +245,7 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
|
||||||
/* The pattern doesn't have an implicit wildcard, or an explicit wildcard,
|
/* The pattern doesn't have an implicit wildcard, or an explicit wildcard,
|
||||||
* so 'str' has to be an exact match to the 'pattern'.
|
* so 'str' has to be an exact match to the 'pattern'.
|
||||||
*/
|
*/
|
||||||
if(!strcmpiW(str, pattern)) {
|
if(!wcsicmp(str, pattern)) {
|
||||||
matches = TRUE;
|
matches = TRUE;
|
||||||
*matched = str;
|
*matched = str;
|
||||||
}
|
}
|
||||||
|
@ -409,7 +405,7 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain
|
||||||
* The mapping would only happen if the "org" key had an explicit subkey
|
* The mapping would only happen if the "org" key had an explicit subkey
|
||||||
* called "www".
|
* called "www".
|
||||||
*/
|
*/
|
||||||
if(check_domain && !domain_offset && !strchrW(host, matched-host-1))
|
if(check_domain && !domain_offset && !wcschr(host, matched-host-1))
|
||||||
found = get_zone_for_scheme(domain_key, schema, zone);
|
found = get_zone_for_scheme(domain_key, schema, zone);
|
||||||
}
|
}
|
||||||
RegCloseKey(domain_key);
|
RegCloseKey(domain_key);
|
||||||
|
@ -532,7 +528,7 @@ static HRESULT map_security_uri_to_zone(IUri *uri, DWORD *zone)
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
if(!strcmpiW(scheme, fileW)) {
|
if(!wcsicmp(scheme, fileW)) {
|
||||||
BSTR path;
|
BSTR path;
|
||||||
WCHAR *ptr, *path_start, root[20];
|
WCHAR *ptr, *path_start, root[20];
|
||||||
|
|
||||||
|
@ -547,7 +543,7 @@ static HRESULT map_security_uri_to_zone(IUri *uri, DWORD *zone)
|
||||||
else
|
else
|
||||||
path_start = path;
|
path_start = path;
|
||||||
|
|
||||||
if((ptr = strchrW(path_start, ':')) && ptr-path_start+1 < ARRAY_SIZE(root)) {
|
if((ptr = wcschr(path_start, ':')) && ptr-path_start+1 < ARRAY_SIZE(root)) {
|
||||||
UINT type;
|
UINT type;
|
||||||
|
|
||||||
memcpy(root, path_start, (ptr-path_start+1)*sizeof(WCHAR));
|
memcpy(root, path_start, (ptr-path_start+1)*sizeof(WCHAR));
|
||||||
|
@ -597,7 +593,7 @@ static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url)
|
||||||
|
|
||||||
hres = CoInternetGetSecurityUrl(url, &secur_url, PSU_SECURITY_URL_ONLY, 0);
|
hres = CoInternetGetSecurityUrl(url, &secur_url, PSU_SECURITY_URL_ONLY, 0);
|
||||||
if(hres != S_OK) {
|
if(hres != S_OK) {
|
||||||
DWORD size = strlenW(url)*sizeof(WCHAR);
|
DWORD size = lstrlenW(url)*sizeof(WCHAR);
|
||||||
|
|
||||||
secur_url = CoTaskMemAlloc(size);
|
secur_url = CoTaskMemAlloc(size);
|
||||||
if(!secur_url)
|
if(!secur_url)
|
||||||
|
@ -1322,7 +1318,7 @@ static LPDWORD build_zonemap_from_reg(void)
|
||||||
|
|
||||||
data = new_data;
|
data = new_data;
|
||||||
}
|
}
|
||||||
data[used] = atoiW(name);
|
data[used] = wcstol(name, NULL, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (used) {
|
if (used) {
|
||||||
|
@ -1875,7 +1871,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
|
||||||
if(!protocol_info)
|
if(!protocol_info)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
size = strlenW(url)+1;
|
size = lstrlenW(url)+1;
|
||||||
new_url = CoTaskMemAlloc(size*sizeof(WCHAR));
|
new_url = CoTaskMemAlloc(size*sizeof(WCHAR));
|
||||||
if(!new_url) {
|
if(!new_url) {
|
||||||
hres = E_OUTOFMEMORY;
|
hres = E_OUTOFMEMORY;
|
||||||
|
@ -1904,7 +1900,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(parse_hres != S_OK || !strcmpW(url, new_url))
|
if(parse_hres != S_OK || !wcscmp(url, new_url))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
CoTaskMemFree(alloc_url);
|
CoTaskMemFree(alloc_url);
|
||||||
|
@ -1921,7 +1917,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
|
||||||
}
|
}
|
||||||
|
|
||||||
if(action == PSU_DEFAULT && (protocol_info = get_protocol_info(url))) {
|
if(action == PSU_DEFAULT && (protocol_info = get_protocol_info(url))) {
|
||||||
size = strlenW(url)+1;
|
size = lstrlenW(url)+1;
|
||||||
new_url = CoTaskMemAlloc(size * sizeof(WCHAR));
|
new_url = CoTaskMemAlloc(size * sizeof(WCHAR));
|
||||||
if(new_url) {
|
if(new_url) {
|
||||||
new_size = 0;
|
new_size = 0;
|
||||||
|
@ -1964,7 +1960,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!alloc_url) {
|
if(!alloc_url) {
|
||||||
size = strlenW(url)+1;
|
size = lstrlenW(url)+1;
|
||||||
alloc_url = CoTaskMemAlloc(size * sizeof(WCHAR));
|
alloc_url = CoTaskMemAlloc(size * sizeof(WCHAR));
|
||||||
if(!alloc_url)
|
if(!alloc_url)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -2001,7 +1997,7 @@ HRESULT WINAPI CoInternetGetSecurityUrl(LPCWSTR pwzUrl, LPWSTR *ppwzSecUrl, PSUA
|
||||||
case URL_SCHEME_FTP:
|
case URL_SCHEME_FTP:
|
||||||
case URL_SCHEME_HTTP:
|
case URL_SCHEME_HTTP:
|
||||||
case URL_SCHEME_HTTPS:
|
case URL_SCHEME_HTTPS:
|
||||||
size = strlenW(secure_url)+1;
|
size = lstrlenW(secure_url)+1;
|
||||||
new_url = CoTaskMemAlloc(size * sizeof(WCHAR));
|
new_url = CoTaskMemAlloc(size * sizeof(WCHAR));
|
||||||
if(new_url)
|
if(new_url)
|
||||||
hres = UrlGetPartW(secure_url, new_url, &size, URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME);
|
hres = UrlGetPartW(secure_url, new_url, &size, URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME);
|
||||||
|
|
|
@ -64,7 +64,7 @@ static name_space *find_name_space(LPCWSTR protocol)
|
||||||
name_space *iter;
|
name_space *iter;
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(iter, &name_space_list, name_space, entry) {
|
LIST_FOR_EACH_ENTRY(iter, &name_space_list, name_space, entry) {
|
||||||
if(!strcmpiW(iter->protocol, protocol))
|
if(!wcsicmp(iter->protocol, protocol))
|
||||||
return iter;
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol)
|
||||||
EnterCriticalSection(&session_cs);
|
EnterCriticalSection(&session_cs);
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(iter, &name_space_list, name_space, entry) {
|
LIST_FOR_EACH_ENTRY(iter, &name_space_list, name_space, entry) {
|
||||||
if(iter->cf == cf && !strcmpiW(iter->protocol, protocol)) {
|
if(iter->cf == cf && !wcsicmp(iter->protocol, protocol)) {
|
||||||
list_remove(&iter->entry);
|
list_remove(&iter->entry);
|
||||||
|
|
||||||
LeaveCriticalSection(&session_cs);
|
LeaveCriticalSection(&session_cs);
|
||||||
|
@ -265,7 +265,7 @@ IInternetProtocol *get_mime_filter(LPCWSTR mime)
|
||||||
EnterCriticalSection(&session_cs);
|
EnterCriticalSection(&session_cs);
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(iter, &mime_filter_list, mime_filter, entry) {
|
LIST_FOR_EACH_ENTRY(iter, &mime_filter_list, mime_filter, entry) {
|
||||||
if(!strcmpW(iter->mime, mime)) {
|
if(!wcscmp(iter->mime, mime)) {
|
||||||
cf = iter->cf;
|
cf = iter->cf;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,7 @@ static HRESULT WINAPI InternetSession_UnregisterMimeFilter(IInternetSession *ifa
|
||||||
EnterCriticalSection(&session_cs);
|
EnterCriticalSection(&session_cs);
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(iter, &mime_filter_list, mime_filter, entry) {
|
LIST_FOR_EACH_ENTRY(iter, &mime_filter_list, mime_filter, entry) {
|
||||||
if(iter->cf == pCF && !strcmpW(iter->mime, pwzType)) {
|
if(iter->cf == pCF && !wcscmp(iter->mime, pwzType)) {
|
||||||
list_remove(&iter->entry);
|
list_remove(&iter->entry);
|
||||||
|
|
||||||
LeaveCriticalSection(&session_cs);
|
LeaveCriticalSection(&session_cs);
|
||||||
|
@ -561,8 +561,8 @@ static void ensure_useragent(void)
|
||||||
else
|
else
|
||||||
os_type = emptyW;
|
os_type = emptyW;
|
||||||
|
|
||||||
sprintfW(buf, formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type);
|
swprintf(buf, ARRAY_SIZE(buf), formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type);
|
||||||
len = strlenW(buf);
|
len = lstrlenW(buf);
|
||||||
|
|
||||||
size = len+40;
|
size = len+40;
|
||||||
ret = heap_alloc(size * sizeof(WCHAR));
|
ret = heap_alloc(size * sizeof(WCHAR));
|
||||||
|
|
|
@ -804,7 +804,7 @@ HRESULT WINAPI MkParseDisplayNameEx(IBindCtx *pbc, LPCWSTR szDisplayName, ULONG
|
||||||
|
|
||||||
hres = CreateURLMoniker(NULL, szDisplayName, ppmk);
|
hres = CreateURLMoniker(NULL, szDisplayName, ppmk);
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
*pchEaten = strlenW(szDisplayName);
|
*pchEaten = lstrlenW(szDisplayName);
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -887,7 +887,7 @@ HRESULT WINAPI URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller, LPCWSTR szURL, LPW
|
||||||
header, sizeof(header), NULL, NULL))
|
header, sizeof(header), NULL, NULL))
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (strlenW(cache_path) > dwBufLength)
|
if (lstrlenW(cache_path) > dwBufLength)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
lstrcpyW(szFileName, cache_path);
|
lstrcpyW(szFileName, cache_path);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
#include "urlmon_main.h"
|
#include "urlmon_main.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
@ -518,7 +519,7 @@ static inline void pct_encode_val(WCHAR val, WCHAR *dest) {
|
||||||
*/
|
*/
|
||||||
void find_domain_name(const WCHAR *host, DWORD host_len,
|
void find_domain_name(const WCHAR *host, DWORD host_len,
|
||||||
INT *domain_start) {
|
INT *domain_start) {
|
||||||
const WCHAR *last_tld, *sec_last_tld, *end;
|
const WCHAR *last_tld, *sec_last_tld, *end, *p;
|
||||||
|
|
||||||
end = host+host_len-1;
|
end = host+host_len-1;
|
||||||
|
|
||||||
|
@ -530,12 +531,18 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
|
||||||
if(host_len < 4)
|
if(host_len < 4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
last_tld = memrchrW(host, '.', host_len);
|
for (last_tld = sec_last_tld = NULL, p = host; p <= end; p++)
|
||||||
|
{
|
||||||
|
if (*p == '.')
|
||||||
|
{
|
||||||
|
sec_last_tld = last_tld;
|
||||||
|
last_tld = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!last_tld)
|
if(!last_tld)
|
||||||
/* http://hostname -> has no domain name. */
|
/* http://hostname -> has no domain name. */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sec_last_tld = memrchrW(host, '.', last_tld-host);
|
|
||||||
if(!sec_last_tld) {
|
if(!sec_last_tld) {
|
||||||
/* If the '.' is at the beginning of the host there
|
/* If the '.' is at the beginning of the host there
|
||||||
* has to be at least 3 characters in the TLD for it
|
* has to be at least 3 characters in the TLD for it
|
||||||
|
@ -586,12 +593,8 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
|
||||||
if(last_tld - (sec_last_tld+1) == 3) {
|
if(last_tld - (sec_last_tld+1) == 3) {
|
||||||
for(i = 0; i < ARRAY_SIZE(recognized_tlds); ++i) {
|
for(i = 0; i < ARRAY_SIZE(recognized_tlds); ++i) {
|
||||||
if(!StrCmpNIW(sec_last_tld+1, recognized_tlds[i].tld_name, 3)) {
|
if(!StrCmpNIW(sec_last_tld+1, recognized_tlds[i].tld_name, 3)) {
|
||||||
const WCHAR *domain = memrchrW(host, '.', sec_last_tld-host);
|
for (p = sec_last_tld; p > host; p--) if (p[-1] == '.') break;
|
||||||
|
*domain_start = p - host;
|
||||||
if(!domain)
|
|
||||||
*domain_start = 0;
|
|
||||||
else
|
|
||||||
*domain_start = (domain+1) - host;
|
|
||||||
TRACE("Found domain name %s\n", debugstr_wn(host+*domain_start,
|
TRACE("Found domain name %s\n", debugstr_wn(host+*domain_start,
|
||||||
(host+host_len)-(host+*domain_start)));
|
(host+host_len)-(host+*domain_start)));
|
||||||
return;
|
return;
|
||||||
|
@ -604,12 +607,8 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
|
||||||
* part of the TLD.
|
* part of the TLD.
|
||||||
* Ex: www.google.fo.uk -> google.fo.uk as the domain name.
|
* Ex: www.google.fo.uk -> google.fo.uk as the domain name.
|
||||||
*/
|
*/
|
||||||
const WCHAR *domain = memrchrW(host, '.', sec_last_tld-host);
|
for (p = sec_last_tld; p > host; p--) if (p[-1] == '.') break;
|
||||||
|
*domain_start = p - host;
|
||||||
if(!domain)
|
|
||||||
*domain_start = 0;
|
|
||||||
else
|
|
||||||
*domain_start = (domain+1) - host;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* The second to last TLD has more than 3 characters making it
|
/* The second to last TLD has more than 3 characters making it
|
||||||
|
@ -773,18 +772,18 @@ static BSTR pre_process_uri(LPCWSTR uri) {
|
||||||
|
|
||||||
start = uri;
|
start = uri;
|
||||||
/* Skip leading controls and whitespace. */
|
/* Skip leading controls and whitespace. */
|
||||||
while(*start && (iscntrlW(*start) || isspaceW(*start))) ++start;
|
while(*start && (iswcntrl(*start) || iswspace(*start))) ++start;
|
||||||
|
|
||||||
/* URI consisted only of control/whitespace. */
|
/* URI consisted only of control/whitespace. */
|
||||||
if(!*start)
|
if(!*start)
|
||||||
return SysAllocStringLen(NULL, 0);
|
return SysAllocStringLen(NULL, 0);
|
||||||
|
|
||||||
end = start + strlenW(start);
|
end = start + lstrlenW(start);
|
||||||
while(--end > start && (iscntrlW(*end) || isspaceW(*end)));
|
while(--end > start && (iswcntrl(*end) || iswspace(*end)));
|
||||||
|
|
||||||
len = ++end - start;
|
len = ++end - start;
|
||||||
for(ptr = start; ptr < end; ptr++) {
|
for(ptr = start; ptr < end; ptr++) {
|
||||||
if(iscntrlW(*ptr))
|
if(iswcntrl(*ptr))
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,7 +792,7 @@ static BSTR pre_process_uri(LPCWSTR uri) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for(ptr = start, ptr2=ret; ptr < end; ptr++) {
|
for(ptr = start, ptr2=ret; ptr < end; ptr++) {
|
||||||
if(!iscntrlW(*ptr))
|
if(!iswcntrl(*ptr))
|
||||||
*ptr2++ = *ptr;
|
*ptr2++ = *ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -845,9 +844,9 @@ static DWORD ui2ipv4(WCHAR *dest, UINT address) {
|
||||||
|
|
||||||
if(!dest) {
|
if(!dest) {
|
||||||
WCHAR tmp[16];
|
WCHAR tmp[16];
|
||||||
ret = sprintfW(tmp, formatW, digits[0], digits[1], digits[2], digits[3]);
|
ret = swprintf(tmp, ARRAY_SIZE(tmp), formatW, digits[0], digits[1], digits[2], digits[3]);
|
||||||
} else
|
} else
|
||||||
ret = sprintfW(dest, formatW, digits[0], digits[1], digits[2], digits[3]);
|
ret = swprintf(dest, 16, formatW, digits[0], digits[1], digits[2], digits[3]);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -858,9 +857,9 @@ static DWORD ui2str(WCHAR *dest, UINT value) {
|
||||||
|
|
||||||
if(!dest) {
|
if(!dest) {
|
||||||
WCHAR tmp[11];
|
WCHAR tmp[11];
|
||||||
ret = sprintfW(tmp, formatW, value);
|
ret = swprintf(tmp, ARRAY_SIZE(tmp), formatW, value);
|
||||||
} else
|
} else
|
||||||
ret = sprintfW(dest, formatW, value);
|
ret = swprintf(dest, 11, formatW, value);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1987,7 +1986,7 @@ static BOOL parse_hierpart(const WCHAR **ptr, parse_data *data, DWORD flags) {
|
||||||
/* For javascript: URIs, simply set everything as a path */
|
/* For javascript: URIs, simply set everything as a path */
|
||||||
if(data->scheme_type == URL_SCHEME_JAVASCRIPT) {
|
if(data->scheme_type == URL_SCHEME_JAVASCRIPT) {
|
||||||
data->path = *ptr;
|
data->path = *ptr;
|
||||||
data->path_len = strlenW(*ptr);
|
data->path_len = lstrlenW(*ptr);
|
||||||
data->is_opaque = TRUE;
|
data->is_opaque = TRUE;
|
||||||
*ptr += data->path_len;
|
*ptr += data->path_len;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -2339,9 +2338,9 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
|
||||||
/* If NO_CANONICALIZE is not set, then windows lower cases the
|
/* If NO_CANONICALIZE is not set, then windows lower cases the
|
||||||
* decoded value.
|
* decoded value.
|
||||||
*/
|
*/
|
||||||
if(!(flags & Uri_CREATE_NO_CANONICALIZE) && isupperW(val)) {
|
if(!(flags & Uri_CREATE_NO_CANONICALIZE) && iswupper(val)) {
|
||||||
if(!computeOnly)
|
if(!computeOnly)
|
||||||
uri->canon_uri[uri->canon_len] = tolowerW(val);
|
uri->canon_uri[uri->canon_len] = towlower(val);
|
||||||
} else {
|
} else {
|
||||||
if(!computeOnly)
|
if(!computeOnly)
|
||||||
uri->canon_uri[uri->canon_len] = val;
|
uri->canon_uri[uri->canon_len] = val;
|
||||||
|
@ -2369,8 +2368,8 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
|
||||||
|
|
||||||
/* The percent encoded value gets lower cased also. */
|
/* The percent encoded value gets lower cased also. */
|
||||||
if(!(flags & Uri_CREATE_NO_CANONICALIZE)) {
|
if(!(flags & Uri_CREATE_NO_CANONICALIZE)) {
|
||||||
uri->canon_uri[uri->canon_len+1] = tolowerW(uri->canon_uri[uri->canon_len+1]);
|
uri->canon_uri[uri->canon_len+1] = towlower(uri->canon_uri[uri->canon_len+1]);
|
||||||
uri->canon_uri[uri->canon_len+2] = tolowerW(uri->canon_uri[uri->canon_len+2]);
|
uri->canon_uri[uri->canon_len+2] = towlower(uri->canon_uri[uri->canon_len+2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2378,7 +2377,7 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
|
||||||
} else {
|
} else {
|
||||||
if(!computeOnly) {
|
if(!computeOnly) {
|
||||||
if(!(flags & Uri_CREATE_NO_CANONICALIZE) && known_scheme)
|
if(!(flags & Uri_CREATE_NO_CANONICALIZE) && known_scheme)
|
||||||
uri->canon_uri[uri->canon_len] = tolowerW(*ptr);
|
uri->canon_uri[uri->canon_len] = towlower(*ptr);
|
||||||
else
|
else
|
||||||
uri->canon_uri[uri->canon_len] = *ptr;
|
uri->canon_uri[uri->canon_len] = *ptr;
|
||||||
}
|
}
|
||||||
|
@ -2645,11 +2644,11 @@ static BOOL canonicalize_ipv6address(const parse_data *data, Uri *uri,
|
||||||
static const WCHAR formatW[] = {'%','x',0};
|
static const WCHAR formatW[] = {'%','x',0};
|
||||||
|
|
||||||
if(!computeOnly)
|
if(!computeOnly)
|
||||||
uri->canon_len += sprintfW(uri->canon_uri+uri->canon_len,
|
uri->canon_len += swprintf(uri->canon_uri+uri->canon_len, 5,
|
||||||
formatW, values[i]);
|
formatW, values[i]);
|
||||||
else {
|
else {
|
||||||
WCHAR tmp[5];
|
WCHAR tmp[5];
|
||||||
uri->canon_len += sprintfW(tmp, formatW, values[i]);
|
uri->canon_len += swprintf(tmp, ARRAY_SIZE(tmp), formatW, values[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3307,7 +3306,7 @@ static BOOL canonicalize_scheme(const parse_data *data, Uri *uri, DWORD flags, B
|
||||||
|
|
||||||
for(i = 0; i < data->scheme_len; ++i) {
|
for(i = 0; i < data->scheme_len; ++i) {
|
||||||
/* Scheme name must be lower case after canonicalization. */
|
/* Scheme name must be lower case after canonicalization. */
|
||||||
uri->canon_uri[i + pos] = tolowerW(data->scheme[i]);
|
uri->canon_uri[i + pos] = towlower(data->scheme[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uri->canon_uri[i + pos] = ':';
|
uri->canon_uri[i + pos] = ':';
|
||||||
|
@ -3889,7 +3888,7 @@ static HRESULT compare_file_paths(const Uri *a, const Uri *b, BOOL *ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fast path */
|
/* Fast path */
|
||||||
if(a->path_len == b->path_len && !strncmpiW(a->canon_uri+a->path_start, b->canon_uri+b->path_start, a->path_len)) {
|
if(a->path_len == b->path_len && !wcsnicmp(a->canon_uri+a->path_start, b->canon_uri+b->path_start, a->path_len)) {
|
||||||
*ret = TRUE;
|
*ret = TRUE;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -3909,7 +3908,7 @@ static HRESULT compare_file_paths(const Uri *a, const Uri *b, BOOL *ret)
|
||||||
len_a = canonicalize_path_hierarchical(a->canon_uri+a->path_start, a->path_len, a->scheme_type, FALSE, 0, FALSE, canon_path_a);
|
len_a = canonicalize_path_hierarchical(a->canon_uri+a->path_start, a->path_len, a->scheme_type, FALSE, 0, FALSE, canon_path_a);
|
||||||
len_b = canonicalize_path_hierarchical(b->canon_uri+b->path_start, b->path_len, b->scheme_type, FALSE, 0, FALSE, canon_path_b);
|
len_b = canonicalize_path_hierarchical(b->canon_uri+b->path_start, b->path_len, b->scheme_type, FALSE, 0, FALSE, canon_path_b);
|
||||||
|
|
||||||
*ret = len_a == len_b && !strncmpiW(canon_path_a, canon_path_b, len_a);
|
*ret = len_a == len_b && !wcsnicmp(canon_path_a, canon_path_b, len_a);
|
||||||
|
|
||||||
heap_free(canon_path_a);
|
heap_free(canon_path_a);
|
||||||
heap_free(canon_path_b);
|
heap_free(canon_path_b);
|
||||||
|
@ -6417,21 +6416,18 @@ static HRESULT merge_paths(parse_data *data, const WCHAR *base, DWORD base_len,
|
||||||
|
|
||||||
/* If not found, try finding the end of @xxx: */
|
/* If not found, try finding the end of @xxx: */
|
||||||
if(end == base+base_len-1)
|
if(end == base+base_len-1)
|
||||||
end = *base == '@' ? memchr(base, ':', base_len) : NULL;
|
end = *base == '@' ? wmemchr(base, ':', base_len) : NULL;
|
||||||
}else {
|
}else {
|
||||||
/* Find the characters that will be copied over from the base path. */
|
/* Find the characters that will be copied over from the base path. */
|
||||||
end = memrchrW(base, '/', base_len);
|
for (end = base + base_len - 1; end >= base; end--) if (*end == '/') break;
|
||||||
if(!end && data->scheme_type == URL_SCHEME_FILE)
|
if(end < base && data->scheme_type == URL_SCHEME_FILE)
|
||||||
/* Try looking for a '\\'. */
|
/* Try looking for a '\\'. */
|
||||||
end = memrchrW(base, '\\', base_len);
|
for (end = base + base_len - 1; end >= base; end--) if (*end == '\\') break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(end) {
|
if (end) base_copy_len = (end+1)-base;
|
||||||
base_copy_len = (end+1)-base;
|
*result = heap_alloc((base_copy_len+relative_len+1)*sizeof(WCHAR));
|
||||||
*result = heap_alloc((base_copy_len+relative_len+1)*sizeof(WCHAR));
|
|
||||||
} else
|
|
||||||
*result = heap_alloc((relative_len+1)*sizeof(WCHAR));
|
|
||||||
|
|
||||||
if(!(*result)) {
|
if(!(*result)) {
|
||||||
*result_len = 0;
|
*result_len = 0;
|
||||||
|
@ -6439,10 +6435,8 @@ static HRESULT merge_paths(parse_data *data, const WCHAR *base, DWORD base_len,
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = *result;
|
ptr = *result;
|
||||||
if(end) {
|
memcpy(ptr, base, base_copy_len*sizeof(WCHAR));
|
||||||
memcpy(ptr, base, base_copy_len*sizeof(WCHAR));
|
ptr += base_copy_len;
|
||||||
ptr += base_copy_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(ptr, relative, relative_len*sizeof(WCHAR));
|
memcpy(ptr, relative, relative_len*sizeof(WCHAR));
|
||||||
ptr += relative_len;
|
ptr += relative_len;
|
||||||
|
|
|
@ -608,7 +608,7 @@ HRESULT WINAPI CopyStgMedium(const STGMEDIUM *src, STGMEDIUM *dst)
|
||||||
break;
|
break;
|
||||||
case TYMED_FILE:
|
case TYMED_FILE:
|
||||||
if(src->u.lpszFileName && !src->pUnkForRelease) {
|
if(src->u.lpszFileName && !src->pUnkForRelease) {
|
||||||
DWORD size = (strlenW(src->u.lpszFileName)+1)*sizeof(WCHAR);
|
DWORD size = (lstrlenW(src->u.lpszFileName)+1)*sizeof(WCHAR);
|
||||||
dst->u.lpszFileName = CoTaskMemAlloc(size);
|
dst->u.lpszFileName = CoTaskMemAlloc(size);
|
||||||
if(!dst->u.lpszFileName)
|
if(!dst->u.lpszFileName)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -674,7 +674,7 @@ HRESULT WINAPI CopyBindInfo(const BINDINFO *pcbiSrc, BINDINFO *pcbiDest)
|
||||||
|
|
||||||
size = FIELD_OFFSET(BINDINFO, szExtraInfo)+sizeof(void*);
|
size = FIELD_OFFSET(BINDINFO, szExtraInfo)+sizeof(void*);
|
||||||
if(pcbiSrc->cbSize>=size && pcbiDest->cbSize>=size && pcbiSrc->szExtraInfo) {
|
if(pcbiSrc->cbSize>=size && pcbiDest->cbSize>=size && pcbiSrc->szExtraInfo) {
|
||||||
size = (strlenW(pcbiSrc->szExtraInfo)+1)*sizeof(WCHAR);
|
size = (lstrlenW(pcbiSrc->szExtraInfo)+1)*sizeof(WCHAR);
|
||||||
pcbiDest->szExtraInfo = CoTaskMemAlloc(size);
|
pcbiDest->szExtraInfo = CoTaskMemAlloc(size);
|
||||||
if(!pcbiDest->szExtraInfo)
|
if(!pcbiDest->szExtraInfo)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -692,7 +692,7 @@ HRESULT WINAPI CopyBindInfo(const BINDINFO *pcbiSrc, BINDINFO *pcbiDest)
|
||||||
|
|
||||||
size = FIELD_OFFSET(BINDINFO, szCustomVerb)+sizeof(void*);
|
size = FIELD_OFFSET(BINDINFO, szCustomVerb)+sizeof(void*);
|
||||||
if(pcbiSrc->cbSize>=size && pcbiDest->cbSize>=size && pcbiSrc->szCustomVerb) {
|
if(pcbiSrc->cbSize>=size && pcbiDest->cbSize>=size && pcbiSrc->szCustomVerb) {
|
||||||
size = (strlenW(pcbiSrc->szCustomVerb)+1)*sizeof(WCHAR);
|
size = (lstrlenW(pcbiSrc->szCustomVerb)+1)*sizeof(WCHAR);
|
||||||
pcbiDest->szCustomVerb = CoTaskMemAlloc(size);
|
pcbiDest->szCustomVerb = CoTaskMemAlloc(size);
|
||||||
if(!pcbiDest->szCustomVerb) {
|
if(!pcbiDest->szCustomVerb) {
|
||||||
CoTaskMemFree(pcbiDest->szExtraInfo);
|
CoTaskMemFree(pcbiDest->szExtraInfo);
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "urlmon.h"
|
#include "urlmon.h"
|
||||||
#include "wininet.h"
|
#include "wininet.h"
|
||||||
|
|
||||||
#include "wine/unicode.h"
|
|
||||||
#include "wine/heap.h"
|
#include "wine/heap.h"
|
||||||
#include "wine/list.h"
|
#include "wine/list.h"
|
||||||
|
|
||||||
|
@ -244,7 +243,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
|
||||||
if(str) {
|
if(str) {
|
||||||
DWORD size;
|
DWORD size;
|
||||||
|
|
||||||
size = (strlenW(str)+1)*sizeof(WCHAR);
|
size = (lstrlenW(str)+1)*sizeof(WCHAR);
|
||||||
ret = heap_alloc(size);
|
ret = heap_alloc(size);
|
||||||
if(ret)
|
if(ret)
|
||||||
memcpy(ret, str, size);
|
memcpy(ret, str, size);
|
||||||
|
|
Loading…
Reference in New Issue