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;
|
NTSTATUS status;
|
||||||
HANDLE dir, root, handle;
|
HANDLE dir, root, handle;
|
||||||
WCHAR path[MAX_PATH];
|
WCHAR path[MAX_PATH];
|
||||||
BYTE data[8192];
|
BYTE data[1024];
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
IO_STATUS_BLOCK io;
|
IO_STATUS_BLOCK io;
|
||||||
UNICODE_STRING nameW;
|
UNICODE_STRING nameW;
|
||||||
|
@ -320,56 +320,52 @@ static void open_file_test(void)
|
||||||
/* try open by file id */
|
/* try open by file id */
|
||||||
|
|
||||||
while (!pNtQueryDirectoryFile( dir, NULL, NULL, NULL, &io, data, sizeof(data),
|
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;
|
FILE_ID_BOTH_DIRECTORY_INFORMATION *info = (FILE_ID_BOTH_DIRECTORY_INFORMATION *)data;
|
||||||
|
|
||||||
restart = FALSE;
|
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;
|
win_skip( "FILE_OPEN_BY_FILE_ID not supported\n" );
|
||||||
nameW.Buffer = (WCHAR *)&info->FileId;
|
break;
|
||||||
nameW.Length = sizeof(info->FileId);
|
}
|
||||||
info->FileName[info->FileNameLength/sizeof(WCHAR)] = 0;
|
if (!status)
|
||||||
attr.RootDirectory = dir;
|
{
|
||||||
|
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,
|
status = pNtOpenFile( &handle, GENERIC_READ, &attr, &io,
|
||||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||||
FILE_OPEN_BY_FILE_ID |
|
FILE_OPEN_BY_FILE_ID |
|
||||||
((info->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? FILE_DIRECTORY_FILE : 0) );
|
((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 );
|
"open %s failed %x\n", wine_dbgstr_w(info->FileName), status );
|
||||||
if (status == STATUS_NOT_IMPLEMENTED)
|
if (!status) CloseHandle( handle );
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue