URLMON: Move BindToStorage hack to the separated function
Jacek Caban
jack at itma.pwr.wroc.pl
Sat Nov 12 15:11:50 CST 2005
This patch makes it easier to switch URLMoniker to use
pluggable protocol.
Changelog:
Move BindToStorage hack to the separated function.
-------------- next part --------------
Index: dlls/urlmon/umon.c
===================================================================
RCS file: /home/wine/wine/dlls/urlmon/umon.c,v
retrieving revision 1.66
diff -u -p -r1.66 umon.c
--- dlls/urlmon/umon.c 10 Nov 2005 11:04:21 -0000 1.66
+++ dlls/urlmon/umon.c 12 Nov 2005 21:08:54 -0000
@@ -547,13 +547,12 @@ static void CALLBACK URLMON_InternetCall
/******************************************************************************
* URLMoniker_BindToStorage
******************************************************************************/
-static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
+static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName,
IBindCtx* pbc,
IMoniker* pmkToLeft,
REFIID riid,
VOID** ppvObject)
{
- URLMonikerImpl *This = (URLMonikerImpl *)iface;
HRESULT hres;
BINDINFO bi;
DWORD bindf;
@@ -561,6 +560,9 @@ static HRESULT WINAPI URLMonikerImpl_Bin
Binding *bind;
int len;
+ WARN("(%s %p %p %s %p)\n", debugstr_w(URLName), pbc, pmkToLeft, debugstr_guid(riid),
+ ppvObject);
+
if(pmkToLeft) {
FIXME("pmkToLeft != NULL\n");
return E_NOTIMPL;
@@ -575,9 +577,9 @@ static HRESULT WINAPI URLMonikerImpl_Bin
bind->ref = 1;
URLMON_LockModule();
- len = lstrlenW(This->URLName)+1;
+ len = lstrlenW(URLName)+1;
bind->URLName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
- memcpy(bind->URLName, This->URLName, len*sizeof(WCHAR));
+ memcpy(bind->URLName, URLName, len*sizeof(WCHAR));
hres = UMCreateStreamOnCacheFile(bind->URLName, 0, szFileName, &bind->hCacheFile, &bind->pstrCache);
@@ -855,6 +857,37 @@ static HRESULT WINAPI URLMonikerImpl_Bin
return hres;
}
+static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
+ IBindCtx* pbc,
+ IMoniker* pmkToLeft,
+ REFIID riid,
+ VOID** ppvObject)
+{
+ URLMonikerImpl *This = (URLMonikerImpl*)iface;
+ WCHAR schema[64];
+ BOOL bret;
+
+ URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW), schema,
+ sizeof(schema)/sizeof(WCHAR), 0, NULL, 0, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0};
+
+ bret = InternetCrackUrlW(This->URLName, 0, ICU_ESCAPE, &url);
+ if(!bret) {
+ ERR("InternetCrackUrl failed: %ld\n", GetLastError());
+ return E_FAIL;
+ }
+
+ if(url.nScheme == INTERNET_SCHEME_HTTP
+ || url.nScheme== INTERNET_SCHEME_HTTPS
+ || url.nScheme== INTERNET_SCHEME_FTP
+ || url.nScheme == INTERNET_SCHEME_GOPHER
+ || url.nScheme == INTERNET_SCHEME_FILE)
+ return URLMonikerImpl_BindToStorage_hack(This->URLName, pbc, pmkToLeft, riid, ppvObject);
+
+ FIXME("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObject);
+
+ return E_NOTIMPL;
+}
+
/******************************************************************************
* URLMoniker_Reduce
******************************************************************************/
More information about the wine-patches
mailing list