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
b29b0d2c
Commit
b29b0d2c
authored
Jun 17, 2015
by
Erich E. Hoover
Committed by
Alexandre Julliard
Jun 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Convert GetVolumePathName tests into a list.
parent
f6c7e247
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
61 deletions
+72
-61
volume.c
dlls/kernel32/tests/volume.c
+72
-61
No files found.
dlls/kernel32/tests/volume.c
View file @
b29b0d2c
...
@@ -591,79 +591,90 @@ static void test_disk_extents(void)
...
@@ -591,79 +591,90 @@ static void test_disk_extents(void)
static
void
test_GetVolumePathNameA
(
void
)
static
void
test_GetVolumePathNameA
(
void
)
{
{
BOOL
ret
;
char
volume_path
[
MAX_PATH
];
char
volume
[
MAX_PATH
];
struct
{
char
expected
[]
=
"C:
\\
"
,
pathC1
[]
=
"C:
\\
"
,
pathC2
[]
=
"C::"
;
const
char
*
file_name
;
const
char
*
path_name
;
DWORD
path_len
;
DWORD
error
;
DWORD
broken_error
;
}
test_paths
[]
=
{
{
/* test 0: NULL parameters, 0 output length */
NULL
,
NULL
,
0
,
ERROR_INVALID_PARAMETER
,
0xdeadbeef
/* winxp */
},
{
/* test 1: empty input, NULL output, 0 output length */
""
,
NULL
,
0
,
ERROR_INVALID_PARAMETER
,
0xdeadbeef
/* winxp */
},
{
/* test 2: valid input, NULL output, 0 output length */
"C:
\\
"
,
NULL
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_FILENAME_EXCED_RANGE
/* winxp */
},
{
/* test 3: valid input, valid output, 0 output length */
"C:
\\
"
,
"C:
\\
"
,
0
,
ERROR_INVALID_PARAMETER
,
ERROR_FILENAME_EXCED_RANGE
/* winxp */
},
{
/* test 4: valid input, valid output, 1 output length */
"C:
\\
"
,
"C:
\\
"
,
1
,
ERROR_FILENAME_EXCED_RANGE
,
NO_ERROR
},
{
/* test 5: valid input, valid output, valid output length */
"C:
\\
"
,
"C:
\\
"
,
sizeof
(
volume_path
),
NO_ERROR
,
NO_ERROR
},
{
/* test 6: lowercase input, uppercase output, valid output length */
"c:
\\
"
,
"C:
\\
"
,
sizeof
(
volume_path
),
NO_ERROR
,
NO_ERROR
},
{
/* test 7: poor quality input, valid output, valid output length */
"C::"
,
"C:
\\
"
,
sizeof
(
volume_path
),
NO_ERROR
,
NO_ERROR
},
{
/* test 8: really bogus input, valid output, 1 output length */
"
\\\\
$$$"
,
"C:
\\
"
,
1
,
ERROR_INVALID_NAME
,
ERROR_FILENAME_EXCED_RANGE
},
};
BOOL
ret
,
success
;
DWORD
error
;
DWORD
error
;
UINT
i
;
/* GetVolumePathNameA is not present before w2k */
if
(
!
pGetVolumePathNameA
)
if
(
!
pGetVolumePathNameA
)
{
{
win_skip
(
"required functions not found
\n
"
);
win_skip
(
"required functions not found
\n
"
);
return
;
return
;
}
}
SetLastError
(
0xdeadbeef
);
for
(
i
=
0
;
i
<
sizeof
(
test_paths
)
/
sizeof
(
test_paths
[
0
]);
i
++
)
ret
=
pGetVolumePathNameA
(
NULL
,
NULL
,
0
);
{
error
=
GetLastError
();
char
*
output
=
(
test_paths
[
i
].
path_name
!=
NULL
?
volume_path
:
NULL
);
ok
(
!
ret
,
"expected failure
\n
"
);
BOOL
expected_ret
=
test_paths
[
i
].
error
==
NO_ERROR
?
TRUE
:
FALSE
;
ok
(
error
==
ERROR_INVALID_PARAMETER
||
broken
(
error
==
0xdeadbeef
)
/* <=XP */
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetVolumePathNameA
(
""
,
NULL
,
0
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
||
broken
(
error
==
0xdeadbeef
)
/* <=XP */
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetVolumePathNameA
(
pathC1
,
NULL
,
0
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
||
broken
(
error
==
ERROR_FILENAME_EXCED_RANGE
)
/* <=XP */
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
error
);
volume_path
[
0
]
=
0
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetVolumePathNameA
(
pathC1
,
volume
,
0
);
ret
=
pGetVolumePathNameA
(
test_paths
[
i
].
file_name
,
output
,
test_paths
[
i
].
path_len
);
error
=
GetLastError
();
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
ret
==
expected_ret
,
"GetVolumePathName test %d %s unexpectedly.
\n
"
,
ok
(
error
==
ERROR_INVALID_PARAMETER
i
,
test_paths
[
i
].
error
==
NO_ERROR
?
"failed"
:
"succeeded"
);
||
broken
(
error
==
ERROR_FILENAME_EXCED_RANGE
)
/* <=XP */
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
if
(
ret
)
ret
=
pGetVolumePathNameA
(
pathC1
,
volume
,
1
);
{
error
=
GetLastError
();
/* If we succeeded then make sure the path is correct */
ok
(
!
ret
,
"expected failure
\n
"
);
success
=
(
strcmp
(
volume_path
,
test_paths
[
i
].
path_name
)
==
0
)
ok
(
error
==
ERROR_FILENAME_EXCED_RANGE
,
"expected ERROR_FILENAME_EXCED_RANGE got %u
\n
"
,
error
);
||
broken
(
strcasecmp
(
volume_path
,
test_paths
[
i
].
path_name
)
==
0
)
/* XP */
;
ok
(
success
,
"GetVolumePathName test %d unexpectedly returned path %s (expected %s).
\n
"
,
volume
[
0
]
=
'\0'
;
i
,
volume_path
,
test_paths
[
i
].
path_name
);
ret
=
pGetVolumePathNameA
(
pathC1
,
volume
,
sizeof
(
volume
));
}
ok
(
ret
,
"expected success
\n
"
);
else
ok
(
!
strcmp
(
expected
,
volume
),
"expected name '%s', returned '%s'
\n
"
,
pathC1
,
volume
);
{
/* On success Windows always returns ERROR_MORE_DATA, so only worry about failure */
pathC1
[
0
]
=
tolower
(
pathC1
[
0
]);
success
=
(
error
==
test_paths
[
i
].
error
||
broken
(
error
==
test_paths
[
i
].
broken_error
));
volume
[
0
]
=
'\0'
;
ok
(
success
,
"GetVolumePathName test %d unexpectedly returned error 0x%x (expected 0x%x).
\n
"
,
ret
=
pGetVolumePathNameA
(
pathC1
,
volume
,
sizeof
(
volume
));
i
,
error
,
test_paths
[
i
].
error
);
ok
(
ret
,
"expected success
\n
"
);
}
ok
(
!
strcmp
(
expected
,
volume
)
||
broken
(
!
strcasecmp
(
expected
,
volume
))
/* <=XP */
,
}
"expected name '%s', returned '%s'
\n
"
,
expected
,
volume
);
volume
[
0
]
=
'\0'
;
ret
=
pGetVolumePathNameA
(
pathC2
,
volume
,
sizeof
(
volume
));
ok
(
ret
,
"expected success
\n
"
);
ok
(
!
strcmp
(
expected
,
volume
),
"expected name '%s', returned '%s'
\n
"
,
expected
,
volume
);
/* test an invalid path */
SetLastError
(
0xdeadbeef
);
ret
=
pGetVolumePathNameA
(
"
\\\\
$$$"
,
volume
,
1
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_NAME
||
broken
(
ERROR_FILENAME_EXCED_RANGE
)
/* <=2000 */
,
"expected ERROR_INVALID_NAME got %u
\n
"
,
error
);
}
}
static
void
test_GetVolumePathNamesForVolumeNameA
(
void
)
static
void
test_GetVolumePathNamesForVolumeNameA
(
void
)
...
...
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