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
6043898c
Commit
6043898c
authored
Nov 26, 2018
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Nov 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Implement PathCchCombine.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6150e208
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
2 deletions
+74
-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
+7
-0
path.c
dlls/kernelbase/tests/path.c
+64
-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 @
6043898c
...
...
@@ -7,7 +7,7 @@
@ stub PathCchAppendEx
@ stdcall PathCchCanonicalize(ptr long wstr) kernelbase.PathCchCanonicalize
@ stdcall PathCchCanonicalizeEx(ptr long wstr long) kernelbase.PathCchCanonicalizeEx
@ st
ub
PathCchCombine
@ st
dcall PathCchCombine(ptr long wstr wstr) kernelbase.
PathCchCombine
@ stdcall PathCchCombineEx(ptr long wstr wstr long) kernelbase.PathCchCombineEx
@ stdcall PathCchFindExtension(wstr long ptr) kernelbase.PathCchFindExtension
@ stdcall PathCchIsRoot(wstr) kernelbase.PathCchIsRoot
...
...
dlls/kernelbase/kernelbase.spec
View file @
6043898c
...
...
@@ -1036,7 +1036,7 @@
# @ stub PathCchAppendEx
@ stdcall PathCchCanonicalize(ptr long wstr)
@ stdcall PathCchCanonicalizeEx(ptr long wstr long)
# @ stub PathCchCombine
@ stdcall PathCchCombine(ptr long wstr wstr)
@ stdcall PathCchCombineEx(ptr long wstr wstr long)
@ stdcall PathCchFindExtension(wstr long ptr)
@ stdcall PathCchIsRoot(wstr)
...
...
dlls/kernelbase/path.c
View file @
6043898c
...
...
@@ -496,6 +496,13 @@ HRESULT WINAPI PathCchCanonicalizeEx(WCHAR *out, SIZE_T size, const WCHAR *in, D
return
hr
;
}
HRESULT
WINAPI
PathCchCombine
(
WCHAR
*
out
,
SIZE_T
size
,
const
WCHAR
*
path1
,
const
WCHAR
*
path2
)
{
TRACE
(
"%p %s %s
\n
"
,
out
,
wine_dbgstr_w
(
path1
),
wine_dbgstr_w
(
path2
));
return
PathCchCombineEx
(
out
,
size
,
path1
,
path2
,
PATHCCH_NONE
);
}
HRESULT
WINAPI
PathCchCombineEx
(
WCHAR
*
out
,
SIZE_T
size
,
const
WCHAR
*
path1
,
const
WCHAR
*
path2
,
DWORD
flags
)
{
HRESULT
hr
;
...
...
dlls/kernelbase/tests/path.c
View file @
6043898c
...
...
@@ -37,6 +37,7 @@ HRESULT (WINAPI *pPathCchAddBackslashEx)(WCHAR *out, SIZE_T size, WCHAR **endptr
HRESULT
(
WINAPI
*
pPathCchAddExtension
)(
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
*
extension
);
HRESULT
(
WINAPI
*
pPathCchCanonicalize
)(
WCHAR
*
out
,
SIZE_T
size
,
const
WCHAR
*
in
);
HRESULT
(
WINAPI
*
pPathCchCanonicalizeEx
)(
WCHAR
*
out
,
SIZE_T
size
,
const
WCHAR
*
in
,
DWORD
flags
);
HRESULT
(
WINAPI
*
pPathCchCombine
)(
WCHAR
*
out
,
SIZE_T
size
,
const
WCHAR
*
path1
,
const
WCHAR
*
path2
);
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
);
...
...
@@ -474,6 +475,67 @@ static void test_PathAllocCombine(void)
}
}
static
void
test_PathCchCombine
(
void
)
{
WCHAR
expected
[
PATHCCH_MAX_CCH
]
=
{
'C'
,
':'
,
'\\'
,
'a'
,
0
};
WCHAR
p1
[
PATHCCH_MAX_CCH
]
=
{
'C'
,
':'
,
'\\'
,
0
};
WCHAR
p2
[
PATHCCH_MAX_CCH
]
=
{
'a'
,
0
};
WCHAR
output
[
PATHCCH_MAX_CCH
];
HRESULT
hr
;
INT
i
;
if
(
!
pPathCchCombine
)
{
win_skip
(
"PathCchCombine() is not available.
\n
"
);
return
;
}
hr
=
pPathCchCombine
(
output
,
5
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %08x
\n
"
,
hr
);
hr
=
pPathCchCombine
(
NULL
,
2
,
p1
,
p2
);
ok
(
hr
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %08x
\n
"
,
hr
);
memset
(
output
,
0xff
,
sizeof
(
output
));
hr
=
pPathCchCombine
(
output
,
0
,
p1
,
p2
);
ok
(
hr
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %08x
\n
"
,
hr
);
ok
(
output
[
0
]
==
0xffff
,
"Expected output buffer to be unchanged
\n
"
);
memset
(
output
,
0xff
,
sizeof
(
output
));
hr
=
pPathCchCombine
(
output
,
1
,
p1
,
p2
);
ok
(
hr
==
STRSAFE_E_INSUFFICIENT_BUFFER
,
"Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08x
\n
"
,
hr
);
ok
(
output
[
0
]
==
0
,
"Expected output buffer to contain NULL string
\n
"
);
memset
(
output
,
0xff
,
sizeof
(
output
));
hr
=
pPathCchCombine
(
output
,
4
,
p1
,
p2
);
ok
(
hr
==
STRSAFE_E_INSUFFICIENT_BUFFER
,
"Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08x
\n
"
,
hr
);
ok
(
output
[
0
]
==
0x0
,
"Expected output buffer to contain NULL string
\n
"
);
memset
(
output
,
0xff
,
sizeof
(
output
));
hr
=
pPathCchCombine
(
output
,
5
,
p1
,
p2
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
output
,
expected
),
"Combination of %s + %s returned %s, expected %s
\n
"
,
wine_dbgstr_w
(
p1
),
wine_dbgstr_w
(
p2
),
wine_dbgstr_w
(
output
),
wine_dbgstr_w
(
expected
));
hr
=
pPathCchCombine
(
output
,
PATHCCH_MAX_CCH
+
1
,
p1
,
p2
);
ok
(
hr
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %08x
\n
"
,
hr
);
hr
=
pPathCchCombine
(
output
,
PATHCCH_MAX_CCH
,
p1
,
p2
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
combine_tests
);
i
++
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
combine_tests
[
i
].
path1
,
-
1
,
p1
,
ARRAY_SIZE
(
p1
));
MultiByteToWideChar
(
CP_ACP
,
0
,
combine_tests
[
i
].
path2
,
-
1
,
p2
,
ARRAY_SIZE
(
p2
));
MultiByteToWideChar
(
CP_ACP
,
0
,
combine_tests
[
i
].
result
,
-
1
,
expected
,
ARRAY_SIZE
(
expected
));
hr
=
pPathCchCombine
(
output
,
ARRAY_SIZE
(
output
),
p1
,
p2
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
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
));
}
}
static
void
test_PathCchCombineEx
(
void
)
{
WCHAR
expected
[
MAX_PATH
]
=
{
'C'
,
':'
,
'\\'
,
'a'
,
0
};
...
...
@@ -2049,6 +2111,7 @@ START_TEST(path)
pPathCchAddExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchAddExtension"
);
pPathCchCanonicalize
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchCanonicalize"
);
pPathCchCanonicalizeEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchCanonicalizeEx"
);
pPathCchCombine
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchCombine"
);
pPathCchCombineEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchCombineEx"
);
pPathCchFindExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchFindExtension"
);
pPathCchIsRoot
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchIsRoot"
);
...
...
@@ -2069,6 +2132,7 @@ START_TEST(path)
test_PathCchAddExtension
();
test_PathCchCanonicalize
();
test_PathCchCanonicalizeEx
();
test_PathCchCombine
();
test_PathCchCombineEx
();
test_PathCchFindExtension
();
test_PathCchIsRoot
();
...
...
include/pathcch.h
View file @
6043898c
...
...
@@ -33,6 +33,7 @@ HRESULT WINAPI PathCchAddBackslashEx(WCHAR *path, SIZE_T size, WCHAR **end, SIZE
HRESULT
WINAPI
PathCchAddExtension
(
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
*
extension
);
HRESULT
WINAPI
PathCchCanonicalize
(
WCHAR
*
out
,
SIZE_T
size
,
const
WCHAR
*
in
);
HRESULT
WINAPI
PathCchCanonicalizeEx
(
WCHAR
*
out
,
SIZE_T
size
,
const
WCHAR
*
in
,
DWORD
flags
);
HRESULT
WINAPI
PathCchCombine
(
WCHAR
*
out
,
SIZE_T
size
,
const
WCHAR
*
path1
,
const
WCHAR
*
path2
);
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
);
...
...
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