Commit af35ffa1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

Added support for aggregation in about protocol.

parent df6ed2f4
...@@ -41,6 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); ...@@ -41,6 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define PROTOCOLINFO(x) ((IInternetProtocolInfo*) &(x)->lpInternetProtocolInfoVtbl) #define PROTOCOLINFO(x) ((IInternetProtocolInfo*) &(x)->lpInternetProtocolInfoVtbl)
#define CLASSFACTORY(x) ((IClassFactory*) &(x)->lpClassFactoryVtbl) #define CLASSFACTORY(x) ((IClassFactory*) &(x)->lpClassFactoryVtbl)
#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
typedef struct { typedef struct {
const IInternetProtocolInfoVtbl *lpInternetProtocolInfoVtbl; const IInternetProtocolInfoVtbl *lpInternetProtocolInfoVtbl;
...@@ -140,21 +141,27 @@ typedef struct { ...@@ -140,21 +141,27 @@ typedef struct {
BYTE *data; BYTE *data;
ULONG data_len; ULONG data_len;
ULONG cur; ULONG cur;
IUnknown *pUnkOuter;
} AboutProtocol; } AboutProtocol;
static HRESULT WINAPI AboutProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) static HRESULT WINAPI AboutProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
{ {
AboutProtocol *This = (AboutProtocol*)iface;
*ppv = NULL; *ppv = NULL;
if(IsEqualGUID(&IID_IUnknown, riid)) { if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv); TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
*ppv = iface; if(This->pUnkOuter)
return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
*ppv = PROTOCOL(This);
}else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", iface, ppv); TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", iface, ppv);
*ppv = iface; *ppv = PROTOCOL(This);
}else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
TRACE("(%p)->(IID_IInternetProtocol %p)\n", iface, ppv); TRACE("(%p)->(IID_IInternetProtocol %p)\n", iface, ppv);
*ppv = iface; *ppv = PROTOCOL(This);
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) { }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
FIXME("IServiceProvider is not implemented\n"); FIXME("IServiceProvider is not implemented\n");
return E_NOINTERFACE; return E_NOINTERFACE;
...@@ -174,7 +181,7 @@ static ULONG WINAPI AboutProtocol_AddRef(IInternetProtocol *iface) ...@@ -174,7 +181,7 @@ static ULONG WINAPI AboutProtocol_AddRef(IInternetProtocol *iface)
AboutProtocol *This = (AboutProtocol*)iface; AboutProtocol *This = (AboutProtocol*)iface;
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%ld\n", iface, ref); TRACE("(%p) ref=%ld\n", iface, ref);
return ref; return This->pUnkOuter ? IUnknown_AddRef(This->pUnkOuter) : ref;
} }
static ULONG WINAPI AboutProtocol_Release(IInternetProtocol *iface) static ULONG WINAPI AboutProtocol_Release(IInternetProtocol *iface)
...@@ -190,7 +197,7 @@ static ULONG WINAPI AboutProtocol_Release(IInternetProtocol *iface) ...@@ -190,7 +197,7 @@ static ULONG WINAPI AboutProtocol_Release(IInternetProtocol *iface)
UNLOCK_MODULE(); UNLOCK_MODULE();
} }
return ref; return This->pUnkOuter ? IUnknown_Release(This->pUnkOuter) : ref;
} }
static HRESULT WINAPI AboutProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, static HRESULT WINAPI AboutProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
...@@ -352,9 +359,9 @@ static HRESULT WINAPI AboutProtocolFactory_CreateInstance(IClassFactory *iface, ...@@ -352,9 +359,9 @@ static HRESULT WINAPI AboutProtocolFactory_CreateInstance(IClassFactory *iface,
REFIID riid, void **ppv) REFIID riid, void **ppv)
{ {
AboutProtocol *ret; AboutProtocol *ret;
HRESULT hres; HRESULT hres = S_OK;
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv); TRACE("(%p)->(%p %s %p)\n", iface, pUnkOuter, debugstr_guid(riid), ppv);
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(AboutProtocol)); ret = HeapAlloc(GetProcessHeap(), 0, sizeof(AboutProtocol));
ret->lpInternetProtocolVtbl = &AboutProtocolVtbl; ret->lpInternetProtocolVtbl = &AboutProtocolVtbl;
...@@ -363,8 +370,17 @@ static HRESULT WINAPI AboutProtocolFactory_CreateInstance(IClassFactory *iface, ...@@ -363,8 +370,17 @@ static HRESULT WINAPI AboutProtocolFactory_CreateInstance(IClassFactory *iface,
ret->data = NULL; ret->data = NULL;
ret->data_len = 0; ret->data_len = 0;
ret->cur = 0; ret->cur = 0;
ret->pUnkOuter = pUnkOuter;
hres = IUnknown_QueryInterface((IUnknown*)ret, riid, ppv);
if(pUnkOuter) {
ret->ref = 1;
if(IsEqualGUID(&IID_IUnknown, riid))
*ppv = PROTOCOL(ret);
else
hres = E_INVALIDARG;
}else {
hres = IInternetProtocol_QueryInterface(PROTOCOL(ret), riid, ppv);
}
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
LOCK_MODULE(); LOCK_MODULE();
...@@ -683,7 +699,7 @@ static HRESULT WINAPI ResProtocolFactory_CreateInstance(IClassFactory *iface, IU ...@@ -683,7 +699,7 @@ static HRESULT WINAPI ResProtocolFactory_CreateInstance(IClassFactory *iface, IU
ResProtocol *ret; ResProtocol *ret;
HRESULT hres; HRESULT hres;
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv); TRACE("(%p)->(%p %s %p)\n", iface, pUnkOuter, debugstr_guid(riid), ppv);
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ResProtocol)); ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ResProtocol));
ret->lpInternetProtocolVtbl = &ResProtocolVtbl; ret->lpInternetProtocolVtbl = &ResProtocolVtbl;
......
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