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
4caf4bf8
Commit
4caf4bf8
authored
Jan 09, 2003
by
Matthew Mastracci
Committed by
Alexandre Julliard
Jan 09, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add implementation for PathCreateFromUrlW and add the start for some
URL unit tests.
parent
1d4db787
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
142 additions
and
2 deletions
+142
-2
path.c
dlls/shlwapi/path.c
+31
-2
.cvsignore
dlls/shlwapi/tests/.cvsignore
+1
-0
Makefile.in
dlls/shlwapi/tests/Makefile.in
+1
-0
path.c
dlls/shlwapi/tests/path.c
+109
-0
No files found.
dlls/shlwapi/path.c
View file @
4caf4bf8
...
...
@@ -3154,12 +3154,41 @@ HRESULT WINAPI PathCreateFromUrlA(LPCSTR lpszUrl, LPSTR lpszPath,
HRESULT
WINAPI
PathCreateFromUrlW
(
LPCWSTR
lpszUrl
,
LPWSTR
lpszPath
,
LPDWORD
pcchPath
,
DWORD
dwFlags
)
{
FIXME
(
"(%s,%p,%p,0x%08lx)-stub
\n
"
,
debugstr_w
(
lpszUrl
),
lpszPath
,
pcchPath
,
dwFlags
);
static
const
WCHAR
stemp
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
,
'/'
,
'/'
,
0
};
LPWSTR
pwszPathPart
;
HRESULT
hr
;
TRACE
(
"(%s,%p,%p,0x%08lx)
\n
"
,
debugstr_w
(
lpszUrl
),
lpszPath
,
pcchPath
,
dwFlags
);
if
(
!
lpszUrl
||
!
lpszPath
||
!
pcchPath
||
!*
pcchPath
)
return
E_INVALIDARG
;
return
S_OK
;
/* Path of the form file://... */
if
(
!
strncmpW
(
lpszUrl
,
stemp
,
7
))
{
lpszUrl
+=
7
;
}
/* Path of the form file:... */
else
if
(
!
strncmpW
(
lpszUrl
,
stemp
,
5
))
{
lpszUrl
+=
5
;
}
/* Ensure that path is of the form c:... or c|... */
if
(
lpszUrl
[
1
]
!=
':'
&&
lpszUrl
[
1
]
!=
'|'
&&
isalphaW
(
*
lpszUrl
))
return
E_INVALIDARG
;
hr
=
UrlUnescapeW
(
lpszUrl
,
lpszPath
,
pcchPath
,
dwFlags
);
if
(
lpszPath
[
1
]
==
'|'
)
lpszPath
[
1
]
=
':'
;
for
(
pwszPathPart
=
lpszPath
;
*
pwszPathPart
;
pwszPathPart
++
)
if
(
*
pwszPathPart
==
'/'
)
*
pwszPathPart
=
'\\'
;
TRACE
(
"Returning %s
\n
"
,
debugstr_w
(
lpszPath
));
return
hr
;
}
/*************************************************************************
...
...
dlls/shlwapi/tests/.cvsignore
View file @
4caf4bf8
Makefile
clist.ok
generated.ok
path.ok
shlwapi_test.exe.spec.c
shreg.ok
testlist.c
dlls/shlwapi/tests/Makefile.in
View file @
4caf4bf8
...
...
@@ -8,6 +8,7 @@ IMPORTS = shlwapi advapi32
CTESTS
=
\
clist.c
\
generated.c
\
path.c
\
shreg.c
@MAKE_TEST_RULES@
...
...
dlls/shlwapi/tests/path.c
0 → 100644
View file @
4caf4bf8
/* Unit test suite for Path functions
*
* Copyright 2002 Matthew Mastracci
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "wine/test.h"
#include "wine/unicode.h"
#include "winbase.h"
#include "shlwapi.h"
#include "wininet.h"
const
char
*
TEST_URL_1
=
"http://www.winehq.org/tests?date=10/10/1923"
;
const
char
*
TEST_URL_2
=
"http://localhost:8080/tests%2e.html?date=Mon%2010/10/1923"
;
const
char
*
TEST_URL_3
=
"http://foo:bar@localhost:21/internal.php?query=x&return=y"
;
static
LPWSTR
GetWideString
(
const
char
*
szString
)
{
LPWSTR
wszString
=
(
LPWSTR
)
HeapAlloc
(
GetProcessHeap
(),
0
,
(
2
*
INTERNET_MAX_URL_LENGTH
)
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
0
,
0
,
szString
,
-
1
,
wszString
,
INTERNET_MAX_URL_LENGTH
);
return
wszString
;
}
static
void
FreeWideString
(
LPWSTR
wszString
)
{
HeapFree
(
GetProcessHeap
(),
0
,
wszString
);
}
static
void
hash_url
(
const
char
*
szUrl
)
{
LPCSTR
szTestUrl
=
szUrl
;
LPWSTR
wszTestUrl
=
GetWideString
(
szTestUrl
);
DWORD
cbSize
=
sizeof
(
DWORD
);
DWORD
dwHash1
,
dwHash2
;
ok
(
UrlHashA
(
szTestUrl
,
(
LPBYTE
)
&
dwHash1
,
cbSize
)
==
S_OK
,
"UrlHashA didn't return S_OK"
);
ok
(
UrlHashW
(
wszTestUrl
,
(
LPBYTE
)
&
dwHash2
,
cbSize
)
==
S_OK
,
"UrlHashW didn't return S_OK"
);
FreeWideString
(
wszTestUrl
);
ok
(
dwHash1
==
dwHash2
,
"Hashes didn't compare"
);
}
static
void
test_UrlHash
(
void
)
{
hash_url
(
TEST_URL_1
);
hash_url
(
TEST_URL_2
);
hash_url
(
TEST_URL_3
);
}
static
void
test_url_part
(
const
char
*
szUrl
,
DWORD
dwPart
,
DWORD
dwFlags
,
char
*
szExpected
)
{
CHAR
szPart
[
INTERNET_MAX_URL_LENGTH
];
WCHAR
wszPart
[
INTERNET_MAX_URL_LENGTH
];
LPWSTR
wszUrl
=
GetWideString
(
szUrl
);
LPWSTR
wszConvertedPart
;
DWORD
dwSize
;
dwSize
=
INTERNET_MAX_URL_LENGTH
;
ok
(
UrlGetPartA
(
szUrl
,
szPart
,
&
dwSize
,
dwPart
,
dwFlags
)
==
S_OK
,
"UrlGetPartA didn't return S_OK"
);
dwSize
=
INTERNET_MAX_URL_LENGTH
;
ok
(
UrlGetPartW
(
wszUrl
,
wszPart
,
&
dwSize
,
dwPart
,
dwFlags
)
==
S_OK
,
"UrlGetPartW didn't return S_OK"
);
wszConvertedPart
=
GetWideString
(
szPart
);
ok
(
strcmpW
(
wszPart
,
wszConvertedPart
)
==
0
,
"Strings didn't match between ascii and unicode UrlGetPart!"
);
FreeWideString
(
wszUrl
);
FreeWideString
(
wszConvertedPart
);
ok
(
strcmp
(
szPart
,
szExpected
)
==
0
,
"Expected %s, but got %s"
,
szExpected
,
szPart
);
}
static
void
test_UrlGetPart
(
void
)
{
test_url_part
(
TEST_URL_3
,
URL_PART_HOSTNAME
,
0
,
"localhost"
);
test_url_part
(
TEST_URL_3
,
URL_PART_PORT
,
0
,
"21"
);
test_url_part
(
TEST_URL_3
,
URL_PART_USERNAME
,
0
,
"foo"
);
test_url_part
(
TEST_URL_3
,
URL_PART_PASSWORD
,
0
,
"bar"
);
test_url_part
(
TEST_URL_3
,
URL_PART_SCHEME
,
0
,
"http"
);
test_url_part
(
TEST_URL_3
,
URL_PART_QUERY
,
0
,
"?query=x&return=y"
);
}
START_TEST
(
path
)
{
test_UrlHash
();
test_UrlGetPart
();
}
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