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
ee0f0da6
Commit
ee0f0da6
authored
Oct 20, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Use RtlDosPathNameToNtPathName_U to validate the path in GetVolumeInformationW.
parent
1dc1ba14
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
19 deletions
+25
-19
volume.c
dlls/kernel32/tests/volume.c
+4
-5
volume.c
dlls/kernel32/volume.c
+21
-14
No files found.
dlls/kernel32/tests/volume.c
View file @
ee0f0da6
...
@@ -324,7 +324,6 @@ static void test_GetVolumeInformationA(void)
...
@@ -324,7 +324,6 @@ static void test_GetVolumeInformationA(void)
ok
(
ret
,
"SetCurrentDirectory: error %d
\n
"
,
GetLastError
());
ok
(
ret
,
"SetCurrentDirectory: error %d
\n
"
,
GetLastError
());
ret
=
pGetVolumeInformationA
(
Root_Colon
,
vol_name_buf
,
vol_name_size
,
NULL
,
ret
=
pGetVolumeInformationA
(
Root_Colon
,
vol_name_buf
,
vol_name_size
,
NULL
,
NULL
,
NULL
,
fs_name_buf
,
fs_name_len
);
NULL
,
NULL
,
fs_name_buf
,
fs_name_len
);
todo_wine
ok
(
ret
,
"GetVolumeInformationA root failed, last error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"GetVolumeInformationA root failed, last error %u
\n
"
,
GetLastError
());
/* check for error on no trailing \ when current dir is subdir (windows) of queried drive */
/* check for error on no trailing \ when current dir is subdir (windows) of queried drive */
...
@@ -392,7 +391,7 @@ static void test_GetVolumeInformationA(void)
...
@@ -392,7 +391,7 @@ static void test_GetVolumeInformationA(void)
/* \ is current on root drive, call succeeds */
/* \ is current on root drive, call succeeds */
ret
=
pGetVolumeInformationA
(
Root_Colon
,
vol_name_buf
,
vol_name_size
,
NULL
,
ret
=
pGetVolumeInformationA
(
Root_Colon
,
vol_name_buf
,
vol_name_size
,
NULL
,
NULL
,
NULL
,
fs_name_buf
,
fs_name_len
);
NULL
,
NULL
,
fs_name_buf
,
fs_name_len
);
todo_wine
ok
(
ret
,
"GetVolumeInformationA failed, last error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"GetVolumeInformationA failed, last error %u
\n
"
,
GetLastError
());
/* again, SetCurrentDirectory on another drive does not matter */
/* again, SetCurrentDirectory on another drive does not matter */
ret
=
SetCurrentDirectory
(
Root_Slash
);
ret
=
SetCurrentDirectory
(
Root_Slash
);
...
@@ -403,7 +402,7 @@ static void test_GetVolumeInformationA(void)
...
@@ -403,7 +402,7 @@ static void test_GetVolumeInformationA(void)
/* \ is current on root drive, call succeeds */
/* \ is current on root drive, call succeeds */
ret
=
pGetVolumeInformationA
(
Root_Colon
,
vol_name_buf
,
vol_name_size
,
NULL
,
ret
=
pGetVolumeInformationA
(
Root_Colon
,
vol_name_buf
,
vol_name_size
,
NULL
,
NULL
,
NULL
,
fs_name_buf
,
fs_name_len
);
NULL
,
NULL
,
fs_name_buf
,
fs_name_len
);
todo_wine
ok
(
ret
,
"GetVolumeInformationA failed, last error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"GetVolumeInformationA failed, last error %u
\n
"
,
GetLastError
());
}
}
/* try null root directory to return "root of the current directory" */
/* try null root directory to return "root of the current directory" */
...
@@ -420,7 +419,7 @@ static void test_GetVolumeInformationA(void)
...
@@ -420,7 +419,7 @@ static void test_GetVolumeInformationA(void)
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetVolumeInformationA
(
Root_UNC
,
vol_name_buf
,
vol_name_size
,
ret
=
pGetVolumeInformationA
(
Root_UNC
,
vol_name_buf
,
vol_name_size
,
&
vol_serial_num
,
&
max_comp_len
,
&
fs_flags
,
fs_name_buf
,
fs_name_len
);
&
vol_serial_num
,
&
max_comp_len
,
&
fs_flags
,
fs_name_buf
,
fs_name_len
);
todo_wine
ok
(
ret
||
broken
(
!
ret
/* win9x */
&&
GetLastError
()
==
ERROR_BAD_NETPATH
),
ok
(
ret
||
broken
(
!
ret
/* win9x */
&&
GetLastError
()
==
ERROR_BAD_NETPATH
),
"GetVolumeInformationA did%s fail, root=%s, last error=%u
\n
"
,
ret
?
" not"
:
""
,
Root_UNC
,
GetLastError
());
"GetVolumeInformationA did%s fail, root=%s, last error=%u
\n
"
,
ret
?
" not"
:
""
,
Root_UNC
,
GetLastError
());
/* try again with device name space */
/* try again with device name space */
...
@@ -428,7 +427,7 @@ static void test_GetVolumeInformationA(void)
...
@@ -428,7 +427,7 @@ static void test_GetVolumeInformationA(void)
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetVolumeInformationA
(
Root_UNC
,
vol_name_buf
,
vol_name_size
,
ret
=
pGetVolumeInformationA
(
Root_UNC
,
vol_name_buf
,
vol_name_size
,
&
vol_serial_num
,
&
max_comp_len
,
&
fs_flags
,
fs_name_buf
,
fs_name_len
);
&
vol_serial_num
,
&
max_comp_len
,
&
fs_flags
,
fs_name_buf
,
fs_name_len
);
todo_wine
ok
(
ret
||
broken
(
!
ret
/* win9x */
&&
GetLastError
()
==
ERROR_BAD_NETPATH
),
ok
(
ret
||
broken
(
!
ret
/* win9x */
&&
GetLastError
()
==
ERROR_BAD_NETPATH
),
"GetVolumeInformationA did%s fail, root=%s, last error=%u
\n
"
,
ret
?
" not"
:
""
,
Root_UNC
,
GetLastError
());
"GetVolumeInformationA did%s fail, root=%s, last error=%u
\n
"
,
ret
?
" not"
:
""
,
Root_UNC
,
GetLastError
());
/* try again with a directory off the root - should generate error */
/* try again with a directory off the root - should generate error */
...
...
dlls/kernel32/volume.c
View file @
ee0f0da6
...
@@ -513,26 +513,29 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
...
@@ -513,26 +513,29 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
static
const
WCHAR
fat32W
[]
=
{
'F'
,
'A'
,
'T'
,
'3'
,
'2'
,
0
};
static
const
WCHAR
fat32W
[]
=
{
'F'
,
'A'
,
'T'
,
'3'
,
'2'
,
0
};
static
const
WCHAR
ntfsW
[]
=
{
'N'
,
'T'
,
'F'
,
'S'
,
0
};
static
const
WCHAR
ntfsW
[]
=
{
'N'
,
'T'
,
'F'
,
'S'
,
0
};
static
const
WCHAR
cdfsW
[]
=
{
'C'
,
'D'
,
'F'
,
'S'
,
0
};
static
const
WCHAR
cdfsW
[]
=
{
'C'
,
'D'
,
'F'
,
'S'
,
0
};
static
const
WCHAR
default_rootW
[]
=
{
'\\'
,
0
};
WCHAR
device
[]
=
{
'\\'
,
'\\'
,
'.'
,
'\\'
,
'A'
,
':'
,
0
};
WCHAR
device
[]
=
{
'\\'
,
'\\'
,
'.'
,
'\\'
,
'A'
,
':'
,
0
};
HANDLE
handle
;
HANDLE
handle
;
UNICODE_STRING
nt_name
;
WCHAR
*
p
;
enum
fs_type
type
=
FS_UNKNOWN
;
enum
fs_type
type
=
FS_UNKNOWN
;
BOOL
ret
=
FALSE
;
if
(
!
root
)
if
(
!
root
)
root
=
default_rootW
;
if
(
!
RtlDosPathNameToNtPathName_U
(
root
,
&
nt_name
,
NULL
,
NULL
))
{
{
WCHAR
path
[
MAX_PATH
];
SetLastError
(
ERROR_PATH_NOT_FOUND
);
GetCurrentDirectoryW
(
MAX_PATH
,
path
);
return
FALSE
;
device
[
4
]
=
path
[
0
];
}
}
else
/* there must be exactly one backslash in the name, at the end */
p
=
memchrW
(
nt_name
.
Buffer
+
4
,
'\\'
,
(
nt_name
.
Length
-
4
)
/
sizeof
(
WCHAR
)
);
if
(
p
!=
nt_name
.
Buffer
+
nt_name
.
Length
/
sizeof
(
WCHAR
)
-
1
)
{
{
if
(
!
root
[
0
]
||
root
[
1
]
!=
':'
||
root
[
lstrlenW
(
root
)
-
1
]
!=
'\\'
)
SetLastError
(
ERROR_INVALID_NAME
);
{
goto
done
;
SetLastError
(
ERROR_INVALID_NAME
);
return
FALSE
;
}
device
[
4
]
=
root
[
0
];
}
}
device
[
4
]
=
nt_name
.
Buffer
[
4
];
/* try to open the device */
/* try to open the device */
...
@@ -566,7 +569,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
...
@@ -566,7 +569,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
}
}
CloseHandle
(
handle
);
CloseHandle
(
handle
);
TRACE
(
"%s: found fs type %d
\n
"
,
debugstr_w
(
device
),
type
);
TRACE
(
"%s: found fs type %d
\n
"
,
debugstr_w
(
device
),
type
);
if
(
type
==
FS_ERROR
)
return
FALSE
;
if
(
type
==
FS_ERROR
)
goto
done
;
if
(
label
&&
label_len
)
VOLUME_GetSuperblockLabel
(
device
,
type
,
superblock
,
label
,
label_len
);
if
(
label
&&
label_len
)
VOLUME_GetSuperblockLabel
(
device
,
type
,
superblock
,
label
,
label_len
);
if
(
serial
)
*
serial
=
VOLUME_GetSuperblockSerial
(
device
,
type
,
superblock
);
if
(
serial
)
*
serial
=
VOLUME_GetSuperblockSerial
(
device
,
type
,
superblock
);
...
@@ -581,7 +584,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
...
@@ -581,7 +584,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
case
DRIVE_UNKNOWN
:
case
DRIVE_UNKNOWN
:
case
DRIVE_NO_ROOT_DIR
:
case
DRIVE_NO_ROOT_DIR
:
SetLastError
(
ERROR_NOT_READY
);
SetLastError
(
ERROR_NOT_READY
);
return
FALSE
;
goto
done
;
case
DRIVE_REMOVABLE
:
case
DRIVE_REMOVABLE
:
case
DRIVE_FIXED
:
case
DRIVE_FIXED
:
case
DRIVE_REMOTE
:
case
DRIVE_REMOTE
:
...
@@ -618,7 +621,11 @@ fill_fs_info: /* now fill in the information that depends on the file system ty
...
@@ -618,7 +621,11 @@ fill_fs_info: /* now fill in the information that depends on the file system ty
if
(
flags
)
*
flags
=
FILE_CASE_PRESERVED_NAMES
;
if
(
flags
)
*
flags
=
FILE_CASE_PRESERVED_NAMES
;
break
;
break
;
}
}
return
TRUE
;
ret
=
TRUE
;
done:
RtlFreeUnicodeString
(
&
nt_name
);
return
ret
;
}
}
...
...
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