Author: akhaldi Date: Sun Mar 19 16:57:50 2017 New Revision: 74195
URL: http://svn.reactos.org/svn/reactos?rev=74195&view=rev Log: [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.
Modified: trunk/reactos/dll/win32/urlmon/binding.c trunk/reactos/dll/win32/urlmon/internet.c trunk/reactos/dll/win32/urlmon/protocol.c trunk/reactos/dll/win32/urlmon/uri.c trunk/reactos/dll/win32/urlmon/urlmon.spec trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/urlmon/binding.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/binding.c?... ============================================================================== --- trunk/reactos/dll/win32/urlmon/binding.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/binding.c [iso-8859-1] Sun Mar 19 16:57:50 2017 @@ -512,8 +512,40 @@ 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)
Modified: trunk/reactos/dll/win32/urlmon/internet.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/internet.c... ============================================================================== --- trunk/reactos/dll/win32/urlmon/internet.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/internet.c [iso-8859-1] Sun Mar 19 16:57:50 2017 @@ -482,7 +482,7 @@ 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);
Modified: trunk/reactos/dll/win32/urlmon/protocol.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/protocol.c... ============================================================================== --- trunk/reactos/dll/win32/urlmon/protocol.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/protocol.c [iso-8859-1] Sun Mar 19 16:57:50 2017 @@ -391,13 +391,7 @@ 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;
Modified: trunk/reactos/dll/win32/urlmon/uri.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/uri.c?rev=... ============================================================================== --- trunk/reactos/dll/win32/urlmon/uri.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/uri.c [iso-8859-1] Sun Mar 19 16:57:50 2017 @@ -6760,7 +6760,7 @@ 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 @@ 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 @@ * 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 @@ 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 @@
/* 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; }
Modified: trunk/reactos/dll/win32/urlmon/urlmon.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon.spe... ============================================================================== --- trunk/reactos/dll/win32/urlmon/urlmon.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/urlmon.spec [iso-8859-1] Sun Mar 19 16:57:50 2017 @@ -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
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=7... ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Mar 19 16:57:50 2017 @@ -188,7 +188,7 @@ 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