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
1e36dbb2
Commit
1e36dbb2
authored
Nov 23, 2018
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Nov 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Implement PathCchRemoveBackslash.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ceb5d598
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
2 deletions
+62
-2
api-ms-win-core-path-l1-1-0.spec
...-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec
+1
-1
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+1
-1
path.c
dlls/kernelbase/path.c
+10
-0
path.c
dlls/kernelbase/tests/path.c
+49
-0
pathcch.h
include/pathcch.h
+1
-0
No files found.
dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec
View file @
1e36dbb2
...
...
@@ -11,7 +11,7 @@
@ stub PathCchCombineEx
@ stdcall PathCchFindExtension(wstr long ptr) kernelbase.PathCchFindExtension
@ stdcall PathCchIsRoot(wstr) kernelbase.PathCchIsRoot
@ st
ub
PathCchRemoveBackslash
@ st
dcall PathCchRemoveBackslash(wstr long) kernelbase.
PathCchRemoveBackslash
@ stdcall PathCchRemoveBackslashEx(wstr long ptr ptr) kernelbase.PathCchRemoveBackslashEx
@ stdcall PathCchRemoveExtension(wstr long) kernelbase.PathCchRemoveExtension
@ stub PathCchRemoveFileSpec
...
...
dlls/kernelbase/kernelbase.spec
View file @
1e36dbb2
...
...
@@ -1040,7 +1040,7 @@
# @ stub PathCchCombineEx
@ stdcall PathCchFindExtension(wstr long ptr)
@ stdcall PathCchIsRoot(wstr)
# @ stub PathCchRemoveBackslash
@ stdcall PathCchRemoveBackslash(wstr long)
@ stdcall PathCchRemoveBackslashEx(wstr long ptr ptr)
@ stdcall PathCchRemoveExtension(wstr long)
# @ stub PathCchRemoveFileSpec
...
...
dlls/kernelbase/path.c
View file @
1e36dbb2
...
...
@@ -278,6 +278,16 @@ BOOL WINAPI PathCchIsRoot(const WCHAR *path)
return
FALSE
;
}
HRESULT
WINAPI
PathCchRemoveBackslash
(
WCHAR
*
path
,
SIZE_T
path_size
)
{
WCHAR
*
path_end
;
SIZE_T
free_size
;
TRACE
(
"%s %lu
\n
"
,
debugstr_w
(
path
),
path_size
);
return
PathCchRemoveBackslashEx
(
path
,
path_size
,
&
path_end
,
&
free_size
);
}
HRESULT
WINAPI
PathCchRemoveBackslashEx
(
WCHAR
*
path
,
SIZE_T
path_size
,
WCHAR
**
path_end
,
SIZE_T
*
free_size
)
{
const
WCHAR
*
root_end
;
...
...
dlls/kernelbase/tests/path.c
View file @
1e36dbb2
...
...
@@ -36,6 +36,7 @@ HRESULT (WINAPI *pPathCchAddExtension)(WCHAR *path, SIZE_T size, const WCHAR *ex
HRESULT
(
WINAPI
*
pPathCchCombineEx
)(
WCHAR
*
out
,
SIZE_T
size
,
const
WCHAR
*
path1
,
const
WCHAR
*
path2
,
DWORD
flags
);
HRESULT
(
WINAPI
*
pPathCchFindExtension
)(
const
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
**
extension
);
BOOL
(
WINAPI
*
pPathCchIsRoot
)(
const
WCHAR
*
path
);
HRESULT
(
WINAPI
*
pPathCchRemoveBackslash
)(
WCHAR
*
path
,
SIZE_T
path_size
);
HRESULT
(
WINAPI
*
pPathCchRemoveBackslashEx
)(
WCHAR
*
path
,
SIZE_T
path_size
,
WCHAR
**
path_end
,
SIZE_T
*
free_size
);
HRESULT
(
WINAPI
*
pPathCchRemoveExtension
)(
WCHAR
*
path
,
SIZE_T
size
);
HRESULT
(
WINAPI
*
pPathCchRenameExtension
)(
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
*
extension
);
...
...
@@ -593,6 +594,52 @@ static const struct removebackslashex_test removebackslashex_tests [] =
"
\\\\
?
\\
Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}
\\
a"
,
50
,
2
,
S_OK
}
};
static
void
test_PathCchRemoveBackslash
(
void
)
{
WCHAR
pathW
[
PATHCCH_MAX_CCH
];
CHAR
pathA
[
PATHCCH_MAX_CCH
];
HRESULT
hr
;
SIZE_T
path_size
;
INT
i
;
if
(
!
pPathCchRemoveBackslash
)
{
win_skip
(
"PathCchRemoveBackslash() is not available.
\n
"
);
return
;
}
/* No NULL check for path on Windows */
if
(
0
)
{
hr
=
pPathCchRemoveBackslash
(
NULL
,
PATHCCH_MAX_CCH
);
ok
(
hr
==
E_INVALIDARG
,
"expect hr %#x, got %#x
\n
"
,
E_INVALIDARG
,
hr
);
}
MultiByteToWideChar
(
CP_ACP
,
0
,
"C:
\\
a
\\
"
,
-
1
,
pathW
,
ARRAY_SIZE
(
pathW
));
hr
=
pPathCchRemoveBackslash
(
pathW
,
0
);
ok
(
hr
==
E_INVALIDARG
,
"expect hr %#x, got %#x
\n
"
,
E_INVALIDARG
,
hr
);
hr
=
pPathCchRemoveBackslash
(
pathW
,
PATHCCH_MAX_CCH
+
1
);
ok
(
hr
==
S_OK
,
"expect hr %#x, got %#x
\n
"
,
S_OK
,
hr
);
hr
=
pPathCchRemoveBackslash
(
pathW
,
PATHCCH_MAX_CCH
);
ok
(
hr
==
S_FALSE
,
"expect hr %#x, got %#x
\n
"
,
S_FALSE
,
hr
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
removebackslashex_tests
);
i
++
)
{
const
struct
removebackslashex_test
*
t
=
removebackslashex_tests
+
i
;
path_size
=
MultiByteToWideChar
(
CP_ACP
,
0
,
t
->
path_in
,
-
1
,
pathW
,
ARRAY_SIZE
(
pathW
));
hr
=
pPathCchRemoveBackslash
(
pathW
,
path_size
);
ok
(
hr
==
t
->
hr
,
"path %s expect result %#x, got %#x
\n
"
,
t
->
path_in
,
t
->
hr
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
WideCharToMultiByte
(
CP_ACP
,
0
,
pathW
,
-
1
,
pathA
,
ARRAY_SIZE
(
pathA
),
NULL
,
NULL
);
ok
(
!
lstrcmpA
(
pathA
,
t
->
path_out
),
"path %s expect output path %s, got %s
\n
"
,
t
->
path_in
,
t
->
path_out
,
pathA
);
}
}
}
static
void
test_PathCchRemoveBackslashEx
(
void
)
{
WCHAR
pathW
[
PATHCCH_MAX_CCH
];
...
...
@@ -1221,6 +1268,7 @@ START_TEST(path)
pPathCchAddExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchAddExtension"
);
pPathCchFindExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchFindExtension"
);
pPathCchIsRoot
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchIsRoot"
);
pPathCchRemoveBackslash
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchRemoveBackslash"
);
pPathCchRemoveBackslashEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchRemoveBackslashEx"
);
pPathCchRemoveExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchRemoveExtension"
);
pPathCchRenameExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchRenameExtension"
);
...
...
@@ -1235,6 +1283,7 @@ START_TEST(path)
test_PathCchAddExtension
();
test_PathCchFindExtension
();
test_PathCchIsRoot
();
test_PathCchRemoveBackslash
();
test_PathCchRemoveBackslashEx
();
test_PathCchRemoveExtension
();
test_PathCchRenameExtension
();
...
...
include/pathcch.h
View file @
1e36dbb2
...
...
@@ -31,6 +31,7 @@ HRESULT WINAPI PathCchAddExtension(WCHAR *path, SIZE_T size, const WCHAR *extens
HRESULT
WINAPI
PathCchCombineEx
(
WCHAR
*
out
,
SIZE_T
size
,
const
WCHAR
*
path1
,
const
WCHAR
*
path2
,
DWORD
flags
);
HRESULT
WINAPI
PathCchFindExtension
(
const
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
**
extension
);
BOOL
WINAPI
PathCchIsRoot
(
const
WCHAR
*
path
);
HRESULT
WINAPI
PathCchRemoveBackslash
(
WCHAR
*
path
,
SIZE_T
path_size
);
HRESULT
WINAPI
PathCchRemoveBackslashEx
(
WCHAR
*
path
,
SIZE_T
path_size
,
WCHAR
**
path_end
,
SIZE_T
*
free_size
);
HRESULT
WINAPI
PathCchRemoveExtension
(
WCHAR
*
path
,
SIZE_T
size
);
HRESULT
WINAPI
PathCchRenameExtension
(
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
*
extension
);
...
...
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