Commit 0029290e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Use find_mime_from_ext directly in file protocol handler.

parent 9351e225
...@@ -251,7 +251,7 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr ...@@ -251,7 +251,7 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
DWORD scheme, size; DWORD scheme, size;
LPWSTR mime = NULL; LPWSTR mime = NULL;
WCHAR null_char = 0; WCHAR null_char = 0;
BSTR url; BSTR ext;
HRESULT hres; HRESULT hres;
TRACE("(%p)->(%p %p %p %08x %p)\n", This, pUri, pOIProtSink, TRACE("(%p)->(%p %p %p %08x %p)\n", This, pUri, pOIProtSink,
...@@ -300,10 +300,10 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr ...@@ -300,10 +300,10 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = IUri_GetDisplayUri(pUri, &url); hres = IUri_GetExtension(pUri, &ext);
if(hres == S_OK) { if(SUCCEEDED(hres)) {
hres = FindMimeFromData(NULL, url, NULL, 0, NULL, 0, &mime, 0); if(hres == S_OK && *ext) {
SysFreeString(url); hres = find_mime_from_ext(ext, &mime);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
IInternetProtocolSink_ReportProgress(pOIProtSink, IInternetProtocolSink_ReportProgress(pOIProtSink,
(grfBINDF & BINDF_FROMURLMON) ? (grfBINDF & BINDF_FROMURLMON) ?
...@@ -312,6 +312,8 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr ...@@ -312,6 +312,8 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
CoTaskMemFree(mime); CoTaskMemFree(mime);
} }
} }
SysFreeString(ext);
}
IInternetProtocolSink_ReportData(pOIProtSink, IInternetProtocolSink_ReportData(pOIProtSink,
BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION, BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
......
...@@ -422,7 +422,7 @@ static BOOL application_octet_stream_filter(const BYTE *b, DWORD size) ...@@ -422,7 +422,7 @@ static BOOL application_octet_stream_filter(const BYTE *b, DWORD size)
return TRUE; 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; DWORD res, size;
WCHAR mime[64]; WCHAR mime[64];
......
...@@ -76,6 +76,8 @@ WCHAR *get_useragent(void) DECLSPEC_HIDDEN; ...@@ -76,6 +76,8 @@ WCHAR *get_useragent(void) DECLSPEC_HIDDEN;
void update_user_agent(WCHAR*) DECLSPEC_HIDDEN; void update_user_agent(WCHAR*) DECLSPEC_HIDDEN;
void free_session(void) 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_storage(IUri*,IBindCtx*,REFIID,void**) DECLSPEC_HIDDEN;
HRESULT bind_to_object(IMoniker*,IUri*,IBindCtx*,REFIID,void**ppv) DECLSPEC_HIDDEN; HRESULT bind_to_object(IMoniker*,IUri*,IBindCtx*,REFIID,void**ppv) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment