According to the testbot results CreateDirectory("C:\\", NULL) fails
with ERROR_ACCESS_DENIED for not administrators. However with UAC enabled
and not and administrator account I get ERROR_ALREADY_EXISTS in that case
with Windows 7 64-bit running on real hardware. Moreover, Wine doesn't
really perform any access checks in that case and blindly assumes that
returning STATUS_ACCESS_DENIED is correct behaviour for the drive's root:
dlls/ntdll/directory.c,lookup_unix_name().
This patch fixes an application that can't find its data files because
after it receives ERROR_ACCESS_DENIED it stops further directory traversing.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This is needed by Office 2013, which hooks those functions and expects
flag to be set.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Windows autodetects up to 256 serial ports and 256 parallel ports per
system.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This was wrong-headed and could never have worked. The second getattrlist()
call that I was trying to avoid was only necessary when the first fails. Given
that the first failed, its results can't be used to avoid the second, no matter
what information we requested.
This reverts commit 5514df9d4e.
Extract a new function, get_dir_case_sensitivity_attr_by_id(), from
get_dir_case_sensitivity_attr(). Call that instead of get_dir_case_sensitivity()
from read_directory_getattrlist(). We get the device and file system IDs from
the same getattrlist() call we're already doing, so that avoids an extra call.
The docs for getattrlist() say that ATTR_CMN_NAME can return up to NAME_MAX + 1
Unicode characters (code points) encoded in UTF-8, which means it can be up to
NAME_MAX * 3 + 1 bytes.
It's necessary to return the actual filename with correct casing and a
plain stat doesn't allow that. Make read_directory_stat() return the
result of the stat() call on a case-insensitive filesystem only when the
file is missing.
When searching for a specific filename on a case-insensitive filesystem
we first try with stat(). If stat() does find the file we currently
return the requested filename back.
That presents an issue when the application cares about the casing of the
actual file stored on-disk. Specifically, NtQueryDirectoryFile is
supposed to return the actual filename with correct casing.
One possible solution to the issue, without having to resort to manually
scanning the directory entries, is to make use of the OS X getattrlist()
function, since it can return the filename stored on the filesystem.
hash_short_file_name() will always create a short name of at least 8 characters
with the 5th being a tilde (~). If the target name isn't of that form, then it
can never match any short name constructed from the directory entries.