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
8de69a17
Commit
8de69a17
authored
Dec 15, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Dec 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Added special case for URL_PART_HOSTNAME in UrlGetPart.
parent
1e0827f6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
5 deletions
+48
-5
url.c
dlls/shlwapi/tests/url.c
+11
-0
url.c
dlls/shlwapi/url.c
+37
-5
No files found.
dlls/shlwapi/tests/url.c
View file @
8de69a17
...
...
@@ -552,6 +552,17 @@ static void test_UrlGetPart(void)
test_url_part
(
http_url
,
URL_PART_HOSTNAME
,
0
,
"www.wine hq.org"
);
test_url_part
(
http_url
,
URL_PART_PASSWORD
,
0
,
"pass 123"
);
dwSize
=
sizeof
(
szPart
);
res
=
UrlGetPartA
(
"file://c:
\\
index.htm"
,
szPart
,
&
dwSize
,
URL_PART_HOSTNAME
,
0
);
ok
(
res
==
S_FALSE
,
"returned %08x
\n
"
,
res
);
dwSize
=
sizeof
(
szPart
);
szPart
[
0
]
=
'x'
;
szPart
[
1
]
=
'\0'
;
res
=
UrlGetPartA
(
"file:some text"
,
szPart
,
&
dwSize
,
URL_PART_HOSTNAME
,
0
);
ok
(
res
==
S_FALSE
,
"returned %08x
\n
"
,
res
);
ok
(
szPart
[
0
]
==
'\0'
,
"szPart[0] = %c
\n
"
,
szPart
[
0
]);
ok
(
dwSize
==
0
,
"dwSize = %d
\n
"
,
dwSize
);
}
/* ########################### */
...
...
dlls/shlwapi/url.c
View file @
8de69a17
...
...
@@ -2004,7 +2004,7 @@ HRESULT WINAPI UrlGetPartA(LPCSTR pszIn, LPSTR pszOut, LPDWORD pcchOut,
len
=
INTERNET_MAX_URL_LENGTH
;
ret
=
UrlGetPartW
(
in
,
out
,
&
len
,
dwPart
,
dwFlags
);
if
(
ret
!=
S_OK
)
{
if
(
FAILED
(
ret
)
)
{
HeapFree
(
GetProcessHeap
(),
0
,
in
);
return
ret
;
}
...
...
@@ -2015,10 +2015,10 @@ HRESULT WINAPI UrlGetPartA(LPCSTR pszIn, LPSTR pszOut, LPDWORD pcchOut,
HeapFree
(
GetProcessHeap
(),
0
,
in
);
return
E_POINTER
;
}
WideCharToMultiByte
(
0
,
0
,
out
,
len
+
1
,
pszOut
,
*
pcchOut
,
0
,
0
);
*
pcchOut
=
len2
;
len2
=
WideCharToMultiByte
(
0
,
0
,
out
,
len
+
1
,
pszOut
,
*
pcchOut
,
0
,
0
);
*
pcchOut
=
len2
-
1
;
HeapFree
(
GetProcessHeap
(),
0
,
in
);
return
S_OK
;
return
ret
;
}
/*************************************************************************
...
...
@@ -2031,12 +2031,18 @@ HRESULT WINAPI UrlGetPartW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut,
{
WINE_PARSE_URL
pl
;
HRESULT
ret
;
DWORD
size
,
schsize
;
DWORD
s
cheme
,
s
ize
,
schsize
;
LPCWSTR
addr
,
schaddr
;
TRACE
(
"(%s %p %p(%d) %08x %08x)
\n
"
,
debugstr_w
(
pszIn
),
pszOut
,
pcchOut
,
*
pcchOut
,
dwPart
,
dwFlags
);
addr
=
strchrW
(
pszIn
,
':'
);
if
(
!
addr
)
return
E_FAIL
;
scheme
=
get_scheme_code
(
pszIn
,
addr
-
pszIn
);
ret
=
URL_ParseUrl
(
pszIn
,
&
pl
);
if
(
ret
==
S_OK
)
{
schaddr
=
pl
.
pScheme
;
...
...
@@ -2050,6 +2056,26 @@ HRESULT WINAPI UrlGetPartW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut,
break
;
case
URL_PART_HOSTNAME
:
switch
(
scheme
)
{
case
URL_SCHEME_FTP
:
case
URL_SCHEME_HTTP
:
case
URL_SCHEME_GOPHER
:
case
URL_SCHEME_TELNET
:
case
URL_SCHEME_FILE
:
case
URL_SCHEME_HTTPS
:
break
;
default:
return
E_FAIL
;
}
if
(
scheme
==
URL_SCHEME_FILE
&&
(
!
pl
.
szHostName
||
(
pl
.
szHostName
==
1
&&
*
(
pl
.
pHostName
+
1
)
==
':'
)))
{
if
(
pcchOut
)
*
pszOut
=
'\0'
;
*
pcchOut
=
0
;
return
S_FALSE
;
}
if
(
!
pl
.
szHostName
)
return
E_INVALIDARG
;
addr
=
pl
.
pHostName
;
size
=
pl
.
szHostName
;
...
...
@@ -2101,7 +2127,13 @@ HRESULT WINAPI UrlGetPartW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut,
*
pcchOut
=
size
;
}
TRACE
(
"len=%d %s
\n
"
,
*
pcchOut
,
debugstr_w
(
pszOut
));
}
else
if
(
dwPart
==
URL_PART_HOSTNAME
&&
scheme
==
URL_SCHEME_FILE
)
{
if
(
*
pcchOut
)
*
pszOut
=
'\0'
;
*
pcchOut
=
0
;
return
S_FALSE
;
}
return
ret
;
}
...
...
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