urlmon: Use find_mime_from_ext directly in file protocol handler.

This commit is contained in:
Jacek Caban 2014-12-23 12:02:12 +01:00 committed by Alexandre Julliard
parent 9351e225bb
commit 0029290e3e
3 changed files with 16 additions and 12 deletions

View file

@ -251,7 +251,7 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
DWORD scheme, size;
LPWSTR mime = NULL;
WCHAR null_char = 0;
BSTR url;
BSTR ext;
HRESULT hres;
TRACE("(%p)->(%p %p %p %08x %p)\n", This, pUri, pOIProtSink,
@ -300,10 +300,10 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
if(FAILED(hres))
return hres;
hres = IUri_GetDisplayUri(pUri, &url);
if(hres == S_OK) {
hres = FindMimeFromData(NULL, url, NULL, 0, NULL, 0, &mime, 0);
SysFreeString(url);
hres = IUri_GetExtension(pUri, &ext);
if(SUCCEEDED(hres)) {
if(hres == S_OK && *ext) {
hres = find_mime_from_ext(ext, &mime);
if(SUCCEEDED(hres)) {
IInternetProtocolSink_ReportProgress(pOIProtSink,
(grfBINDF & BINDF_FROMURLMON) ?
@ -312,6 +312,8 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
CoTaskMemFree(mime);
}
}
SysFreeString(ext);
}
IInternetProtocolSink_ReportData(pOIProtSink,
BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,

View file

@ -422,7 +422,7 @@ static BOOL application_octet_stream_filter(const BYTE *b, DWORD size)
return TRUE;
}
static HRESULT find_mime_from_ext(const WCHAR *ext, WCHAR **ret)
HRESULT find_mime_from_ext(const WCHAR *ext, WCHAR **ret)
{
DWORD res, size;
WCHAR mime[64];

View file

@ -76,6 +76,8 @@ WCHAR *get_useragent(void) DECLSPEC_HIDDEN;
void update_user_agent(WCHAR*) DECLSPEC_HIDDEN;
void free_session(void) DECLSPEC_HIDDEN;
HRESULT find_mime_from_ext(const WCHAR*,WCHAR**) DECLSPEC_HIDDEN;
HRESULT bind_to_storage(IUri*,IBindCtx*,REFIID,void**) DECLSPEC_HIDDEN;
HRESULT bind_to_object(IMoniker*,IUri*,IBindCtx*,REFIID,void**ppv) DECLSPEC_HIDDEN;