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
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,17 +300,19 @@ 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);
if(SUCCEEDED(hres)) {
IInternetProtocolSink_ReportProgress(pOIProtSink,
(grfBINDF & BINDF_FROMURLMON) ?
BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE : BINDSTATUS_MIMETYPEAVAILABLE,
mime);
CoTaskMemFree(mime);
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) ?
BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE : BINDSTATUS_MIMETYPEAVAILABLE,
mime);
CoTaskMemFree(mime);
}
}
SysFreeString(ext);
}
IInternetProtocolSink_ReportData(pOIProtSink,
......
......@@ -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];
......
......@@ -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;
......
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