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
f33bf35d
Commit
f33bf35d
authored
Aug 23, 2021
by
Daniel Lehman
Committed by
Alexandre Julliard
Aug 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Don't add a backslash to the second path if not needed.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ac7f6fda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
14 deletions
+11
-14
path.c
dlls/kernelbase/path.c
+4
-3
path.c
dlls/kernelbase/tests/path.c
+7
-11
No files found.
dlls/kernelbase/path.c
View file @
f33bf35d
...
...
@@ -401,7 +401,7 @@ HRESULT WINAPI PathAllocCombine(const WCHAR *path1, const WCHAR *path2, DWORD fl
{
SIZE_T
combined_length
,
length2
;
WCHAR
*
combined_path
;
BOOL
from_path2
=
FALSE
;
BOOL
add_backslash
=
FALSE
;
HRESULT
hr
;
TRACE
(
"%s %s %#x %p
\n
"
,
wine_dbgstr_w
(
path1
),
wine_dbgstr_w
(
path2
),
flags
,
out
);
...
...
@@ -419,7 +419,8 @@ HRESULT WINAPI PathAllocCombine(const WCHAR *path1, const WCHAR *path2, DWORD fl
{
path1
=
path2
;
path2
=
NULL
;
from_path2
=
TRUE
;
add_backslash
=
(
is_drive_spec
(
path1
)
&&
!
path1
[
2
])
||
(
is_prefixed_disk
(
path1
)
&&
!
path1
[
6
]);
}
length2
=
path2
?
lstrlenW
(
path2
)
:
0
;
...
...
@@ -435,7 +436,7 @@ HRESULT WINAPI PathAllocCombine(const WCHAR *path1, const WCHAR *path2, DWORD fl
lstrcpyW
(
combined_path
,
path1
);
PathCchStripPrefix
(
combined_path
,
combined_length
);
if
(
from_path2
)
PathCchAddBackslashEx
(
combined_path
,
combined_length
,
NULL
,
NULL
);
if
(
add_backslash
)
PathCchAddBackslashEx
(
combined_path
,
combined_length
,
NULL
,
NULL
);
if
(
path2
&&
path2
[
0
])
{
...
...
dlls/kernelbase/tests/path.c
View file @
f33bf35d
...
...
@@ -426,7 +426,6 @@ struct combine_test
const
CHAR
*
path1
;
const
CHAR
*
path2
;
const
CHAR
*
result
;
BOOL
todo
;
};
static
const
struct
combine_test
combine_tests
[]
=
...
...
@@ -474,21 +473,21 @@ static const struct combine_test combine_tests[] =
/* Second path is fully qualified */
{
"X:
\\
"
,
"C:"
,
"C:
\\
"
},
{
"X:
\\
"
,
"C:
\\
"
,
"C:
\\
"
},
{
"X:
\\
"
,
"C:
\\
a"
,
"C:
\\
a"
,
TRUE
},
{
"X:
\\
"
,
"C:
\\
a"
,
"C:
\\
a"
},
{
"X:
\\
"
,
"
\\\\
"
,
"
\\\\
"
},
{
"X:
\\
"
,
"
\\\\
a"
,
"
\\\\
a"
,
TRUE
},
{
"X:
\\
"
,
"
\\\\
a"
,
"
\\\\
a"
},
{
"X:
\\
"
,
"
\\\\
?
\\
C:"
,
"C:
\\
"
},
{
"X:
\\
"
,
"
\\\\
?
\\
C:
\\
"
,
"C:
\\
"
},
{
"X:
\\
"
,
"
\\\\
?
\\
C:
\\
a"
,
"C:
\\
a"
,
TRUE
},
{
"X:
\\
"
,
"
\\\\
?
\\
UNC"
,
"
\\\\
?
\\
UNC"
,
TRUE
},
{
"X:
\\
"
,
"
\\\\
?
\\
C:
\\
a"
,
"C:
\\
a"
},
{
"X:
\\
"
,
"
\\\\
?
\\
UNC"
,
"
\\\\
?
\\
UNC"
},
{
"X:
\\
"
,
"
\\\\
?
\\
UNC
\\
"
,
"
\\\\
"
},
{
"X:
\\
"
,
"
\\\\
?
\\
UNC
\\
a"
,
"
\\\\
a"
,
TRUE
},
{
"X:
\\
"
,
"
\\\\
?
\\
UNC
\\
a"
,
"
\\\\
a"
},
{
"X:
\\
"
,
"
\\\\
?
\\
Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}"
,
"
\\\\
?
\\
Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}"
,
TRUE
},
"
\\\\
?
\\
Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}"
},
{
"X:
\\
"
,
"
\\\\
?
\\
Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}
\\
"
,
"
\\\\
?
\\
Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}
\\
"
},
{
"X:
\\
"
,
"
\\\\
?
\\
Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}
\\
a"
,
"
\\\\
?
\\
Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}
\\
a"
,
TRUE
},
"
\\\\
?
\\
Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}
\\
a"
},
/* Canonicalization */
{
"C:
\\
a"
,
".
\\
b"
,
"C:
\\
a
\\
b"
},
...
...
@@ -547,7 +546,6 @@ static void test_PathAllocCombine(void)
if
(
SUCCEEDED
(
hr
))
{
WideCharToMultiByte
(
CP_ACP
,
0
,
resultW
,
-
1
,
resultA
,
ARRAY_SIZE
(
resultA
),
NULL
,
NULL
);
todo_wine_if
(
t
->
todo
)
ok
(
!
lstrcmpA
(
resultA
,
t
->
result
),
"combine %s %s expect result %s, got %s
\n
"
,
t
->
path1
,
t
->
path2
,
t
->
result
,
resultA
);
LocalFree
(
resultW
);
...
...
@@ -611,7 +609,6 @@ static void test_PathCchCombine(void)
hr
=
pPathCchCombine
(
output
,
ARRAY_SIZE
(
output
),
p1
,
p2
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
todo_wine_if
(
combine_tests
[
i
].
todo
)
ok
(
!
lstrcmpW
(
output
,
expected
),
"Combining %s with %s returned %s, expected %s
\n
"
,
wine_dbgstr_w
(
p1
),
wine_dbgstr_w
(
p2
),
wine_dbgstr_w
(
output
),
wine_dbgstr_w
(
expected
));
}
...
...
@@ -680,7 +677,6 @@ static void test_PathCchCombineEx(void)
hr
=
pPathCchCombineEx
(
output
,
MAX_PATH
,
p1
,
p2
,
0
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
todo_wine_if
(
combine_tests
[
i
].
todo
)
ok
(
!
lstrcmpW
(
output
,
expected
),
"Combining %s with %s returned %s, expected %s
\n
"
,
wine_dbgstr_w
(
p1
),
wine_dbgstr_w
(
p2
),
wine_dbgstr_w
(
output
),
wine_dbgstr_w
(
expected
));
}
...
...
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