2 * Copyright 2010 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "urlmon_main.h"
20 #include "wine/debug.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(urlmon
);
25 const IUriVtbl
*lpIUriVtbl
;
30 const IUriBuilderVtbl
*lpIUriBuilderVtbl
;
34 #define URI(x) ((IUri*) &(x)->lpIUriVtbl)
35 #define URIBUILDER(x) ((IUriBuilder*) &(x)->lpIUriBuilderVtbl)
37 #define URI_THIS(iface) DEFINE_THIS(Uri, IUri, iface)
39 static HRESULT WINAPI
Uri_QueryInterface(IUri
*iface
, REFIID riid
, void **ppv
)
41 Uri
*This
= URI_THIS(iface
);
43 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
44 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
46 }else if(IsEqualGUID(&IID_IUri
, riid
)) {
47 TRACE("(%p)->(IID_IUri %p)\n", This
, ppv
);
50 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
55 IUnknown_AddRef((IUnknown
*)*ppv
);
59 static ULONG WINAPI
Uri_AddRef(IUri
*iface
)
61 Uri
*This
= URI_THIS(iface
);
62 LONG ref
= InterlockedIncrement(&This
->ref
);
64 TRACE("(%p) ref=%d\n", This
, ref
);
69 static ULONG WINAPI
Uri_Release(IUri
*iface
)
71 Uri
*This
= URI_THIS(iface
);
72 LONG ref
= InterlockedDecrement(&This
->ref
);
74 TRACE("(%p) ref=%d\n", This
, ref
);
82 static HRESULT WINAPI
Uri_GetPropertyBSTR(IUri
*iface
, Uri_PROPERTY uriProp
, BSTR
*pbstrProperty
, DWORD dwFlags
)
84 Uri
*This
= URI_THIS(iface
);
85 FIXME("(%p)->(%d %p %x)\n", This
, uriProp
, pbstrProperty
, dwFlags
);
89 static HRESULT WINAPI
Uri_GetPropertyLength(IUri
*iface
, Uri_PROPERTY uriProp
, DWORD
*pcchProperty
, DWORD dwFlags
)
91 Uri
*This
= URI_THIS(iface
);
92 FIXME("(%p)->(%d %p %x)\n", This
, uriProp
, pcchProperty
, dwFlags
);
96 static HRESULT WINAPI
Uri_GetPropertyDWORD(IUri
*iface
, Uri_PROPERTY uriProp
, DWORD
*pcchProperty
, DWORD dwFlags
)
98 Uri
*This
= URI_THIS(iface
);
99 FIXME("(%p)->(%d %p %x)\n", This
, uriProp
, pcchProperty
, dwFlags
);
103 static HRESULT WINAPI
Uri_HasProperty(IUri
*iface
, Uri_PROPERTY uriProp
, BOOL
*pfHasProperty
)
105 Uri
*This
= URI_THIS(iface
);
106 FIXME("(%p)->()\n", This
);
110 static HRESULT WINAPI
Uri_GetAbsoluteUri(IUri
*iface
, BSTR
*pstrAbsoluteUri
)
112 Uri
*This
= URI_THIS(iface
);
113 FIXME("(%p)->(%p)\n", This
, pstrAbsoluteUri
);
117 static HRESULT WINAPI
Uri_GetAuthority(IUri
*iface
, BSTR
*pstrAuthority
)
119 Uri
*This
= URI_THIS(iface
);
120 FIXME("(%p)->(%p)\n", This
, pstrAuthority
);
124 static HRESULT WINAPI
Uri_GetDisplayUri(IUri
*iface
, BSTR
*pstrDisplayUri
)
126 Uri
*This
= URI_THIS(iface
);
127 FIXME("(%p)->(%p)\n", This
, pstrDisplayUri
);
131 static HRESULT WINAPI
Uri_GetDomain(IUri
*iface
, BSTR
*pstrDomain
)
133 Uri
*This
= URI_THIS(iface
);
134 FIXME("(%p)->(%p)\n", This
, pstrDomain
);
138 static HRESULT WINAPI
Uri_GetExtension(IUri
*iface
, BSTR
*pstrExtension
)
140 Uri
*This
= URI_THIS(iface
);
141 FIXME("(%p)->(%p)\n", This
, pstrExtension
);
145 static HRESULT WINAPI
Uri_GetFragment(IUri
*iface
, BSTR
*pstrFragment
)
147 Uri
*This
= URI_THIS(iface
);
148 FIXME("(%p)->(%p)\n", This
, pstrFragment
);
152 static HRESULT WINAPI
Uri_GetHost(IUri
*iface
, BSTR
*pstrHost
)
154 Uri
*This
= URI_THIS(iface
);
155 FIXME("(%p)->(%p)\n", This
, pstrHost
);
159 static HRESULT WINAPI
Uri_GetPassword(IUri
*iface
, BSTR
*pstrPassword
)
161 Uri
*This
= URI_THIS(iface
);
162 FIXME("(%p)->(%p)\n", This
, pstrPassword
);
166 static HRESULT WINAPI
Uri_GetPath(IUri
*iface
, BSTR
*pstrPath
)
168 Uri
*This
= URI_THIS(iface
);
169 FIXME("(%p)->(%p)\n", This
, pstrPath
);
173 static HRESULT WINAPI
Uri_GetPathAndQuery(IUri
*iface
, BSTR
*pstrPathAndQuery
)
175 Uri
*This
= URI_THIS(iface
);
176 FIXME("(%p)->(%p)\n", This
, pstrPathAndQuery
);
180 static HRESULT WINAPI
Uri_GetQuery(IUri
*iface
, BSTR
*pstrQuery
)
182 Uri
*This
= URI_THIS(iface
);
183 FIXME("(%p)->(%p)\n", This
, pstrQuery
);
187 static HRESULT WINAPI
Uri_GetRawUri(IUri
*iface
, BSTR
*pstrRawUri
)
189 Uri
*This
= URI_THIS(iface
);
190 FIXME("(%p)->(%p)\n", This
, pstrRawUri
);
194 static HRESULT WINAPI
Uri_GetSchemeName(IUri
*iface
, BSTR
*pstrSchemeName
)
196 Uri
*This
= URI_THIS(iface
);
197 FIXME("(%p)->(%p)\n", This
, pstrSchemeName
);
201 static HRESULT WINAPI
Uri_GetUserInfo(IUri
*iface
, BSTR
*pstrUserInfo
)
203 Uri
*This
= URI_THIS(iface
);
204 FIXME("(%p)->(%p)\n", This
, pstrUserInfo
);
208 static HRESULT WINAPI
Uri_GetUserName(IUri
*iface
, BSTR
*pstrUserName
)
210 Uri
*This
= URI_THIS(iface
);
211 FIXME("(%p)->(%p)\n", This
, pstrUserName
);
215 static HRESULT WINAPI
Uri_GetHostType(IUri
*iface
, DWORD
*pdwHostType
)
217 Uri
*This
= URI_THIS(iface
);
218 FIXME("(%p)->(%p)\n", This
, pdwHostType
);
222 static HRESULT WINAPI
Uri_GetPort(IUri
*iface
, DWORD
*pdwPort
)
224 Uri
*This
= URI_THIS(iface
);
225 FIXME("(%p)->(%p)\n", This
, pdwPort
);
229 static HRESULT WINAPI
Uri_GetScheme(IUri
*iface
, DWORD
*pdwScheme
)
231 Uri
*This
= URI_THIS(iface
);
232 FIXME("(%p)->(%p)\n", This
, pdwScheme
);
236 static HRESULT WINAPI
Uri_GetZone(IUri
*iface
, DWORD
*pdwZone
)
238 Uri
*This
= URI_THIS(iface
);
239 FIXME("(%p)->(%p)\n", This
, pdwZone
);
243 static HRESULT WINAPI
Uri_GetProperties(IUri
*iface
, DWORD
*pdwProperties
)
245 Uri
*This
= URI_THIS(iface
);
246 FIXME("(%p)->(%p)\n", This
, pdwProperties
);
250 static HRESULT WINAPI
Uri_IsEqual(IUri
*iface
, IUri
*pUri
, BOOL
*pfEqual
)
252 Uri
*This
= URI_THIS(iface
);
253 FIXME("(%p)->(%p %p)\n", This
, pUri
, pfEqual
);
259 static const IUriVtbl UriVtbl
= {
264 Uri_GetPropertyLength
,
265 Uri_GetPropertyDWORD
,
290 /***********************************************************************
291 * CreateUri (urlmon.@)
293 HRESULT WINAPI
CreateUri(LPCWSTR pwzURI
, DWORD dwFlags
, DWORD_PTR dwReserved
, IUri
**ppURI
)
297 TRACE("(%s %x %x %p)\n", debugstr_w(pwzURI
), dwFlags
, (DWORD
)dwReserved
, ppURI
);
299 ret
= heap_alloc(sizeof(Uri
));
301 return E_OUTOFMEMORY
;
303 ret
->lpIUriVtbl
= &UriVtbl
;
310 #define URIBUILDER_THIS(iface) DEFINE_THIS(UriBuilder, IUriBuilder, iface)
312 static HRESULT WINAPI
UriBuilder_QueryInterface(IUriBuilder
*iface
, REFIID riid
, void **ppv
)
314 UriBuilder
*This
= URIBUILDER_THIS(iface
);
316 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
317 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
318 *ppv
= URIBUILDER(This
);
319 }else if(IsEqualGUID(&IID_IUriBuilder
, riid
)) {
320 TRACE("(%p)->(IID_IUri %p)\n", This
, ppv
);
321 *ppv
= URIBUILDER(This
);
323 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
325 return E_NOINTERFACE
;
328 IUnknown_AddRef((IUnknown
*)*ppv
);
332 static ULONG WINAPI
UriBuilder_AddRef(IUriBuilder
*iface
)
334 UriBuilder
*This
= URIBUILDER_THIS(iface
);
335 LONG ref
= InterlockedIncrement(&This
->ref
);
337 TRACE("(%p) ref=%d\n", This
, ref
);
342 static ULONG WINAPI
UriBuilder_Release(IUriBuilder
*iface
)
344 UriBuilder
*This
= URIBUILDER_THIS(iface
);
345 LONG ref
= InterlockedDecrement(&This
->ref
);
347 TRACE("(%p) ref=%d\n", This
, ref
);
355 static HRESULT WINAPI
UriBuilder_CreateUriSimple(IUriBuilder
*iface
,
356 DWORD dwAllowEncodingPropertyMask
,
357 DWORD_PTR dwReserved
,
360 UriBuilder
*This
= URIBUILDER_THIS(iface
);
361 FIXME("(%p)->(%d %d %p)\n", This
, dwAllowEncodingPropertyMask
, (DWORD
)dwReserved
, ppIUri
);
365 static HRESULT WINAPI
UriBuilder_CreateUri(IUriBuilder
*iface
,
367 DWORD dwAllowEncodingPropertyMask
,
368 DWORD_PTR dwReserved
,
371 UriBuilder
*This
= URIBUILDER_THIS(iface
);
372 FIXME("(%p)->(0x%08x %d %d %p)\n", This
, dwCreateFlags
, dwAllowEncodingPropertyMask
, (DWORD
)dwReserved
, ppIUri
);
376 static HRESULT WINAPI
UriBuilder_CreateUriWithFlags(IUriBuilder
*iface
,
378 DWORD dwUriBuilderFlags
,
379 DWORD dwAllowEncodingPropertyMask
,
380 DWORD_PTR dwReserved
,
383 UriBuilder
*This
= URIBUILDER_THIS(iface
);
384 FIXME("(%p)->(0x%08x 0x%08x %d %d %p)\n", This
, dwCreateFlags
, dwUriBuilderFlags
,
385 dwAllowEncodingPropertyMask
, (DWORD
)dwReserved
, ppIUri
);
389 static HRESULT WINAPI
UriBuilder_GetIUri(IUriBuilder
*iface
, IUri
**ppIUri
)
391 UriBuilder
*This
= URIBUILDER_THIS(iface
);
392 FIXME("(%p)->(%p)\n", This
, ppIUri
);
396 static HRESULT WINAPI
UriBuilder_SetIUri(IUriBuilder
*iface
, IUri
*pIUri
)
398 UriBuilder
*This
= URIBUILDER_THIS(iface
);
399 FIXME("(%p)->(%p)\n", This
, pIUri
);
403 static HRESULT WINAPI
UriBuilder_GetFragment(IUriBuilder
*iface
, DWORD
*pcchFragment
, LPCWSTR
*ppwzFragment
)
405 UriBuilder
*This
= URIBUILDER_THIS(iface
);
406 FIXME("(%p)->(%p %p)\n", This
, pcchFragment
, ppwzFragment
);
410 static HRESULT WINAPI
UriBuilder_GetHost(IUriBuilder
*iface
, DWORD
*pcchHost
, LPCWSTR
*ppwzHost
)
412 UriBuilder
*This
= URIBUILDER_THIS(iface
);
413 FIXME("(%p)->(%p %p)\n", This
, pcchHost
, ppwzHost
);
417 static HRESULT WINAPI
UriBuilder_GetPassword(IUriBuilder
*iface
, DWORD
*pcchPassword
, LPCWSTR
*ppwzPassword
)
419 UriBuilder
*This
= URIBUILDER_THIS(iface
);
420 FIXME("(%p)->(%p %p)\n", This
, pcchPassword
, ppwzPassword
);
424 static HRESULT WINAPI
UriBuilder_GetPath(IUriBuilder
*iface
, DWORD
*pcchPath
, LPCWSTR
*ppwzPath
)
426 UriBuilder
*This
= URIBUILDER_THIS(iface
);
427 FIXME("(%p)->(%p %p)\n", This
, pcchPath
, ppwzPath
);
431 static HRESULT WINAPI
UriBuilder_GetPort(IUriBuilder
*iface
, BOOL
*pfHasPort
, DWORD
*pdwPort
)
433 UriBuilder
*This
= URIBUILDER_THIS(iface
);
434 FIXME("(%p)->(%p %p)\n", This
, pfHasPort
, pdwPort
);
438 static HRESULT WINAPI
UriBuilder_GetQuery(IUriBuilder
*iface
, DWORD
*pcchQuery
, LPCWSTR
*ppwzQuery
)
440 UriBuilder
*This
= URIBUILDER_THIS(iface
);
441 FIXME("(%p)->(%p %p)\n", This
, pcchQuery
, ppwzQuery
);
445 static HRESULT WINAPI
UriBuilder_GetSchemeName(IUriBuilder
*iface
, DWORD
*pcchSchemeName
, LPCWSTR
*ppwzSchemeName
)
447 UriBuilder
*This
= URIBUILDER_THIS(iface
);
448 FIXME("(%p)->(%p %p)\n", This
, pcchSchemeName
, ppwzSchemeName
);
452 static HRESULT WINAPI
UriBuilder_GetUserName(IUriBuilder
*iface
, DWORD
*pcchUserName
, LPCWSTR
*ppwzUserName
)
454 UriBuilder
*This
= URIBUILDER_THIS(iface
);
455 FIXME("(%p)->(%p %p)\n", This
, pcchUserName
, ppwzUserName
);
459 static HRESULT WINAPI
UriBuilder_SetFragment(IUriBuilder
*iface
, LPCWSTR pwzNewValue
)
461 UriBuilder
*This
= URIBUILDER_THIS(iface
);
462 FIXME("(%p)->(%s)\n", This
, debugstr_w(pwzNewValue
));
466 static HRESULT WINAPI
UriBuilder_SetHost(IUriBuilder
*iface
, LPCWSTR pwzNewValue
)
468 UriBuilder
*This
= URIBUILDER_THIS(iface
);
469 FIXME("(%p)->(%s)\n", This
, debugstr_w(pwzNewValue
));
473 static HRESULT WINAPI
UriBuilder_SetPassword(IUriBuilder
*iface
, LPCWSTR pwzNewValue
)
475 UriBuilder
*This
= URIBUILDER_THIS(iface
);
476 FIXME("(%p)->(%s)\n", This
, debugstr_w(pwzNewValue
));
480 static HRESULT WINAPI
UriBuilder_SetPath(IUriBuilder
*iface
, LPCWSTR pwzNewValue
)
482 UriBuilder
*This
= URIBUILDER_THIS(iface
);
483 FIXME("(%p)->(%s)\n", This
, debugstr_w(pwzNewValue
));
487 static HRESULT WINAPI
UriBuilder_SetPort(IUriBuilder
*iface
, BOOL fHasPort
, DWORD dwNewValue
)
489 UriBuilder
*This
= URIBUILDER_THIS(iface
);
490 FIXME("(%p)->(%d %d)\n", This
, fHasPort
, dwNewValue
);
494 static HRESULT WINAPI
UriBuilder_SetQuery(IUriBuilder
*iface
, LPCWSTR pwzNewValue
)
496 UriBuilder
*This
= URIBUILDER_THIS(iface
);
497 FIXME("(%p)->(%s)\n", This
, debugstr_w(pwzNewValue
));
501 static HRESULT WINAPI
UriBuilder_SetSchemeName(IUriBuilder
*iface
, LPCWSTR pwzNewValue
)
503 UriBuilder
*This
= URIBUILDER_THIS(iface
);
504 FIXME("(%p)->(%s)\n", This
, debugstr_w(pwzNewValue
));
508 static HRESULT WINAPI
UriBuilder_SetUserName(IUriBuilder
*iface
, LPCWSTR pwzNewValue
)
510 UriBuilder
*This
= URIBUILDER_THIS(iface
);
511 FIXME("(%p)->(%s)\n", This
, debugstr_w(pwzNewValue
));
515 static HRESULT WINAPI
UriBuilder_RemoveProperties(IUriBuilder
*iface
, DWORD dwPropertyMask
)
517 UriBuilder
*This
= URIBUILDER_THIS(iface
);
518 FIXME("(%p)->(0x%08x)\n", This
, dwPropertyMask
);
522 static HRESULT WINAPI
UriBuilder_HasBeenModified(IUriBuilder
*iface
, BOOL
*pfModified
)
524 UriBuilder
*This
= URIBUILDER_THIS(iface
);
525 FIXME("(%p)->(%p)\n", This
, pfModified
);
529 #undef URIBUILDER_THIS
531 static const IUriBuilderVtbl UriBuilderVtbl
= {
532 UriBuilder_QueryInterface
,
535 UriBuilder_CreateUriSimple
,
536 UriBuilder_CreateUri
,
537 UriBuilder_CreateUriWithFlags
,
540 UriBuilder_GetFragment
,
542 UriBuilder_GetPassword
,
546 UriBuilder_GetSchemeName
,
547 UriBuilder_GetUserName
,
548 UriBuilder_SetFragment
,
550 UriBuilder_SetPassword
,
554 UriBuilder_SetSchemeName
,
555 UriBuilder_SetUserName
,
556 UriBuilder_RemoveProperties
,
557 UriBuilder_HasBeenModified
,
560 /***********************************************************************
561 * CreateIUriBuilder (urlmon.@)
563 HRESULT WINAPI
CreateIUriBuilder(IUri
*pIUri
, DWORD dwFlags
, DWORD_PTR dwReserved
, IUriBuilder
**ppIUriBuilder
)
567 TRACE("(%p %x %x %p)\n", pIUri
, dwFlags
, (DWORD
)dwReserved
, ppIUriBuilder
);
569 ret
= heap_alloc(sizeof(UriBuilder
));
571 return E_OUTOFMEMORY
;
573 ret
->lpIUriBuilderVtbl
= &UriBuilderVtbl
;
576 *ppIUriBuilder
= URIBUILDER(ret
);