From: Vishnunithyasoundhar S <svishnunithyasoundhar@gmail.com> Signed-off-by: Vishnunithyasoundhar S <svishnunithyasoundhar@gmail.com> --- dlls/kernel32/tests/path.c | 12 +++++++----- dlls/kernelbase/file.c | 8 ++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c index aa1833504d8..438159d752e 100644 --- a/dlls/kernel32/tests/path.c +++ b/dlls/kernel32/tests/path.c @@ -360,7 +360,7 @@ static void test_InitPathA(CHAR *newdir, CHAR *curDrive, CHAR *otherDrive) lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr1)==0, "GetTempFileNameA returned '%s' which doesn't match '%s' or '%s'. id=%x\n", newdir,tmpstr,tmpstr1,id); - ok(DeleteFileA(newdir),"Couldn't delete the temporary file we just created\n"); + ok(DeleteFileA(newdir),"Couldn't delete the temporary file we just created\n"); id=GetTempFileNameA(tmppath,NULL,0,newdir); sprintf(tmpstr,"%.4x.tmp",id & 0xffff); @@ -1164,12 +1164,14 @@ static void test_GetLongPathNameA(void) ok(length >= strlen(tempfile) + 1, "Wrong length\n"); ok(temppath[0] == 0, "Buffer should not have been touched\n"); - /* Some UNC syntax tests */ + /* Extended file path syntax test */ memset(temppath, 0, MAX_PATH); memset(temppath2, 0, MAX_PATH); lstrcpyA(temppath2, "\\\\?\\"); lstrcatA(temppath2, tempfile); + int temppath2length = strlen(temppath2); + trace("DEBUG: Path: %s - Length: %zu\n", temppath2, temppath2length); explength = length + 4; SetLastError(0xdeadbeef); @@ -1256,12 +1258,12 @@ static void test_GetLongPathNameW(void) static const WCHAR backslash[] = { '\\', 0}; static const WCHAR letterX[] = { 'X', 0}; - SetLastError(0xdeadbeef); + SetLastError(0xdeadbeef); length = GetLongPathNameW(NULL,NULL,0); ok(0==length,"GetLongPathNameW returned %ld but expected 0\n",length); ok(GetLastError()==ERROR_INVALID_PARAMETER,"GetLastError returned %ld but expected ERROR_INVALID_PARAMETER\n",GetLastError()); - SetLastError(0xdeadbeef); + SetLastError(0xdeadbeef); empty[0]=0; length = GetLongPathNameW(empty,NULL,0); ok(0==length,"GetLongPathNameW returned %ld but expected 0\n",length); @@ -1322,7 +1324,7 @@ static void test_GetLongPathNameW(void) ok(GetLastError() == ERROR_PATH_NOT_FOUND, "Expected ERROR_PATH_NOT_FOUND, got %ld\n", GetLastError()); } /* With prefix */ - expanded = 4 + (GetLongPathNameW(tempdir, NULL, 0) - 1) + lstrlenW(name) + 1 + lstrlenW(name) + 1; + expanded = (GetLongPathNameW(tempdir, NULL, 0) - 1) + lstrlenW(name) + 1 + lstrlenW(name) + 1; SetLastError(0xdeadbeef); length = GetLongPathNameW(shortpath, NULL, 0); ok(length == expanded, "Expected %ld, got %ld\n", expanded, length); diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c index c206e2f9cc2..c9e46ab6f5b 100644 --- a/dlls/kernelbase/file.c +++ b/dlls/kernelbase/file.c @@ -2117,6 +2117,14 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetLongPathNameW( LPCWSTR shortpath, LPWSTR longp return 0; } + /* Handle \\?\ prefix (Extended Length Path) */ + if (shortpath[0] == '\\' && shortpath[1] == '\\' && shortpath[2] == '?' && + shortpath[3] == '\\') + { + if (iswalpha(shortpath[4]) && shortpath[5] == ':' && shortpath[6] == '\\') + return GetLongPathNameW(shortpath + 4, longpath, longlen); + } + if (shortpath[0] == '\\' && shortpath[1] == '\\') { FIXME( "UNC pathname %s\n", debugstr_w(shortpath) ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10192