diff --git a/dlls/itss/Makefile.in b/dlls/itss/Makefile.in index 1485dfd9a24..65f89673567 100644 --- a/dlls/itss/Makefile.in +++ b/dlls/itss/Makefile.in @@ -12,6 +12,7 @@ C_SRCS = \ lzx.c \ itss.c \ moniker.c \ + protocol.c \ storage.c RC_SRCS = rsrc.rc diff --git a/dlls/itss/itss.c b/dlls/itss/itss.c index 683b02efccb..cca4f61df72 100644 --- a/dlls/itss/itss.c +++ b/dlls/itss/itss.c @@ -145,6 +145,7 @@ static const IClassFactoryVtbl ITSSCF_Vtbl = static const IClassFactoryImpl ITStorage_factory = { &ITSSCF_Vtbl, ITSS_create }; static const IClassFactoryImpl MSITStore_factory = { &ITSSCF_Vtbl, ITS_IParseDisplayName_create }; +static const IClassFactoryImpl ITSProtocol_factory = { &ITSSCF_Vtbl, ITSProtocol_create }; /*********************************************************************** * DllGetClassObject (ITSS.@) @@ -159,6 +160,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) factory = &ITStorage_factory; else if (IsEqualGUID(&CLSID_MSITStore, rclsid)) factory = &MSITStore_factory; + else if (IsEqualGUID(&CLSID_ITSProtocol, rclsid)) + factory = &ITSProtocol_factory; else { FIXME("%s: no class found.\n", debugstr_guid(rclsid)); diff --git a/dlls/itss/itsstor.h b/dlls/itss/itsstor.h index 736dd88ab4a..d134725406b 100644 --- a/dlls/itss/itsstor.h +++ b/dlls/itss/itsstor.h @@ -35,9 +35,12 @@ extern HRESULT ITS_IParseDisplayName_create( IUnknown *pUnkOuter, LPVOID *ppObj); +extern HRESULT ITSProtocol_create(IUnknown *pUnkOuter, LPVOID *ppobj); + extern LONG dll_count; static inline void ITSS_LockModule(void) { InterlockedIncrement(&dll_count); } static inline void ITSS_UnlockModule(void) { InterlockedDecrement(&dll_count); } +#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl))) #endif /* __WINE_ITS_STORAGE_PRIVATE__ */ diff --git a/dlls/itss/protocol.c b/dlls/itss/protocol.c new file mode 100644 index 00000000000..5a192af59bc --- /dev/null +++ b/dlls/itss/protocol.c @@ -0,0 +1,201 @@ +/* + * Copyright 2006 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "urlmon.h" +#include "itsstor.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(itss); + +typedef struct { + const IInternetProtocolVtbl *lpInternetProtocolVtbl; + LONG ref; +} ITSProtocol; + +#define PROTOCOL_THIS(iface) DEFINE_THIS(ITSProtocol, InternetProtocol, iface) + +#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) + +static HRESULT WINAPI ITSProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + + *ppv = NULL; + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = PROTOCOL(This); + }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { + TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); + *ppv = PROTOCOL(This); + }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { + TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); + *ppv = PROTOCOL(This); + } + + if(*ppv) { + IInternetProtocol_AddRef(iface); + return S_OK; + } + + WARN("not supported interface %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI ITSProtocol_AddRef(IInternetProtocol *iface) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + LONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p) ref=%d\n", This, ref); + return ref; +} + +static ULONG WINAPI ITSProtocol_Release(IInternetProtocol *iface) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) { + HeapFree(GetProcessHeap(), 0, This); + ITSS_UnlockModule(); + } + + return ref; +} + +static HRESULT WINAPI ITSProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, + IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, + DWORD grfPI, DWORD dwReserved) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink, + pOIBindInfo, grfPI, dwReserved); + return E_NOTIMPL; +} + +static HRESULT WINAPI ITSProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%p)\n", This, pProtocolData); + return E_NOTIMPL; +} + +static HRESULT WINAPI ITSProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, + DWORD dwOptions) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); + return E_NOTIMPL; +} + +static HRESULT WINAPI ITSProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%08x)\n", This, dwOptions); + return E_NOTIMPL; +} + +static HRESULT WINAPI ITSProtocol_Suspend(IInternetProtocol *iface) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ITSProtocol_Resume(IInternetProtocol *iface) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ITSProtocol_Read(IInternetProtocol *iface, void *pv, + ULONG cb, ULONG *pcbRead) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); + return E_NOTIMPL; +} + +static HRESULT WINAPI ITSProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, + DWORD dwOrgin, ULARGE_INTEGER *plibNewPosition) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrgin, plibNewPosition); + return E_NOTIMPL; +} + +static HRESULT WINAPI ITSProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%08x)\n", This, dwOptions); + return E_NOTIMPL; +} + +static HRESULT WINAPI ITSProtocol_UnlockRequest(IInternetProtocol *iface) +{ + ITSProtocol *This = PROTOCOL_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +#undef PROTOCOL_THIS + +static const IInternetProtocolVtbl ITSProtocolVtbl = { + ITSProtocol_QueryInterface, + ITSProtocol_AddRef, + ITSProtocol_Release, + ITSProtocol_Start, + ITSProtocol_Continue, + ITSProtocol_Abort, + ITSProtocol_Terminate, + ITSProtocol_Suspend, + ITSProtocol_Resume, + ITSProtocol_Read, + ITSProtocol_Seek, + ITSProtocol_LockRequest, + ITSProtocol_UnlockRequest +}; + +HRESULT ITSProtocol_create(IUnknown *pUnkOuter, LPVOID *ppobj) +{ + ITSProtocol *ret; + + TRACE("(%p %p)\n", pUnkOuter, ppobj); + + ITSS_LockModule(); + + ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ITSProtocol)); + + ret->lpInternetProtocolVtbl = &ITSProtocolVtbl; + ret->ref = 1; + + *ppobj = PROTOCOL(ret); + + return S_OK; +}