[URLMON] Sync with Wine Staging 2.2. CORE-12823

1b04cf1 urlmon: Remove 'stub' from implemented functions trace message.
8f23a89 urlmon: Fix FindMimeFromData spec file entry.
32671b1 urlmon: Added Seek implementations for streams using cache file.
aa2ed73 urlmon: Correctly handle INTERNET_STATUS_REQUEST_COMPLETE notification with no data available.
22b4599 urlmon: Fix buffer overflow in parse_canonicalize.

svn path=/trunk/; revision=74195
This commit is contained in:
Amine Khaldi 2017-03-19 16:57:50 +00:00
parent 4fba105205
commit 8b55390e8d
6 changed files with 62 additions and 28 deletions

View file

@ -512,8 +512,40 @@ static HRESULT WINAPI ProtocolStream_Seek(IStream *iface, LARGE_INTEGER dlibMove
DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
{
ProtocolStream *This = impl_from_IStream(iface);
FIXME("(%p)->(%d %08x %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
return E_NOTIMPL;
LARGE_INTEGER new_pos;
DWORD method;
TRACE("(%p)->(%d %08x %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
if(This->buf->file == INVALID_HANDLE_VALUE) {
/* We should probably call protocol handler's Seek. */
FIXME("no cache file, not supported\n");
return E_FAIL;
}
switch(dwOrigin) {
case STREAM_SEEK_SET:
method = FILE_BEGIN;
break;
case STREAM_SEEK_CUR:
method = FILE_CURRENT;
break;
case STREAM_SEEK_END:
method = FILE_END;
break;
default:
WARN("Invalid origin %x\n", dwOrigin);
return E_FAIL;
}
if(!SetFilePointerEx(This->buf->file, dlibMove, &new_pos, method)) {
FIXME("SetFilePointerEx failed: %u\n", GetLastError());
return E_FAIL;
}
if(plibNewPosition)
plibNewPosition->QuadPart = new_pos.QuadPart;
return S_OK;
}
static HRESULT WINAPI ProtocolStream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)

View file

@ -482,7 +482,7 @@ HRESULT WINAPI CoInternetQueryInfo(LPCWSTR pwzUrl, QUERYOPTION QueryOption,
IInternetProtocolInfo *protocol_info;
HRESULT hres;
TRACE("(%s, %x, %x, %p, %x, %p, %x): stub\n", debugstr_w(pwzUrl),
TRACE("(%s, %x, %x, %p, %x, %p, %x)\n", debugstr_w(pwzUrl),
QueryOption, dwQueryFlags, pvBuffer, cbBuffer, pcbBuffer, dwReserved);
protocol_info = get_protocol_info(pwzUrl);

View file

@ -391,13 +391,7 @@ HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data)
if(res) {
TRACE("available %u bytes\n", protocol->query_available);
if(!protocol->query_available) {
if(is_start) {
TRACE("empty file\n");
all_data_read(protocol);
}else {
WARN("unexpected end of file?\n");
report_result(protocol, INET_E_DOWNLOAD_FAILURE);
}
all_data_read(protocol);
return S_OK;
}
protocol->available_bytes = protocol->query_available;

View file

@ -6760,7 +6760,7 @@ HRESULT WINAPI CoInternetCombineUrlEx(IUri *pBaseUri, LPCWSTR pwzRelativeUrl, DW
HRESULT hr;
IInternetProtocolInfo *info;
TRACE("(%p %s %x %p %x) stub\n", pBaseUri, debugstr_w(pwzRelativeUrl), dwCombineFlags,
TRACE("(%p %s %x %p %x)\n", pBaseUri, debugstr_w(pwzRelativeUrl), dwCombineFlags,
ppCombinedUri, (DWORD)dwReserved);
if(!ppCombinedUri)
@ -6817,7 +6817,6 @@ static HRESULT parse_canonicalize(const Uri *uri, DWORD flags, LPWSTR output,
const WCHAR *ptr = NULL;
WCHAR *path = NULL;
const WCHAR **pptr;
WCHAR buffer[INTERNET_MAX_URL_LENGTH+1];
DWORD len = 0;
BOOL reduce_path;
@ -6844,11 +6843,11 @@ static HRESULT parse_canonicalize(const Uri *uri, DWORD flags, LPWSTR output,
* it later.
*/
if(reduce_path && !path && ptr == uri->canon_uri+uri->path_start)
path = buffer+len;
path = output+len;
/* Check if it's time to reduce the path. */
if(reduce_path && ptr == uri->canon_uri+uri->path_start+uri->path_len) {
DWORD current_path_len = (buffer+len) - path;
DWORD current_path_len = (output+len) - path;
DWORD new_path_len = remove_dot_segments(path, current_path_len);
/* Update the current length. */
@ -6860,7 +6859,9 @@ static HRESULT parse_canonicalize(const Uri *uri, DWORD flags, LPWSTR output,
const WCHAR decoded = decode_pct_val(ptr);
if(decoded) {
if(allow_unescape && (flags & URL_UNESCAPE)) {
buffer[len++] = decoded;
if(len < output_len)
output[len] = decoded;
len++;
ptr += 2;
do_default_action = FALSE;
}
@ -6868,48 +6869,55 @@ static HRESULT parse_canonicalize(const Uri *uri, DWORD flags, LPWSTR output,
/* See if %'s needed to encoded. */
if(do_default_action && (flags & URL_ESCAPE_PERCENT)) {
pct_encode_val(*ptr, buffer+len);
if(len + 3 < output_len)
pct_encode_val(*ptr, output+len);
len += 3;
do_default_action = FALSE;
}
} else if(*ptr == ' ') {
if((flags & URL_ESCAPE_SPACES_ONLY) &&
!(flags & URL_ESCAPE_UNSAFE)) {
pct_encode_val(*ptr, buffer+len);
if(len + 3 < output_len)
pct_encode_val(*ptr, output+len);
len += 3;
do_default_action = FALSE;
}
} else if(!is_reserved(*ptr) && !is_unreserved(*ptr)) {
if(flags & URL_ESCAPE_UNSAFE) {
pct_encode_val(*ptr, buffer+len);
if(len + 3 < output_len)
pct_encode_val(*ptr, output+len);
len += 3;
do_default_action = FALSE;
}
}
if(do_default_action)
buffer[len++] = *ptr;
if(do_default_action) {
if(len < output_len)
output[len] = *ptr;
len++;
}
}
/* Sometimes the path is the very last component of the IUri, so
* see if the dot segments need to be reduced now.
*/
if(reduce_path && path) {
DWORD current_path_len = (buffer+len) - path;
DWORD current_path_len = (output+len) - path;
DWORD new_path_len = remove_dot_segments(path, current_path_len);
/* Update the current length. */
len -= (current_path_len-new_path_len);
}
buffer[len++] = 0;
if(len < output_len)
output[len] = 0;
else
output[output_len-1] = 0;
/* The null terminator isn't included in the length. */
*result_len = len-1;
if(len > output_len)
*result_len = len;
if(len >= output_len)
return STRSAFE_E_INSUFFICIENT_BUFFER;
else
memcpy(output, buffer, len*sizeof(WCHAR));
return S_OK;
}

View file

@ -65,7 +65,7 @@
164 stdcall FaultInIEFeature(long ptr ptr long)
#165 stub FindMediaType
#166 stub FindMediaTypeClass
167 stdcall FindMimeFromData(long ptr ptr long ptr long ptr long)
167 stdcall FindMimeFromData(ptr ptr ptr long ptr long ptr long)
#168 GetAddSitesFileUrl
169 stdcall GetClassFileOrMime(ptr wstr ptr long wstr long ptr)
#170 stub GetClassURL

View file

@ -188,7 +188,7 @@ reactos/dll/win32/traffic # Synced to WineStaging-1.9.11
reactos/dll/win32/twain_32 # Synced to WineStaging-1.9.11
reactos/dll/win32/updspapi # Synced to WineStaging-1.9.11
reactos/dll/win32/url # Synced to WineStaging-1.9.11
reactos/dll/win32/urlmon # Synced to WineStaging-1.9.23
reactos/dll/win32/urlmon # Synced to WineStaging-2.2
reactos/dll/win32/usp10 # Synced to WineStaging-2.2
reactos/dll/win32/uxtheme # Forked
reactos/dll/win32/vbscript # Synced to WineStaging-1.9.23