Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4aea5ca7
Commit
4aea5ca7
authored
Oct 14, 2014
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Oct 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Fix incorrect lastpart in GetFullPathNameA with DBCS.
parent
c27af477
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
10 deletions
+28
-10
path.c
dlls/kernel32/path.c
+6
-10
path.c
dlls/kernel32/tests/path.c
+22
-0
No files found.
dlls/kernel32/path.c
View file @
4aea5ca7
...
...
@@ -251,12 +251,12 @@ DWORD WINAPI GetFullPathNameA( LPCSTR name, DWORD len, LPSTR buffer,
LPSTR
*
lastpart
)
{
WCHAR
*
nameW
;
WCHAR
bufferW
[
MAX_PATH
];
WCHAR
bufferW
[
MAX_PATH
]
,
*
lastpartW
=
NULL
;
DWORD
ret
;
if
(
!
(
nameW
=
FILE_name_AtoW
(
name
,
FALSE
)))
return
0
;
ret
=
GetFullPathNameW
(
nameW
,
MAX_PATH
,
bufferW
,
NULL
);
ret
=
GetFullPathNameW
(
nameW
,
MAX_PATH
,
bufferW
,
&
lastpartW
);
if
(
!
ret
)
return
0
;
if
(
ret
>
MAX_PATH
)
...
...
@@ -267,14 +267,10 @@ DWORD WINAPI GetFullPathNameA( LPCSTR name, DWORD len, LPSTR buffer,
ret
=
copy_filename_WtoA
(
bufferW
,
buffer
,
len
);
if
(
ret
<
len
&&
lastpart
)
{
LPSTR
p
=
buffer
+
strlen
(
buffer
)
-
1
;
if
(
*
p
!=
'\\'
)
{
while
((
p
>
buffer
+
2
)
&&
(
*
p
!=
'\\'
))
p
--
;
*
lastpart
=
p
+
1
;
}
else
*
lastpart
=
NULL
;
if
(
lastpartW
)
*
lastpart
=
buffer
+
FILE_name_WtoA
(
bufferW
,
lastpartW
-
bufferW
,
NULL
,
0
);
else
*
lastpart
=
NULL
;
}
return
ret
;
}
...
...
dlls/kernel32/tests/path.c
View file @
4aea5ca7
...
...
@@ -1828,6 +1828,7 @@ static void test_GetFullPathNameA(void)
char
output
[
MAX_PATH
],
*
filepart
;
DWORD
ret
;
int
i
;
UINT
acp
;
const
struct
{
...
...
@@ -1864,6 +1865,27 @@ static void test_GetFullPathNameA(void)
"[%d] Expected GetLastError() to return 0xdeadbeef, got %u
\n
"
,
i
,
GetLastError
());
}
acp
=
GetACP
();
if
(
acp
!=
932
)
skip
(
"Skipping DBCS(Japanese) GetFullPathNameA test in this codepage (%d)
\n
"
,
acp
);
else
{
const
struct
dbcs_case
{
const
char
*
input
;
const
char
*
expected
;
}
testset
[]
=
{
{
"c:
\\
a
\\\x95\x5c\x97\xa0
.txt"
,
"
\x95\x5c\x97\xa0
.txt"
},
{
"c:
\\\x83\x8f\x83\x43\x83\x93\\
wine.c"
,
"wine.c"
},
{
"c:
\\
demo
\\\x97\xa0\x95\x5c
"
,
"
\x97\xa0\x95\x5c
"
}
};
for
(
i
=
0
;
i
<
sizeof
(
testset
)
/
sizeof
(
testset
[
0
]);
i
++
)
{
ret
=
GetFullPathNameA
(
testset
[
i
].
input
,
sizeof
(
output
),
output
,
&
filepart
);
ok
(
ret
,
"[%d] GetFullPathName error %u
\n
"
,
i
,
GetLastError
());
ok
(
!
lstrcmpA
(
filepart
,
testset
[
i
].
expected
),
"[%d] expected %s got %s
\n
"
,
i
,
testset
[
i
].
expected
,
filepart
);
}
}
}
static
void
test_GetFullPathNameW
(
void
)
...
...
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