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
26541471
Commit
26541471
authored
May 15, 2011
by
Sergey Khodych
Committed by
Alexandre Julliard
May 17, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Implement URL_APPLY_GUESSFILE in UrlApplyScheme.
parent
2e1bec52
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
33 deletions
+55
-33
url.c
dlls/shlwapi/tests/url.c
+7
-1
url.c
dlls/shlwapi/url.c
+48
-32
No files found.
dlls/shlwapi/tests/url.c
View file @
26541471
...
...
@@ -91,7 +91,12 @@ static const TEST_URL_APPLY TEST_APPLY[] = {
{
"http://www.winehq.org"
,
URL_APPLY_GUESSSCHEME
|
URL_APPLY_DEFAULT
,
S_FALSE
,
TEST_APPLY_MAX_LENGTH
,
untouchedA
},
{
""
,
URL_APPLY_GUESSSCHEME
|
URL_APPLY_DEFAULT
,
S_OK
,
7
,
"http://"
},
{
""
,
URL_APPLY_GUESSSCHEME
,
S_FALSE
,
TEST_APPLY_MAX_LENGTH
,
untouchedA
},
{
""
,
URL_APPLY_DEFAULT
,
S_OK
,
7
,
"http://"
}
{
""
,
URL_APPLY_DEFAULT
,
S_OK
,
7
,
"http://"
},
{
"u:
\\
windows"
,
URL_APPLY_GUESSFILE
|
URL_APPLY_DEFAULT
,
S_OK
,
18
,
"file:///u:/windows"
},
{
"u:
\\
windows"
,
URL_APPLY_GUESSFILE
,
S_OK
,
18
,
"file:///u:/windows"
},
{
"u:
\\
windows"
,
URL_APPLY_DEFAULT
,
S_OK
,
17
,
"http://u:
\\
windows"
},
{
"file:///c:/windows"
,
URL_APPLY_GUESSFILE
,
S_FALSE
,
TEST_APPLY_MAX_LENGTH
,
untouchedA
},
{
"aa:
\\
windows"
,
URL_APPLY_GUESSFILE
,
S_FALSE
,
TEST_APPLY_MAX_LENGTH
,
untouchedA
},
};
/* ################ */
...
...
@@ -379,6 +384,7 @@ static const struct {
{
"c:foo
\\
bar"
,
"file:///c:foo/bar"
,
S_OK
},
{
"c:
\\
foo/b a%r"
,
"file:///c:/foo/b%20a%25r"
,
S_OK
},
{
"c:
\\
foo
\\
foo bar"
,
"file:///c:/foo/foo%20bar"
,
S_OK
},
{
"file:///c:/foo/bar"
,
"file:///c:/foo/bar"
,
S_FALSE
},
#if 0
/* The following test fails on native shlwapi as distributed with Win95/98.
* Wine matches the behaviour of later versions.
...
...
dlls/shlwapi/url.c
View file @
26541471
...
...
@@ -1700,6 +1700,39 @@ static HRESULT URL_GuessScheme(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut)
return
E_FAIL
;
}
static
HRESULT
URL_CreateFromPath
(
LPCWSTR
pszPath
,
LPWSTR
pszUrl
,
LPDWORD
pcchUrl
)
{
DWORD
needed
;
HRESULT
ret
=
S_OK
;
WCHAR
*
pszNewUrl
;
WCHAR
file_colonW
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
,
0
};
WCHAR
three_slashesW
[]
=
{
'/'
,
'/'
,
'/'
,
0
};
PARSEDURLW
parsed_url
;
parsed_url
.
cbSize
=
sizeof
(
parsed_url
);
if
(
ParseURLW
(
pszPath
,
&
parsed_url
)
==
S_OK
)
{
if
(
parsed_url
.
nScheme
!=
URL_SCHEME_INVALID
&&
parsed_url
.
cchProtocol
>
1
)
{
needed
=
strlenW
(
pszPath
);
if
(
needed
>=
*
pcchUrl
)
{
*
pcchUrl
=
needed
+
1
;
return
E_POINTER
;
}
else
{
*
pcchUrl
=
needed
;
return
S_FALSE
;
}
}
}
pszNewUrl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
pszPath
)
+
9
)
*
sizeof
(
WCHAR
));
/* "file:///" + pszPath_len + 1 */
strcpyW
(
pszNewUrl
,
file_colonW
);
if
(
isalphaW
(
pszPath
[
0
])
&&
pszPath
[
1
]
==
':'
)
strcatW
(
pszNewUrl
,
three_slashesW
);
strcatW
(
pszNewUrl
,
pszPath
);
ret
=
UrlEscapeW
(
pszNewUrl
,
pszUrl
,
pcchUrl
,
URL_ESCAPE_PERCENT
);
HeapFree
(
GetProcessHeap
(),
0
,
pszNewUrl
);
return
ret
;
}
static
HRESULT
URL_ApplyDefault
(
LPCWSTR
pszIn
,
LPWSTR
pszOut
,
LPDWORD
pcchOut
)
{
HKEY
newkey
;
...
...
@@ -1747,11 +1780,18 @@ HRESULT WINAPI UrlApplySchemeW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DW
if
(
!
pszIn
||
!
pszOut
||
!
pcchOut
)
return
E_INVALIDARG
;
if
(
dwFlags
&
URL_APPLY_GUESSFILE
)
{
FIXME
(
"(%s %p %p(%d) 0x%08x): stub URL_APPLY_GUESSFILE not implemented
\n
"
,
debugstr_w
(
pszIn
),
pszOut
,
pcchOut
,
*
pcchOut
,
dwFlags
);
strcpyW
(
pszOut
,
pszIn
);
*
pcchOut
=
strlenW
(
pszOut
);
return
S_FALSE
;
if
(
*
pcchOut
>
1
&&
':'
==
pszIn
[
1
])
{
res1
=
*
pcchOut
;
ret
=
URL_CreateFromPath
(
pszIn
,
pszOut
,
&
res1
);
if
(
ret
==
S_OK
||
ret
==
E_POINTER
){
*
pcchOut
=
res1
;
return
ret
;
}
else
if
(
ret
==
S_FALSE
)
{
return
ret
;
}
}
}
in_scheme
.
cbSize
=
sizeof
(
in_scheme
);
...
...
@@ -2408,12 +2448,7 @@ HRESULT WINAPI UrlCreateFromPathA(LPCSTR pszPath, LPSTR pszUrl, LPDWORD pcchUrl,
*/
HRESULT
WINAPI
UrlCreateFromPathW
(
LPCWSTR
pszPath
,
LPWSTR
pszUrl
,
LPDWORD
pcchUrl
,
DWORD
dwReserved
)
{
DWORD
needed
;
HRESULT
ret
;
WCHAR
*
pszNewUrl
;
WCHAR
file_colonW
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
,
0
};
WCHAR
three_slashesW
[]
=
{
'/'
,
'/'
,
'/'
,
0
};
PARSEDURLW
parsed_url
;
TRACE
(
"(%s, %p, %p, 0x%08x)
\n
"
,
debugstr_w
(
pszPath
),
pszUrl
,
pcchUrl
,
dwReserved
);
...
...
@@ -2423,30 +2458,11 @@ HRESULT WINAPI UrlCreateFromPathW(LPCWSTR pszPath, LPWSTR pszUrl, LPDWORD pcchUr
if
(
!
pszUrl
||
!
pcchUrl
)
return
E_INVALIDARG
;
ret
=
URL_CreateFromPath
(
pszPath
,
pszUrl
,
pcchUrl
);
parsed_url
.
cbSize
=
sizeof
(
parsed_url
);
if
(
ParseURLW
(
pszPath
,
&
parsed_url
)
==
S_OK
)
{
if
(
parsed_url
.
nScheme
!=
URL_SCHEME_INVALID
&&
parsed_url
.
cchProtocol
>
1
)
{
needed
=
strlenW
(
pszPath
);
if
(
needed
>=
*
pcchUrl
)
{
*
pcchUrl
=
needed
+
1
;
return
E_POINTER
;
}
else
{
*
pcchUrl
=
needed
;
strcpyW
(
pszUrl
,
pszPath
);
return
S_FALSE
;
}
}
}
pszNewUrl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
pszPath
)
+
9
)
*
sizeof
(
WCHAR
));
/* "file:///" + pszPath_len + 1 */
strcpyW
(
pszNewUrl
,
file_colonW
);
if
(
isalphaW
(
pszPath
[
0
])
&&
pszPath
[
1
]
==
':'
)
strcatW
(
pszNewUrl
,
three_slashesW
);
strcatW
(
pszNewUrl
,
pszPath
);
ret
=
UrlEscapeW
(
pszNewUrl
,
pszUrl
,
pcchUrl
,
URL_ESCAPE_PERCENT
);
if
(
S_FALSE
==
ret
)
strcpyW
(
pszUrl
,
pszPath
);
HeapFree
(
GetProcessHeap
(),
0
,
pszNewUrl
);
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