Dmitry Timoshkov : kernel32: GetLongPathName should fail when called with a wildcard.
Alexandre Julliard
julliard at winehq.org
Mon Oct 22 15:38:44 CDT 2018
Module: wine
Branch: master
Commit: ccf9b18ea0aba1041b59fd287b6de8c726008a59
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ccf9b18ea0aba1041b59fd287b6de8c726008a59
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Sat Oct 20 23:46:41 2018 +0300
kernel32: GetLongPathName should fail when called with a wildcard.
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/path.c | 10 ++++++++--
dlls/kernel32/tests/path.c | 2 --
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index a9db7e8..41f0d34 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -297,6 +297,8 @@ DWORD WINAPI GetLongPathNameW( LPCWSTR shortpath, LPWSTR longpath, DWORD longlen
HANDLE goit;
BOOL is_legal_8dot3;
+ TRACE("%s,%p,%u\n", debugstr_w(shortpath), longpath, longlen);
+
if (!shortpath)
{
SetLastError(ERROR_INVALID_PARAMETER);
@@ -308,8 +310,6 @@ DWORD WINAPI GetLongPathNameW( LPCWSTR shortpath, LPWSTR longpath, DWORD longlen
return 0;
}
- TRACE("%s,%p,%d\n", debugstr_w(shortpath), longpath, longlen);
-
if (shortpath[0] == '\\' && shortpath[1] == '\\')
{
FIXME("UNC pathname %s\n", debugstr_w(shortpath));
@@ -333,6 +333,12 @@ DWORD WINAPI GetLongPathNameW( LPCWSTR shortpath, LPWSTR longpath, DWORD longlen
lp = sp = 2;
}
+ if (strpbrkW(shortpath + sp, wildcardsW))
+ {
+ SetLastError(ERROR_INVALID_NAME);
+ return 0;
+ }
+
while (shortpath[sp])
{
/* check for path delimiters and reproduce them */
diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c
index f0cfb4d..df91b31 100644
--- a/dlls/kernel32/tests/path.c
+++ b/dlls/kernel32/tests/path.c
@@ -1202,9 +1202,7 @@ static void test_GetLongPathNameA(void)
strcpy(name, "*");
SetLastError(0xdeadbeef);
length = pGetLongPathNameA(tempfile, temppath, MAX_PATH);
-todo_wine
ok(!length, "GetLongPathNameA should fail\n");
-todo_wine
ok(GetLastError() == ERROR_INVALID_NAME, "wrong error %d\n", GetLastError());
strcpy(name, "longfilename.longext");
More information about the wine-cvs
mailing list