Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
221331e7
Commit
221331e7
authored
Nov 30, 2010
by
Thomas Mullaly
Committed by
Alexandre Julliard
Dec 03, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Implemented PARSE_PATH_FROM_URL for CoInternetParseIUri.
parent
6a646ac2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
1 deletion
+75
-1
uri.c
dlls/urlmon/tests/uri.c
+8
-1
uri.c
dlls/urlmon/uri.c
+67
-0
No files found.
dlls/urlmon/tests/uri.c
View file @
221331e7
...
...
@@ -5941,7 +5941,14 @@ static const uri_parse_test uri_parse_tests[] = {
{
"file:///c:/test#frag"
,
0
,
PARSE_DOCUMENT
,
0
,
""
,
S_OK
,
FALSE
},
{
"zip://google.com/#frag"
,
0
,
PARSE_DOCUMENT
,
0
,
""
,
S_OK
,
FALSE
},
{
"zip:test#frag"
,
0
,
PARSE_DOCUMENT
,
0
,
""
,
S_OK
,
FALSE
},
{
"testing#frag"
,
Uri_CREATE_ALLOW_RELATIVE
,
PARSE_DOCUMENT
,
0
,
""
,
S_OK
,
FALSE
}
{
"testing#frag"
,
Uri_CREATE_ALLOW_RELATIVE
,
PARSE_DOCUMENT
,
0
,
""
,
S_OK
,
FALSE
},
/* PARSE_PATH_FROM_URL tests. */
{
"file:///c:/test.mp3"
,
0
,
PARSE_PATH_FROM_URL
,
0
,
"c:
\\
test.mp3"
,
S_OK
,
FALSE
},
{
"file:///c:/t<|>est.mp3"
,
0
,
PARSE_PATH_FROM_URL
,
0
,
"c:
\\
t<|>est.mp3"
,
S_OK
,
FALSE
},
{
"file:///c:/te%XX t/"
,
0
,
PARSE_PATH_FROM_URL
,
0
,
"c:
\\
te%XX t
\\
"
,
S_OK
,
FALSE
},
{
"file://server/test"
,
0
,
PARSE_PATH_FROM_URL
,
0
,
"
\\\\
server
\\
test"
,
S_OK
,
FALSE
},
{
"http://google.com/"
,
0
,
PARSE_PATH_FROM_URL
,
0
,
""
,
E_INVALIDARG
,
FALSE
}
};
static
inline
LPWSTR
a2w
(
LPCSTR
str
)
{
...
...
dlls/urlmon/uri.c
View file @
221331e7
...
...
@@ -6298,6 +6298,64 @@ static HRESULT parse_document(const Uri *uri, LPWSTR output, DWORD output_len,
return
S_OK
;
}
static
HRESULT
parse_path_from_url
(
const
Uri
*
uri
,
LPWSTR
output
,
DWORD
output_len
,
DWORD
*
result_len
)
{
const
WCHAR
*
path_ptr
;
WCHAR
buffer
[
INTERNET_MAX_URL_LENGTH
+
1
];
WCHAR
*
ptr
;
if
(
uri
->
scheme_type
!=
URL_SCHEME_FILE
)
{
*
result_len
=
0
;
if
(
output_len
>
0
)
output
[
0
]
=
0
;
return
E_INVALIDARG
;
}
ptr
=
buffer
;
if
(
uri
->
host_start
>
-
1
)
{
static
const
WCHAR
slash_slashW
[]
=
{
'\\'
,
'\\'
};
memcpy
(
ptr
,
slash_slashW
,
sizeof
(
slash_slashW
));
ptr
+=
sizeof
(
slash_slashW
)
/
sizeof
(
WCHAR
);
memcpy
(
ptr
,
uri
->
canon_uri
+
uri
->
host_start
,
uri
->
host_len
*
sizeof
(
WCHAR
));
ptr
+=
uri
->
host_len
;
}
path_ptr
=
uri
->
canon_uri
+
uri
->
path_start
;
if
(
uri
->
path_len
>
3
&&
*
path_ptr
==
'/'
&&
is_drive_path
(
path_ptr
+
1
))
/* Skip past the '/' in front of the drive path. */
++
path_ptr
;
for
(;
path_ptr
<
uri
->
canon_uri
+
uri
->
path_start
+
uri
->
path_len
;
++
path_ptr
,
++
ptr
)
{
BOOL
do_default_action
=
TRUE
;
if
(
*
path_ptr
==
'%'
)
{
const
WCHAR
decoded
=
decode_pct_val
(
path_ptr
);
if
(
decoded
)
{
*
ptr
=
decoded
;
path_ptr
+=
2
;
do_default_action
=
FALSE
;
}
}
else
if
(
*
path_ptr
==
'/'
)
{
*
ptr
=
'\\'
;
do_default_action
=
FALSE
;
}
if
(
do_default_action
)
*
ptr
=
*
path_ptr
;
}
*
ptr
=
0
;
*
result_len
=
ptr
-
buffer
;
if
(
*
result_len
+
1
>
output_len
)
return
STRSAFE_E_INSUFFICIENT_BUFFER
;
memcpy
(
output
,
buffer
,
(
*
result_len
+
1
)
*
sizeof
(
WCHAR
));
return
S_OK
;
}
/***********************************************************************
* CoInternetParseIUri (urlmon.@)
*/
...
...
@@ -6350,6 +6408,15 @@ HRESULT WINAPI CoInternetParseIUri(IUri *pIUri, PARSEACTION ParseAction, DWORD d
}
hr
=
parse_document
(
uri
,
pwzResult
,
cchResult
,
pcchResult
);
break
;
case
PARSE_PATH_FROM_URL
:
if
(
!
(
uri
=
get_uri_obj
(
pIUri
)))
{
*
pcchResult
=
0
;
FIXME
(
"(%p %d %x %p %d %p %x) Unknown IUri's not supported for this action.
\n
"
,
pIUri
,
ParseAction
,
dwFlags
,
pwzResult
,
cchResult
,
pcchResult
,
(
DWORD
)
dwReserved
);
return
E_NOTIMPL
;
}
hr
=
parse_path_from_url
(
uri
,
pwzResult
,
cchResult
,
pcchResult
);
break
;
case
PARSE_SECURITY_URL
:
case
PARSE_MIME
:
case
PARSE_SERVER
:
...
...
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