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
62c4ffb4
Commit
62c4ffb4
authored
Oct 09, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Support NT prefix paths in PathGetDriveNumberW.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
63d6dce0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
path.c
dlls/shlwapi/path.c
+17
-9
path.c
dlls/shlwapi/tests/path.c
+12
-0
No files found.
dlls/shlwapi/path.c
View file @
62c4ffb4
...
...
@@ -538,17 +538,25 @@ int WINAPI PathGetDriveNumberA(LPCSTR lpszPath)
*
* See PathGetDriveNumberA.
*/
int
WINAPI
PathGetDriveNumberW
(
LPCWSTR
lpszP
ath
)
int
WINAPI
PathGetDriveNumberW
(
const
WCHAR
*
p
ath
)
{
TRACE
(
"(%s)
\n
"
,
debugstr_w
(
lpszPath
))
;
WCHAR
drive
;
if
(
lpszPath
)
{
WCHAR
tl
=
tolowerW
(
lpszPath
[
0
]);
if
(
tl
>=
'a'
&&
tl
<=
'z'
&&
lpszPath
[
1
]
==
':'
)
return
tl
-
'a'
;
}
return
-
1
;
static
const
WCHAR
nt_prefixW
[]
=
{
'\\'
,
'\\'
,
'?'
,
'\\'
};
TRACE
(
"(%s)
\n
"
,
debugstr_w
(
path
));
if
(
!
path
)
return
-
1
;
if
(
!
strncmpW
(
path
,
nt_prefixW
,
4
))
path
+=
4
;
drive
=
tolowerW
(
path
[
0
]);
if
(
drive
<
'a'
||
drive
>
'z'
||
path
[
1
]
!=
':'
)
return
-
1
;
return
drive
-
'a'
;
}
/*************************************************************************
...
...
dlls/shlwapi/tests/path.c
View file @
62c4ffb4
...
...
@@ -1429,6 +1429,11 @@ static void test_PathGetDriveNumber(void)
static
const
CHAR
test2A
[]
=
"file:////b:
\\
test.file"
;
static
const
CHAR
test3A
[]
=
"file:///c:
\\
test.file"
;
static
const
CHAR
test4A
[]
=
"file:
\\\\
c:
\\
test.file"
;
static
const
CHAR
test5A
[]
=
"
\\\\
?
\\
C:
\\
dir
\\
file.txt"
;
static
const
WCHAR
test1W
[]
=
{
'a'
,
':'
,
'\\'
,
0
};
static
const
WCHAR
test5W
[]
=
{
'\\'
,
'\\'
,
'?'
,
'\\'
,
'C'
,
':'
,
'\\'
,
'd'
,
'i'
,
'r'
,
'\\'
,
'f'
,
'i'
,
'l'
,
'e'
,
0
};
int
ret
;
SetLastError
(
0xdeadbeef
);
...
...
@@ -1438,12 +1443,19 @@ static void test_PathGetDriveNumber(void)
ret
=
PathGetDriveNumberA
(
test1A
);
ok
(
ret
==
0
,
"got %d
\n
"
,
ret
);
ret
=
PathGetDriveNumberW
(
test1W
);
ok
(
ret
==
0
,
"got %d
\n
"
,
ret
);
ret
=
PathGetDriveNumberA
(
test2A
);
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ret
=
PathGetDriveNumberA
(
test3A
);
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ret
=
PathGetDriveNumberA
(
test4A
);
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ret
=
PathGetDriveNumberA
(
test5A
);
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ret
=
PathGetDriveNumberW
(
test5W
);
ok
(
ret
==
2
||
broken
(
ret
==
-
1
)
/* winxp */
,
"got = %d
\n
"
,
ret
);
}
static
void
test_PathUnExpandEnvStrings
(
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