diff --git a/reactos/dll/win32/urlmon/binding.c b/reactos/dll/win32/urlmon/binding.c index 1e56055adaa..f09e6c962c6 100644 --- a/reactos/dll/win32/urlmon/binding.c +++ b/reactos/dll/win32/urlmon/binding.c @@ -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) diff --git a/reactos/dll/win32/urlmon/internet.c b/reactos/dll/win32/urlmon/internet.c index 8c4561aab1e..8a6b7f8d849 100644 --- a/reactos/dll/win32/urlmon/internet.c +++ b/reactos/dll/win32/urlmon/internet.c @@ -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); diff --git a/reactos/dll/win32/urlmon/protocol.c b/reactos/dll/win32/urlmon/protocol.c index b099e814d0a..543ae504b2f 100644 --- a/reactos/dll/win32/urlmon/protocol.c +++ b/reactos/dll/win32/urlmon/protocol.c @@ -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; diff --git a/reactos/dll/win32/urlmon/uri.c b/reactos/dll/win32/urlmon/uri.c index 301f4b93f4b..05579d9a0f9 100644 --- a/reactos/dll/win32/urlmon/uri.c +++ b/reactos/dll/win32/urlmon/uri.c @@ -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; } diff --git a/reactos/dll/win32/urlmon/urlmon.spec b/reactos/dll/win32/urlmon/urlmon.spec index 4b1ea5bc222..6a92641fc4b 100644 --- a/reactos/dll/win32/urlmon/urlmon.spec +++ b/reactos/dll/win32/urlmon/urlmon.spec @@ -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 diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index fa28505d7a0..f8e95075791 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -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