2 * Copyright 2010 Jacek Caban for CodeWeavers
3 * Copyright 2010 Thomas Mullaly
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "urlmon_main.h"
21 #include "wine/debug.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
26 const IUriVtbl *lpIUriVtbl;
31 const IUriBuilderVtbl *lpIUriBuilderVtbl;
35 #define URI(x) ((IUri*) &(x)->lpIUriVtbl)
36 #define URIBUILDER(x) ((IUriBuilder*) &(x)->lpIUriBuilderVtbl)
38 #define URI_THIS(iface) DEFINE_THIS(Uri, IUri, iface)
40 static HRESULT WINAPI Uri_QueryInterface(IUri *iface, REFIID riid, void **ppv)
42 Uri *This = URI_THIS(iface);
44 if(IsEqualGUID(&IID_IUnknown, riid)) {
45 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
47 }else if(IsEqualGUID(&IID_IUri, riid)) {
48 TRACE("(%p)->(IID_IUri %p)\n", This, ppv);
51 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
56 IUnknown_AddRef((IUnknown*)*ppv);
60 static ULONG WINAPI Uri_AddRef(IUri *iface)
62 Uri *This = URI_THIS(iface);
63 LONG ref = InterlockedIncrement(&This->ref);
65 TRACE("(%p) ref=%d\n", This, ref);
70 static ULONG WINAPI Uri_Release(IUri *iface)
72 Uri *This = URI_THIS(iface);
73 LONG ref = InterlockedDecrement(&This->ref);
75 TRACE("(%p) ref=%d\n", This, ref);
83 static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BSTR *pbstrProperty, DWORD dwFlags)
85 Uri *This = URI_THIS(iface);
86 FIXME("(%p)->(%d %p %x)\n", This, uriProp, pbstrProperty, dwFlags);
90 static HRESULT WINAPI Uri_GetPropertyLength(IUri *iface, Uri_PROPERTY uriProp, DWORD *pcchProperty, DWORD dwFlags)
92 Uri *This = URI_THIS(iface);
93 FIXME("(%p)->(%d %p %x)\n", This, uriProp, pcchProperty, dwFlags);
97 static HRESULT WINAPI Uri_GetPropertyDWORD(IUri *iface, Uri_PROPERTY uriProp, DWORD *pcchProperty, DWORD dwFlags)
99 Uri *This = URI_THIS(iface);
100 FIXME("(%p)->(%d %p %x)\n", This, uriProp, pcchProperty, dwFlags);
105 /* Microsoft's implementation for the ZONE property of a URI seems to be lacking...
106 * From what I can tell, instead of checking which URLZONE the URI belongs to it
107 * simply assigns URLZONE_INVALID and returns E_NOTIMPL. This also applies the GetZone
110 if(uriProp == Uri_PROPERTY_ZONE) {
111 *pcchProperty = URLZONE_INVALID;
118 static HRESULT WINAPI Uri_HasProperty(IUri *iface, Uri_PROPERTY uriProp, BOOL *pfHasProperty)
120 Uri *This = URI_THIS(iface);
121 FIXME("(%p)->()\n", This);
125 static HRESULT WINAPI Uri_GetAbsoluteUri(IUri *iface, BSTR *pstrAbsoluteUri)
127 Uri *This = URI_THIS(iface);
128 FIXME("(%p)->(%p)\n", This, pstrAbsoluteUri);
136 static HRESULT WINAPI Uri_GetAuthority(IUri *iface, BSTR *pstrAuthority)
138 Uri *This = URI_THIS(iface);
139 FIXME("(%p)->(%p)\n", This, pstrAuthority);
147 static HRESULT WINAPI Uri_GetDisplayUri(IUri *iface, BSTR *pstrDisplayUri)
149 Uri *This = URI_THIS(iface);
150 FIXME("(%p)->(%p)\n", This, pstrDisplayUri);
158 static HRESULT WINAPI Uri_GetDomain(IUri *iface, BSTR *pstrDomain)
160 Uri *This = URI_THIS(iface);
161 FIXME("(%p)->(%p)\n", This, pstrDomain);
169 static HRESULT WINAPI Uri_GetExtension(IUri *iface, BSTR *pstrExtension)
171 Uri *This = URI_THIS(iface);
172 FIXME("(%p)->(%p)\n", This, pstrExtension);
180 static HRESULT WINAPI Uri_GetFragment(IUri *iface, BSTR *pstrFragment)
182 Uri *This = URI_THIS(iface);
183 FIXME("(%p)->(%p)\n", This, pstrFragment);
191 static HRESULT WINAPI Uri_GetHost(IUri *iface, BSTR *pstrHost)
193 Uri *This = URI_THIS(iface);
194 FIXME("(%p)->(%p)\n", This, pstrHost);
198 static HRESULT WINAPI Uri_GetPassword(IUri *iface, BSTR *pstrPassword)
200 Uri *This = URI_THIS(iface);
201 FIXME("(%p)->(%p)\n", This, pstrPassword);
209 static HRESULT WINAPI Uri_GetPath(IUri *iface, BSTR *pstrPath)
211 Uri *This = URI_THIS(iface);
212 FIXME("(%p)->(%p)\n", This, pstrPath);
216 static HRESULT WINAPI Uri_GetPathAndQuery(IUri *iface, BSTR *pstrPathAndQuery)
218 Uri *This = URI_THIS(iface);
219 FIXME("(%p)->(%p)\n", This, pstrPathAndQuery);
223 static HRESULT WINAPI Uri_GetQuery(IUri *iface, BSTR *pstrQuery)
225 Uri *This = URI_THIS(iface);
226 FIXME("(%p)->(%p)\n", This, pstrQuery);
230 static HRESULT WINAPI Uri_GetRawUri(IUri *iface, BSTR *pstrRawUri)
232 Uri *This = URI_THIS(iface);
233 FIXME("(%p)->(%p)\n", This, pstrRawUri);
237 static HRESULT WINAPI Uri_GetSchemeName(IUri *iface, BSTR *pstrSchemeName)
239 Uri *This = URI_THIS(iface);
240 FIXME("(%p)->(%p)\n", This, pstrSchemeName);
244 static HRESULT WINAPI Uri_GetUserInfo(IUri *iface, BSTR *pstrUserInfo)
246 Uri *This = URI_THIS(iface);
247 FIXME("(%p)->(%p)\n", This, pstrUserInfo);
251 static HRESULT WINAPI Uri_GetUserName(IUri *iface, BSTR *pstrUserName)
253 Uri *This = URI_THIS(iface);
254 FIXME("(%p)->(%p)\n", This, pstrUserName);
258 static HRESULT WINAPI Uri_GetHostType(IUri *iface, DWORD *pdwHostType)
260 Uri *This = URI_THIS(iface);
261 FIXME("(%p)->(%p)\n", This, pdwHostType);
265 static HRESULT WINAPI Uri_GetPort(IUri *iface, DWORD *pdwPort)
267 Uri *This = URI_THIS(iface);
268 FIXME("(%p)->(%p)\n", This, pdwPort);
272 static HRESULT WINAPI Uri_GetScheme(IUri *iface, DWORD *pdwScheme)
274 Uri *This = URI_THIS(iface);
275 FIXME("(%p)->(%p)\n", This, pdwScheme);
279 static HRESULT WINAPI Uri_GetZone(IUri *iface, DWORD *pdwZone)
281 Uri *This = URI_THIS(iface);
282 FIXME("(%p)->(%p)\n", This, pdwZone);
286 static HRESULT WINAPI Uri_GetProperties(IUri *iface, DWORD *pdwProperties)
288 Uri *This = URI_THIS(iface);
289 FIXME("(%p)->(%p)\n", This, pdwProperties);
293 static HRESULT WINAPI Uri_IsEqual(IUri *iface, IUri *pUri, BOOL *pfEqual)
295 Uri *This = URI_THIS(iface);
296 FIXME("(%p)->(%p %p)\n", This, pUri, pfEqual);
302 static const IUriVtbl UriVtbl = {
307 Uri_GetPropertyLength,
308 Uri_GetPropertyDWORD,
333 /***********************************************************************
334 * CreateUri (urlmon.@)
336 HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IUri **ppURI)
340 TRACE("(%s %x %x %p)\n", debugstr_w(pwzURI), dwFlags, (DWORD)dwReserved, ppURI);
350 ret = heap_alloc(sizeof(Uri));
352 return E_OUTOFMEMORY;
354 ret->lpIUriVtbl = &UriVtbl;
361 #define URIBUILDER_THIS(iface) DEFINE_THIS(UriBuilder, IUriBuilder, iface)
363 static HRESULT WINAPI UriBuilder_QueryInterface(IUriBuilder *iface, REFIID riid, void **ppv)
365 UriBuilder *This = URIBUILDER_THIS(iface);
367 if(IsEqualGUID(&IID_IUnknown, riid)) {
368 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
369 *ppv = URIBUILDER(This);
370 }else if(IsEqualGUID(&IID_IUriBuilder, riid)) {
371 TRACE("(%p)->(IID_IUri %p)\n", This, ppv);
372 *ppv = URIBUILDER(This);
374 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
376 return E_NOINTERFACE;
379 IUnknown_AddRef((IUnknown*)*ppv);
383 static ULONG WINAPI UriBuilder_AddRef(IUriBuilder *iface)
385 UriBuilder *This = URIBUILDER_THIS(iface);
386 LONG ref = InterlockedIncrement(&This->ref);
388 TRACE("(%p) ref=%d\n", This, ref);
393 static ULONG WINAPI UriBuilder_Release(IUriBuilder *iface)
395 UriBuilder *This = URIBUILDER_THIS(iface);
396 LONG ref = InterlockedDecrement(&This->ref);
398 TRACE("(%p) ref=%d\n", This, ref);
406 static HRESULT WINAPI UriBuilder_CreateUriSimple(IUriBuilder *iface,
407 DWORD dwAllowEncodingPropertyMask,
408 DWORD_PTR dwReserved,
411 UriBuilder *This = URIBUILDER_THIS(iface);
412 FIXME("(%p)->(%d %d %p)\n", This, dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri);
416 static HRESULT WINAPI UriBuilder_CreateUri(IUriBuilder *iface,
418 DWORD dwAllowEncodingPropertyMask,
419 DWORD_PTR dwReserved,
422 UriBuilder *This = URIBUILDER_THIS(iface);
423 FIXME("(%p)->(0x%08x %d %d %p)\n", This, dwCreateFlags, dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri);
427 static HRESULT WINAPI UriBuilder_CreateUriWithFlags(IUriBuilder *iface,
429 DWORD dwUriBuilderFlags,
430 DWORD dwAllowEncodingPropertyMask,
431 DWORD_PTR dwReserved,
434 UriBuilder *This = URIBUILDER_THIS(iface);
435 FIXME("(%p)->(0x%08x 0x%08x %d %d %p)\n", This, dwCreateFlags, dwUriBuilderFlags,
436 dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri);
440 static HRESULT WINAPI UriBuilder_GetIUri(IUriBuilder *iface, IUri **ppIUri)
442 UriBuilder *This = URIBUILDER_THIS(iface);
443 FIXME("(%p)->(%p)\n", This, ppIUri);
447 static HRESULT WINAPI UriBuilder_SetIUri(IUriBuilder *iface, IUri *pIUri)
449 UriBuilder *This = URIBUILDER_THIS(iface);
450 FIXME("(%p)->(%p)\n", This, pIUri);
454 static HRESULT WINAPI UriBuilder_GetFragment(IUriBuilder *iface, DWORD *pcchFragment, LPCWSTR *ppwzFragment)
456 UriBuilder *This = URIBUILDER_THIS(iface);
457 FIXME("(%p)->(%p %p)\n", This, pcchFragment, ppwzFragment);
461 static HRESULT WINAPI UriBuilder_GetHost(IUriBuilder *iface, DWORD *pcchHost, LPCWSTR *ppwzHost)
463 UriBuilder *This = URIBUILDER_THIS(iface);
464 FIXME("(%p)->(%p %p)\n", This, pcchHost, ppwzHost);
468 static HRESULT WINAPI UriBuilder_GetPassword(IUriBuilder *iface, DWORD *pcchPassword, LPCWSTR *ppwzPassword)
470 UriBuilder *This = URIBUILDER_THIS(iface);
471 FIXME("(%p)->(%p %p)\n", This, pcchPassword, ppwzPassword);
475 static HRESULT WINAPI UriBuilder_GetPath(IUriBuilder *iface, DWORD *pcchPath, LPCWSTR *ppwzPath)
477 UriBuilder *This = URIBUILDER_THIS(iface);
478 FIXME("(%p)->(%p %p)\n", This, pcchPath, ppwzPath);
482 static HRESULT WINAPI UriBuilder_GetPort(IUriBuilder *iface, BOOL *pfHasPort, DWORD *pdwPort)
484 UriBuilder *This = URIBUILDER_THIS(iface);
485 FIXME("(%p)->(%p %p)\n", This, pfHasPort, pdwPort);
489 static HRESULT WINAPI UriBuilder_GetQuery(IUriBuilder *iface, DWORD *pcchQuery, LPCWSTR *ppwzQuery)
491 UriBuilder *This = URIBUILDER_THIS(iface);
492 FIXME("(%p)->(%p %p)\n", This, pcchQuery, ppwzQuery);
496 static HRESULT WINAPI UriBuilder_GetSchemeName(IUriBuilder *iface, DWORD *pcchSchemeName, LPCWSTR *ppwzSchemeName)
498 UriBuilder *This = URIBUILDER_THIS(iface);
499 FIXME("(%p)->(%p %p)\n", This, pcchSchemeName, ppwzSchemeName);
503 static HRESULT WINAPI UriBuilder_GetUserName(IUriBuilder *iface, DWORD *pcchUserName, LPCWSTR *ppwzUserName)
505 UriBuilder *This = URIBUILDER_THIS(iface);
506 FIXME("(%p)->(%p %p)\n", This, pcchUserName, ppwzUserName);
510 static HRESULT WINAPI UriBuilder_SetFragment(IUriBuilder *iface, LPCWSTR pwzNewValue)
512 UriBuilder *This = URIBUILDER_THIS(iface);
513 FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
517 static HRESULT WINAPI UriBuilder_SetHost(IUriBuilder *iface, LPCWSTR pwzNewValue)
519 UriBuilder *This = URIBUILDER_THIS(iface);
520 FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
524 static HRESULT WINAPI UriBuilder_SetPassword(IUriBuilder *iface, LPCWSTR pwzNewValue)
526 UriBuilder *This = URIBUILDER_THIS(iface);
527 FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
531 static HRESULT WINAPI UriBuilder_SetPath(IUriBuilder *iface, LPCWSTR pwzNewValue)
533 UriBuilder *This = URIBUILDER_THIS(iface);
534 FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
538 static HRESULT WINAPI UriBuilder_SetPort(IUriBuilder *iface, BOOL fHasPort, DWORD dwNewValue)
540 UriBuilder *This = URIBUILDER_THIS(iface);
541 FIXME("(%p)->(%d %d)\n", This, fHasPort, dwNewValue);
545 static HRESULT WINAPI UriBuilder_SetQuery(IUriBuilder *iface, LPCWSTR pwzNewValue)
547 UriBuilder *This = URIBUILDER_THIS(iface);
548 FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
552 static HRESULT WINAPI UriBuilder_SetSchemeName(IUriBuilder *iface, LPCWSTR pwzNewValue)
554 UriBuilder *This = URIBUILDER_THIS(iface);
555 FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
559 static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewValue)
561 UriBuilder *This = URIBUILDER_THIS(iface);
562 FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
566 static HRESULT WINAPI UriBuilder_RemoveProperties(IUriBuilder *iface, DWORD dwPropertyMask)
568 UriBuilder *This = URIBUILDER_THIS(iface);
569 FIXME("(%p)->(0x%08x)\n", This, dwPropertyMask);
573 static HRESULT WINAPI UriBuilder_HasBeenModified(IUriBuilder *iface, BOOL *pfModified)
575 UriBuilder *This = URIBUILDER_THIS(iface);
576 FIXME("(%p)->(%p)\n", This, pfModified);
580 #undef URIBUILDER_THIS
582 static const IUriBuilderVtbl UriBuilderVtbl = {
583 UriBuilder_QueryInterface,
586 UriBuilder_CreateUriSimple,
587 UriBuilder_CreateUri,
588 UriBuilder_CreateUriWithFlags,
591 UriBuilder_GetFragment,
593 UriBuilder_GetPassword,
597 UriBuilder_GetSchemeName,
598 UriBuilder_GetUserName,
599 UriBuilder_SetFragment,
601 UriBuilder_SetPassword,
605 UriBuilder_SetSchemeName,
606 UriBuilder_SetUserName,
607 UriBuilder_RemoveProperties,
608 UriBuilder_HasBeenModified,
611 /***********************************************************************
612 * CreateIUriBuilder (urlmon.@)
614 HRESULT WINAPI CreateIUriBuilder(IUri *pIUri, DWORD dwFlags, DWORD_PTR dwReserved, IUriBuilder **ppIUriBuilder)
618 TRACE("(%p %x %x %p)\n", pIUri, dwFlags, (DWORD)dwReserved, ppIUriBuilder);
620 ret = heap_alloc(sizeof(UriBuilder));
622 return E_OUTOFMEMORY;
624 ret->lpIUriBuilderVtbl = &UriBuilderVtbl;
627 *ppIUriBuilder = URIBUILDER(ret);