mshtml: Added IHTMLLocation::get_pathname implementation.
This commit is contained in:
parent
3d1bb79983
commit
2ca7683dfb
|
@ -6,6 +6,7 @@ MODULE = mshtml.dll
|
||||||
IMPORTLIB = mshtml
|
IMPORTLIB = mshtml
|
||||||
IMPORTS = strmiids uuid urlmon shlwapi ole32 oleaut32 user32 gdi32 advapi32 kernel32
|
IMPORTS = strmiids uuid urlmon shlwapi ole32 oleaut32 user32 gdi32 advapi32 kernel32
|
||||||
EXTRADEFS = -DCOM_NO_WINDOWS_H
|
EXTRADEFS = -DCOM_NO_WINDOWS_H
|
||||||
|
DELAYIMPORTS = wininet
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
conpoint.c \
|
conpoint.c \
|
||||||
|
|
|
@ -23,7 +23,10 @@
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
|
#include "winreg.h"
|
||||||
#include "ole2.h"
|
#include "ole2.h"
|
||||||
|
#include "wininet.h"
|
||||||
|
#include "shlwapi.h"
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
|
@ -195,8 +198,41 @@ static HRESULT WINAPI HTMLLocation_put_pathname(IHTMLLocation *iface, BSTR v)
|
||||||
static HRESULT WINAPI HTMLLocation_get_pathname(IHTMLLocation *iface, BSTR *p)
|
static HRESULT WINAPI HTMLLocation_get_pathname(IHTMLLocation *iface, BSTR *p)
|
||||||
{
|
{
|
||||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||||
FIXME("(%p)->(%p)\n", This, p);
|
WCHAR buf[INTERNET_MAX_PATH_LENGTH];
|
||||||
|
URL_COMPONENTSW url = {sizeof(url)};
|
||||||
|
DWORD size = 0;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%p)\n", This, p);
|
||||||
|
|
||||||
|
if(!This->doc || !This->doc->url) {
|
||||||
|
FIXME("No current URL\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = CoInternetParseUrl(This->doc->url, PARSE_PATH_FROM_URL, 0, buf, sizeof(buf), &size, 0);
|
||||||
|
if(SUCCEEDED(hres)) {
|
||||||
|
*p = SysAllocString(buf);
|
||||||
|
if(!*p)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
url.dwUrlPathLength = 1;
|
||||||
|
if(!InternetCrackUrlW(This->doc->url, 0, 0, &url)) {
|
||||||
|
FIXME("InternetCrackUrl failed\n");
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!url.dwUrlPathLength) {
|
||||||
|
*p = NULL;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
*p = SysAllocStringLen(url.lpszUrlPath, url.dwUrlPathLength);
|
||||||
|
if(!*p)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI HTMLLocation_put_search(IHTMLLocation *iface, BSTR v)
|
static HRESULT WINAPI HTMLLocation_put_search(IHTMLLocation *iface, BSTR v)
|
||||||
|
|
|
@ -2383,6 +2383,7 @@ static void test_location(IHTMLDocument2 *doc)
|
||||||
{
|
{
|
||||||
IHTMLLocation *location, *location2;
|
IHTMLLocation *location, *location2;
|
||||||
IHTMLWindow2 *window;
|
IHTMLWindow2 *window;
|
||||||
|
BSTR str;
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
|
@ -2406,6 +2407,10 @@ static void test_location(IHTMLDocument2 *doc)
|
||||||
test_ifaces((IUnknown*)location, location_iids);
|
test_ifaces((IUnknown*)location, location_iids);
|
||||||
test_disp2((IUnknown*)location, &DIID_DispHTMLLocation, &IID_IHTMLLocation);
|
test_disp2((IUnknown*)location, &DIID_DispHTMLLocation, &IID_IHTMLLocation);
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_pathname(location, &str);
|
||||||
|
ok(hres == S_OK, "get_pathname failed: %08x\n", hres);
|
||||||
|
ok(!strcmp_wa(str, "blank"), "unexpected pathname %s\n", dbgstr_w(str));
|
||||||
|
|
||||||
ref = IHTMLLocation_Release(location);
|
ref = IHTMLLocation_Release(location);
|
||||||
ok(!ref, "location chould be destroyed here\n");
|
ok(!ref, "location chould be destroyed here\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue