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
2d76bf2e
Commit
2d76bf2e
authored
Mar 03, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 03, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi/tests: Some tests for PathGetDriveNumber.
parent
f8a89aa0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
34 deletions
+72
-34
path.c
dlls/shlwapi/tests/path.c
+72
-34
No files found.
dlls/shlwapi/tests/path.c
View file @
2d76bf2e
...
...
@@ -28,12 +28,12 @@
#include "shlwapi.h"
#include "wininet.h"
static
HMODULE
hShlwapi
;
static
HRESULT
(
WINAPI
*
pPathIsValidCharA
)(
char
,
DWORD
);
static
HRESULT
(
WINAPI
*
pPathIsValidCharW
)(
WCHAR
,
DWORD
);
static
LPWSTR
(
WINAPI
*
pPathCombineW
)(
LPWSTR
,
LPCWSTR
,
LPCWSTR
);
static
HRESULT
(
WINAPI
*
pPathCreateFromUrlA
)(
LPCSTR
,
LPSTR
,
LPDWORD
,
DWORD
);
static
HRESULT
(
WINAPI
*
pPathCreateFromUrlW
)(
LPCWSTR
,
LPWSTR
,
LPDWORD
,
DWORD
);
static
BOOL
(
WINAPI
*
pPathAppendA
)(
LPSTR
,
LPCSTR
);
/* ################ */
...
...
@@ -300,6 +300,15 @@ static void test_PathIsValidCharA(void)
BOOL
ret
;
unsigned
int
c
;
/* For whatever reason, PathIsValidCharA and PathAppendA share the same
* ordinal number in some native versions. Check this to prevent a crash.
*/
if
(
!
pPathIsValidCharA
||
pPathIsValidCharA
==
(
void
*
)
pPathAppendA
)
{
win_skip
(
"PathIsValidCharA isn't available
\n
"
);
return
;
}
for
(
c
=
0
;
c
<
0x7f
;
c
++
)
{
ret
=
pPathIsValidCharA
(
c
,
~
0U
);
...
...
@@ -318,6 +327,12 @@ static void test_PathIsValidCharW(void)
BOOL
ret
;
unsigned
int
c
;
if
(
!
pPathIsValidCharW
)
{
win_skip
(
"PathIsValidCharW isn't available
\n
"
);
return
;
}
for
(
c
=
0
;
c
<
0x7f
;
c
++
)
{
ret
=
pPathIsValidCharW
(
c
,
~
0U
);
...
...
@@ -392,7 +407,13 @@ static void test_PathCombineW(void)
WCHAR
wbuf
[
MAX_PATH
+
1
],
wstr1
[
MAX_PATH
]
=
{
'C'
,
':'
,
'\\'
,
0
},
wstr2
[
MAX_PATH
];
static
const
WCHAR
expout
[]
=
{
'C'
,
':'
,
'\\'
,
'A'
,
'A'
,
0
};
int
i
;
if
(
!
pPathCombineW
)
{
win_skip
(
"PathCombineW isn't available
\n
"
);
return
;
}
wszString2
=
HeapAlloc
(
GetProcessHeap
(),
0
,
MAX_PATH
*
sizeof
(
WCHAR
));
/* NULL test */
...
...
@@ -1312,43 +1333,60 @@ static void test_PathUnquoteSpaces(void)
}
}
static
void
test_PathGetDriveNumber
(
void
)
{
static
const
CHAR
test1A
[]
=
"a:
\\
test.file"
;
static
const
CHAR
test2A
[]
=
"file:////b:
\\
test.file"
;
static
const
CHAR
test3A
[]
=
"file:///c:
\\
test.file"
;
static
const
CHAR
test4A
[]
=
"file:
\\\\
c:
\\
test.file"
;
int
ret
;
SetLastError
(
0xdeadbeef
);
ret
=
PathGetDriveNumberA
(
NULL
);
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"got %d
\n
"
,
GetLastError
());
ret
=
PathGetDriveNumberA
(
test1A
);
ok
(
ret
==
0
,
"got %d
\n
"
,
ret
);
ret
=
PathGetDriveNumberA
(
test2A
);
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ret
=
PathGetDriveNumberA
(
test3A
);
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ret
=
PathGetDriveNumberA
(
test4A
);
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
}
/* ################ */
START_TEST
(
path
)
{
hShlwapi
=
GetModuleHandleA
(
"shlwapi.dll"
);
pPathCreateFromUrlA
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"PathCreateFromUrlA"
);
pPathCreateFromUrlW
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"PathCreateFromUrlW"
);
test_PathSearchAndQualify
();
test_PathCreateFromUrl
();
test_PathIsUrl
();
test_PathAddBackslash
();
test_PathMakePretty
();
test_PathMatchSpec
();
/* For whatever reason, PathIsValidCharA and PathAppendA share the same
* ordinal number in some native versions. Check this to prevent a crash.
*/
pPathIsValidCharA
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
(
LPSTR
)
455
);
if
(
pPathIsValidCharA
&&
pPathIsValidCharA
!=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"PathAppendA"
))
{
test_PathIsValidCharA
();
HMODULE
hShlwapi
=
GetModuleHandleA
(
"shlwapi.dll"
);
pPathIsValidCharW
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
(
LPSTR
)
456
);
if
(
pPathIsValidCharW
)
test_PathIsValidCharW
();
}
pPathCreateFromUrlA
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"PathCreateFromUrlA"
);
pPathCreateFromUrlW
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"PathCreateFromUrlW"
);
pPathCombineW
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"PathCombineW"
);
pPathIsValidCharA
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
(
LPSTR
)
455
);
pPathIsValidCharW
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
(
LPSTR
)
456
);
pPathAppendA
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"PathAppendA"
);
pPathCombineW
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"PathCombineW"
);
if
(
pPathCombineW
)
test_PathCombineW
();
test_PathSearchAndQualify
();
test_PathCreateFromUrl
();
test_PathIsUrl
();
test_PathAddBackslash
();
test_PathMakePretty
();
test_PathMatchSpec
();
test_PathCombineA
();
test_PathAppendA
();
test_PathCanonicalizeA
();
test_PathFindExtensionA
();
test_PathBuildRootA
();
test_PathCommonPrefixA
();
test_PathUnquoteSpaces
();
test_PathIsValidCharA
();
test_PathIsValidCharW
();
test_PathCombineW
();
test_PathCombineA
();
test_PathAppendA
();
test_PathCanonicalizeA
();
test_PathFindExtensionA
();
test_PathBuildRootA
();
test_PathCommonPrefixA
();
test_PathUnquoteSpaces
();
test_PathGetDriveNumber
();
}
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