Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
6a456fa6
Commit
6a456fa6
authored
Oct 16, 2009
by
Andrew Eikum
Committed by
Alexandre Julliard
Oct 19, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Reimplement IHTMLLocation::get_href.
parent
192a838c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
7 deletions
+90
-7
htmllocation.c
dlls/mshtml/htmllocation.c
+88
-5
htmllocation.c
dlls/mshtml/tests/htmllocation.c
+2
-2
No files found.
dlls/mshtml/htmllocation.c
View file @
6a456fa6
...
...
@@ -165,20 +165,103 @@ static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
static
HRESULT
WINAPI
HTMLLocation_get_href
(
IHTMLLocation
*
iface
,
BSTR
*
p
)
{
HTMLLocation
*
This
=
HTMLLOCATION_THIS
(
iface
);
const
WCHAR
*
url
;
HRESULT
hres
;
URL_COMPONENTSW
url
=
{
sizeof
(
URL_COMPONENTSW
)};
WCHAR
*
buf
=
NULL
,
*
url_path
=
NULL
;
HRESULT
hres
,
ret
;
DWORD
len
=
0
;
int
i
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
if
(
!
p
)
return
E_POINTER
;
hres
=
get_url
(
This
,
&
url
);
url
.
dwSchemeLength
=
1
;
url
.
dwHostNameLength
=
1
;
url
.
dwUrlPathLength
=
1
;
url
.
dwExtraInfoLength
=
1
;
hres
=
get_url_components
(
This
,
&
url
);
if
(
FAILED
(
hres
))
return
hres
;
*
p
=
SysAllocString
(
url
);
return
*
p
?
S_OK
:
E_OUTOFMEMORY
;
switch
(
url
.
nScheme
)
{
case
INTERNET_SCHEME_FILE
:
{
/* prepend a slash */
url_path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
url
.
dwUrlPathLength
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
url_path
)
return
E_OUTOFMEMORY
;
url_path
[
0
]
=
'/'
;
memcpy
(
url_path
+
1
,
url
.
lpszUrlPath
,
url
.
dwUrlPathLength
*
sizeof
(
WCHAR
));
url
.
lpszUrlPath
=
url_path
;
url
.
dwUrlPathLength
=
url
.
dwUrlPathLength
+
1
;
}
break
;
case
INTERNET_SCHEME_HTTP
:
case
INTERNET_SCHEME_HTTPS
:
case
INTERNET_SCHEME_FTP
:
if
(
!
url
.
dwUrlPathLength
)
{
/* add a slash if it's blank */
url_path
=
url
.
lpszUrlPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
1
*
sizeof
(
WCHAR
));
if
(
!
url
.
lpszUrlPath
)
return
E_OUTOFMEMORY
;
url
.
lpszUrlPath
[
0
]
=
'/'
;
url
.
dwUrlPathLength
=
1
;
}
break
;
default:
break
;
}
/* replace \ with / */
for
(
i
=
0
;
i
<
url
.
dwUrlPathLength
;
++
i
)
if
(
url
.
lpszUrlPath
[
i
]
==
'\\'
)
url
.
lpszUrlPath
[
i
]
=
'/'
;
if
(
InternetCreateUrlW
(
&
url
,
ICU_ESCAPE
,
NULL
,
&
len
))
{
FIXME
(
"InternetCreateUrl succeeded with NULL buffer?
\n
"
);
ret
=
E_FAIL
;
goto
cleanup
;
}
if
(
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
{
FIXME
(
"InternetCreateUrl failed with error: %08x
\n
"
,
GetLastError
());
SetLastError
(
0
);
ret
=
E_FAIL
;
goto
cleanup
;
}
SetLastError
(
0
);
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
!
buf
)
{
ret
=
E_OUTOFMEMORY
;
goto
cleanup
;
}
if
(
!
InternetCreateUrlW
(
&
url
,
ICU_ESCAPE
,
buf
,
&
len
))
{
FIXME
(
"InternetCreateUrl failed with error: %08x
\n
"
,
GetLastError
());
SetLastError
(
0
);
ret
=
E_FAIL
;
goto
cleanup
;
}
*
p
=
SysAllocStringLen
(
buf
,
len
);
if
(
!*
p
)
{
ret
=
E_OUTOFMEMORY
;
goto
cleanup
;
}
ret
=
S_OK
;
cleanup:
if
(
buf
)
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
if
(
url_path
)
HeapFree
(
GetProcessHeap
(),
0
,
url_path
);
return
ret
;
}
static
HRESULT
WINAPI
HTMLLocation_put_protocol
(
IHTMLLocation
*
iface
,
BSTR
v
)
...
...
dlls/mshtml/tests/htmllocation.c
View file @
6a456fa6
...
...
@@ -56,7 +56,7 @@ static const WCHAR http_url[] = {'h','t','t','p',':','/','/','w','w','w','.','w'
static
const
struct
location_test
http_test
=
{
"HTTP"
,
http_url
,
"http://www.winehq.org/?search#hash"
,
FALS
E
,
"http://www.winehq.org/?search#hash"
,
TRU
E
,
"http:"
,
TRUE
,
"www.winehq.org:80"
,
TRUE
,
"www.winehq.org"
,
TRUE
,
...
...
@@ -112,7 +112,7 @@ static const WCHAR file_url[] = {'f','i','l','e',':','/','/','C',':','\\','w','i
static
const
struct
location_test
file_test
=
{
"FILE"
,
file_url
,
"file:///C:/windows/win.ini"
,
FALS
E
,
"file:///C:/windows/win.ini"
,
TRU
E
,
"file:"
,
TRUE
,
NULL
,
TRUE
,
NULL
,
TRUE
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment