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
de35ace5
Commit
de35ace5
authored
Dec 19, 2002
by
Robert Shearman
Committed by
Alexandre Julliard
Dec 19, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented UrlCreateFromPath[AW] and slightly related
PathCreateFromFileA.
parent
ee8411f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
214 additions
and
7 deletions
+214
-7
path.c
dlls/shlwapi/path.c
+9
-2
shlwapi.spec
dlls/shlwapi/shlwapi.spec
+2
-2
url.c
dlls/shlwapi/url.c
+203
-3
No files found.
dlls/shlwapi/path.c
View file @
de35ace5
...
@@ -3124,11 +3124,18 @@ LPWSTR WINAPI PathSkipRootW(LPCWSTR lpszPath)
...
@@ -3124,11 +3124,18 @@ LPWSTR WINAPI PathSkipRootW(LPCWSTR lpszPath)
HRESULT
WINAPI
PathCreateFromUrlA
(
LPCSTR
lpszUrl
,
LPSTR
lpszPath
,
HRESULT
WINAPI
PathCreateFromUrlA
(
LPCSTR
lpszUrl
,
LPSTR
lpszPath
,
LPDWORD
pcchPath
,
DWORD
dwFlags
)
LPDWORD
pcchPath
,
DWORD
dwFlags
)
{
{
FIXME
(
"(%s,%p,%p,0x%08lx)-stub
\n
"
,
debugstr_a
(
lpszUrl
),
lpszPath
,
pcchPath
,
dwFlags
);
LPSTR
pszPathPart
;
TRACE
(
"(%s,%p,%p,0x%08lx)
\n
"
,
debugstr_a
(
lpszUrl
),
lpszPath
,
pcchPath
,
dwFlags
);
if
(
!
lpszUrl
||
!
lpszPath
||
!
pcchPath
||
!*
pcchPath
)
if
(
!
lpszUrl
||
!
lpszPath
||
!
pcchPath
||
!*
pcchPath
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
pszPathPart
=
StrChrA
(
lpszUrl
,
':'
);
if
((((
pszPathPart
-
lpszUrl
)
==
1
)
&&
isalpha
(
*
lpszUrl
))
||
!
lstrcmpA
(
lpszUrl
,
"file:"
))
{
return
UrlUnescapeA
(
pszPathPart
,
lpszPath
,
pcchPath
,
dwFlags
);
}
/* extracts thing prior to : in pszURL and checks against:
/* extracts thing prior to : in pszURL and checks against:
* https
* https
* shell
* shell
...
@@ -3136,7 +3143,7 @@ HRESULT WINAPI PathCreateFromUrlA(LPCSTR lpszUrl, LPSTR lpszPath,
...
@@ -3136,7 +3143,7 @@ HRESULT WINAPI PathCreateFromUrlA(LPCSTR lpszUrl, LPSTR lpszPath,
* about - if match returns E_INVALIDARG
* about - if match returns E_INVALIDARG
*/
*/
return
S_OK
;
return
E_INVALIDARG
;
}
}
/*************************************************************************
/*************************************************************************
...
...
dlls/shlwapi/shlwapi.spec
View file @
de35ace5
...
@@ -657,8 +657,8 @@
...
@@ -657,8 +657,8 @@
@ stdcall UrlCombineW(wstr wstr wstr ptr long) UrlCombineW
@ stdcall UrlCombineW(wstr wstr wstr ptr long) UrlCombineW
@ stdcall UrlCompareA(str str long) UrlCompareA
@ stdcall UrlCompareA(str str long) UrlCompareA
@ stdcall UrlCompareW(wstr wstr long) UrlCompareW
@ stdcall UrlCompareW(wstr wstr long) UrlCompareW
@ st
ub
UrlCreateFromPathA
@ st
dcall UrlCreateFromPathA(str ptr ptr long)
UrlCreateFromPathA
@ st
ub
UrlCreateFromPathW
@ st
dcall UrlCreateFromPathW(wstr ptr ptr long)
UrlCreateFromPathW
@ stdcall UrlEscapeA(str ptr ptr long)UrlEscapeA
@ stdcall UrlEscapeA(str ptr ptr long)UrlEscapeA
@ stdcall UrlEscapeW(wstr ptr ptr long)UrlEscapeW
@ stdcall UrlEscapeW(wstr ptr ptr long)UrlEscapeW
@ stdcall UrlGetLocationA(str) UrlGetLocationA
@ stdcall UrlGetLocationA(str) UrlGetLocationA
...
...
dlls/shlwapi/url.c
View file @
de35ace5
...
@@ -181,7 +181,7 @@ static BOOL URL_NeedEscapeA(CHAR ch, DWORD dwFlags)
...
@@ -181,7 +181,7 @@ static BOOL URL_NeedEscapeA(CHAR ch, DWORD dwFlags)
case
'{'
:
case
'{'
:
case
'}'
:
case
'}'
:
case
'|'
:
case
'|'
:
case
'\\'
:
/* case '\\': */
case
'^'
:
case
'^'
:
case
']'
:
case
']'
:
case
'['
:
case
'['
:
...
@@ -921,8 +921,8 @@ HRESULT WINAPI UrlEscapeA(
...
@@ -921,8 +921,8 @@ HRESULT WINAPI UrlEscapeA(
char
next
[
3
],
*
dst
=
pszEscaped
;
char
next
[
3
],
*
dst
=
pszEscaped
;
INT
len
;
INT
len
;
TRACE
(
"(%s %p %
p
0x%08lx)
\n
"
,
debugstr_a
(
pszUrl
),
pszEscaped
,
TRACE
(
"(%s %p %
lx
0x%08lx)
\n
"
,
debugstr_a
(
pszUrl
),
pszEscaped
,
pcchEscaped
,
dwFlags
);
*
pcchEscaped
,
dwFlags
);
if
(
dwFlags
&
~
(
URL_ESCAPE_SPACES_ONLY
|
if
(
dwFlags
&
~
(
URL_ESCAPE_SPACES_ONLY
|
URL_ESCAPE_SEGMENT_ONLY
|
URL_ESCAPE_SEGMENT_ONLY
|
...
@@ -1981,3 +1981,203 @@ BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
...
@@ -1981,3 +1981,203 @@ BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
res1
=
SHLWAPI_2
(
lpstrPath
,
&
base
);
res1
=
SHLWAPI_2
(
lpstrPath
,
&
base
);
return
(
base
.
fcncde
>
0
);
return
(
base
.
fcncde
>
0
);
}
}
/*************************************************************************
* UrlCreateFromPathA [SHLWAPI.@]
*/
HRESULT
WINAPI
UrlCreateFromPathA
(
LPCSTR
pszPath
,
LPSTR
pszUrl
,
LPDWORD
pcchUrl
,
DWORD
dwReserved
)
{
DWORD
nCharBeforeColon
=
0
;
DWORD
nSlashes
=
0
;
DWORD
dwChRequired
=
0
;
LPSTR
pszNewUrl
=
NULL
;
LPCSTR
pszConstPointer
=
NULL
;
LPSTR
pszPointer
=
NULL
;
DWORD
i
;
HRESULT
ret
;
TRACE
(
"(%s, %p, %p, 0x%08lx)
\n
"
,
debugstr_a
(
pszPath
),
pszUrl
,
pcchUrl
,
dwReserved
);
/* Validate arguments */
if
(
dwReserved
!=
0
)
{
FIXME
(
"dwReserved should be 0: 0x%08lx
\n
"
,
dwReserved
);
return
E_INVALIDARG
;
}
if
(
!
pszUrl
||
!
pcchUrl
||
!
pszUrl
)
{
ERR
(
"Invalid argument
\n
"
);
return
E_INVALIDARG
;
}
for
(
pszConstPointer
=
pszPath
;
*
pszConstPointer
;
pszConstPointer
++
)
{
if
(
isalpha
(
*
pszConstPointer
)
||
isdigit
(
*
pszConstPointer
)
||
*
pszConstPointer
==
'.'
||
*
pszConstPointer
==
'-'
)
nCharBeforeColon
++
;
else
break
;
}
if
(
*
pszConstPointer
==
':'
)
/* then already in URL format, so copy */
{
dwChRequired
=
lstrlenA
(
pszPath
);
if
(
dwChRequired
>
*
pcchUrl
)
{
*
pcchUrl
=
dwChRequired
;
return
E_POINTER
;
}
else
{
*
pcchUrl
=
dwChRequired
;
StrCpyA
(
pszUrl
,
pszPath
);
return
S_FALSE
;
}
}
/* then must need converting to file: format */
/* Strip off leading slashes */
while
(
*
pszPath
==
'\\'
||
*
pszPath
==
'/'
)
{
pszPath
++
;
nSlashes
++
;
}
dwChRequired
=
*
pcchUrl
;
/* UrlEscape will fill this in with the correct amount */
TRACE
(
"pszUrl: %s
\n
"
,
debugstr_a
(
pszPath
));
pszNewUrl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwChRequired
+
1
);
ret
=
UrlEscapeA
(
pszPath
,
pszNewUrl
,
&
dwChRequired
,
URL_ESCAPE_PERCENT
);
TRACE
(
"ret: 0x%08lx, pszUrl: %s
\n
"
,
ret
,
debugstr_a
(
pszNewUrl
));
TRACE
(
"%ld
\n
"
,
dwChRequired
);
if
(
ret
!=
E_POINTER
&&
FAILED
(
ret
))
return
ret
;
dwChRequired
+=
5
;
/* "file:" */
if
((
lstrlenA
(
pszUrl
)
>
1
)
&&
isalpha
(
pszUrl
[
0
])
&&
(
pszUrl
[
1
]
==
':'
))
{
dwChRequired
+=
3
;
/* "///" */
nSlashes
=
3
;
}
else
switch
(
nSlashes
)
{
case
0
:
/* no slashes */
break
;
case
2
:
/* two slashes */
case
4
:
case
5
:
case
6
:
dwChRequired
+=
2
;
nSlashes
=
2
;
break
;
default:
/* three slashes */
dwChRequired
+=
3
;
nSlashes
=
3
;
}
if
(
dwChRequired
>
*
pcchUrl
)
return
E_POINTER
;
*
pcchUrl
=
dwChRequired
;
/* Return number of chars required (not including termination) */
StrCpyA
(
pszUrl
,
"file:"
);
pszPointer
=
pszUrl
+
lstrlenA
(
pszUrl
);
for
(
i
=
0
;
i
<
nSlashes
;
i
++
)
{
*
pszPointer
=
'/'
;
pszPointer
++
;
}
StrCpyA
(
pszPointer
,
pszNewUrl
);
TRACE
(
"<- %s
\n
"
,
debugstr_a
(
pszUrl
));
return
S_OK
;
}
/*************************************************************************
* UrlCreateFromPathA [SHLWAPI.@]
*/
HRESULT
WINAPI
UrlCreateFromPathW
(
LPCWSTR
pszPath
,
LPWSTR
pszUrl
,
LPDWORD
pcchUrl
,
DWORD
dwReserved
)
{
DWORD
nCharBeforeColon
=
0
;
DWORD
nSlashes
=
0
;
DWORD
dwChRequired
=
0
;
LPWSTR
pszNewUrl
=
NULL
;
LPCWSTR
pszConstPointer
=
NULL
;
LPWSTR
pszPointer
=
NULL
;
DWORD
i
;
HRESULT
ret
;
TRACE
(
"(%s, %p, %p, 0x%08lx)
\n
"
,
debugstr_w
(
pszPath
),
pszUrl
,
pcchUrl
,
dwReserved
);
/* Validate arguments */
if
(
dwReserved
!=
0
)
return
E_INVALIDARG
;
if
(
!
pszUrl
||
!
pcchUrl
||
!
pszUrl
)
return
E_INVALIDARG
;
for
(
pszConstPointer
=
pszPath
;
*
pszConstPointer
;
pszConstPointer
++
)
{
if
(
isalphaW
(
*
pszConstPointer
)
||
isdigitW
(
*
pszConstPointer
)
||
*
pszConstPointer
==
'.'
||
*
pszConstPointer
==
'-'
)
nCharBeforeColon
++
;
else
break
;
}
if
(
*
pszConstPointer
==
':'
)
/* then already in URL format, so copy */
{
dwChRequired
=
lstrlenW
(
pszPath
);
*
pcchUrl
=
dwChRequired
;
if
(
dwChRequired
>
*
pcchUrl
)
return
E_POINTER
;
else
{
StrCpyW
(
pszUrl
,
pszPath
);
return
S_FALSE
;
}
}
/* then must need converting to file: format */
/* Strip off leading slashes */
while
(
*
pszPath
==
'\\'
||
*
pszPath
==
'/'
)
{
pszPath
++
;
nSlashes
++
;
}
dwChRequired
=
*
pcchUrl
;
/* UrlEscape will fill this in with the correct amount */
ret
=
UrlEscapeW
(
pszPath
,
pszUrl
,
&
dwChRequired
,
URL_ESCAPE_PERCENT
);
if
(
ret
!=
E_POINTER
&&
FAILED
(
ret
))
return
ret
;
dwChRequired
+=
5
;
/* "file:" */
if
((
lstrlenW
(
pszUrl
)
>
1
)
&&
isalphaW
(
pszUrl
[
0
])
&&
(
pszUrl
[
1
]
==
':'
))
{
dwChRequired
+=
3
;
/* "///" */
nSlashes
=
3
;
}
else
switch
(
nSlashes
)
{
case
0
:
/* no slashes */
break
;
case
2
:
/* two slashes */
case
4
:
case
5
:
case
6
:
dwChRequired
+=
2
;
nSlashes
=
2
;
break
;
default:
/* three slashes */
dwChRequired
+=
3
;
nSlashes
=
3
;
}
*
pcchUrl
=
dwChRequired
;
/* Return number of chars required (not including termination) */
if
(
dwChRequired
>
*
pcchUrl
)
return
E_POINTER
;
pszNewUrl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
dwChRequired
+
1
)
*
sizeof
(
WCHAR
));
StrCpyW
(
pszNewUrl
,
fileW
);
pszPointer
=
pszNewUrl
+
4
;
*
pszPointer
=
':'
;
pszPointer
++
;
for
(
i
=
0
;
i
<
nSlashes
;
i
++
)
{
*
pszPointer
=
'/'
;
pszPointer
++
;
}
StrCpyW
(
pszPointer
,
pszPath
);
StrCpyW
(
pszUrl
,
pszNewUrl
);
return
S_OK
;
}
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