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
3465646d
Commit
3465646d
authored
Sep 06, 2013
by
Bruno Jesus
Committed by
Alexandre Julliard
Sep 09, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Fix parameters checking for GetVolumePathName().
parent
1c13e622
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
9 deletions
+27
-9
volume.c
dlls/kernel32/tests/volume.c
+8
-5
volume.c
dlls/kernel32/volume.c
+19
-4
No files found.
dlls/kernel32/tests/volume.c
View file @
3465646d
...
...
@@ -606,7 +606,6 @@ static void test_GetVolumePathNameA(void)
ret
=
pGetVolumePathNameA
(
NULL
,
NULL
,
0
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
||
broken
(
error
==
0xdeadbeef
)
/* <=XP */
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
error
);
...
...
@@ -615,7 +614,6 @@ todo_wine
ret
=
pGetVolumePathNameA
(
""
,
NULL
,
0
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
||
broken
(
error
==
0xdeadbeef
)
/* <=XP */
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
error
);
...
...
@@ -624,7 +622,6 @@ todo_wine
ret
=
pGetVolumePathNameA
(
pathC1
,
NULL
,
0
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
||
broken
(
error
==
ERROR_FILENAME_EXCED_RANGE
)
/* <=XP */
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
error
);
...
...
@@ -633,7 +630,6 @@ todo_wine
ret
=
pGetVolumePathNameA
(
pathC1
,
volume
,
0
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
||
broken
(
error
==
ERROR_FILENAME_EXCED_RANGE
)
/* <=XP */
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
error
);
...
...
@@ -642,7 +638,6 @@ todo_wine
ret
=
pGetVolumePathNameA
(
pathC1
,
volume
,
1
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
error
==
ERROR_FILENAME_EXCED_RANGE
,
"expected ERROR_FILENAME_EXCED_RANGE got %u
\n
"
,
error
);
volume
[
0
]
=
'\0'
;
...
...
@@ -664,6 +659,14 @@ todo_wine
ok
(
ret
,
"expected success
\n
"
);
todo_wine
ok
(
!
strcmp
(
expected
,
volume
),
"expected name '%s', returned '%s'
\n
"
,
expected
,
volume
);
/* test an invalid path */
SetLastError
(
0xdeadbeef
);
ret
=
pGetVolumePathNameA
(
"
\\\\
$$$"
,
volume
,
1
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_NAME
||
broken
(
ERROR_FILENAME_EXCED_RANGE
)
/* <=2000 */
,
"expected ERROR_INVALID_NAME got %u
\n
"
,
error
);
}
static
void
test_GetVolumePathNamesForVolumeNameA
(
void
)
...
...
dlls/kernel32/volume.c
View file @
3465646d
...
...
@@ -1782,12 +1782,14 @@ BOOL WINAPI GetDiskFreeSpaceA( LPCSTR root, LPDWORD cluster_sectors,
BOOL
WINAPI
GetVolumePathNameA
(
LPCSTR
filename
,
LPSTR
volumepathname
,
DWORD
buflen
)
{
BOOL
ret
;
WCHAR
*
filenameW
=
NULL
,
*
volumeW
;
WCHAR
*
filenameW
=
NULL
,
*
volumeW
=
NULL
;
FIXME
(
"(%s, %p, %d), stub!
\n
"
,
debugstr_a
(
filename
),
volumepathname
,
buflen
);
if
(
filename
&&
!
(
filenameW
=
FILE_name_AtoW
(
filename
,
FALSE
)))
return
FALSE
;
if
(
!
(
volumeW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buflen
*
sizeof
(
WCHAR
)
)))
return
FALSE
;
if
(
filename
&&
!
(
filenameW
=
FILE_name_AtoW
(
filename
,
FALSE
)))
return
FALSE
;
if
(
volumepathname
&&
!
(
volumeW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buflen
*
sizeof
(
WCHAR
)
)))
return
FALSE
;
if
((
ret
=
GetVolumePathNameW
(
filenameW
,
volumeW
,
buflen
)))
FILE_name_WtoA
(
volumeW
,
-
1
,
volumepathname
,
buflen
);
...
...
@@ -1805,14 +1807,27 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
FIXME
(
"(%s, %p, %d), stub!
\n
"
,
debugstr_w
(
filename
),
volumepathname
,
buflen
);
if
(
p
&&
tolowerW
(
p
[
0
])
>=
'a'
&&
tolowerW
(
p
[
0
])
<=
'z'
&&
p
[
1
]
==
':'
&&
p
[
2
]
==
'\\'
&&
buflen
>=
4
)
if
(
!
filename
||
!
volumepathname
||
!
buflen
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
p
&&
tolowerW
(
p
[
0
])
>=
'a'
&&
tolowerW
(
p
[
0
])
<=
'z'
&&
p
[
1
]
==
':'
&&
p
[
2
]
==
'\\'
)
{
if
(
buflen
<
4
)
{
SetLastError
(
ERROR_FILENAME_EXCED_RANGE
);
return
FALSE
;
}
volumepathname
[
0
]
=
p
[
0
];
volumepathname
[
1
]
=
':'
;
volumepathname
[
2
]
=
'\\'
;
volumepathname
[
3
]
=
0
;
return
TRUE
;
}
SetLastError
(
ERROR_INVALID_NAME
);
return
FALSE
;
}
...
...
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