mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Updated kernel32-GetVolumePathName to fix several test failures.
This commit is contained in:
parent
69ae1f591a
commit
f6af570538
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -5,6 +5,7 @@ wine-staging (1.7.46) UNRELEASED; urgency=low
|
||||
* Added patch to fix possible use-after-free in wineserver device IPR code.
|
||||
* Added patch to fix wineserver crash when pipe server object is destroyed
|
||||
before client (fixes Wine Staging Bug #393).
|
||||
* Updated kernel32-GetVolumePathName to fix several test failures.
|
||||
* Removed patch for implementation of GdipCreateRegionRgnData (accepted
|
||||
upstream).
|
||||
* Removed patch to fix output buffer size for IOCTL_DVD_READ_STRUCTURE
|
||||
|
@ -1,15 +1,15 @@
|
||||
From 719e096c6ca40ef86cd8f23d419807cdcd002656 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Sat, 25 Jan 2014 09:47:12 -0700
|
||||
From 6c8b09bb431e70a3667fd791737491f027641615 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
|
||||
Date: Wed, 17 Jun 2015 19:28:39 -0600
|
||||
Subject: kernel32: Implement GetVolumePathName.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/volume.c | 3 --
|
||||
dlls/kernel32/volume.c | 123 ++++++++++++++++++++++++++++++++++++++-----
|
||||
2 files changed, 109 insertions(+), 17 deletions(-)
|
||||
dlls/kernel32/volume.c | 121 ++++++++++++++++++++++++++++++++++++++-----
|
||||
2 files changed, 107 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
|
||||
index 61da509..4b3bdf5 100644
|
||||
index e934dee..2243da9 100644
|
||||
--- a/dlls/kernel32/tests/volume.c
|
||||
+++ b/dlls/kernel32/tests/volume.c
|
||||
@@ -649,15 +649,12 @@ static void test_GetVolumePathNameA(void)
|
||||
@ -29,10 +29,10 @@ index 61da509..4b3bdf5 100644
|
||||
|
||||
/* test an invalid path */
|
||||
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
|
||||
index d396764..8826dd2 100644
|
||||
index d06dd05..4720cb4 100644
|
||||
--- a/dlls/kernel32/volume.c
|
||||
+++ b/dlls/kernel32/volume.c
|
||||
@@ -1786,7 +1786,7 @@ BOOL WINAPI GetVolumePathNameA(LPCSTR filename, LPSTR volumepathname, DWORD bufl
|
||||
@@ -1792,7 +1792,7 @@ BOOL WINAPI GetVolumePathNameA(LPCSTR filename, LPSTR volumepathname, DWORD bufl
|
||||
BOOL ret;
|
||||
WCHAR *filenameW = NULL, *volumeW = NULL;
|
||||
|
||||
@ -41,7 +41,7 @@ index d396764..8826dd2 100644
|
||||
|
||||
if (filename && !(filenameW = FILE_name_AtoW( filename, FALSE )))
|
||||
return FALSE;
|
||||
@@ -1802,12 +1802,27 @@ BOOL WINAPI GetVolumePathNameA(LPCSTR filename, LPSTR volumepathname, DWORD bufl
|
||||
@@ -1808,12 +1808,27 @@ BOOL WINAPI GetVolumePathNameA(LPCSTR filename, LPSTR volumepathname, DWORD bufl
|
||||
|
||||
/***********************************************************************
|
||||
* GetVolumePathNameW (KERNEL32.@)
|
||||
@ -71,7 +71,7 @@ index d396764..8826dd2 100644
|
||||
|
||||
if (!filename || !volumepathname || !buflen)
|
||||
{
|
||||
@@ -1815,24 +1830,104 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
|
||||
@@ -1821,24 +1836,102 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -122,7 +122,12 @@ index d396764..8826dd2 100644
|
||||
+ RtlFreeAnsiString( &unix_name );
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
- volumepathname[0] = p[0];
|
||||
- volumepathname[1] = ':';
|
||||
- volumepathname[2] = '\\';
|
||||
- volumepathname[3] = 0;
|
||||
- return TRUE;
|
||||
+ RtlFreeAnsiString( &unix_name );
|
||||
+ last_pos = pos;
|
||||
+ c = strrchrW( volumenameW, '\\' );
|
||||
@ -133,24 +138,17 @@ index d396764..8826dd2 100644
|
||||
+ if (status != STATUS_SUCCESS)
|
||||
+ {
|
||||
+ /* the path was completely invalid */
|
||||
+ if (filename[0] != '\\')
|
||||
+ {
|
||||
+ /* DOS-style paths revert to C:\ (anything not beginning with a slash) */
|
||||
+ last_pos = strlenW(fallbackpathW) - 1; /* points to \\ */
|
||||
+ filename = fallbackpathW;
|
||||
+ status = STATUS_SUCCESS;
|
||||
+ }
|
||||
+ else
|
||||
+ if (filename[0] == '\\')
|
||||
+ {
|
||||
+ /* NT-style paths fail */
|
||||
+ status = STATUS_OBJECT_NAME_INVALID;
|
||||
+ goto cleanup;
|
||||
}
|
||||
- volumepathname[0] = p[0];
|
||||
- volumepathname[1] = ':';
|
||||
- volumepathname[2] = '\\';
|
||||
- volumepathname[3] = 0;
|
||||
- return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ /* DOS-style paths revert to C:\ (anything not beginning with a slash) */
|
||||
+ last_pos = strlenW(fallbackpathW) - 1; /* points to \\ */
|
||||
+ filename = fallbackpathW;
|
||||
+ status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
- SetLastError(ERROR_INVALID_NAME);
|
||||
@ -188,5 +186,5 @@ index d396764..8826dd2 100644
|
||||
* GetVolumePathNamesForVolumeNameA (KERNEL32.@)
|
||||
*/
|
||||
--
|
||||
2.1.0
|
||||
1.9.1
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
From f01a3110045b59483ec4172ad782198f44ed7639 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Sat, 25 Jan 2014 09:53:39 -0700
|
||||
From fc911ce59b14c352982aaf2b5b91edb976642451 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
|
||||
Date: Wed, 17 Jun 2015 19:28:54 -0600
|
||||
Subject: kernel32: Convert GetVolumePathName tests into a list.
|
||||
|
||||
---
|
||||
@ -8,7 +8,7 @@ Subject: kernel32: Convert GetVolumePathName tests into a list.
|
||||
1 file changed, 74 insertions(+), 63 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
|
||||
index 4b3bdf5..f15269c 100644
|
||||
index 2243da9..2bb2603 100644
|
||||
--- a/dlls/kernel32/tests/volume.c
|
||||
+++ b/dlls/kernel32/tests/volume.c
|
||||
@@ -591,79 +591,90 @@ static void test_disk_extents(void)
|
||||
@ -28,19 +28,19 @@ index 4b3bdf5..f15269c 100644
|
||||
+ } test_paths[] = {
|
||||
+ { /* test 0: NULL parameters, 0 output length */
|
||||
+ NULL, NULL, 0,
|
||||
+ ERROR_INVALID_PARAMETER, 0xdeadbeef /* XP */
|
||||
+ ERROR_INVALID_PARAMETER, 0xdeadbeef /* winxp */
|
||||
+ },
|
||||
+ { /* test 1: empty input, NULL output, 0 output length */
|
||||
+ "", NULL, 0,
|
||||
+ ERROR_INVALID_PARAMETER, 0xdeadbeef /* XP */
|
||||
+ ERROR_INVALID_PARAMETER, 0xdeadbeef /* winxp */
|
||||
+ },
|
||||
+ { /* test 2: valid input, NULL output, 0 output length */
|
||||
+ "C:\\", NULL, 0,
|
||||
+ ERROR_INVALID_PARAMETER, ERROR_FILENAME_EXCED_RANGE /* XP */
|
||||
+ 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 /* XP */
|
||||
+ ERROR_INVALID_PARAMETER, ERROR_FILENAME_EXCED_RANGE /* winxp */
|
||||
+ },
|
||||
+ { /* test 4: valid input, valid output, 1 output length */
|
||||
+ "C:\\", "C:\\", 1,
|
||||
@ -89,7 +89,7 @@ index 4b3bdf5..f15269c 100644
|
||||
- ok(error == ERROR_INVALID_PARAMETER
|
||||
- || broken( error == 0xdeadbeef) /* <=XP */,
|
||||
- "expected ERROR_INVALID_PARAMETER got %u\n", error);
|
||||
+ for(i=0; i<sizeof(test_paths)/sizeof(test_paths[0]); i++)
|
||||
+ for (i=0; i<sizeof(test_paths)/sizeof(test_paths[0]); i++)
|
||||
+ {
|
||||
+ char *output = (test_paths[i].path_name != NULL ? volume_path : NULL);
|
||||
+ BOOL expected_ret = test_paths[i].error == NO_ERROR ? TRUE : FALSE;
|
||||
@ -166,5 +166,5 @@ index 4b3bdf5..f15269c 100644
|
||||
|
||||
static void test_GetVolumePathNamesForVolumeNameA(void)
|
||||
--
|
||||
2.1.0
|
||||
1.9.1
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
From 93f0d790f4b5f7945847c8b5190c9da11d6160fa Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Sat, 25 Jan 2014 09:54:39 -0700
|
||||
From 4e662a9f24b82213cd5744e7281c3a5056050e80 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
|
||||
Date: Wed, 17 Jun 2015 19:29:16 -0600
|
||||
Subject: kernel32: Add a bunch more GetVolumePathName tests.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/volume.c | 28 ++++++++++++++++++++++++++++
|
||||
1 file changed, 28 insertions(+)
|
||||
dlls/kernel32/tests/volume.c | 32 +++++++++++++++++++++++++++++++-
|
||||
1 file changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
|
||||
index f15269c..e17cc16 100644
|
||||
index 2bb2603..3eb7fed 100644
|
||||
--- a/dlls/kernel32/tests/volume.c
|
||||
+++ b/dlls/kernel32/tests/volume.c
|
||||
@@ -635,6 +635,34 @@ static void test_GetVolumePathNameA(void)
|
||||
@ -23,29 +23,47 @@ index f15269c..e17cc16 100644
|
||||
+ "C:\\windows\\system32\\AnInvalidFolder", "C:\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 11: an unreasonable DOS path */
|
||||
+ "InvalidDrive:\\AnInvalidFolder", "C:\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 12: a reasonable NT-converted DOS path that shouldn't exist */
|
||||
+ { /* test 11: a reasonable NT-converted DOS path that shouldn't exist */
|
||||
+ "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 13: an unreasonable NT-converted DOS path */
|
||||
+ "\\\\?\\InvalidDrive:\\AnInvalidFolder", "", sizeof(volume_path),
|
||||
+ { /* test 12: an unreasonable NT-converted DOS path */
|
||||
+ "\\\\?\\InvalidDrive:\\AnInvalidFolder", "\\\\?\\InvalidDrive:\\" /* win2k, winxp */,
|
||||
+ sizeof(volume_path),
|
||||
+ ERROR_INVALID_NAME, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 14: an unreasonable NT volume path */
|
||||
+ "\\\\?\\Volume{00000000-00-0000-0000-000000000000}\\AnInvalidFolder", "", sizeof(volume_path),
|
||||
+ { /* test 13: an unreasonable NT volume path */
|
||||
+ "\\\\?\\Volume{00000000-00-0000-0000-000000000000}\\AnInvalidFolder",
|
||||
+ "\\\\?\\Volume{00000000-00-0000-0000-000000000000}\\" /* win2k, winxp */,
|
||||
+ sizeof(volume_path),
|
||||
+ ERROR_INVALID_NAME, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 15: an unreasonable NT-ish path */
|
||||
+ "\\\\ReallyBogus\\InvalidDrive:\\AnInvalidFolder", "", sizeof(volume_path),
|
||||
+ { /* test 14: an unreasonable NT-ish path */
|
||||
+ "\\\\ReallyBogus\\InvalidDrive:\\AnInvalidFolder",
|
||||
+ "\\\\ReallyBogus\\InvalidDrive:\\" /* win2k, winxp */, sizeof(volume_path),
|
||||
+ ERROR_INVALID_NAME, NO_ERROR
|
||||
+ },
|
||||
};
|
||||
BOOL ret, success;
|
||||
DWORD error;
|
||||
@@ -649,6 +677,7 @@ static void test_GetVolumePathNameA(void)
|
||||
|
||||
for (i=0; i<sizeof(test_paths)/sizeof(test_paths[0]); i++)
|
||||
{
|
||||
+ BOOL broken_ret = test_paths[i].broken_error == NO_ERROR ? TRUE : FALSE;
|
||||
char *output = (test_paths[i].path_name != NULL ? volume_path : NULL);
|
||||
BOOL expected_ret = test_paths[i].error == NO_ERROR ? TRUE : FALSE;
|
||||
|
||||
@@ -656,7 +685,8 @@ static void test_GetVolumePathNameA(void)
|
||||
SetLastError( 0xdeadbeef );
|
||||
ret = pGetVolumePathNameA( test_paths[i].file_name, output, test_paths[i].path_len );
|
||||
error = GetLastError();
|
||||
- ok(ret == expected_ret, "GetVolumePathName test %d %s unexpectedly.\n",
|
||||
+ ok(ret == expected_ret || broken(ret == broken_ret),
|
||||
+ "GetVolumePathName test %d %s unexpectedly.\n",
|
||||
i, test_paths[i].error == NO_ERROR ? "failed" : "succeeded");
|
||||
|
||||
if (ret)
|
||||
--
|
||||
2.1.0
|
||||
1.9.1
|
||||
|
||||
|
@ -0,0 +1,64 @@
|
||||
From c46f7883a62e17b59e10d3bdabf5e0e26a989009 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
|
||||
Date: Tue, 16 Jun 2015 08:17:23 -0600
|
||||
Subject: kernel32: Handle semi-DOS paths in GetVolumePathName.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/volume.c | 8 ++++++++
|
||||
dlls/kernel32/volume.c | 14 ++++++++++++--
|
||||
2 files changed, 20 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
|
||||
index 3eb7fed..5b117b8 100644
|
||||
--- a/dlls/kernel32/tests/volume.c
|
||||
+++ b/dlls/kernel32/tests/volume.c
|
||||
@@ -663,6 +663,14 @@ static void test_GetVolumePathNameA(void)
|
||||
"\\\\ReallyBogus\\InvalidDrive:\\" /* win2k, winxp */, sizeof(volume_path),
|
||||
ERROR_INVALID_NAME, NO_ERROR
|
||||
},
|
||||
+ { /* test 15: poor quality input, valid output, valid output length, different drive */
|
||||
+ "D::", "D:\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 16: unused drive letter */
|
||||
+ "M::", "C:\\", 4,
|
||||
+ ERROR_FILE_NOT_FOUND, ERROR_MORE_DATA
|
||||
+ },
|
||||
};
|
||||
BOOL ret, success;
|
||||
DWORD error;
|
||||
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
|
||||
index 4720cb4..3eef540 100644
|
||||
--- a/dlls/kernel32/volume.c
|
||||
+++ b/dlls/kernel32/volume.c
|
||||
@@ -1818,7 +1818,7 @@ BOOL WINAPI GetVolumePathNameA(LPCSTR filename, LPSTR volumepathname, DWORD bufl
|
||||
BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD buflen)
|
||||
{
|
||||
const WCHAR ntprefixW[] = { '\\','\\','?','\\',0 };
|
||||
- const WCHAR fallbackpathW[] = { 'C',':','\\',0 };
|
||||
+ WCHAR fallbackpathW[] = { 'C',':','\\',0 };
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
WCHAR *volumenameW = NULL, *c;
|
||||
int pos, last_pos, stop_pos;
|
||||
@@ -1897,7 +1897,17 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- /* DOS-style paths revert to C:\ (anything not beginning with a slash) */
|
||||
+ /* DOS-style paths (anything not beginning with a slash) have fallback replies */
|
||||
+ if (filename[1] == ':')
|
||||
+ {
|
||||
+ /* if the path is semi-sane (X:) then use the given drive letter (if it is mounted) */
|
||||
+ fallbackpathW[0] = filename[0];
|
||||
+ if (!isalpha(filename[0]) || GetDriveTypeW( fallbackpathW ) == DRIVE_NO_ROOT_DIR)
|
||||
+ {
|
||||
+ status = STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ }
|
||||
last_pos = strlenW(fallbackpathW) - 1; /* points to \\ */
|
||||
filename = fallbackpathW;
|
||||
status = STATUS_SUCCESS;
|
||||
--
|
||||
1.9.1
|
||||
|
@ -0,0 +1,99 @@
|
||||
From f58ffbfac9dd899e4a546759ede241dfd7163eae Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
|
||||
Date: Mon, 15 Jun 2015 22:20:03 -0600
|
||||
Subject: kernel32: Handle bogus DOS paths in GetVolumePathName.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/volume.c | 22 ++++++++++++++++++----
|
||||
dlls/kernel32/volume.c | 12 ++++++++++++
|
||||
2 files changed, 30 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
|
||||
index 5b117b8..7ed55d7 100644
|
||||
--- a/dlls/kernel32/tests/volume.c
|
||||
+++ b/dlls/kernel32/tests/volume.c
|
||||
@@ -591,7 +591,7 @@ static void test_disk_extents(void)
|
||||
|
||||
static void test_GetVolumePathNameA(void)
|
||||
{
|
||||
- char volume_path[MAX_PATH];
|
||||
+ char volume_path[MAX_PATH], cwd[MAX_PATH];
|
||||
struct {
|
||||
const char *file_name;
|
||||
const char *path_name;
|
||||
@@ -671,6 +671,10 @@ static void test_GetVolumePathNameA(void)
|
||||
"M::", "C:\\", 4,
|
||||
ERROR_FILE_NOT_FOUND, ERROR_MORE_DATA
|
||||
},
|
||||
+ { /* test 17: an unreasonable DOS path */
|
||||
+ "InvalidDrive:\\AnInvalidFolder", "%CurrentDrive%\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
};
|
||||
BOOL ret, success;
|
||||
DWORD error;
|
||||
@@ -683,6 +687,13 @@ static void test_GetVolumePathNameA(void)
|
||||
return;
|
||||
}
|
||||
|
||||
+ /* Obtain the drive of the working directory */
|
||||
+ ret = GetCurrentDirectoryA( sizeof(cwd), cwd );
|
||||
+ ok( ret, "Failed to obtain the current working directory.\n" );
|
||||
+ cwd[2] = 0;
|
||||
+ ret = SetEnvironmentVariableA( "CurrentDrive", cwd );
|
||||
+ ok( ret, "Failed to set an environment variable for the current working drive.\n" );
|
||||
+
|
||||
for (i=0; i<sizeof(test_paths)/sizeof(test_paths[0]); i++)
|
||||
{
|
||||
BOOL broken_ret = test_paths[i].broken_error == NO_ERROR ? TRUE : FALSE;
|
||||
@@ -699,11 +710,14 @@ static void test_GetVolumePathNameA(void)
|
||||
|
||||
if (ret)
|
||||
{
|
||||
+ char path_name[MAX_PATH];
|
||||
+
|
||||
+ ExpandEnvironmentStringsA( test_paths[i].path_name, path_name, MAX_PATH);
|
||||
/* If we succeeded then make sure the path is correct */
|
||||
- success = (strcmp( volume_path, test_paths[i].path_name ) == 0)
|
||||
- || broken(strcasecmp( volume_path, test_paths[i].path_name ) == 0) /* XP */;
|
||||
+ success = (strcmp( volume_path, path_name ) == 0)
|
||||
+ || broken(strcasecmp( volume_path, path_name ) == 0) /* XP */;
|
||||
ok(success, "GetVolumePathName test %d unexpectedly returned path %s (expected %s).\n",
|
||||
- i, volume_path, test_paths[i].path_name);
|
||||
+ i, volume_path, path_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
|
||||
index 3eef540..e135967 100644
|
||||
--- a/dlls/kernel32/volume.c
|
||||
+++ b/dlls/kernel32/volume.c
|
||||
@@ -1889,6 +1889,8 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
|
||||
|
||||
if (status != STATUS_SUCCESS)
|
||||
{
|
||||
+ WCHAR cwdW[MAX_PATH];
|
||||
+
|
||||
/* the path was completely invalid */
|
||||
if (filename[0] == '\\')
|
||||
{
|
||||
@@ -1908,6 +1910,16 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
+ else if (GetCurrentDirectoryW( sizeof(cwdW), cwdW ))
|
||||
+ {
|
||||
+ /* if the path is completely bogus then revert to the drive of the working directory */
|
||||
+ fallbackpathW[0] = cwdW[0];
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ status = STATUS_OBJECT_NAME_INVALID;
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
last_pos = strlenW(fallbackpathW) - 1; /* points to \\ */
|
||||
filename = fallbackpathW;
|
||||
status = STATUS_SUCCESS;
|
||||
--
|
||||
1.9.1
|
||||
|
@ -0,0 +1,56 @@
|
||||
From 33c65845c7841e2766d25ec370d6723a6dc5c38b Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
|
||||
Date: Mon, 15 Jun 2015 22:20:03 -0600
|
||||
Subject: kernel32: Handle device paths in GetVolumePathName.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/volume.c | 8 ++++++++
|
||||
dlls/kernel32/volume.c | 5 +++--
|
||||
2 files changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
|
||||
index 7ed55d7..4349ec4 100644
|
||||
--- a/dlls/kernel32/tests/volume.c
|
||||
+++ b/dlls/kernel32/tests/volume.c
|
||||
@@ -675,6 +675,14 @@ static void test_GetVolumePathNameA(void)
|
||||
"InvalidDrive:\\AnInvalidFolder", "%CurrentDrive%\\", sizeof(volume_path),
|
||||
NO_ERROR, NO_ERROR
|
||||
},
|
||||
+ { /* test 18: a reasonable device path */
|
||||
+ "\\??\\CdRom0", "%CurrentDrive%\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 19: an unreasonable device path */
|
||||
+ "\\??\\ReallyBogus", "%CurrentDrive%\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
};
|
||||
BOOL ret, success;
|
||||
DWORD error;
|
||||
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
|
||||
index e135967..7c80cb1 100644
|
||||
--- a/dlls/kernel32/volume.c
|
||||
+++ b/dlls/kernel32/volume.c
|
||||
@@ -1817,6 +1817,7 @@ BOOL WINAPI GetVolumePathNameA(LPCSTR filename, LPSTR volumepathname, DWORD bufl
|
||||
*/
|
||||
BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD buflen)
|
||||
{
|
||||
+ const WCHAR deviceprefixW[] = { '\\','?','?','\\',0 };
|
||||
const WCHAR ntprefixW[] = { '\\','\\','?','\\',0 };
|
||||
WCHAR fallbackpathW[] = { 'C',':','\\',0 };
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
@@ -1892,9 +1893,9 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
|
||||
WCHAR cwdW[MAX_PATH];
|
||||
|
||||
/* the path was completely invalid */
|
||||
- if (filename[0] == '\\')
|
||||
+ if (filename[0] == '\\' && strncmpW(deviceprefixW, filename, strlenW(deviceprefixW)) != 0)
|
||||
{
|
||||
- /* NT-style paths fail */
|
||||
+ /* NT-style and device-style paths fail */
|
||||
status = STATUS_OBJECT_NAME_INVALID;
|
||||
goto cleanup;
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,14 +1,14 @@
|
||||
From 58660ba82873512fe46e897274f569865f8af80f Mon Sep 17 00:00:00 2001
|
||||
From ba80811571531adf3c09736b42dd400e0269abea Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
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(-)
|
||||
dlls/kernel32/tests/volume.c | 142 +++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 142 insertions(+)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
|
||||
index e17cc16..e4026ed 100644
|
||||
index 4349ec4..67aa852 100644
|
||||
--- a/dlls/kernel32/tests/volume.c
|
||||
+++ b/dlls/kernel32/tests/volume.c
|
||||
@@ -54,6 +54,7 @@ static UINT (WINAPI *pGetLogicalDriveStringsA)(UINT,LPSTR);
|
||||
@ -19,120 +19,102 @@ index e17cc16..e4026ed 100644
|
||||
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)
|
||||
@@ -683,6 +684,94 @@ static void test_GetVolumePathNameA(void)
|
||||
"\\??\\ReallyBogus", "%CurrentDrive%\\", sizeof(volume_path),
|
||||
NO_ERROR, NO_ERROR
|
||||
},
|
||||
{ /* 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 */
|
||||
+ { /* test 20 */
|
||||
+ "C:", "C:", 2,
|
||||
+ ERROR_FILENAME_EXCED_RANGE, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 17 */
|
||||
+ { /* test 21 */
|
||||
+ "C:", "C:", 3,
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ NO_ERROR, ERROR_FILENAME_EXCED_RANGE
|
||||
+ },
|
||||
+ { /* test 18 */
|
||||
+ { /* test 22 */
|
||||
+ "C:\\", "C:", 2,
|
||||
+ ERROR_FILENAME_EXCED_RANGE, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 19 */
|
||||
+ { /* test 23 */
|
||||
+ "C:\\", "C:", 3,
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ NO_ERROR, ERROR_FILENAME_EXCED_RANGE
|
||||
+ },
|
||||
+ { /* test 20 */
|
||||
+ { /* test 24 */
|
||||
+ "C::", "C:", 2,
|
||||
+ ERROR_FILENAME_EXCED_RANGE, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 21 */
|
||||
+ { /* test 25 */
|
||||
+ "C::", "C:", 3,
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ NO_ERROR, ERROR_FILENAME_EXCED_RANGE
|
||||
+ },
|
||||
+ { /* test 22 */
|
||||
+ { /* test 26 */
|
||||
+ "C::", "C:\\", 4,
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ NO_ERROR, ERROR_MORE_DATA
|
||||
+ },
|
||||
+ { /* test 23 */
|
||||
+ { /* test 27 */
|
||||
+ "C:\\windows\\system32\\AnInvalidFolder", "C:", 3,
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ NO_ERROR, ERROR_FILENAME_EXCED_RANGE
|
||||
+ },
|
||||
+ { /* test 24 */
|
||||
+ { /* test 28 */
|
||||
+ "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:", 3,
|
||||
+ ERROR_FILENAME_EXCED_RANGE, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 25 */
|
||||
+ { /* test 29 */
|
||||
+ "\\\\?\\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
|
||||
+ "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:", 7,
|
||||
+ NO_ERROR, ERROR_FILENAME_EXCED_RANGE
|
||||
+ },
|
||||
+ { /* test 31 */
|
||||
+ "C:ABC:DEF:\\AnInvalidFolder", "C:\\", 4,
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ "\\\\?\\c:\\AnInvalidFolder", "\\\\?\\c:", 7,
|
||||
+ NO_ERROR, ERROR_FILENAME_EXCED_RANGE
|
||||
+ },
|
||||
+ { /* test 32 */
|
||||
+ "?:ABC:DEF:\\AnInvalidFolder", "", sizeof(volume_path),
|
||||
+ ERROR_FILE_NOT_FOUND, NO_ERROR
|
||||
+ "C:/", "C:\\", 4,
|
||||
+ NO_ERROR, ERROR_MORE_DATA
|
||||
+ },
|
||||
+ { /* test 33 */
|
||||
+ "relative/path", "C:\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR /* FIXME: depends on system dir */
|
||||
+ "M:/", "", 4,
|
||||
+ ERROR_FILE_NOT_FOUND, ERROR_MORE_DATA
|
||||
+ },
|
||||
+ { /* test 34 */
|
||||
+ "/unix-style/absolute/path", "C:\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR /* FIXME: depends on system dir */
|
||||
+ "C:ABC:DEF:\\AnInvalidFolder", "C:\\", 4,
|
||||
+ NO_ERROR, ERROR_MORE_DATA
|
||||
+ },
|
||||
+ { /* test 35 */
|
||||
+ "\\??\\ReallyBogus", "C:\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR /* FIXME: depends on system dir */
|
||||
+ "?:ABC:DEF:\\AnInvalidFolder", "?:\\" /* win2k, winxp */, sizeof(volume_path),
|
||||
+ ERROR_FILE_NOT_FOUND, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 36 */
|
||||
+ "\\??\\C:\\NonExistent", "C:\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR /* FIXME: depends on system dir */
|
||||
+ "relative/path", "%CurrentDrive%\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 37 */
|
||||
+ "\\??\\M:\\NonExistent", "C:\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR /* FIXME: depends on system dir */
|
||||
+ "/unix-style/absolute/path", "%CurrentDrive%\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 38 */
|
||||
+ "somefile:def", "C:\\", sizeof(volume_path),
|
||||
+ "\\??\\C:\\NonExistent", "%CurrentDrive%\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 39 */
|
||||
+ "s:omefile", "", sizeof(volume_path),
|
||||
+ "\\??\\M:\\NonExistent", "%CurrentDrive%\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 40 */
|
||||
+ "somefile:def", "%CurrentDrive%\\", sizeof(volume_path),
|
||||
+ NO_ERROR, NO_ERROR
|
||||
+ },
|
||||
+ { /* test 41 */
|
||||
+ "s:omefile", "S:\\" /* win2k, winxp */, sizeof(volume_path),
|
||||
+ ERROR_FILE_NOT_FOUND, NO_ERROR
|
||||
+ },
|
||||
+
|
||||
};
|
||||
BOOL ret, success;
|
||||
DWORD error;
|
||||
@@ -681,6 +779,9 @@ static void test_GetVolumePathNameA(void)
|
||||
@@ -709,6 +798,9 @@ static void test_GetVolumePathNameA(void)
|
||||
BOOL expected_ret = test_paths[i].error == NO_ERROR ? TRUE : FALSE;
|
||||
|
||||
volume_path[0] = 0;
|
||||
@ -142,7 +124,7 @@ index e17cc16..e4026ed 100644
|
||||
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)
|
||||
@@ -734,9 +826,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);
|
||||
}
|
||||
@ -200,7 +182,7 @@ index e17cc16..e4026ed 100644
|
||||
static void test_GetVolumePathNamesForVolumeNameA(void)
|
||||
{
|
||||
BOOL ret;
|
||||
@@ -1044,6 +1193,7 @@ START_TEST(volume)
|
||||
@@ -1076,6 +1216,7 @@ START_TEST(volume)
|
||||
pGetLogicalDriveStringsW = (void *) GetProcAddress(hdll, "GetLogicalDriveStringsW");
|
||||
pGetVolumeInformationA = (void *) GetProcAddress(hdll, "GetVolumeInformationA");
|
||||
pGetVolumePathNameA = (void *) GetProcAddress(hdll, "GetVolumePathNameA");
|
||||
@ -208,7 +190,7 @@ index e17cc16..e4026ed 100644
|
||||
pGetVolumePathNamesForVolumeNameA = (void *) GetProcAddress(hdll, "GetVolumePathNamesForVolumeNameA");
|
||||
pGetVolumePathNamesForVolumeNameW = (void *) GetProcAddress(hdll, "GetVolumePathNamesForVolumeNameW");
|
||||
|
||||
@@ -1051,6 +1201,7 @@ START_TEST(volume)
|
||||
@@ -1083,6 +1224,7 @@ START_TEST(volume)
|
||||
test_define_dos_deviceA();
|
||||
test_FindFirstVolume();
|
||||
test_GetVolumePathNameA();
|
||||
@ -217,5 +199,5 @@ index e17cc16..e4026ed 100644
|
||||
test_GetVolumeNameForVolumeMountPointW();
|
||||
test_GetLogicalDriveStringsA();
|
||||
--
|
||||
2.1.0
|
||||
1.9.1
|
||||
|
@ -3081,11 +3081,17 @@ if test "$enable_kernel32_GetVolumePathName" -eq 1; then
|
||||
patch_apply kernel32-GetVolumePathName/0001-kernel32-Implement-GetVolumePathName.patch
|
||||
patch_apply kernel32-GetVolumePathName/0002-kernel32-Convert-GetVolumePathName-tests-into-a-list.patch
|
||||
patch_apply kernel32-GetVolumePathName/0003-kernel32-Add-a-bunch-more-GetVolumePathName-tests.patch
|
||||
patch_apply kernel32-GetVolumePathName/0004-kernel32-tests-Add-a-lot-of-picky-GetVolumePathName-.patch
|
||||
patch_apply kernel32-GetVolumePathName/0004-kernel32-Handle-semi-DOS-paths-in-GetVolumePathName.patch
|
||||
patch_apply kernel32-GetVolumePathName/0005-kernel32-Handle-bogus-DOS-paths-in-GetVolumePathName.patch
|
||||
patch_apply kernel32-GetVolumePathName/0006-kernel32-Handle-device-paths-in-GetVolumePathName.patch
|
||||
patch_apply kernel32-GetVolumePathName/0007-kernel32-tests-Add-a-lot-of-picky-GetVolumePathName-.patch
|
||||
(
|
||||
echo '+ { "Erich E. Hoover", "kernel32: Implement GetVolumePathName.", 1 },';
|
||||
echo '+ { "Erich E. Hoover", "kernel32: Convert GetVolumePathName tests into a list.", 1 },';
|
||||
echo '+ { "Erich E. Hoover", "kernel32: Add a bunch more GetVolumePathName tests.", 1 },';
|
||||
echo '+ { "Erich E. Hoover", "kernel32: Handle semi-DOS paths in GetVolumePathName.", 1 },';
|
||||
echo '+ { "Erich E. Hoover", "kernel32: Handle bogus DOS paths in GetVolumePathName.", 1 },';
|
||||
echo '+ { "Erich E. Hoover", "kernel32: Handle device paths in GetVolumePathName.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "kernel32/tests: Add a lot of picky GetVolumePathName tests.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user