diff --git a/patches/Makefile b/patches/Makefile index 0d21cdb5..7573466e 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -344,6 +344,7 @@ kernel32-GetVolumePathName.ok: $(call APPLY_FILE,kernel32-GetVolumePathName/0001-kernel32-Implement-GetVolumePathName.patch) $(call APPLY_FILE,kernel32-GetVolumePathName/0002-kernel32-Convert-GetVolumePathName-tests-into-a-list.patch) $(call APPLY_FILE,kernel32-GetVolumePathName/0003-kernel32-Add-a-bunch-more-GetVolumePathName-tests.patch) + $(call APPLY_FILE,kernel32-GetVolumePathName/0004-kernel32-tests-Add-a-lot-of-picky-GetVolumePathName-.patch) @( \ echo '+ { "kernel32-GetVolumePathName", "Erich E. Hoover", "Implement GetVolumePathName." },'; \ ) > kernel32-GetVolumePathName.ok diff --git a/patches/kernel32-GetVolumePathName/0004-kernel32-tests-Add-a-lot-of-picky-GetVolumePathName-.patch b/patches/kernel32-GetVolumePathName/0004-kernel32-tests-Add-a-lot-of-picky-GetVolumePathName-.patch new file mode 100644 index 00000000..99970873 --- /dev/null +++ b/patches/kernel32-GetVolumePathName/0004-kernel32-tests-Add-a-lot-of-picky-GetVolumePathName-.patch @@ -0,0 +1,221 @@ +From 8ea2e534c88b3dc0f76b4ae41695802871793ab9 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Tue, 2 Sep 2014 05:23:37 +0200 +Subject: kernel32/tests: Add a lot of picky GetVolumePathName tests. + +--- + dlls/kernel32/tests/volume.c | 153 ++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 152 insertions(+), 1 deletion(-) + +diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c +index e17cc16..e4026ed 100644 +--- a/dlls/kernel32/tests/volume.c ++++ b/dlls/kernel32/tests/volume.c +@@ -54,6 +54,7 @@ static UINT (WINAPI *pGetLogicalDriveStringsA)(UINT,LPSTR); + static UINT (WINAPI *pGetLogicalDriveStringsW)(UINT,LPWSTR); + static BOOL (WINAPI *pGetVolumeInformationA)(LPCSTR, LPSTR, DWORD, LPDWORD, LPDWORD, LPDWORD, LPSTR, DWORD); + static BOOL (WINAPI *pGetVolumePathNameA)(LPCSTR, LPSTR, DWORD); ++static BOOL (WINAPI *pGetVolumePathNameW)(LPWSTR, LPWSTR, DWORD); + static BOOL (WINAPI *pGetVolumePathNamesForVolumeNameA)(LPCSTR, LPSTR, DWORD, LPDWORD); + static BOOL (WINAPI *pGetVolumePathNamesForVolumeNameW)(LPCWSTR, LPWSTR, DWORD, LPDWORD); + +@@ -645,7 +646,7 @@ static void test_GetVolumePathNameA(void) + }, + { /* test 11: an unreasonable DOS path */ + "InvalidDrive:\\AnInvalidFolder", "C:\\", sizeof(volume_path), +- NO_ERROR, NO_ERROR ++ NO_ERROR, NO_ERROR /* FIXME: depends on system dir */ + }, + { /* test 12: a reasonable NT-converted DOS path that shouldn't exist */ + "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:\\", sizeof(volume_path), +@@ -663,6 +664,103 @@ static void test_GetVolumePathNameA(void) + "\\\\ReallyBogus\\InvalidDrive:\\AnInvalidFolder", "", sizeof(volume_path), + ERROR_INVALID_NAME, NO_ERROR + }, ++ { /* test 16 */ ++ "C:", "C:", 2, ++ ERROR_FILENAME_EXCED_RANGE, NO_ERROR ++ }, ++ { /* test 17 */ ++ "C:", "C:", 3, ++ NO_ERROR, NO_ERROR ++ }, ++ { /* test 18 */ ++ "C:\\", "C:", 2, ++ ERROR_FILENAME_EXCED_RANGE, NO_ERROR ++ }, ++ { /* test 19 */ ++ "C:\\", "C:", 3, ++ NO_ERROR, NO_ERROR ++ }, ++ { /* test 20 */ ++ "C::", "C:", 2, ++ ERROR_FILENAME_EXCED_RANGE, NO_ERROR ++ }, ++ { /* test 21 */ ++ "C::", "C:", 3, ++ NO_ERROR, NO_ERROR ++ }, ++ { /* test 22 */ ++ "C::", "C:\\", 4, ++ NO_ERROR, NO_ERROR ++ }, ++ { /* test 23 */ ++ "C:\\windows\\system32\\AnInvalidFolder", "C:", 3, ++ NO_ERROR, NO_ERROR ++ }, ++ { /* test 24 */ ++ "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:", 3, ++ ERROR_FILENAME_EXCED_RANGE, NO_ERROR ++ }, ++ { /* test 25 */ ++ "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:", 6, ++ ERROR_FILENAME_EXCED_RANGE, NO_ERROR ++ }, ++ { /* test 26 */ ++ "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:", 7, ++ NO_ERROR, NO_ERROR ++ }, ++ { /* test 27 */ ++ "\\\\?\\c:\\AnInvalidFolder", "\\\\?\\c:", 7, ++ NO_ERROR, NO_ERROR ++ }, ++ { /* test 28 */ ++ "C:/", "C:\\", 4, ++ NO_ERROR, NO_ERROR ++ }, ++ { /* test 29 */ ++ "E:/", "", 4, ++ ERROR_FILE_NOT_FOUND, NO_ERROR ++ }, ++ { /* test 30 */ ++ "M::", "C:\\", 4, ++ ERROR_FILE_NOT_FOUND, NO_ERROR ++ }, ++ { /* test 31 */ ++ "C:ABC:DEF:\\AnInvalidFolder", "C:\\", 4, ++ NO_ERROR, NO_ERROR ++ }, ++ { /* test 32 */ ++ "?:ABC:DEF:\\AnInvalidFolder", "", sizeof(volume_path), ++ ERROR_FILE_NOT_FOUND, NO_ERROR ++ }, ++ { /* test 33 */ ++ "relative/path", "C:\\", sizeof(volume_path), ++ NO_ERROR, NO_ERROR /* FIXME: depends on system dir */ ++ }, ++ { /* test 34 */ ++ "/unix-style/absolute/path", "C:\\", sizeof(volume_path), ++ NO_ERROR, NO_ERROR /* FIXME: depends on system dir */ ++ }, ++ { /* test 35 */ ++ "\\??\\ReallyBogus", "C:\\", sizeof(volume_path), ++ NO_ERROR, NO_ERROR /* FIXME: depends on system dir */ ++ }, ++ { /* test 36 */ ++ "\\??\\C:\\NonExistent", "C:\\", sizeof(volume_path), ++ NO_ERROR, NO_ERROR /* FIXME: depends on system dir */ ++ }, ++ { /* test 37 */ ++ "\\??\\M:\\NonExistent", "C:\\", sizeof(volume_path), ++ NO_ERROR, NO_ERROR /* FIXME: depends on system dir */ ++ }, ++ { /* test 38 */ ++ "somefile:def", "C:\\", sizeof(volume_path), ++ NO_ERROR, NO_ERROR ++ }, ++ { /* test 39 */ ++ "s:omefile", "", sizeof(volume_path), ++ ERROR_FILE_NOT_FOUND, NO_ERROR ++ }, ++ + }; + BOOL ret, success; + DWORD error; +@@ -681,6 +779,9 @@ static void test_GetVolumePathNameA(void) + BOOL expected_ret = test_paths[i].error == NO_ERROR ? TRUE : FALSE; + + volume_path[0] = 0; ++ if (test_paths[i].path_len < sizeof(volume_path)) ++ volume_path[ test_paths[i].path_len ] = 0x11; ++ + SetLastError( 0xdeadbeef ); + ret = pGetVolumePathNameA( test_paths[i].file_name, output, test_paths[i].path_len ); + error = GetLastError(); +@@ -702,9 +803,57 @@ static void test_GetVolumePathNameA(void) + ok(success, "GetVolumePathName test %d unexpectedly returned error 0x%x (expected 0x%x).\n", + i, error, test_paths[i].error); + } ++ ++ if (test_paths[i].path_len < sizeof(volume_path)) ++ ok(volume_path[ test_paths[i].path_len ] == 0x11, ++ "GetVolumePathName test %d corrupted byte after end of buffer.\n", i); + } + } + ++static void test_GetVolumePathNameW(void) ++{ ++ static WCHAR drive_c1[] = {'C',':',0}; ++ static WCHAR drive_c2[] = {'C',':','\\',0}; ++ WCHAR volume_path[MAX_PATH]; ++ BOOL ret; ++ ++ if (!pGetVolumePathNameW) ++ { ++ win_skip("required functions not found\n"); ++ return; ++ } ++ ++ volume_path[0] = 0; ++ volume_path[1] = 0x11; ++ ret = pGetVolumePathNameW( drive_c1, volume_path, 1 ); ++ ok(!ret, "GetVolumePathNameW test succeeded unexpectedly.\n"); ++ ok(GetLastError() == ERROR_FILENAME_EXCED_RANGE, "GetVolumePathNameW unexpectedly returned error 0x%x (expected 0x%x).\n", ++ GetLastError(), ERROR_FILENAME_EXCED_RANGE); ++ ok(volume_path[1] == 0x11, "GetVolumePathW corrupted byte after end of buffer.\n"); ++ ++ volume_path[0] = 0; ++ volume_path[2] = 0x11; ++ ret = pGetVolumePathNameW( drive_c1, volume_path, 2 ); ++ ok(!ret, "GetVolumePathNameW test succeeded unexpectedly.\n"); ++ ok(GetLastError() == ERROR_FILENAME_EXCED_RANGE, "GetVolumePathNameW unexpectedly returned error 0x%x (expected 0x%x).\n", ++ GetLastError(), ERROR_FILENAME_EXCED_RANGE); ++ ok(volume_path[2] == 0x11, "GetVolumePathW corrupted byte after end of buffer.\n"); ++ ++ volume_path[0] = 0; ++ volume_path[3] = 0x11; ++ ret = pGetVolumePathNameW( drive_c1, volume_path, 3 ); ++ ok(ret, "GetVolumePathNameW test failed unexpectedly.\n"); ++ ok(memcmp(volume_path, drive_c1, sizeof(drive_c1)) == 0, "GetVolumePathNameW unexpectedly returned wrong path.\n"); ++ ok(volume_path[3] == 0x11, "GetVolumePathW corrupted byte after end of buffer.\n"); ++ ++ volume_path[0] = 0; ++ volume_path[4] = 0x11; ++ ret = pGetVolumePathNameW( drive_c1, volume_path, 4 ); ++ ok(ret, "GetVolumePathNameW test failed unexpectedly.\n"); ++ ok(memcmp(volume_path, drive_c2, sizeof(drive_c2)) == 0, "GetVolumePathNameW unexpectedly returned wrong path.\n"); ++ ok(volume_path[4] == 0x11, "GetVolumePathW corrupted byte after end of buffer.\n"); ++} ++ + static void test_GetVolumePathNamesForVolumeNameA(void) + { + BOOL ret; +@@ -1044,6 +1193,7 @@ START_TEST(volume) + pGetLogicalDriveStringsW = (void *) GetProcAddress(hdll, "GetLogicalDriveStringsW"); + pGetVolumeInformationA = (void *) GetProcAddress(hdll, "GetVolumeInformationA"); + pGetVolumePathNameA = (void *) GetProcAddress(hdll, "GetVolumePathNameA"); ++ pGetVolumePathNameW = (void *) GetProcAddress(hdll, "GetVolumePathNameW"); + pGetVolumePathNamesForVolumeNameA = (void *) GetProcAddress(hdll, "GetVolumePathNamesForVolumeNameA"); + pGetVolumePathNamesForVolumeNameW = (void *) GetProcAddress(hdll, "GetVolumePathNamesForVolumeNameW"); + +@@ -1051,6 +1201,7 @@ START_TEST(volume) + test_define_dos_deviceA(); + test_FindFirstVolume(); + test_GetVolumePathNameA(); ++ test_GetVolumePathNameW(); + test_GetVolumeNameForVolumeMountPointA(); + test_GetVolumeNameForVolumeMountPointW(); + test_GetLogicalDriveStringsA(); +-- +2.1.0 +