Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
c90e46b6
Commit
c90e46b6
authored
Aug 14, 2016
by
Peter Beutner
Committed by
Alexandre Julliard
Aug 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Properly handle double delimiters in GetShortPathName/GetLongPathName.
Signed-off-by:
Peter Beutner
<
p.beutner@gmx.net
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1fe0b84f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
35 deletions
+2
-35
path.c
dlls/kernel32/path.c
+2
-25
path.c
dlls/kernel32/tests/path.c
+0
-10
No files found.
dlls/kernel32/path.c
View file @
c90e46b6
...
...
@@ -335,23 +335,12 @@ DWORD WINAPI GetLongPathNameW( LPCWSTR shortpath, LPWSTR longpath, DWORD longlen
/* check for path delimiters and reproduce them */
if
(
shortpath
[
sp
]
==
'\\'
||
shortpath
[
sp
]
==
'/'
)
{
if
(
!
lp
||
(
tmplongpath
[
lp
-
1
]
!=
'\\'
&&
tmplongpath
[
lp
-
1
]
!=
'/'
))
{
/* strip double delimiters */
tmplongpath
[
lp
++
]
=
shortpath
[
sp
];
}
tmplongpath
[
lp
++
]
=
shortpath
[
sp
++
];
tmplongpath
[
lp
]
=
0
;
/* terminate string */
sp
++
;
continue
;
}
p
=
shortpath
+
sp
;
if
(
sp
==
0
&&
p
[
0
]
==
'.'
&&
(
p
[
1
]
==
'/'
||
p
[
1
]
==
'\\'
))
{
tmplongpath
[
lp
++
]
=
*
p
++
;
tmplongpath
[
lp
++
]
=
*
p
++
;
sp
+=
2
;
}
for
(;
*
p
&&
*
p
!=
'/'
&&
*
p
!=
'\\'
;
p
++
);
tmplen
=
p
-
(
shortpath
+
sp
);
lstrcpynW
(
tmplongpath
+
lp
,
shortpath
+
sp
,
tmplen
+
1
);
...
...
@@ -498,24 +487,12 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
/* check for path delimiters and reproduce them */
if
(
longpath
[
lp
]
==
'\\'
||
longpath
[
lp
]
==
'/'
)
{
if
(
!
sp
||
(
tmpshortpath
[
sp
-
1
]
!=
'\\'
&&
tmpshortpath
[
sp
-
1
]
!=
'/'
))
{
/* strip double delimiters */
tmpshortpath
[
sp
]
=
longpath
[
lp
];
sp
++
;
}
tmpshortpath
[
sp
++
]
=
longpath
[
lp
++
];
tmpshortpath
[
sp
]
=
0
;
/* terminate string */
lp
++
;
continue
;
}
p
=
longpath
+
lp
;
if
(
lp
==
0
&&
p
[
0
]
==
'.'
&&
(
p
[
1
]
==
'/'
||
p
[
1
]
==
'\\'
))
{
tmpshortpath
[
sp
++
]
=
*
p
++
;
tmpshortpath
[
sp
++
]
=
*
p
++
;
lp
+=
2
;
}
for
(;
*
p
&&
*
p
!=
'/'
&&
*
p
!=
'\\'
;
p
++
);
tmplen
=
p
-
(
longpath
+
lp
);
lstrcpynW
(
tmpshortpath
+
sp
,
longpath
+
lp
,
tmplen
+
1
);
...
...
dlls/kernel32/tests/path.c
View file @
c90e46b6
...
...
@@ -949,32 +949,24 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive)
/* test double delimiters */
sprintf
(
tmpstr
,
"%s
\\\\
%s"
,
SHORTDIR
,
SHORTFILE
);
ok
(
GetShortPathNameA
(
tmpstr
,
tmpstr1
,
MAX_PATH
),
"GetShortPathNameA failed
\n
"
);
todo_wine
ok
(
lstrcmpiA
(
tmpstr
,
tmpstr1
)
==
0
,
"GetShortPathNameA returned '%s' instead of '%s'
\n
"
,
tmpstr1
,
tmpstr
);
sprintf
(
tmpstr
,
".
\\\\
%s
\\\\
%s"
,
SHORTDIR
,
SHORTFILE
);
todo_wine
{
ok
(
GetShortPathNameA
(
tmpstr
,
tmpstr1
,
MAX_PATH
),
"GetShortPathNameA failed
\n
"
);
ok
(
lstrcmpiA
(
tmpstr
,
tmpstr1
)
==
0
,
"GetShortPathNameA returned '%s' instead of '%s'
\n
"
,
tmpstr1
,
tmpstr
);
}
if
(
pGetLongPathNameA
)
{
sprintf
(
tmpstr
,
"%s
\\\\
%s"
,
LONGDIR
,
LONGFILE
);
ok
(
pGetLongPathNameA
(
tmpstr
,
tmpstr1
,
MAX_PATH
),
"GetLongPathNameA failed
\n
"
);
todo_wine
ok
(
lstrcmpiA
(
tmpstr
,
tmpstr1
)
==
0
,
"GetLongPathNameA returned '%s' instead of '%s'
\n
"
,
tmpstr1
,
tmpstr
);
sprintf
(
tmpstr
,
".
\\\\
%s
\\\\
%s"
,
LONGDIR
,
LONGFILE
);
todo_wine
{
ok
(
pGetLongPathNameA
(
tmpstr
,
tmpstr1
,
MAX_PATH
),
"GetLongPathNameA failed
\n
"
);
ok
(
lstrcmpiA
(
tmpstr
,
tmpstr1
)
==
0
,
"GetLongPathNameA returned '%s' instead of '%s'
\n
"
,
tmpstr1
,
tmpstr
);
}
}
}
static
void
test_GetTempPathA
(
char
*
tmp_dir
)
...
...
@@ -2204,12 +2196,10 @@ static void test_relative_path(void)
strcpy
(
buf
,
"deadbeef"
);
ret
=
pGetLongPathNameA
(
"..
\\\\
foo
\\
file"
,
buf
,
MAX_PATH
);
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
);
ok
(
ret
,
"GetShortPathName error %d
\n
"
,
GetLastError
());
todo_wine
ok
(
!
strcmp
(
buf
,
"..
\\\\
foo
\\
file"
),
"expected ..
\\\\
foo
\\
file, got %s
\n
"
,
buf
);
SetCurrentDirectoryA
(
".."
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment