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
c02419ed
Commit
c02419ed
authored
Nov 22, 2018
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Nov 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Implement PathIsUNCEx.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c9c646e9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
2 deletions
+96
-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
+21
-0
path.c
dlls/kernelbase/tests/path.c
+72
-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 @
c02419ed
...
@@ -19,4 +19,4 @@
...
@@ -19,4 +19,4 @@
@ stub PathCchSkipRoot
@ stub PathCchSkipRoot
@ stub PathCchStripPrefix
@ stub PathCchStripPrefix
@ stub PathCchStripToRoot
@ stub PathCchStripToRoot
@ st
ub
PathIsUNCEx
@ st
dcall PathIsUNCEx(wstr ptr) kernelbase.
PathIsUNCEx
dlls/kernelbase/kernelbase.spec
View file @
c02419ed
...
@@ -1082,7 +1082,7 @@
...
@@ -1082,7 +1082,7 @@
@ stdcall PathIsSameRootA(str str) shlwapi.PathIsSameRootA
@ stdcall PathIsSameRootA(str str) shlwapi.PathIsSameRootA
@ stdcall PathIsSameRootW(wstr wstr) shlwapi.PathIsSameRootW
@ stdcall PathIsSameRootW(wstr wstr) shlwapi.PathIsSameRootW
@ stdcall PathIsUNCA(str) shlwapi.PathIsUNCA
@ stdcall PathIsUNCA(str) shlwapi.PathIsUNCA
# @ stub PathIsUNCEx
@ stdcall PathIsUNCEx(wstr ptr)
@ stdcall PathIsUNCServerA(str) shlwapi.PathIsUNCServerA
@ stdcall PathIsUNCServerA(str) shlwapi.PathIsUNCServerA
@ stdcall PathIsUNCServerShareA(str) shlwapi.PathIsUNCServerShareA
@ stdcall PathIsUNCServerShareA(str) shlwapi.PathIsUNCServerShareA
@ stdcall PathIsUNCServerShareW(wstr) shlwapi.PathIsUNCServerShareW
@ stdcall PathIsUNCServerShareW(wstr) shlwapi.PathIsUNCServerShareW
...
...
dlls/kernelbase/path.c
View file @
c02419ed
...
@@ -38,6 +38,12 @@ static SIZE_T strnlenW(const WCHAR *string, SIZE_T maxlen)
...
@@ -38,6 +38,12 @@ static SIZE_T strnlenW(const WCHAR *string, SIZE_T maxlen)
return
i
;
return
i
;
}
}
static
BOOL
is_prefixed_unc
(
const
WCHAR
*
string
)
{
static
const
WCHAR
prefixed_unc
[]
=
{
'\\'
,
'\\'
,
'?'
,
'\\'
,
'U'
,
'N'
,
'C'
,
'\\'
};
return
!
strncmpiW
(
string
,
prefixed_unc
,
ARRAY_SIZE
(
prefixed_unc
));
}
HRESULT
WINAPI
PathCchAddBackslash
(
WCHAR
*
path
,
SIZE_T
size
)
HRESULT
WINAPI
PathCchAddBackslash
(
WCHAR
*
path
,
SIZE_T
size
)
{
{
return
PathCchAddBackslashEx
(
path
,
size
,
NULL
,
NULL
);
return
PathCchAddBackslashEx
(
path
,
size
,
NULL
,
NULL
);
...
@@ -183,3 +189,18 @@ HRESULT WINAPI PathCchRenameExtension(WCHAR *path, SIZE_T size, const WCHAR *ext
...
@@ -183,3 +189,18 @@ HRESULT WINAPI PathCchRenameExtension(WCHAR *path, SIZE_T size, const WCHAR *ext
hr
=
PathCchAddExtension
(
path
,
size
,
extension
);
hr
=
PathCchAddExtension
(
path
,
size
,
extension
);
return
FAILED
(
hr
)
?
hr
:
S_OK
;
return
FAILED
(
hr
)
?
hr
:
S_OK
;
}
}
BOOL
WINAPI
PathIsUNCEx
(
const
WCHAR
*
path
,
const
WCHAR
**
server
)
{
const
WCHAR
*
result
=
NULL
;
TRACE
(
"%s %p
\n
"
,
wine_dbgstr_w
(
path
),
server
);
if
(
is_prefixed_unc
(
path
))
result
=
path
+
8
;
else
if
(
path
[
0
]
==
'\\'
&&
path
[
1
]
==
'\\'
&&
path
[
2
]
!=
'?'
)
result
=
path
+
2
;
if
(
server
)
*
server
=
result
;
return
result
?
TRUE
:
FALSE
;
}
dlls/kernelbase/tests/path.c
View file @
c02419ed
...
@@ -37,6 +37,7 @@ HRESULT (WINAPI *pPathCchCombineEx)(WCHAR *out, SIZE_T size, const WCHAR *path1,
...
@@ -37,6 +37,7 @@ HRESULT (WINAPI *pPathCchCombineEx)(WCHAR *out, SIZE_T size, const WCHAR *path1,
HRESULT
(
WINAPI
*
pPathCchFindExtension
)(
const
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
**
extension
);
HRESULT
(
WINAPI
*
pPathCchFindExtension
)(
const
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
**
extension
);
HRESULT
(
WINAPI
*
pPathCchRemoveExtension
)(
WCHAR
*
path
,
SIZE_T
size
);
HRESULT
(
WINAPI
*
pPathCchRemoveExtension
)(
WCHAR
*
path
,
SIZE_T
size
);
HRESULT
(
WINAPI
*
pPathCchRenameExtension
)(
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
*
extension
);
HRESULT
(
WINAPI
*
pPathCchRenameExtension
)(
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
*
extension
);
BOOL
(
WINAPI
*
pPathIsUNCEx
)(
const
WCHAR
*
path
,
const
WCHAR
**
server
);
static
const
struct
static
const
struct
{
{
...
@@ -632,6 +633,75 @@ static void test_PathCchRenameExtension(void)
...
@@ -632,6 +633,75 @@ static void test_PathCchRenameExtension(void)
}
}
}
}
struct
isuncex_test
{
const
CHAR
*
path
;
INT
server_offset
;
BOOL
ret
;
};
static
const
struct
isuncex_test
isuncex_tests
[]
=
{
{
"
\\\\
"
,
2
,
TRUE
},
{
"
\\\\
a
\\
"
,
2
,
TRUE
},
{
"
\\\\
.
\\
"
,
2
,
TRUE
},
{
"
\\\\
?
\\
UNC
\\
"
,
8
,
TRUE
},
{
"
\\\\
?
\\
UNC
\\
a"
,
8
,
TRUE
},
{
"
\\\\
?
\\
unc
\\
"
,
8
,
TRUE
},
{
"
\\\\
?
\\
unc
\\
a"
,
8
,
TRUE
},
{
""
,
0
,
FALSE
},
{
"
\\
"
,
0
,
FALSE
},
{
"C:
\\
"
,
0
,
FALSE
},
{
"
\\
??
\\
"
,
0
,
FALSE
},
{
"
\\\\
?
\\
"
,
0
,
FALSE
},
{
"
\\\\
?
\\
UNC"
,
0
,
FALSE
},
{
"
\\\\
?
\\
C:"
,
0
,
FALSE
},
{
"
\\\\
?
\\
C:
\\
"
,
0
,
FALSE
},
{
"
\\\\
?
\\
C:
\\
a"
,
0
,
FALSE
},
{
"
\\\\
?
\\
Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}
\\
"
,
0
,
FALSE
}
};
static
void
test_PathIsUNCEx
(
void
)
{
WCHAR
pathW
[
MAX_PATH
];
const
WCHAR
*
server
;
BOOL
ret
;
INT
i
;
if
(
!
pPathIsUNCEx
)
{
win_skip
(
"PathIsUNCEx(() is not available.
\n
"
);
return
;
}
/* No NULL check for path pointers on Windows */
if
(
0
)
{
ret
=
pPathIsUNCEx
(
NULL
,
&
server
);
ok
(
ret
==
FALSE
,
"expect FALSE
\n
"
);
}
MultiByteToWideChar
(
CP_ACP
,
0
,
"C:
\\
"
,
-
1
,
pathW
,
ARRAY_SIZE
(
pathW
));
ret
=
pPathIsUNCEx
(
pathW
,
NULL
);
ok
(
ret
==
FALSE
,
"expect FALSE
\n
"
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
isuncex_tests
);
i
++
)
{
const
struct
isuncex_test
*
t
=
isuncex_tests
+
i
;
MultiByteToWideChar
(
CP_ACP
,
0
,
t
->
path
,
-
1
,
pathW
,
ARRAY_SIZE
(
pathW
));
server
=
(
const
WCHAR
*
)
0xdeadbeef
;
ret
=
pPathIsUNCEx
(
pathW
,
&
server
);
ok
(
ret
==
t
->
ret
,
"path
\"
%s
\"
expect return %d, got %d
\n
"
,
t
->
path
,
t
->
ret
,
ret
);
if
(
ret
)
ok
(
server
==
pathW
+
t
->
server_offset
,
"path
\"
%s
\"
expect server offset %d, got %ld
\n
"
,
t
->
path
,
t
->
server_offset
,
(
INT_PTR
)(
server
-
pathW
));
else
ok
(
!
server
,
"expect server is null, got %p
\n
"
,
server
);
}
}
START_TEST
(
path
)
START_TEST
(
path
)
{
{
HMODULE
hmod
=
LoadLibraryA
(
"kernelbase.dll"
);
HMODULE
hmod
=
LoadLibraryA
(
"kernelbase.dll"
);
...
@@ -643,6 +713,7 @@ START_TEST(path)
...
@@ -643,6 +713,7 @@ START_TEST(path)
pPathCchFindExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchFindExtension"
);
pPathCchFindExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchFindExtension"
);
pPathCchRemoveExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchRemoveExtension"
);
pPathCchRemoveExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchRemoveExtension"
);
pPathCchRenameExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchRenameExtension"
);
pPathCchRenameExtension
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathCchRenameExtension"
);
pPathIsUNCEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"PathIsUNCEx"
);
test_PathCchCombineEx
();
test_PathCchCombineEx
();
test_PathCchAddBackslash
();
test_PathCchAddBackslash
();
...
@@ -651,4 +722,5 @@ START_TEST(path)
...
@@ -651,4 +722,5 @@ START_TEST(path)
test_PathCchFindExtension
();
test_PathCchFindExtension
();
test_PathCchRemoveExtension
();
test_PathCchRemoveExtension
();
test_PathCchRenameExtension
();
test_PathCchRenameExtension
();
test_PathIsUNCEx
();
}
}
include/pathcch.h
View file @
c02419ed
...
@@ -32,3 +32,4 @@ HRESULT WINAPI PathCchCombineEx(WCHAR *out, SIZE_T size, const WCHAR *path1, con
...
@@ -32,3 +32,4 @@ HRESULT WINAPI PathCchCombineEx(WCHAR *out, SIZE_T size, const WCHAR *path1, con
HRESULT
WINAPI
PathCchFindExtension
(
const
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
**
extension
);
HRESULT
WINAPI
PathCchFindExtension
(
const
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
**
extension
);
HRESULT
WINAPI
PathCchRemoveExtension
(
WCHAR
*
path
,
SIZE_T
size
);
HRESULT
WINAPI
PathCchRemoveExtension
(
WCHAR
*
path
,
SIZE_T
size
);
HRESULT
WINAPI
PathCchRenameExtension
(
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
*
extension
);
HRESULT
WINAPI
PathCchRenameExtension
(
WCHAR
*
path
,
SIZE_T
size
,
const
WCHAR
*
extension
);
BOOL
WINAPI
PathIsUNCEx
(
const
WCHAR
*
path
,
const
WCHAR
**
server
);
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