From 1ad867467e3c094765bfe41b1ae7c9af08391453 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 18 Mar 2010 01:19:02 +0300 Subject: [PATCH] urlmon: Add stub IUriBuilder interface. --- dlls/urlmon/uri.c | 278 +++++++++++++++++++++++++++++++++++++++- dlls/urlmon/urlmon.spec | 1 + include/urlmon.idl | 100 +++++++++++++++ 3 files changed, 378 insertions(+), 1 deletion(-) diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index d4d6b47e5ab..668aa9b7109 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -26,7 +26,13 @@ typedef struct { LONG ref; } Uri; -#define URI(x) ((IUri*) &(x)->lpIUriVtbl) +typedef struct { + const IUriBuilderVtbl *lpIUriBuilderVtbl; + LONG ref; +} UriBuilder; + +#define URI(x) ((IUri*) &(x)->lpIUriVtbl) +#define URIBUILDER(x) ((IUriBuilder*) &(x)->lpIUriBuilderVtbl) #define URI_THIS(iface) DEFINE_THIS(Uri, IUri, iface) @@ -300,3 +306,273 @@ HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IU *ppURI = URI(ret); return S_OK; } + +#define URIBUILDER_THIS(iface) DEFINE_THIS(UriBuilder, IUriBuilder, iface) + +static HRESULT WINAPI UriBuilder_QueryInterface(IUriBuilder *iface, REFIID riid, void **ppv) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = URIBUILDER(This); + }else if(IsEqualGUID(&IID_IUriBuilder, riid)) { + TRACE("(%p)->(IID_IUri %p)\n", This, ppv); + *ppv = URIBUILDER(This); + }else { + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI UriBuilder_AddRef(IUriBuilder *iface) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI UriBuilder_Release(IUriBuilder *iface) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) + heap_free(This); + + return ref; +} + +static HRESULT WINAPI UriBuilder_CreateUriSimple(IUriBuilder *iface, + DWORD dwAllowEncodingPropertyMask, + DWORD_PTR dwReserved, + IUri **ppIUri) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%d %d %p)\n", This, dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_CreateUri(IUriBuilder *iface, + DWORD dwCreateFlags, + DWORD dwAllowEncodingPropertyMask, + DWORD_PTR dwReserved, + IUri **ppIUri) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(0x%08x %d %d %p)\n", This, dwCreateFlags, dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_CreateUriWithFlags(IUriBuilder *iface, + DWORD dwCreateFlags, + DWORD dwUriBuilderFlags, + DWORD dwAllowEncodingPropertyMask, + DWORD_PTR dwReserved, + IUri **ppIUri) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(0x%08x 0x%08x %d %d %p)\n", This, dwCreateFlags, dwUriBuilderFlags, + dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_GetIUri(IUriBuilder *iface, IUri **ppIUri) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%p)\n", This, ppIUri); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_SetIUri(IUriBuilder *iface, IUri *pIUri) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%p)\n", This, pIUri); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_GetFragment(IUriBuilder *iface, DWORD *pcchFragment, LPCWSTR *ppwzFragment) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%p %p)\n", This, pcchFragment, ppwzFragment); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_GetHost(IUriBuilder *iface, DWORD *pcchHost, LPCWSTR *ppwzHost) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%p %p)\n", This, pcchHost, ppwzHost); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_GetPassword(IUriBuilder *iface, DWORD *pcchPassword, LPCWSTR *ppwzPassword) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%p %p)\n", This, pcchPassword, ppwzPassword); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_GetPath(IUriBuilder *iface, DWORD *pcchPath, LPCWSTR *ppwzPath) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%p %p)\n", This, pcchPath, ppwzPath); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_GetPort(IUriBuilder *iface, BOOL *pfHasPort, DWORD *pdwPort) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%p %p)\n", This, pfHasPort, pdwPort); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_GetQuery(IUriBuilder *iface, DWORD *pcchQuery, LPCWSTR *ppwzQuery) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%p %p)\n", This, pcchQuery, ppwzQuery); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_GetSchemeName(IUriBuilder *iface, DWORD *pcchSchemeName, LPCWSTR *ppwzSchemeName) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%p %p)\n", This, pcchSchemeName, ppwzSchemeName); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_GetUserName(IUriBuilder *iface, DWORD *pcchUserName, LPCWSTR *ppwzUserName) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%p %p)\n", This, pcchUserName, ppwzUserName); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_SetFragment(IUriBuilder *iface, LPCWSTR pwzNewValue) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue)); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_SetHost(IUriBuilder *iface, LPCWSTR pwzNewValue) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue)); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_SetPassword(IUriBuilder *iface, LPCWSTR pwzNewValue) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue)); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_SetPath(IUriBuilder *iface, LPCWSTR pwzNewValue) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue)); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_SetPort(IUriBuilder *iface, BOOL fHasPort, DWORD dwNewValue) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%d %d)\n", This, fHasPort, dwNewValue); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_SetQuery(IUriBuilder *iface, LPCWSTR pwzNewValue) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue)); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_SetSchemeName(IUriBuilder *iface, LPCWSTR pwzNewValue) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue)); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewValue) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue)); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_RemoveProperties(IUriBuilder *iface, DWORD dwPropertyMask) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(0x%08x)\n", This, dwPropertyMask); + return E_NOTIMPL; +} + +static HRESULT WINAPI UriBuilder_HasBeenModified(IUriBuilder *iface, BOOL *pfModified) +{ + UriBuilder *This = URIBUILDER_THIS(iface); + FIXME("(%p)->(%p)\n", This, pfModified); + return E_NOTIMPL; +} + +#undef URIBUILDER_THIS + +static const IUriBuilderVtbl UriBuilderVtbl = { + UriBuilder_QueryInterface, + UriBuilder_AddRef, + UriBuilder_Release, + UriBuilder_CreateUriSimple, + UriBuilder_CreateUri, + UriBuilder_CreateUriWithFlags, + UriBuilder_GetIUri, + UriBuilder_SetIUri, + UriBuilder_GetFragment, + UriBuilder_GetHost, + UriBuilder_GetPassword, + UriBuilder_GetPath, + UriBuilder_GetPort, + UriBuilder_GetQuery, + UriBuilder_GetSchemeName, + UriBuilder_GetUserName, + UriBuilder_SetFragment, + UriBuilder_SetHost, + UriBuilder_SetPassword, + UriBuilder_SetPath, + UriBuilder_SetPort, + UriBuilder_SetQuery, + UriBuilder_SetSchemeName, + UriBuilder_SetUserName, + UriBuilder_RemoveProperties, + UriBuilder_HasBeenModified, +}; + +/*********************************************************************** + * CreateIUriBuilder (urlmon.@) + */ +HRESULT WINAPI CreateIUriBuilder(IUri *pIUri, DWORD dwFlags, DWORD_PTR dwReserved, IUriBuilder **ppIUriBuilder) +{ + UriBuilder *ret; + + TRACE("(%p %x %x %p)\n", pIUri, dwFlags, (DWORD)dwReserved, ppIUriBuilder); + + ret = heap_alloc(sizeof(UriBuilder)); + if(!ret) + return E_OUTOFMEMORY; + + ret->lpIUriBuilderVtbl = &UriBuilderVtbl; + ret->ref = 1; + + *ppIUriBuilder = URIBUILDER(ret); + return S_OK; +} diff --git a/dlls/urlmon/urlmon.spec b/dlls/urlmon/urlmon.spec index a67004a9b0b..4c08bb2f657 100644 --- a/dlls/urlmon/urlmon.spec +++ b/dlls/urlmon/urlmon.spec @@ -26,6 +26,7 @@ @ stdcall CreateAsyncBindCtx(long ptr ptr ptr) @ stdcall CreateAsyncBindCtxEx(ptr long ptr ptr ptr long) @ stdcall CreateFormatEnumerator(long ptr ptr) +@ stdcall CreateIUriBuilder(ptr long long ptr) @ stdcall CreateUri(wstr long long ptr) @ stdcall CreateURLMoniker(ptr wstr ptr) @ stdcall CreateURLMonikerEx(ptr wstr ptr long) diff --git a/include/urlmon.idl b/include/urlmon.idl index d16a3b5d7ec..2ab3b2b021d 100644 --- a/include/urlmon.idl +++ b/include/urlmon.idl @@ -24,6 +24,7 @@ import "msxml.idl"; cpp_quote("#ifdef WINE_NO_UNICODE_MACROS") cpp_quote("#undef GetUserName") +cpp_quote("#undef SetPort") cpp_quote("#endif") interface IInternetProtocolSink; @@ -1716,6 +1717,105 @@ interface IUriContainer : IUnknown HRESULT GetIUri([out] IUri **ppIUri); } +/***************************************************************************** + * IUriBuilder interface + */ +[ + local, + object, + uuid(4221b2e1-8955-46c0-bd5b-de9897565de7), + pointer_default(unique) +] +interface IUriBuilder: IUnknown +{ + HRESULT CreateUriSimple( + [in] DWORD dwAllowEncodingPropertyMask, + [in] DWORD_PTR dwReserved, + [out] IUri **ppIUri); + + HRESULT CreateUri( + [in] DWORD dwCreateFlags, + [in] DWORD dwAllowEncodingPropertyMask, + [in] DWORD_PTR dwReserved, + [out] IUri **ppIUri); + + HRESULT CreateUriWithFlags( + [in] DWORD dwCreateFlags, + [in] DWORD dwUriBuilderFlags, + [in] DWORD dwAllowEncodingPropertyMask, + [in] DWORD_PTR dwReserved, + [out] IUri **ppIUri); + + HRESULT GetIUri( + [out] IUri **ppIUri); + + HRESULT SetIUri( + [in, unique] IUri *pIUri); + + HRESULT GetFragment( + [out] DWORD *pcchFragment, + [out] LPCWSTR *ppwzFragment); + + HRESULT GetHost( + [out] DWORD *pcchHost, + [out] LPCWSTR *ppwzHost); + + HRESULT GetPassword( + [out] DWORD *pcchPassword, + [out] LPCWSTR *ppwzPassword); + + HRESULT GetPath( + [out] DWORD *pcchPath, + [out] LPCWSTR *ppwzPath); + + HRESULT GetPort( + [out] BOOL *pfHasPort, + [out] DWORD *pdwPort); + + HRESULT GetQuery( + [out] DWORD *pcchQuery, + [out] LPCWSTR *ppwzQuery); + + HRESULT GetSchemeName( + [out] DWORD *pcchSchemeName, + [out] LPCWSTR *ppwzSchemeName); + + HRESULT GetUserName( + [out] DWORD *pcchUserName, + [out] LPCWSTR *ppwzUserName); + + HRESULT SetFragment( + [in] LPCWSTR pwzNewValue); + + HRESULT SetHost( + [in] LPCWSTR pwzNewValue); + + HRESULT SetPassword( + [in] LPCWSTR pwzNewValue); + + HRESULT SetPath( + [in] LPCWSTR pwzNewValue); + + HRESULT SetPort( + [in] BOOL fHasPort, + [in] DWORD dwNewValue); + + HRESULT SetQuery( + [in] LPCWSTR pwzNewValue); + + HRESULT SetSchemeName( + [in] LPCWSTR pwzNewValue); + + HRESULT SetUserName( + [in] LPCWSTR pwzNewValue); + + HRESULT RemoveProperties( + [in] DWORD dwPropertyMask); + + HRESULT HasBeenModified( + [out] BOOL *pfModified); +}; + /***************************************************************************** * IInternetProtocolEx interface */