Module: wine Branch: master Commit: eba2f4322169715b3672651a5427b718b6eafa8f URL: http://source.winehq.org/git/wine.git/?a=commit;h=eba2f4322169715b3672651a54...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Wed Oct 30 11:44:13 2013 +0900
kernel32: Add special case for "." and ".." to GetLongPathName.
---
dlls/kernel32/path.c | 11 +++++++++++ dlls/kernel32/tests/path.c | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index 7ed1c61..09fb04b 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -358,6 +358,17 @@ DWORD WINAPI GetLongPathNameW( LPCWSTR shortpath, LPWSTR longpath, DWORD longlen for (; *p && *p != '/' && *p != '\'; p++); tmplen = p - (shortpath + sp); lstrcpynW(tmplongpath + lp, shortpath + sp, tmplen + 1); + + if (tmplongpath[lp] == '.') + { + if (tmplen == 1 || (tmplen == 2 && tmplongpath[lp + 1] == '.')) + { + lp += tmplen; + sp += tmplen; + continue; + } + } + /* Check if the file exists and use the existing file name */ goit = FindFirstFileW(tmplongpath, &wfd); if (goit == INVALID_HANDLE_VALUE) diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c index 62236a0..7cfa19c 100644 --- a/dlls/kernel32/tests/path.c +++ b/dlls/kernel32/tests/path.c @@ -1958,7 +1958,6 @@ static void test_relative_path(void) strcpy(buf, "deadbeef"); ret = pGetLongPathNameA(".", buf, MAX_PATH); ok(ret, "GetLongPathName error %d\n", GetLastError()); -todo_wine ok(!strcmp(buf, "."), "expected ., got %s\n", buf); strcpy(buf, "deadbeef"); ret = GetShortPathNameA(".", buf, MAX_PATH); @@ -1968,7 +1967,6 @@ todo_wine strcpy(buf, "deadbeef"); ret = pGetLongPathNameA("..", buf, MAX_PATH); ok(ret, "GetLongPathName error %d\n", GetLastError()); -todo_wine ok(!strcmp(buf, ".."), "expected .., got %s\n", buf); strcpy(buf, "deadbeef"); ret = GetShortPathNameA("..", buf, MAX_PATH); @@ -1977,9 +1975,7 @@ todo_wine
strcpy(buf, "deadbeef"); ret = pGetLongPathNameA("..\foo\file", buf, MAX_PATH); -todo_wine ok(ret, "GetLongPathName error %d\n", GetLastError()); -todo_wine ok(!strcmp(buf, "..\foo\file"), "expected ..\foo\file, got %s\n", buf); strcpy(buf, "deadbeef"); ret = GetShortPathNameA("..\foo\file", buf, MAX_PATH);