diff --git a/reactos/dll/win32/urlmon/CMakeLists.txt b/reactos/dll/win32/urlmon/CMakeLists.txt index 8ced4f8fa6f..94e183b14cf 100644 --- a/reactos/dll/win32/urlmon/CMakeLists.txt +++ b/reactos/dll/win32/urlmon/CMakeLists.txt @@ -45,6 +45,6 @@ add_library(urlmon SHARED set_module_type(urlmon win32dll) target_link_libraries(urlmon uuid wine ${PSEH_LIB}) -add_importlibs(urlmon rpcrt4 propsys ole32 oleaut32 shlwapi shell32 wininet user32 advapi32 advpack msvcrt kernel32 ntdll) +add_importlibs(urlmon rpcrt4 propsys ole32 oleaut32 shlwapi shell32 wininet user32 advapi32 advpack kernel32_vista msvcrt kernel32 ntdll) add_pch(urlmon urlmon_main.h SOURCE) add_cd_file(TARGET urlmon DESTINATION reactos/system32 FOR all) diff --git a/reactos/dll/win32/urlmon/bindprot.c b/reactos/dll/win32/urlmon/bindprot.c index 53bf50928f1..cc2e75923f1 100644 --- a/reactos/dll/win32/urlmon/bindprot.c +++ b/reactos/dll/win32/urlmon/bindprot.c @@ -80,8 +80,6 @@ static LRESULT WINAPI notif_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return DefWindowProcW(hwnd, msg, wParam, lParam); } -#ifndef __REACTOS__ - static const WCHAR wszURLMonikerNotificationWindow[] = {'U','R','L',' ','M','o','n','i','k','e','r',' ', 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0}; @@ -107,22 +105,11 @@ void unregister_notif_wnd_class(void) UnregisterClassW(MAKEINTRESOURCEW(notif_wnd_class), hProxyDll); } -#endif /* !__REACTOS__ */ - HWND get_notif_hwnd(void) { -#ifdef __REACTOS__ - static ATOM wnd_class = 0; -#endif tls_data_t *tls_data; -#ifdef __REACTOS__ - static const WCHAR wszURLMonikerNotificationWindow[] = - {'U','R','L',' ','M','o','n','i','k','e','r',' ', - 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0}; -#else static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; -#endif tls_data = get_tls_data(); if(!tls_data) @@ -133,33 +120,11 @@ HWND get_notif_hwnd(void) return tls_data->notif_hwnd; } -#ifndef __REACTOS__ InitOnceExecuteOnce(&init_once, register_notif_wnd_class, NULL, NULL); if(!notif_wnd_class) return NULL; -#else - if(!wnd_class) { - static WNDCLASSEXW wndclass = { - sizeof(wndclass), 0, - notif_wnd_proc, 0, 0, - NULL, NULL, NULL, NULL, NULL, - wszURLMonikerNotificationWindow, - NULL - }; - wndclass.hInstance = hProxyDll; - - wnd_class = RegisterClassExW(&wndclass); - if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS) - wnd_class = 1; - } -#endif - -#ifndef __REACTOS__ tls_data->notif_hwnd = CreateWindowExW(0, MAKEINTRESOURCEW(notif_wnd_class), -#else - tls_data->notif_hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow, -#endif wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, hProxyDll, NULL); if(tls_data->notif_hwnd) diff --git a/reactos/dll/win32/urlmon/file.c b/reactos/dll/win32/urlmon/file.c index fa2649ffb29..85e2a2828bf 100644 --- a/reactos/dll/win32/urlmon/file.c +++ b/reactos/dll/win32/urlmon/file.c @@ -245,7 +245,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, @@ -294,17 +294,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, diff --git a/reactos/dll/win32/urlmon/internet.c b/reactos/dll/win32/urlmon/internet.c index f779bd9b609..8c4561aab1e 100644 --- a/reactos/dll/win32/urlmon/internet.c +++ b/reactos/dll/win32/urlmon/internet.c @@ -530,10 +530,8 @@ static HRESULT set_internet_feature(INTERNETFEATURELIST feature, DWORD flags, BO if(feature >= FEATURE_ENTRY_COUNT) return E_FAIL; - if(flags & ~supported_flags) { + if(flags & ~supported_flags) FIXME("Unsupported flags: %08x\n", flags & ~supported_flags); - return E_NOTIMPL; - } if(flags & SET_FEATURE_ON_PROCESS) set_feature_on_process(feature, enable); diff --git a/reactos/dll/win32/urlmon/mimefilter.c b/reactos/dll/win32/urlmon/mimefilter.c index 3d529b57250..734c5cf8559 100644 --- a/reactos/dll/win32/urlmon/mimefilter.c +++ b/reactos/dll/win32/urlmon/mimefilter.c @@ -419,20 +419,15 @@ static BOOL application_octet_stream_filter(const BYTE *b, DWORD size) return TRUE; } -static HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret) +HRESULT find_mime_from_ext(const WCHAR *ext, WCHAR **ret) { - const WCHAR *ptr; DWORD res, size; WCHAR mime[64]; HKEY hkey; static const WCHAR content_typeW[] = {'C','o','n','t','e','n','t',' ','T','y','p','e','\0'}; - ptr = strrchrW(url, '.'); - if(!ptr) - return E_FAIL; - - res = RegOpenKeyW(HKEY_CLASSES_ROOT, ptr, &hkey); + res = RegOpenKeyW(HKEY_CLASSES_ROOT, ext, &hkey); if(res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res); @@ -449,6 +444,41 @@ static HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret) return S_OK; } +static HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret) +{ + const WCHAR *ptr, *end_ptr; + WCHAR *ext = NULL; + HRESULT hres; + + for(end_ptr = url; *end_ptr; end_ptr++) { + if(*end_ptr == '?' || *end_ptr == '#') + break; + } + + for(ptr = end_ptr; ptr >= url; ptr--) { + if(*ptr == '.') + break; + } + + if(ptr < url) + return E_FAIL; + + if(*end_ptr) { + unsigned len = end_ptr-ptr; + + ext = heap_alloc((len+1)*sizeof(WCHAR)); + if(!ext) + return E_OUTOFMEMORY; + + memcpy(ext, ptr, len*sizeof(WCHAR)); + ext[len] = 0; + } + + hres = find_mime_from_ext(ext ? ext : ptr, ret); + heap_free(ext); + return hres; +} + static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0}; static const WCHAR text_richtextW[] = {'t','e','x','t','/','r','i','c','h','t','e','x','t',0}; static const WCHAR text_xmlW[] = {'t','e','x','t','/','x','m','l',0}; diff --git a/reactos/dll/win32/urlmon/protocol.c b/reactos/dll/win32/urlmon/protocol.c index 84b8448ae2d..b099e814d0a 100644 --- a/reactos/dll/win32/urlmon/protocol.c +++ b/reactos/dll/win32/urlmon/protocol.c @@ -298,6 +298,12 @@ HINTERNET get_internet_session(IInternetBindInfo *bind_info) return internet_session; } +void update_user_agent(WCHAR *user_agent) +{ + if(internet_session) + InternetSetOptionW(internet_session, INTERNET_OPTION_USER_AGENT, user_agent, strlenW(user_agent)); +} + HRESULT protocol_start(Protocol *protocol, IInternetProtocol *prot, IUri *uri, IInternetProtocolSink *protocol_sink, IInternetBindInfo *bind_info) { diff --git a/reactos/dll/win32/urlmon/sec_mgr.c b/reactos/dll/win32/urlmon/sec_mgr.c index c5978370f10..b3e7618f3f5 100644 --- a/reactos/dll/win32/urlmon/sec_mgr.c +++ b/reactos/dll/win32/urlmon/sec_mgr.c @@ -729,7 +729,7 @@ static HRESULT generate_security_id(IUri *uri, BYTE *secid, DWORD *secid_len, DW if(len+sizeof(DWORD) > *secid_len) { SysFreeString(display_uri); - return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + return E_NOT_SUFFICIENT_BUFFER; } WideCharToMultiByte(CP_ACP, 0, display_uri, -1, (LPSTR)secid, len, NULL, NULL); @@ -765,7 +765,7 @@ static HRESULT generate_security_id(IUri *uri, BYTE *secid, DWORD *secid_len, DW if(len+sizeof(DWORD) > *secid_len) { SysFreeString(host); SysFreeString(scheme); - return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + return E_NOT_SUFFICIENT_BUFFER; } WideCharToMultiByte(CP_ACP, 0, scheme, -1, (LPSTR)secid, len, NULL, NULL); diff --git a/reactos/dll/win32/urlmon/session.c b/reactos/dll/win32/urlmon/session.c index 7c5a3bb931d..e819ee5a4ef 100644 --- a/reactos/dll/win32/urlmon/session.c +++ b/reactos/dll/win32/urlmon/session.c @@ -713,6 +713,7 @@ HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBuf heap_free(user_agent); user_agent = new_user_agent; + update_user_agent(user_agent); LeaveCriticalSection(&session_cs); break; diff --git a/reactos/dll/win32/urlmon/urlmon_main.c b/reactos/dll/win32/urlmon/urlmon_main.c index 74cf5d20a01..4cc17cafdf5 100644 --- a/reactos/dll/win32/urlmon/urlmon_main.c +++ b/reactos/dll/win32/urlmon/urlmon_main.c @@ -127,9 +127,7 @@ static void process_detach(void) free_session(); free_tls_list(); -#ifndef __REACTOS__ unregister_notif_wnd_class(); -#endif } /*********************************************************************** diff --git a/reactos/dll/win32/urlmon/urlmon_main.h b/reactos/dll/win32/urlmon/urlmon_main.h index da18ecd19da..ea23f446ae9 100644 --- a/reactos/dll/win32/urlmon/urlmon_main.h +++ b/reactos/dll/win32/urlmon/urlmon_main.h @@ -83,9 +83,12 @@ IInternetProtocol *get_mime_filter(LPCWSTR) DECLSPEC_HIDDEN; BOOL is_registered_protocol(LPCWSTR) DECLSPEC_HIDDEN; HRESULT register_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL) DECLSPEC_HIDDEN; HINTERNET get_internet_session(IInternetBindInfo*) DECLSPEC_HIDDEN; -LPWSTR get_useragent(void) DECLSPEC_HIDDEN; +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; @@ -236,9 +239,7 @@ typedef struct { tls_data_t *get_tls_data(void) DECLSPEC_HIDDEN; -#ifndef __REACTOS__ void unregister_notif_wnd_class(void) DECLSPEC_HIDDEN; -#endif HWND get_notif_hwnd(void) DECLSPEC_HIDDEN; void release_notif_hwnd(HWND) DECLSPEC_HIDDEN; diff --git a/reactos/dll/win32/urlmon/urlmon_ros.diff b/reactos/dll/win32/urlmon/urlmon_ros.diff deleted file mode 100644 index c04c5914a84..00000000000 --- a/reactos/dll/win32/urlmon/urlmon_ros.diff +++ /dev/null @@ -1,96 +0,0 @@ -diff -prudN e:\Wine\dlls\urlmon/bindprot.c e:\reactos\dll\win32\urlmon/bindprot.c ---- e:\Wine\dlls\urlmon/bindprot.c 2014-04-04 14:12:42.439519600 +0100 -+++ e:\reactos\dll\win32\urlmon/bindprot.c 2014-04-11 16:18:48.958227500 +0100 -@@ -83,36 +80,14 @@ static LRESULT WINAPI notif_wnd_proc(HWN - return DefWindowProcW(hwnd, msg, wParam, lParam); - } - --static const WCHAR wszURLMonikerNotificationWindow[] = -- {'U','R','L',' ','M','o','n','i','k','e','r',' ', -- 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0}; -- --static ATOM notif_wnd_class; -- --static BOOL WINAPI register_notif_wnd_class(INIT_ONCE *once, void *param, void **context) --{ -- static WNDCLASSEXW wndclass = { -- sizeof(wndclass), 0, notif_wnd_proc, 0, 0, -- NULL, NULL, NULL, NULL, NULL, -- wszURLMonikerNotificationWindow, NULL -- }; -- -- wndclass.hInstance = hProxyDll; -- notif_wnd_class = RegisterClassExW(&wndclass); -- return TRUE; --} -- --void unregister_notif_wnd_class(void) --{ -- if(notif_wnd_class) -- UnregisterClassW(MAKEINTRESOURCEW(notif_wnd_class), hProxyDll); --} -- - HWND get_notif_hwnd(void) - { -+ static ATOM wnd_class = 0; - tls_data_t *tls_data; - -- static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; -+ static const WCHAR wszURLMonikerNotificationWindow[] = -+ {'U','R','L',' ','M','o','n','i','k','e','r',' ', -+ 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0}; - - tls_data = get_tls_data(); - if(!tls_data) -@@ -123,11 +98,23 @@ HWND get_notif_hwnd(void) - return tls_data->notif_hwnd; - } - -- InitOnceExecuteOnce(&init_once, register_notif_wnd_class, NULL, NULL); -- if(!notif_wnd_class) -- return NULL; -+ if(!wnd_class) { -+ static WNDCLASSEXW wndclass = { -+ sizeof(wndclass), 0, -+ notif_wnd_proc, 0, 0, -+ NULL, NULL, NULL, NULL, NULL, -+ wszURLMonikerNotificationWindow, -+ NULL -+ }; - -- tls_data->notif_hwnd = CreateWindowExW(0, MAKEINTRESOURCEW(notif_wnd_class), -+ wndclass.hInstance = hProxyDll; -+ -+ wnd_class = RegisterClassExW(&wndclass); -+ if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS) -+ wnd_class = 1; -+ } -+ -+ tls_data->notif_hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow, - wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE, - NULL, hProxyDll, NULL); - if(tls_data->notif_hwnd) - -diff -prudN e:\Wine\dlls\urlmon/urlmon_main.c e:\reactos\dll\win32\urlmon/urlmon_main.c ---- e:\Wine\dlls\urlmon/urlmon_main.c 2014-04-04 14:12:42.460533100 +0100 -+++ e:\reactos\dll\win32\urlmon/urlmon_main.c 2014-04-11 16:19:12.473179000 +0100 -@@ -139,7 +127,6 @@ static void process_detach(void) - - free_session(); - free_tls_list(); -- unregister_notif_wnd_class(); - } - - /*********************************************************************** - -diff -prudN e:\Wine\dlls\urlmon/urlmon_main.h e:\reactos\dll\win32\urlmon/urlmon_main.h ---- e:\Wine\dlls\urlmon/urlmon_main.h 2014-04-04 14:12:42.461533700 +0100 -+++ e:\reactos\dll\win32\urlmon/urlmon_main.h 2014-04-11 16:19:21.822446700 +0100 -@@ -225,7 +236,6 @@ typedef struct { - - tls_data_t *get_tls_data(void) DECLSPEC_HIDDEN; - --void unregister_notif_wnd_class(void) DECLSPEC_HIDDEN; - HWND get_notif_hwnd(void) DECLSPEC_HIDDEN; - void release_notif_hwnd(HWND) DECLSPEC_HIDDEN; - diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 5ec9413e2ee..f3deecd4bdc 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -201,7 +201,7 @@ reactos/dll/win32/twain_32 # Synced to Wine-1.7.27 reactos/dll/win32/unicows # Synced to Wine-1.3.32 (Win9x only, why do we need this?!) reactos/dll/win32/updspapi # Synced to Wine-1.7.27 reactos/dll/win32/url # Synced to Wine-1.7.27 -reactos/dll/win32/urlmon # Synced to Wine-1.7.27 +reactos/dll/win32/urlmon # Synced to WineStaging-1.7.37 reactos/dll/win32/usp10 # Synced to Wine-1.7.27 reactos/dll/win32/uxtheme # Forked reactos/dll/win32/vbscript # Synced to Wine-1.7.27