From bbf8a4baf570814aea05111da76d18615ca420af Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 19 Oct 2009 11:18:18 -0500 Subject: [PATCH] mshtml: Implement IHTMLLocation::get_search. --- dlls/mshtml/htmllocation.c | 24 ++++++++++++++++++++++-- dlls/mshtml/tests/htmllocation.c | 12 ++++++------ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index b97cb016db1..5db526702c5 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -462,12 +462,32 @@ static HRESULT WINAPI HTMLLocation_put_search(IHTMLLocation *iface, BSTR v) static HRESULT WINAPI HTMLLocation_get_search(IHTMLLocation *iface, BSTR *p) { HTMLLocation *This = HTMLLOCATION_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); + URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW)}; + HRESULT hres; + const WCHAR hash[] = {'#',0}; + + TRACE("(%p)->(%p)\n", This, p); if(!p) return E_POINTER; - return E_NOTIMPL; + url.dwExtraInfoLength = 1; + hres = get_url_components(This, &url); + if(FAILED(hres)) + return hres; + + if(!url.dwExtraInfoLength){ + *p = NULL; + return S_OK; + } + + url.dwExtraInfoLength = strcspnW(url.lpszExtraInfo, hash); + + *p = SysAllocStringLen(url.lpszExtraInfo, url.dwExtraInfoLength); + + if(!*p) + return E_OUTOFMEMORY; + return S_OK; } static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v) diff --git a/dlls/mshtml/tests/htmllocation.c b/dlls/mshtml/tests/htmllocation.c index e6b43e2edda..b66fe62a1c3 100644 --- a/dlls/mshtml/tests/htmllocation.c +++ b/dlls/mshtml/tests/htmllocation.c @@ -62,7 +62,7 @@ static const struct location_test http_test = { "www.winehq.org", TRUE, "80", TRUE, "", TRUE, - "?search", FALSE, + "?search", TRUE, "#hash", TRUE }; @@ -76,7 +76,7 @@ static const struct location_test http_file_test = { "www.winehq.org", TRUE, "80", TRUE, "file", TRUE, - "?search", FALSE, + "?search", TRUE, "#hash", TRUE }; @@ -90,7 +90,7 @@ static const struct location_test ftp_test = { "ftp.winehq.org", TRUE, "21", TRUE, "", TRUE, - NULL, FALSE, + NULL, TRUE, NULL, TRUE }; @@ -104,7 +104,7 @@ static const struct location_test ftp_file_test = { "ftp.winehq.org", TRUE, "21", TRUE, "file", TRUE, - NULL, FALSE, + NULL, TRUE, NULL, TRUE }; @@ -118,7 +118,7 @@ static const struct location_test file_test = { NULL, TRUE, "", TRUE, "C:\\windows\\win.ini", TRUE, - NULL, FALSE, + NULL, TRUE, NULL, TRUE }; @@ -291,7 +291,7 @@ static void test_search(IHTMLLocation *loc, const struct location_test *test) test->name, E_POINTER, hres); hres = IHTMLLocation_get_search(loc, &str); - todo_wine ok(hres == S_OK, "%s: get_search failed: 0x%08x\n", test->name, hres); + ok(hres == S_OK, "%s: get_search failed: 0x%08x\n", test->name, hres); if(hres == S_OK){ if(test->search_ok) ok(str_eq_wa(str, test->search),