URLMON: Separated IBinding and IMoniker interfaces
Jacek Caban
jack at itma.pwr.wroc.pl
Sun May 22 05:25:17 CDT 2005
Changelog:
Separated IBinding and IMoniker interfaces
-------------- next part --------------
? dlls/urlmon/diff
Index: dlls/urlmon/umon.c
===================================================================
RCS file: /home/wine/wine/dlls/urlmon/umon.c,v
retrieving revision 1.52
diff -u -p -r1.52 umon.c
--- dlls/urlmon/umon.c 5 May 2005 09:50:46 -0000 1.52
+++ dlls/urlmon/umon.c 22 May 2005 10:06:49 -0000
@@ -48,15 +48,12 @@ static const WCHAR BSCBHolder[] = { '_',
/*static BOOL registered_wndclass = FALSE;*/
-/* filemoniker data structure */
-typedef struct URLMonikerImpl{
+typedef struct {
+ IBindingVtbl *lpVtbl;
- IMonikerVtbl* lpvtbl1; /* VTable relative to the IMoniker interface.*/
- IBindingVtbl* lpvtbl2; /* VTable to IBinding interface */
+ ULONG ref;
- ULONG ref; /* reference counter for this object */
-
- LPOLESTR URLName; /* URL string identified by this URLmoniker */
+ LPWSTR URLName;
HWND hwndCallback;
IBindCtx *pBC;
@@ -65,88 +62,119 @@ typedef struct URLMonikerImpl{
IUMCacheStream *pstrCache;
IBindStatusCallback *pbscb;
DWORD total_read, expected_size;
-} URLMonikerImpl;
+} Binding;
-/*******************************************************************************
- * URLMoniker_QueryInterface
- *******************************************************************************/
-static HRESULT WINAPI URLMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
+static HRESULT WINAPI Binding_QueryInterface(IBinding* iface, REFIID riid, void **ppvObject)
{
- URLMonikerImpl *This = (URLMonikerImpl *)iface;
+ Binding *This = (Binding*)iface;
- TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
+ TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppvObject);
- /* Perform a sanity check on the parameters.*/
- if ( (This==0) || (ppvObject==0) )
+ if((This == NULL) || (ppvObject == NULL))
return E_INVALIDARG;
- /* Initialize the return parameter */
- *ppvObject = 0;
-
- /* Compare the riid with the interface IDs implemented by this object.*/
- if (IsEqualIID(&IID_IUnknown, riid) ||
- IsEqualIID(&IID_IPersist, riid) ||
- IsEqualIID(&IID_IPersistStream,riid) ||
- IsEqualIID(&IID_IMoniker, riid)
- )
+ if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IBinding, riid)) {
*ppvObject = iface;
+ IBinding_AddRef(iface);
+ return S_OK;
+ }
- /* Check that we obtained an interface.*/
- if ((*ppvObject)==0)
- return E_NOINTERFACE;
+ *ppvObject = NULL;
+ return E_NOINTERFACE;
+}
- /* Query Interface always increases the reference count by one when it is successful */
- IMoniker_AddRef(iface);
+static ULONG WINAPI Binding_AddRef(IBinding* iface)
+{
+ Binding *This = (Binding*)iface;
+ ULONG ref = InterlockedIncrement(&This->ref);
- return S_OK;
+ TRACE("(%p) ref=%ld\n", This, ref);
+
+ return ref;
}
-/******************************************************************************
- * URLMoniker_AddRef
- ******************************************************************************/
-static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface)
+static ULONG WINAPI Binding_Release(IBinding* iface)
{
- URLMonikerImpl *This = (URLMonikerImpl *)iface;
- ULONG refCount = InterlockedIncrement(&This->ref);
+ Binding *This = (Binding*)iface;
+ ULONG ref = InterlockedDecrement(&This->ref);
- TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
+ TRACE("(%p) ref=%ld\n",This, ref);
- URLMON_LockModule();
+ if(!ref) {
+ HeapFree(GetProcessHeap(), 0, This->URLName);
+ if (This->hCacheFile)
+ CloseHandle(This->hCacheFile);
+ if (This->pstrCache)
+ {
+ UMCloseCacheFileStream(This->pstrCache);
+ IStream_Release((IStream *)This->pstrCache);
+ }
+ if (This->pbscb)
+ IBindStatusCallback_Release(This->pbscb);
- return refCount;
+ HeapFree(GetProcessHeap(), 0, This);
+
+ URLMON_UnlockModule();
+ }
+
+ return ref;
}
-/******************************************************************************
- * URLMoniker_Release
- ******************************************************************************/
-static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface)
+static HRESULT WINAPI Binding_Abort(IBinding* iface)
{
- URLMonikerImpl *This = (URLMonikerImpl *)iface;
- ULONG refCount = InterlockedDecrement(&This->ref);
+ Binding *This = (Binding*)iface;
- TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
+ FIXME("(%p): stub\n", This);
- /* destroy the object if there's no more reference on it */
- if (!refCount) {
- HeapFree(GetProcessHeap(),0,This->URLName);
- HeapFree(GetProcessHeap(),0,This);
- if (This->hCacheFile)
- CloseHandle(This->hCacheFile);
- if (This->pstrCache)
- {
- UMCloseCacheFileStream(This->pstrCache);
- IStream_Release((IStream *)This->pstrCache);
- }
- if (This->pbscb)
- IBindStatusCallback_Release(This->pbscb);
- }
+ return E_NOTIMPL;
+}
- URLMON_UnlockModule();
+static HRESULT WINAPI Binding_GetBindResult(IBinding* iface, CLSID* pclsidProtocol, DWORD* pdwResult, LPOLESTR* pszResult, DWORD* pdwReserved)
+{
+ Binding *This = (Binding*)iface;
- return refCount;
+ FIXME("(%p)->(%p, %p, %p, %p): stub\n", This, pclsidProtocol, pdwResult, pszResult, pdwReserved);
+
+ return E_NOTIMPL;
}
-static void URLMonikerImpl_CloseCacheDownload(URLMonikerImpl *This)
+static HRESULT WINAPI Binding_GetPriority(IBinding* iface, LONG* pnPriority)
+{
+ Binding *This = (Binding*)iface;
+
+ FIXME("(%p)->(%p): stub\n", This, pnPriority);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Binding_Resume(IBinding* iface)
+{
+ Binding *This = (Binding*)iface;
+
+ FIXME("(%p): stub\n", This);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Binding_SetPriority(IBinding* iface, LONG nPriority)
+{
+ Binding *This = (Binding*)iface;
+
+ FIXME("(%p)->(%ld): stub\n", This, nPriority);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Binding_Suspend(IBinding* iface)
+{
+ Binding *This = (Binding*)iface;
+
+ FIXME("(%p): stub\n", This);
+
+ return E_NOTIMPL;
+}
+
+static void Binding_CloseCacheDownload(Binding *This)
{
CloseHandle(This->hCacheFile);
This->hCacheFile = 0;
@@ -155,7 +183,7 @@ static void URLMonikerImpl_CloseCacheDow
This->pstrCache = 0;
}
-static HRESULT URLMonikerImpl_MoreCacheData(URLMonikerImpl *This, char *buf, DWORD dwBytes)
+static HRESULT Binding_MoreCacheData(Binding *This, char *buf, DWORD dwBytes)
{
DWORD written;
@@ -202,7 +230,7 @@ static HRESULT URLMonikerImpl_MoreCacheD
return HRESULT_FROM_WIN32(GetLastError());
}
-static void URLMonikerImpl_FinishedDownload(URLMonikerImpl *This, HRESULT hr)
+static void Binding_FinishedDownload(Binding *This, HRESULT hr)
{
STGMEDIUM stg;
FORMATETC fmt;
@@ -245,6 +273,100 @@ static void URLMonikerImpl_FinishedDownl
This->pbscb = 0;
}
+static IBindingVtbl BindingVtbl =
+{
+ Binding_QueryInterface,
+ Binding_AddRef,
+ Binding_Release,
+ Binding_Abort,
+ Binding_Suspend,
+ Binding_Resume,
+ Binding_SetPriority,
+ Binding_GetPriority,
+ Binding_GetBindResult
+};
+
+/* filemoniker data structure */
+typedef struct {
+
+ IMonikerVtbl* lpvtbl; /* VTable relative to the IMoniker interface.*/
+
+ ULONG ref; /* reference counter for this object */
+
+ LPOLESTR URLName; /* URL string identified by this URLmoniker */
+} URLMonikerImpl;
+
+/*******************************************************************************
+ * URLMoniker_QueryInterface
+ *******************************************************************************/
+static HRESULT WINAPI URLMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
+{
+ URLMonikerImpl *This = (URLMonikerImpl *)iface;
+
+ TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
+
+ /* Perform a sanity check on the parameters.*/
+ if ( (This==0) || (ppvObject==0) )
+ return E_INVALIDARG;
+
+ /* Initialize the return parameter */
+ *ppvObject = 0;
+
+ /* Compare the riid with the interface IDs implemented by this object.*/
+ if (IsEqualIID(&IID_IUnknown, riid) ||
+ IsEqualIID(&IID_IPersist, riid) ||
+ IsEqualIID(&IID_IPersistStream,riid) ||
+ IsEqualIID(&IID_IMoniker, riid)
+ )
+ *ppvObject = iface;
+
+ /* Check that we obtained an interface.*/
+ if ((*ppvObject)==0)
+ return E_NOINTERFACE;
+
+ /* Query Interface always increases the reference count by one when it is successful */
+ IMoniker_AddRef(iface);
+
+ return S_OK;
+}
+
+/******************************************************************************
+ * URLMoniker_AddRef
+ ******************************************************************************/
+static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface)
+{
+ URLMonikerImpl *This = (URLMonikerImpl *)iface;
+ ULONG refCount = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
+
+ URLMON_LockModule();
+
+ return refCount;
+}
+
+/******************************************************************************
+ * URLMoniker_Release
+ ******************************************************************************/
+static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface)
+{
+ URLMonikerImpl *This = (URLMonikerImpl *)iface;
+ ULONG refCount = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
+
+ /* destroy the object if there's no more reference on it */
+ if (!refCount) {
+ HeapFree(GetProcessHeap(),0,This->URLName);
+ HeapFree(GetProcessHeap(),0,This);
+ }
+
+ URLMON_UnlockModule();
+
+ return refCount;
+}
+
+
/******************************************************************************
* URLMoniker_GetClassID
******************************************************************************/
@@ -438,6 +560,8 @@ static HRESULT WINAPI URLMonikerImpl_Bin
BINDINFO bi;
DWORD bindf;
WCHAR szFileName[MAX_PATH + 1];
+ Binding *bind;
+ int len;
if(pmkToLeft) {
FIXME("pmkToLeft != NULL\n");
@@ -448,33 +572,42 @@ static HRESULT WINAPI URLMonikerImpl_Bin
return E_NOTIMPL;
}
- hres = UMCreateStreamOnCacheFile(This->URLName, 0, szFileName, &This->hCacheFile, &This->pstrCache);
+ bind = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Binding));
+ bind->lpVtbl = &BindingVtbl;
+ bind->ref = 1;
+ URLMON_LockModule();
+
+ len = lstrlenW(This->URLName)+1;
+ bind->URLName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
+ memcpy(bind->URLName, This->URLName, len*sizeof(WCHAR));
+
+ hres = UMCreateStreamOnCacheFile(bind->URLName, 0, szFileName, &bind->hCacheFile, &bind->pstrCache);
if(SUCCEEDED(hres)) {
TRACE("Created stream...\n");
- *ppvObject = (void *) This->pstrCache;
- IStream_AddRef((IStream *) This->pstrCache);
+ *ppvObject = (void *) bind->pstrCache;
+ IStream_AddRef((IStream *) bind->pstrCache);
- hres = IBindCtx_GetObjectParam(pbc, (LPOLESTR)BSCBHolder, (IUnknown**)&This->pbscb);
+ hres = IBindCtx_GetObjectParam(pbc, (LPOLESTR)BSCBHolder, (IUnknown**)&bind->pbscb);
if(SUCCEEDED(hres)) {
TRACE("Got IBindStatusCallback...\n");
memset(&bi, 0, sizeof(bi));
bi.cbSize = sizeof(bi);
bindf = 0;
- hres = IBindStatusCallback_GetBindInfo(This->pbscb, &bindf, &bi);
+ hres = IBindStatusCallback_GetBindInfo(bind->pbscb, &bindf, &bi);
if(SUCCEEDED(hres)) {
WCHAR *urlcopy, *tmpwc;
URL_COMPONENTSW url;
WCHAR *host, *path, *user, *pass;
- DWORD lensz = sizeof(This->expected_size);
+ DWORD lensz = sizeof(bind->expected_size);
DWORD dwService = 0;
BOOL bSuccess;
TRACE("got bindinfo. bindf = %08lx extrainfo = %s bindinfof = %08lx bindverb = %08lx iid %s\n",
bindf, debugstr_w(bi.szExtraInfo), bi.grfBindInfoF, bi.dwBindVerb, debugstr_guid(&bi.iid));
- hres = IBindStatusCallback_OnStartBinding(This->pbscb, 0, (IBinding*)&This->lpvtbl2);
+ hres = IBindStatusCallback_OnStartBinding(bind->pbscb, 0, (IBinding*)bind);
TRACE("OnStartBinding rets %08lx\n", hres);
/* This class will accept URLs with the backslash in them. But InternetCrackURL will not - it
@@ -482,8 +615,8 @@ static HRESULT WINAPI URLMonikerImpl_Bin
* a copy of the URL here and change the backslash to a forward slash everywhere it appears -
* but only before any '#' or '?', after which backslash should be left alone.
*/
- urlcopy = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * (lstrlenW(This->URLName) + 1));
- lstrcpyW(urlcopy, This->URLName);
+ urlcopy = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * (lstrlenW(bind->URLName) + 1));
+ lstrcpyW(urlcopy, bind->URLName);
for (tmpwc = urlcopy; *tmpwc && *tmpwc != '#' && *tmpwc != '?'; ++tmpwc)
if (*tmpwc == '\\')
*tmpwc = '/';
@@ -499,8 +632,8 @@ static HRESULT WINAPI URLMonikerImpl_Bin
URLMON_hInstance, NULL);
#endif
- This->expected_size = 0;
- This->total_read = 0;
+ bind->expected_size = 0;
+ bind->total_read = 0;
memset(&url, 0, sizeof(url));
url.dwStructSize = sizeof(url);
@@ -540,9 +673,9 @@ static HRESULT WINAPI URLMonikerImpl_Bin
case INTERNET_SCHEME_HTTP:
case INTERNET_SCHEME_HTTPS:
- This->hinternet = InternetOpenA("User Agent", 0, NULL, NULL, 0 /*INTERNET_FLAG_ASYNC*/);
-/* InternetSetStatusCallback(This->hinternet, URLMON_InternetCallback);*/
- if (!This->hinternet)
+ bind->hinternet = InternetOpenA("User Agent", 0, NULL, NULL, 0 /*INTERNET_FLAG_ASYNC*/);
+/* InternetSetStatusCallback(bind->hinternet, URLMON_InternetCallback);*/
+ if (!bind->hinternet)
{
hres = HRESULT_FROM_WIN32(GetLastError());
break;
@@ -575,66 +708,66 @@ static HRESULT WINAPI URLMonikerImpl_Bin
break;
}
- This->hconnect = InternetConnectW(This->hinternet, host, url.nPort, user, pass,
- dwService, 0, (DWORD)This);
- if (!This->hconnect)
+ bind->hconnect = InternetConnectW(bind->hinternet, host, url.nPort, user, pass,
+ dwService, 0, (DWORD)bind);
+ if (!bind->hconnect)
{
hres = HRESULT_FROM_WIN32(GetLastError());
- CloseHandle(This->hinternet);
+ CloseHandle(bind->hinternet);
break;
}
- hres = IBindStatusCallback_OnProgress(This->pbscb, 0, 0, 0x22, NULL);
- hres = IBindStatusCallback_OnProgress(This->pbscb, 0, 0, BINDSTATUS_FINDINGRESOURCE, NULL);
- hres = IBindStatusCallback_OnProgress(This->pbscb, 0, 0, BINDSTATUS_CONNECTING, NULL);
- hres = IBindStatusCallback_OnProgress(This->pbscb, 0, 0, BINDSTATUS_SENDINGREQUEST, NULL);
+ hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, 0x22, NULL);
+ hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_FINDINGRESOURCE, NULL);
+ hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_CONNECTING, NULL);
+ hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_SENDINGREQUEST, NULL);
bSuccess = FALSE;
switch (dwService)
{
case INTERNET_SERVICE_GOPHER:
- This->hrequest = GopherOpenFileW(This->hconnect,
+ bind->hrequest = GopherOpenFileW(bind->hconnect,
path,
0,
INTERNET_FLAG_RELOAD,
0);
- if (This->hrequest)
+ if (bind->hrequest)
bSuccess = TRUE;
else
hres = HRESULT_FROM_WIN32(GetLastError());
break;
case INTERNET_SERVICE_FTP:
- This->hrequest = FtpOpenFileW(This->hconnect,
+ bind->hrequest = FtpOpenFileW(bind->hconnect,
path,
GENERIC_READ,
FTP_TRANSFER_TYPE_BINARY |
INTERNET_FLAG_TRANSFER_BINARY |
INTERNET_FLAG_RELOAD,
0);
- if (This->hrequest)
+ if (bind->hrequest)
bSuccess = TRUE;
else
hres = HRESULT_FROM_WIN32(GetLastError());
break;
case INTERNET_SERVICE_HTTP:
- This->hrequest = HttpOpenRequestW(This->hconnect, NULL, path, NULL, NULL, NULL, 0, (DWORD)This);
- if (!This->hrequest)
+ bind->hrequest = HttpOpenRequestW(bind->hconnect, NULL, path, NULL, NULL, NULL, 0, (DWORD)bind);
+ if (!bind->hrequest)
{
hres = HRESULT_FROM_WIN32(GetLastError());
}
- else if (!HttpSendRequestW(This->hrequest, NULL, 0, NULL, 0))
+ else if (!HttpSendRequestW(bind->hrequest, NULL, 0, NULL, 0))
{
hres = HRESULT_FROM_WIN32(GetLastError());
- InternetCloseHandle(This->hrequest);
+ InternetCloseHandle(bind->hrequest);
}
else
{
- HttpQueryInfoW(This->hrequest,
+ HttpQueryInfoW(bind->hrequest,
HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER,
- &This->expected_size,
+ &bind->expected_size,
&lensz,
NULL);
bSuccess = TRUE;
@@ -643,30 +776,30 @@ static HRESULT WINAPI URLMonikerImpl_Bin
}
if(bSuccess)
{
- TRACE("res = %ld gle = %08lx url len = %ld\n", hres, GetLastError(), This->expected_size);
+ TRACE("res = %ld gle = %08lx url len = %ld\n", hres, GetLastError(), bind->expected_size);
- IBindStatusCallback_OnProgress(This->pbscb, 0, 0, BINDSTATUS_CACHEFILENAMEAVAILABLE, szFileName);
+ IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_CACHEFILENAMEAVAILABLE, szFileName);
while(1) {
char buf[4096];
DWORD bufread;
- if(InternetReadFile(This->hrequest, buf, sizeof(buf), &bufread)) {
+ if(InternetReadFile(bind->hrequest, buf, sizeof(buf), &bufread)) {
TRACE("read %ld bytes %s...\n", bufread, debugstr_an(buf, 10));
if(bufread == 0) break;
- hres = URLMonikerImpl_MoreCacheData(This, buf, bufread);
+ hres = Binding_MoreCacheData(bind, buf, bufread);
} else
break;
}
- InternetCloseHandle(This->hrequest);
+ InternetCloseHandle(bind->hrequest);
hres = S_OK;
}
- InternetCloseHandle(This->hconnect);
- InternetCloseHandle(This->hinternet);
+ InternetCloseHandle(bind->hconnect);
+ InternetCloseHandle(bind->hinternet);
break;
case INTERNET_SCHEME_FILE:
- path = This->URLName + 5; /* Skip the "file:" part */
+ path = bind->URLName + 5; /* Skip the "file:" part */
if ((path[0] != '/' && path[0] != '\\') ||
(path[1] != '/' && path[1] != '\\'))
{
@@ -689,10 +822,10 @@ static HRESULT WINAPI URLMonikerImpl_Bin
char buf[4096];
DWORD bufread;
- IBindStatusCallback_OnProgress(This->pbscb, 0, 0, BINDSTATUS_CACHEFILENAMEAVAILABLE, szFileName);
+ IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_CACHEFILENAMEAVAILABLE, szFileName);
while (ReadFile(h, buf, sizeof(buf), &bufread, NULL) && bufread > 0)
- hres = URLMonikerImpl_MoreCacheData(This, buf, bufread);
+ hres = Binding_MoreCacheData(bind, buf, bufread);
CloseHandle(h);
hres = S_OK;
@@ -705,8 +838,8 @@ static HRESULT WINAPI URLMonikerImpl_Bin
FIXME("Unsupported URI scheme");
break;
}
- URLMonikerImpl_CloseCacheDownload(This);
- URLMonikerImpl_FinishedDownload(This, hres);
+ Binding_CloseCacheDownload(bind);
+ Binding_FinishedDownload(bind, hres);
if (user)
HeapFree(GetProcessHeap(), 0, user);
@@ -718,6 +851,9 @@ static HRESULT WINAPI URLMonikerImpl_Bin
}
}
}
+
+ IBinding_Release((IBinding*)bind);
+
return hres;
}
@@ -964,98 +1100,6 @@ static HRESULT WINAPI URLMonikerImpl_IsS
return S_OK;
}
-static HRESULT WINAPI URLMonikerImpl_IBinding_QueryInterface(IBinding* iface,REFIID riid,void** ppvObject)
-{
- ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
-
- TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
-
- /* Perform a sanity check on the parameters.*/
- if ( (This==0) || (ppvObject==0) )
- return E_INVALIDARG;
-
- /* Initialize the return parameter */
- *ppvObject = 0;
-
- /* Compare the riid with the interface IDs implemented by this object.*/
- if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IBinding, riid))
- *ppvObject = iface;
-
- /* Check that we obtained an interface.*/
- if ((*ppvObject)==0)
- return E_NOINTERFACE;
-
- /* Query Interface always increases the reference count by one when it is successful */
- IBinding_AddRef(iface);
-
- return S_OK;
-
-}
-
-static ULONG WINAPI URLMonikerImpl_IBinding_AddRef(IBinding* iface)
-{
- ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
- TRACE("(%p)\n",This);
-
- return URLMonikerImpl_AddRef((IMoniker*)This);
-}
-
-static ULONG WINAPI URLMonikerImpl_IBinding_Release(IBinding* iface)
-{
- ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
- TRACE("(%p)\n",This);
-
- return URLMonikerImpl_Release((IMoniker*)This);
-}
-
-static HRESULT WINAPI URLMonikerImpl_IBinding_Abort(IBinding* iface)
-{
- ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
- FIXME("(%p): stub\n", This);
-
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI URLMonikerImpl_IBinding_GetBindResult(IBinding* iface, CLSID* pclsidProtocol, DWORD* pdwResult, LPOLESTR* pszResult, DWORD* pdwReserved)
-{
- ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
- FIXME("(%p)->(%p, %p, %p, %p): stub\n", This, pclsidProtocol, pdwResult, pszResult, pdwReserved);
-
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI URLMonikerImpl_IBinding_GetPriority(IBinding* iface, LONG* pnPriority)
-{
- ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
- FIXME("(%p)->(%p): stub\n", This, pnPriority);
-
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI URLMonikerImpl_IBinding_Resume(IBinding* iface)
-{
- ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
- FIXME("(%p): stub\n", This);
-
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI URLMonikerImpl_IBinding_SetPriority(IBinding* iface, LONG nPriority)
-{
- ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
- FIXME("(%p)->(%ld): stub\n", This, nPriority);
-
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI URLMonikerImpl_IBinding_Suspend(IBinding* iface)
-{
- ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
- FIXME("(%p): stub\n", This);
-
- return E_NOTIMPL;
-}
-
/********************************************************************************/
/* Virtual function table for the URLMonikerImpl class which include IPersist,*/
/* IPersistStream and IMoniker functions. */
@@ -1086,19 +1130,6 @@ static IMonikerVtbl VT_URLMonikerImpl =
URLMonikerImpl_IsSystemMoniker
};
-static IBindingVtbl VTBinding_URLMonikerImpl =
-{
- URLMonikerImpl_IBinding_QueryInterface,
- URLMonikerImpl_IBinding_AddRef,
- URLMonikerImpl_IBinding_Release,
- URLMonikerImpl_IBinding_Abort,
- URLMonikerImpl_IBinding_Suspend,
- URLMonikerImpl_IBinding_Resume,
- URLMonikerImpl_IBinding_SetPriority,
- URLMonikerImpl_IBinding_GetPriority,
- URLMonikerImpl_IBinding_GetBindResult
-};
-
/******************************************************************************
* URLMoniker_Construct (local function)
*******************************************************************************/
@@ -1111,9 +1142,8 @@ static HRESULT URLMonikerImpl_Construct(
memset(This, 0, sizeof(*This));
/* Initialize the virtual function table. */
- This->lpvtbl1 = &VT_URLMonikerImpl;
- This->lpvtbl2 = &VTBinding_URLMonikerImpl;
- This->ref = 0;
+ This->lpvtbl = &VT_URLMonikerImpl;
+ This->ref = 0;
if(lpszLeftURLName) {
hres = UrlCombineW(lpszLeftURLName, lpszURLName, NULL, &sizeStr, 0);
Index: dlls/urlmon/tests/url.c
===================================================================
RCS file: /home/wine/wine/dlls/urlmon/tests/url.c,v
retrieving revision 1.4
diff -u -p -r1.4 url.c
--- dlls/urlmon/tests/url.c 20 Dec 2004 18:58:04 -0000 1.4
+++ dlls/urlmon/tests/url.c 22 May 2005 10:06:49 -0000
@@ -93,12 +93,19 @@ static ULONG WINAPI statusclb_Release(IB
static HRESULT WINAPI statusclb_OnStartBinding(IBindStatusCallback *iface, DWORD dwReserved, IBinding *pib)
{
statusclb *This = (statusclb*)iface;
+ HRESULT hres;
+ IMoniker *mon;
This->pbind = pib;
ok(pib != NULL, "pib should not be NULL\n");
if(pib)
IBinding_AddRef(pib);
+ hres = IBinding_QueryInterface(pib, &IID_IMoniker, (void**)&mon);
+ ok(hres == E_NOINTERFACE, "IBinding should not have IMoniker interface\n");
+ if(SUCCEEDED(hres))
+ IMoniker_Release(mon);
+
return S_OK;
}
@@ -242,6 +249,7 @@ static void test_BindToStorage()
MSG msg;
IBindStatusCallback *previousclb, *sclb = statusclb_create();
IUnknown *unk = (IUnknown*)0x00ff00ff;
+ IBinding *bind;
hres = CreateAsyncBindCtx(0, sclb, NULL, &bctx);
ok(SUCCEEDED(hres), "CreateAsyncBindCtx failed: %08lx\n\n", hres);
@@ -263,6 +271,11 @@ static void test_BindToStorage()
IBindCtx_Release(bctx);
return;
}
+
+ hres = IMoniker_QueryInterface(mon, &IID_IBinding, (void**)&bind);
+ ok(hres == E_NOINTERFACE, "IMoniker should not have IBinding interface\n");
+ if(SUCCEEDED(hres))
+ IBinding_Release(bind);
hres = IMoniker_GetDisplayName(mon, bctx, NULL, &display_name);
ok(SUCCEEDED(hres), "GetDisplayName failed %08lx\n", hres);
More information about the wine-patches
mailing list