ntdll/tests: Enumerate one by one.
This commit is contained in:
parent
8b8d2038fb
commit
3536770083
|
@ -254,7 +254,7 @@ static void open_file_test(void)
|
|||
NTSTATUS status;
|
||||
HANDLE dir, root, handle;
|
||||
WCHAR path[MAX_PATH];
|
||||
BYTE data[8192];
|
||||
BYTE data[1024];
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
IO_STATUS_BLOCK io;
|
||||
UNICODE_STRING nameW;
|
||||
|
@ -320,56 +320,52 @@ static void open_file_test(void)
|
|||
/* try open by file id */
|
||||
|
||||
while (!pNtQueryDirectoryFile( dir, NULL, NULL, NULL, &io, data, sizeof(data),
|
||||
FileIdBothDirectoryInformation, FALSE, NULL, restart ))
|
||||
FileIdBothDirectoryInformation, TRUE, NULL, restart ))
|
||||
{
|
||||
FILE_ID_BOTH_DIRECTORY_INFORMATION *info = (FILE_ID_BOTH_DIRECTORY_INFORMATION *)data;
|
||||
|
||||
restart = FALSE;
|
||||
for (;;)
|
||||
|
||||
if (!info->FileId.QuadPart) continue;
|
||||
|
||||
nameW.Buffer = (WCHAR *)&info->FileId;
|
||||
nameW.Length = sizeof(info->FileId);
|
||||
info->FileName[info->FileNameLength/sizeof(WCHAR)] = 0;
|
||||
attr.RootDirectory = dir;
|
||||
status = pNtOpenFile( &handle, GENERIC_READ, &attr, &io,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
FILE_OPEN_BY_FILE_ID |
|
||||
((info->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? FILE_DIRECTORY_FILE : 0) );
|
||||
ok( status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED || status == STATUS_NOT_IMPLEMENTED,
|
||||
"open %s failed %x\n", wine_dbgstr_w(info->FileName), status );
|
||||
if (status == STATUS_NOT_IMPLEMENTED)
|
||||
{
|
||||
if (!info->FileId.QuadPart) goto next;
|
||||
nameW.Buffer = (WCHAR *)&info->FileId;
|
||||
nameW.Length = sizeof(info->FileId);
|
||||
info->FileName[info->FileNameLength/sizeof(WCHAR)] = 0;
|
||||
attr.RootDirectory = dir;
|
||||
win_skip( "FILE_OPEN_BY_FILE_ID not supported\n" );
|
||||
break;
|
||||
}
|
||||
if (!status)
|
||||
{
|
||||
FILE_ALL_INFORMATION all_info;
|
||||
|
||||
if (!pNtQueryInformationFile( handle, &io, &all_info, sizeof(all_info), FileAllInformation ))
|
||||
{
|
||||
/* check that it's the same file */
|
||||
ok( info->EndOfFile.QuadPart == all_info.StandardInformation.EndOfFile.QuadPart,
|
||||
"mismatched file size for %s\n", wine_dbgstr_w(info->FileName));
|
||||
ok( info->LastWriteTime.QuadPart == all_info.BasicInformation.LastWriteTime.QuadPart,
|
||||
"mismatched write time for %s\n", wine_dbgstr_w(info->FileName));
|
||||
}
|
||||
CloseHandle( handle );
|
||||
|
||||
/* try same thing from drive root */
|
||||
attr.RootDirectory = root;
|
||||
status = pNtOpenFile( &handle, GENERIC_READ, &attr, &io,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
FILE_OPEN_BY_FILE_ID |
|
||||
((info->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? FILE_DIRECTORY_FILE : 0) );
|
||||
ok( status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED || status == STATUS_NOT_IMPLEMENTED,
|
||||
ok( status == STATUS_SUCCESS || status == STATUS_NOT_IMPLEMENTED,
|
||||
"open %s failed %x\n", wine_dbgstr_w(info->FileName), status );
|
||||
if (status == STATUS_NOT_IMPLEMENTED)
|
||||
{
|
||||
win_skip( "FILE_OPEN_BY_FILE_ID not supported\n" );
|
||||
break;
|
||||
}
|
||||
if (!status)
|
||||
{
|
||||
FILE_ALL_INFORMATION all_info;
|
||||
|
||||
if (!pNtQueryInformationFile( handle, &io, &all_info, sizeof(all_info), FileAllInformation ))
|
||||
{
|
||||
/* check that it's the same file */
|
||||
ok( info->EndOfFile.QuadPart == all_info.StandardInformation.EndOfFile.QuadPart,
|
||||
"mismatched file size for %s\n", wine_dbgstr_w(info->FileName));
|
||||
ok( info->LastWriteTime.QuadPart == all_info.BasicInformation.LastWriteTime.QuadPart,
|
||||
"mismatched write time for %s\n", wine_dbgstr_w(info->FileName));
|
||||
}
|
||||
CloseHandle( handle );
|
||||
|
||||
/* try same thing from drive root */
|
||||
attr.RootDirectory = root;
|
||||
status = pNtOpenFile( &handle, GENERIC_READ, &attr, &io,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
FILE_OPEN_BY_FILE_ID |
|
||||
((info->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? FILE_DIRECTORY_FILE : 0) );
|
||||
ok( status == STATUS_SUCCESS || status == STATUS_NOT_IMPLEMENTED,
|
||||
"open %s failed %x\n", wine_dbgstr_w(info->FileName), status );
|
||||
if (!status) CloseHandle( handle );
|
||||
}
|
||||
next:
|
||||
if (!info->NextEntryOffset) break;
|
||||
info = (FILE_ID_BOTH_DIRECTORY_INFORMATION *)((char *)info + info->NextEntryOffset);
|
||||
if (!status) CloseHandle( handle );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue