[URLMON] Sync with Wine Staging 1.7.37. CORE-9246

svn path=/trunk/; revision=67113
This commit is contained in:
Amine Khaldi 2015-04-09 12:42:05 +00:00
parent 02ae5f591c
commit 1a79e7e0b6
12 changed files with 66 additions and 161 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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,

View file

@ -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);

View file

@ -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};

View file

@ -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)
{

View file

@ -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);

View file

@ -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;

View file

@ -127,9 +127,7 @@ static void process_detach(void)
free_session();
free_tls_list();
#ifndef __REACTOS__
unregister_notif_wnd_class();
#endif
}
/***********************************************************************

View file

@ -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;

View file

@ -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;

View file

@ -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