Dmitry Timoshkov : kernel32: Add special case for "." and ".." to GetShortPathName.
Alexandre Julliard
julliard at winehq.org
Wed Oct 30 13:11:03 CDT 2013
Module: wine
Branch: master
Commit: d57444a62268ff6158f9c2295093b713e6400f5b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d57444a62268ff6158f9c2295093b713e6400f5b
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Wed Oct 30 11:43:50 2013 +0900
kernel32: Add special case for "." and ".." to GetShortPathName.
---
dlls/kernel32/path.c | 10 ++++++++++
dlls/kernel32/tests/path.c | 4 ----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index 1728bfa..7ed1c61 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -489,6 +489,16 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
tmplen = p - (longpath + lp);
lstrcpynW(tmpshortpath + sp, longpath + lp, tmplen + 1);
+ if (tmpshortpath[sp] == '.')
+ {
+ if (tmplen == 1 || (tmplen == 2 && tmpshortpath[sp + 1] == '.'))
+ {
+ sp += tmplen;
+ lp += tmplen;
+ continue;
+ }
+ }
+
/* Check if the file exists and use the existing short file name */
goit = FindFirstFileW(tmpshortpath, &wfd);
if (goit == INVALID_HANDLE_VALUE) goto notfound;
diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c
index fe699b2..62236a0 100644
--- a/dlls/kernel32/tests/path.c
+++ b/dlls/kernel32/tests/path.c
@@ -1963,7 +1963,6 @@ todo_wine
strcpy(buf, "deadbeef");
ret = GetShortPathNameA(".", buf, MAX_PATH);
ok(ret, "GetShortPathName error %d\n", GetLastError());
-todo_wine
ok(!strcmp(buf, "."), "expected ., got %s\n", buf);
strcpy(buf, "deadbeef");
@@ -1974,7 +1973,6 @@ todo_wine
strcpy(buf, "deadbeef");
ret = GetShortPathNameA("..", buf, MAX_PATH);
ok(ret, "GetShortPathName error %d\n", GetLastError());
-todo_wine
ok(!strcmp(buf, ".."), "expected .., got %s\n", buf);
strcpy(buf, "deadbeef");
@@ -1985,9 +1983,7 @@ todo_wine
ok(!strcmp(buf, "..\\foo\\file"), "expected ..\\foo\\file, got %s\n", buf);
strcpy(buf, "deadbeef");
ret = GetShortPathNameA("..\\foo\\file", buf, MAX_PATH);
-todo_wine
ok(ret, "GetShortPathName error %d\n", GetLastError());
-todo_wine
ok(!strcmp(buf, "..\\foo\\file"), "expected ..\\foo\\file, got %s\n", buf);
SetCurrentDirectoryA("..");
More information about the wine-cvs
mailing list