kernel32: Add special case for "." and ".." to GetLongPathName.
This commit is contained in:
parent
d57444a622
commit
eba2f43221
@ -358,6 +358,17 @@ DWORD WINAPI GetLongPathNameW( LPCWSTR shortpath, LPWSTR longpath, DWORD longlen
|
|||||||
for (; *p && *p != '/' && *p != '\\'; p++);
|
for (; *p && *p != '/' && *p != '\\'; p++);
|
||||||
tmplen = p - (shortpath + sp);
|
tmplen = p - (shortpath + sp);
|
||||||
lstrcpynW(tmplongpath + lp, shortpath + sp, tmplen + 1);
|
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 */
|
/* Check if the file exists and use the existing file name */
|
||||||
goit = FindFirstFileW(tmplongpath, &wfd);
|
goit = FindFirstFileW(tmplongpath, &wfd);
|
||||||
if (goit == INVALID_HANDLE_VALUE)
|
if (goit == INVALID_HANDLE_VALUE)
|
||||||
|
@ -1958,7 +1958,6 @@ static void test_relative_path(void)
|
|||||||
strcpy(buf, "deadbeef");
|
strcpy(buf, "deadbeef");
|
||||||
ret = pGetLongPathNameA(".", buf, MAX_PATH);
|
ret = pGetLongPathNameA(".", buf, MAX_PATH);
|
||||||
ok(ret, "GetLongPathName error %d\n", GetLastError());
|
ok(ret, "GetLongPathName error %d\n", GetLastError());
|
||||||
todo_wine
|
|
||||||
ok(!strcmp(buf, "."), "expected ., got %s\n", buf);
|
ok(!strcmp(buf, "."), "expected ., got %s\n", buf);
|
||||||
strcpy(buf, "deadbeef");
|
strcpy(buf, "deadbeef");
|
||||||
ret = GetShortPathNameA(".", buf, MAX_PATH);
|
ret = GetShortPathNameA(".", buf, MAX_PATH);
|
||||||
@ -1968,7 +1967,6 @@ todo_wine
|
|||||||
strcpy(buf, "deadbeef");
|
strcpy(buf, "deadbeef");
|
||||||
ret = pGetLongPathNameA("..", buf, MAX_PATH);
|
ret = pGetLongPathNameA("..", buf, MAX_PATH);
|
||||||
ok(ret, "GetLongPathName error %d\n", GetLastError());
|
ok(ret, "GetLongPathName error %d\n", GetLastError());
|
||||||
todo_wine
|
|
||||||
ok(!strcmp(buf, ".."), "expected .., got %s\n", buf);
|
ok(!strcmp(buf, ".."), "expected .., got %s\n", buf);
|
||||||
strcpy(buf, "deadbeef");
|
strcpy(buf, "deadbeef");
|
||||||
ret = GetShortPathNameA("..", buf, MAX_PATH);
|
ret = GetShortPathNameA("..", buf, MAX_PATH);
|
||||||
@ -1977,9 +1975,7 @@ todo_wine
|
|||||||
|
|
||||||
strcpy(buf, "deadbeef");
|
strcpy(buf, "deadbeef");
|
||||||
ret = pGetLongPathNameA("..\\foo\\file", buf, MAX_PATH);
|
ret = pGetLongPathNameA("..\\foo\\file", buf, MAX_PATH);
|
||||||
todo_wine
|
|
||||||
ok(ret, "GetLongPathName error %d\n", GetLastError());
|
ok(ret, "GetLongPathName error %d\n", GetLastError());
|
||||||
todo_wine
|
|
||||||
ok(!strcmp(buf, "..\\foo\\file"), "expected ..\\foo\\file, got %s\n", buf);
|
ok(!strcmp(buf, "..\\foo\\file"), "expected ..\\foo\\file, got %s\n", buf);
|
||||||
strcpy(buf, "deadbeef");
|
strcpy(buf, "deadbeef");
|
||||||
ret = GetShortPathNameA("..\\foo\\file", buf, MAX_PATH);
|
ret = GetShortPathNameA("..\\foo\\file", buf, MAX_PATH);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user