diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c index 2243da955d8..2bb2603512f 100644 --- a/dlls/kernel32/tests/volume.c +++ b/dlls/kernel32/tests/volume.c @@ -591,79 +591,90 @@ static void test_disk_extents(void) static void test_GetVolumePathNameA(void) { - BOOL ret; - char volume[MAX_PATH]; - char expected[] = "C:\\", pathC1[] = "C:\\", pathC2[] = "C::"; + char volume_path[MAX_PATH]; + struct { + 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; + UINT i; + /* GetVolumePathNameA is not present before w2k */ if (!pGetVolumePathNameA) { win_skip("required functions not found\n"); return; } - SetLastError( 0xdeadbeef ); - ret = pGetVolumePathNameA(NULL, 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); + for (i=0; i