From 7f6faca6f6880843217ac39e7d90ea006416bd16 Mon Sep 17 00:00:00 2001 From: Thomas Mullaly Date: Mon, 6 Sep 2010 16:51:11 -0400 Subject: [PATCH] urlmon: Implemented IUriBuilder_{Get/Set}SchemeName. --- dlls/urlmon/tests/uri.c | 4 ++-- dlls/urlmon/uri.c | 27 ++++++++++++--------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index a8b495229b2..d062df37260 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -4313,7 +4313,7 @@ static const uri_builder_test uri_builder_tests[] = { }, { "http://google.com/",0,S_OK,FALSE, { - {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,TRUE} + {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE} }, {TRUE,TRUE,120,S_OK,FALSE}, 0,S_OK,TRUE, @@ -4345,7 +4345,7 @@ static const uri_builder_test uri_builder_tests[] = { }, { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE, { - {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,TRUE}, + {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}, {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}, {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE} }, diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index ce144466be1..f15f6aa1d89 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -97,6 +97,9 @@ typedef struct { WCHAR *query; DWORD query_len; + + WCHAR *scheme; + DWORD scheme_len; } UriBuilder; typedef struct { @@ -4328,6 +4331,7 @@ static ULONG WINAPI UriBuilder_Release(IUriBuilder *iface) heap_free(This->password); heap_free(This->path); heap_free(This->query); + heap_free(This->scheme); heap_free(This); } @@ -4535,19 +4539,11 @@ static HRESULT WINAPI UriBuilder_GetSchemeName(IUriBuilder *iface, DWORD *pcchSc UriBuilder *This = URIBUILDER_THIS(iface); TRACE("(%p)->(%p %p)\n", This, pcchSchemeName, ppwzSchemeName); - if(!pcchSchemeName) { - if(ppwzSchemeName) - *ppwzSchemeName = NULL; - return E_POINTER; - } - - if(!ppwzSchemeName) { - *pcchSchemeName = 0; - return E_POINTER; - } - - FIXME("(%p)->(%p %p)\n", This, pcchSchemeName, ppwzSchemeName); - return E_NOTIMPL; + if(!This->uri || This->uri->scheme_start == -1 || This->modified_props & Uri_HAS_SCHEME_NAME) + return get_builder_component(&This->scheme, &This->scheme_len, NULL, 0, ppwzSchemeName, pcchSchemeName); + else + return get_builder_component(&This->scheme, &This->scheme_len, This->uri->canon_uri+This->uri->scheme_start, + This->uri->scheme_len, ppwzSchemeName, pcchSchemeName); } static HRESULT WINAPI UriBuilder_GetUserName(IUriBuilder *iface, DWORD *pcchUserName, LPCWSTR *ppwzUserName) @@ -4624,8 +4620,9 @@ static HRESULT WINAPI UriBuilder_SetQuery(IUriBuilder *iface, LPCWSTR pwzNewValu 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; + TRACE("(%p)->(%s)\n", This, debugstr_w(pwzNewValue)); + return set_builder_component(&This->scheme, &This->scheme_len, pwzNewValue, 0, + &This->modified_props, Uri_HAS_SCHEME_NAME); } static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewValue)