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
18069b2d
Commit
18069b2d
authored
Dec 15, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Dec 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Added PARSE_ROOTDOCUMENT to CoInternetParseUrl.
parent
3adfe170
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
9 deletions
+86
-9
internet.c
dlls/urlmon/internet.c
+69
-3
misc.c
dlls/urlmon/tests/misc.c
+17
-6
No files found.
dlls/urlmon/internet.c
View file @
18069b2d
...
...
@@ -38,6 +38,9 @@ static HRESULT parse_schema(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size,
if
(
ptr
)
len
=
ptr
-
url
;
if
(
rsize
)
*
rsize
=
len
;
if
(
len
>=
size
)
return
E_POINTER
;
...
...
@@ -45,9 +48,6 @@ static HRESULT parse_schema(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size,
memcpy
(
result
,
url
,
len
*
sizeof
(
WCHAR
));
result
[
len
]
=
0
;
if
(
rsize
)
*
rsize
=
len
;
return
S_OK
;
}
...
...
@@ -200,6 +200,70 @@ static HRESULT parse_domain(LPCWSTR url, DWORD flags, LPWSTR result,
return
S_OK
;
}
static
HRESULT
parse_rootdocument
(
LPCWSTR
url
,
DWORD
flags
,
LPWSTR
result
,
DWORD
size
,
DWORD
*
rsize
)
{
IInternetProtocolInfo
*
protocol_info
;
PARSEDURLW
url_info
;
HRESULT
hres
;
TRACE
(
"(%s %08x %p %d %p)
\n
"
,
debugstr_w
(
url
),
flags
,
result
,
size
,
rsize
);
protocol_info
=
get_protocol_info
(
url
);
if
(
protocol_info
)
{
hres
=
IInternetProtocolInfo_ParseUrl
(
protocol_info
,
url
,
PARSE_ROOTDOCUMENT
,
flags
,
result
,
size
,
rsize
,
0
);
IInternetProtocolInfo_Release
(
protocol_info
);
if
(
SUCCEEDED
(
hres
))
return
hres
;
}
url_info
.
cbSize
=
sizeof
(
url_info
);
if
(
FAILED
(
ParseURLW
(
url
,
&
url_info
)))
return
E_FAIL
;
switch
(
url_info
.
nScheme
)
{
case
URL_SCHEME_FTP
:
case
URL_SCHEME_HTTP
:
case
URL_SCHEME_HTTPS
:
if
(
url_info
.
cchSuffix
<
3
||
*
(
url_info
.
pszSuffix
)
!=
'/'
||
*
(
url_info
.
pszSuffix
+
1
)
!=
'/'
)
return
E_FAIL
;
if
(
size
<
url_info
.
cchProtocol
+
3
)
{
size
=
0
;
hres
=
UrlGetPartW
(
url
,
result
,
&
size
,
URL_PART_HOSTNAME
,
flags
);
if
(
rsize
)
*
rsize
=
size
+
url_info
.
cchProtocol
+
3
;
if
(
hres
==
E_POINTER
)
return
S_FALSE
;
return
hres
;
}
size
-=
url_info
.
cchProtocol
+
3
;
hres
=
UrlGetPartW
(
url
,
result
+
url_info
.
cchProtocol
+
3
,
&
size
,
URL_PART_HOSTNAME
,
flags
);
if
(
hres
==
E_POINTER
)
return
S_FALSE
;
if
(
FAILED
(
hres
))
return
E_FAIL
;
if
(
rsize
)
*
rsize
=
size
+
url_info
.
cchProtocol
+
3
;
memcpy
(
result
,
url
,
(
url_info
.
cchProtocol
+
3
)
*
sizeof
(
WCHAR
));
return
hres
;
default:
return
E_FAIL
;
}
}
/**************************************************************************
* CoInternetParseUrl (URLMON.@)
*/
...
...
@@ -224,6 +288,8 @@ HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD
return
parse_security_domain
(
pwzUrl
,
dwFlags
,
pszResult
,
cchResult
,
pcchResult
);
case
PARSE_DOMAIN
:
return
parse_domain
(
pwzUrl
,
dwFlags
,
pszResult
,
cchResult
,
pcchResult
);
case
PARSE_ROOTDOCUMENT
:
return
parse_rootdocument
(
pwzUrl
,
dwFlags
,
pszResult
,
cchResult
,
pcchResult
);
default:
FIXME
(
"not supported action %d
\n
"
,
ParseAction
);
}
...
...
dlls/urlmon/tests/misc.c
View file @
18069b2d
...
...
@@ -271,6 +271,8 @@ static const WCHAR wszAbout[] = {'a','b','o','u','t',0};
static
const
WCHAR
wszEmpty
[]
=
{
0
};
static
const
WCHAR
wszWineHQ
[]
=
{
'w'
,
'w'
,
'w'
,
'.'
,
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
0
};
static
const
WCHAR
wszHttpWineHQ
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'w'
,
'w'
,
'w'
,
'.'
,
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
0
};
struct
parse_test
{
LPCWSTR
url
;
...
...
@@ -281,15 +283,17 @@ struct parse_test {
LPCWSTR
schema
;
LPCWSTR
domain
;
HRESULT
domain_hres
;
LPCWSTR
rootdocument
;
HRESULT
rootdocument_hres
;
};
static
const
struct
parse_test
parse_tests
[]
=
{
{
url1
,
S_OK
,
url1
,
E_INVALIDARG
,
NULL
,
wszRes
,
NULL
,
E_FAIL
},
{
url2
,
E_FAIL
,
url2
,
E_INVALIDARG
,
NULL
,
wszEmpty
,
NULL
,
E_FAIL
},
{
url3
,
E_FAIL
,
url3
,
S_OK
,
path3
,
wszFile
,
wszEmpty
,
S_OK
},
{
url4
,
E_FAIL
,
url4e
,
S_OK
,
path4
,
wszFile
,
wszEmpty
,
S_OK
},
{
url5
,
E_FAIL
,
url5
,
E_INVALIDARG
,
NULL
,
wszHttp
,
wszWineHQ
,
S_OK
},
{
url6
,
S_OK
,
url6
,
E_INVALIDARG
,
NULL
,
wszAbout
,
NULL
,
E_FAIL
}
{
url1
,
S_OK
,
url1
,
E_INVALIDARG
,
NULL
,
wszRes
,
NULL
,
E_FAIL
,
NULL
,
E_FAIL
},
{
url2
,
E_FAIL
,
url2
,
E_INVALIDARG
,
NULL
,
wszEmpty
,
NULL
,
E_FAIL
,
NULL
,
E_FAIL
},
{
url3
,
E_FAIL
,
url3
,
S_OK
,
path3
,
wszFile
,
wszEmpty
,
S_OK
,
NULL
,
E_FAIL
},
{
url4
,
E_FAIL
,
url4e
,
S_OK
,
path4
,
wszFile
,
wszEmpty
,
S_OK
,
NULL
,
E_FAIL
},
{
url5
,
E_FAIL
,
url5
,
E_INVALIDARG
,
NULL
,
wszHttp
,
wszWineHQ
,
S_OK
,
wszHttpWineHQ
,
S_OK
},
{
url6
,
S_OK
,
url6
,
E_INVALIDARG
,
NULL
,
wszAbout
,
NULL
,
E_FAIL
,
NULL
,
E_FAIL
},
};
static
void
test_CoInternetParseUrl
(
void
)
...
...
@@ -342,6 +346,13 @@ static void test_CoInternetParseUrl(void)
ok
(
hres
==
parse_tests
[
i
].
domain_hres
,
"[%d] domain failed: %08x
\n
"
,
i
,
hres
);
if
(
parse_tests
[
i
].
domain
)
ok
(
!
lstrcmpW
(
parse_tests
[
i
].
domain
,
buf
),
"[%d] wrong domain, received %s
\n
"
,
i
,
wine_dbgstr_w
(
buf
));
memset
(
buf
,
0xf0
,
sizeof
(
buf
));
hres
=
CoInternetParseUrl
(
parse_tests
[
i
].
url
,
PARSE_ROOTDOCUMENT
,
0
,
buf
,
sizeof
(
buf
)
/
sizeof
(
WCHAR
),
&
size
,
0
);
ok
(
hres
==
parse_tests
[
i
].
rootdocument_hres
,
"[%d] rootdocument failed: %08x
\n
"
,
i
,
hres
);
if
(
parse_tests
[
i
].
rootdocument
)
ok
(
!
lstrcmpW
(
parse_tests
[
i
].
rootdocument
,
buf
),
"[%d] wrong rootdocument, received %s
\n
"
,
i
,
wine_dbgstr_w
(
buf
));
}
}
...
...
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