ntdll: Improve stub for FileFsAttributeInformation in NtQueryVolumeInformationFile.

This commit is contained in:
André Hentschel 2013-03-25 16:07:33 +01:00 committed by Alexandre Julliard
parent 7b9fc3bb7d
commit d53a55ea88
2 changed files with 65 additions and 1 deletions

View File

@ -92,6 +92,7 @@ mode_t FILE_umask = 0;
#define SECSPERDAY 86400
#define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY)
static const WCHAR ntfsW[] = {'N','T','F','S'};
/**************************************************************************
* FILE_CreateFile (internal)
@ -2639,7 +2640,23 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io
}
break;
case FileFsAttributeInformation:
FIXME( "%p: attribute info not supported\n", handle );
if (length < offsetof( FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName[sizeof(ntfsW)/sizeof(WCHAR)] ))
io->u.Status = STATUS_BUFFER_TOO_SMALL;
else
{
FILE_FS_ATTRIBUTE_INFORMATION *info = buffer;
FIXME( "%p: faking attribute info\n", handle );
info->FileSystemAttribute = FILE_SUPPORTS_ENCRYPTION | FILE_FILE_COMPRESSION |
FILE_PERSISTENT_ACLS | FILE_UNICODE_ON_DISK |
FILE_CASE_PRESERVED_NAMES | FILE_CASE_SENSITIVE_SEARCH;
info->MaximumComponentNameLength = MAXIMUM_FILENAME_LENGTH - 1;
info->FileSystemNameLength = sizeof(ntfsW);
memcpy(info->FileSystemName, ntfsW, sizeof(ntfsW));
io->Information = sizeof(*info);
io->u.Status = STATUS_SUCCESS;
}
break;
case FileFsControlInformation:
FIXME( "%p: control info not supported\n", handle );

View File

@ -1634,6 +1634,52 @@ todo_wine
CloseHandle( dir );
}
static void test_query_attribute_information_file(void)
{
NTSTATUS status;
HANDLE dir;
WCHAR path[MAX_PATH];
OBJECT_ATTRIBUTES attr;
IO_STATUS_BLOCK io;
UNICODE_STRING nameW;
FILE_FS_ATTRIBUTE_INFORMATION *ffai;
BYTE buf[sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + MAX_PATH * sizeof(WCHAR)];
GetWindowsDirectoryW( path, MAX_PATH );
pRtlDosPathNameToNtPathName_U( path, &nameW, NULL, NULL );
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
attr.ObjectName = &nameW;
attr.Attributes = OBJ_CASE_INSENSITIVE;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
status = pNtOpenFile( &dir, SYNCHRONIZE|FILE_LIST_DIRECTORY, &attr, &io,
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_DIRECTORY_FILE|FILE_SYNCHRONOUS_IO_NONALERT );
ok( !status, "open %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status );
pRtlFreeUnicodeString( &nameW );
ZeroMemory( buf, sizeof(buf) );
U(io).Status = 0xdadadada;
io.Information = 0xcacacaca;
status = pNtQueryVolumeInformationFile( dir, &io, buf, sizeof(buf), FileFsAttributeInformation );
ffai = (FILE_FS_ATTRIBUTE_INFORMATION *)buf;
ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %d\n", status);
ok(U(io).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %d\n", U(io).Status);
ok(ffai->FileSystemAttribute != 0, "Missing FileSystemAttribute\n");
ok(ffai->MaximumComponentNameLength != 0, "Missing MaximumComponentNameLength\n");
ok(ffai->FileSystemNameLength != 0, "Missing FileSystemNameLength\n");
trace("FileSystemAttribute: %x MaximumComponentNameLength: %x FileSystemName: %s\n",
ffai->FileSystemAttribute, ffai->MaximumComponentNameLength,
wine_dbgstr_wn(ffai->FileSystemName, ffai->FileSystemNameLength / sizeof(WCHAR)));
CloseHandle( dir );
}
static void test_NtCreateFile(void)
{
static const struct test_data
@ -1770,4 +1816,5 @@ START_TEST(file)
test_file_name_information();
test_file_all_name_information();
test_query_volume_information_file();
test_query_attribute_information_file();
}