Commit 6314cf02 authored by Vincas Miliūnas's avatar Vincas Miliūnas Committed by Alexandre Julliard

kernel32: Added implementation of FileIdBothDirectoryInfo for GetFileInformationByHandleEx.

parent 9cec60bb
...@@ -864,6 +864,59 @@ BOOL WINAPI GetFileInformationByHandle( HANDLE hFile, BY_HANDLE_FILE_INFORMATION ...@@ -864,6 +864,59 @@ BOOL WINAPI GetFileInformationByHandle( HANDLE hFile, BY_HANDLE_FILE_INFORMATION
/*********************************************************************** /***********************************************************************
* GetFileInformationByHandleEx (KERNEL32.@)
*/
BOOL WINAPI GetFileInformationByHandleEx( HANDLE handle, FILE_INFO_BY_HANDLE_CLASS class,
LPVOID info, DWORD size )
{
NTSTATUS status;
IO_STATUS_BLOCK io;
switch (class)
{
case FileBasicInfo:
case FileStandardInfo:
case FileNameInfo:
case FileRenameInfo:
case FileDispositionInfo:
case FileAllocationInfo:
case FileEndOfFileInfo:
case FileStreamInfo:
case FileCompressionInfo:
case FileAttributeTagInfo:
case FileIoPriorityHintInfo:
case FileRemoteProtocolInfo:
case FileFullDirectoryInfo:
case FileFullDirectoryRestartInfo:
case FileStorageInfo:
case FileAlignmentInfo:
case FileIdInfo:
case FileIdExtdDirectoryInfo:
case FileIdExtdDirectoryRestartInfo:
FIXME( "%p, %u, %p, %u\n", handle, class, info, size );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return FALSE;
case FileIdBothDirectoryRestartInfo:
case FileIdBothDirectoryInfo:
status = NtQueryDirectoryFile( handle, NULL, NULL, NULL, &io, info, size,
FileIdBothDirectoryInformation, FALSE, NULL,
(class == FileIdBothDirectoryRestartInfo) );
if (status != STATUS_SUCCESS)
{
SetLastError( RtlNtStatusToDosError( status ) );
return FALSE;
}
return TRUE;
default:
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
}
/***********************************************************************
* GetFileSize (KERNEL32.@) * GetFileSize (KERNEL32.@)
* *
* Retrieve the size of a file. * Retrieve the size of a file.
......
...@@ -533,6 +533,7 @@ ...@@ -533,6 +533,7 @@
@ stdcall GetFileAttributesExW(wstr long ptr) @ stdcall GetFileAttributesExW(wstr long ptr)
@ stdcall GetFileAttributesW(wstr) @ stdcall GetFileAttributesW(wstr)
@ stdcall GetFileInformationByHandle(long ptr) @ stdcall GetFileInformationByHandle(long ptr)
@ stdcall GetFileInformationByHandleEx(long long ptr long)
@ stdcall GetFileSize(long ptr) @ stdcall GetFileSize(long ptr)
@ stdcall GetFileSizeEx(long ptr) @ stdcall GetFileSizeEx(long ptr)
@ stdcall GetFileTime(long ptr ptr ptr) @ stdcall GetFileTime(long ptr ptr ptr)
......
...@@ -3303,7 +3303,6 @@ static void test_GetFileInformationByHandleEx(void) ...@@ -3303,7 +3303,6 @@ static void test_GetFileInformationByHandleEx(void)
{ {
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetFileInformationByHandleEx(directory, checks[i].handleClass, checks[i].ptr, checks[i].size); ret = pGetFileInformationByHandleEx(directory, checks[i].handleClass, checks[i].ptr, checks[i].size);
todo_wine
ok(!ret && GetLastError() == checks[i].errorCode, "GetFileInformationByHandleEx: expected error %u, " ok(!ret && GetLastError() == checks[i].errorCode, "GetFileInformationByHandleEx: expected error %u, "
"got %u.\n", checks[i].errorCode, GetLastError()); "got %u.\n", checks[i].errorCode, GetLastError());
} }
...@@ -3314,18 +3313,14 @@ static void test_GetFileInformationByHandleEx(void) ...@@ -3314,18 +3313,14 @@ static void test_GetFileInformationByHandleEx(void)
ret = pGetFileInformationByHandleEx(directory, FileIdBothDirectoryInfo, buffer, sizeof(buffer)); ret = pGetFileInformationByHandleEx(directory, FileIdBothDirectoryInfo, buffer, sizeof(buffer));
if (!ret && GetLastError() == ERROR_NO_MORE_FILES) if (!ret && GetLastError() == ERROR_NO_MORE_FILES)
break; break;
todo_wine
ok(ret, "GetFileInformationByHandleEx: failed to query for FileIdBothDirectoryInfo, got error %u.\n", GetLastError()); ok(ret, "GetFileInformationByHandleEx: failed to query for FileIdBothDirectoryInfo, got error %u.\n", GetLastError());
if (!ret) if (!ret)
break; break;
bothDirInfo = (FILE_ID_BOTH_DIR_INFO *)buffer; bothDirInfo = (FILE_ID_BOTH_DIR_INFO *)buffer;
while (TRUE) while (TRUE)
{ {
todo_wine
ok(bothDirInfo->FileAttributes != 0xffffffff, "GetFileInformationByHandleEx: returned invalid file attributes.\n"); ok(bothDirInfo->FileAttributes != 0xffffffff, "GetFileInformationByHandleEx: returned invalid file attributes.\n");
todo_wine
ok(bothDirInfo->FileId.u.LowPart != 0xffffffff, "GetFileInformationByHandleEx: returned invalid file id.\n"); ok(bothDirInfo->FileId.u.LowPart != 0xffffffff, "GetFileInformationByHandleEx: returned invalid file id.\n");
todo_wine
ok(bothDirInfo->FileNameLength != 0xffffffff, "GetFileInformationByHandleEx: returned invalid file name length.\n"); ok(bothDirInfo->FileNameLength != 0xffffffff, "GetFileInformationByHandleEx: returned invalid file name length.\n");
if (!bothDirInfo->NextEntryOffset) if (!bothDirInfo->NextEntryOffset)
break; break;
......
...@@ -2042,6 +2042,7 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event, ...@@ -2042,6 +2042,7 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event,
case FileIdBothDirectoryInformation: case FileIdBothDirectoryInformation:
case FileIdFullDirectoryInformation: case FileIdFullDirectoryInformation:
if (length < dir_info_size( info_class, 1 )) return io->u.Status = STATUS_INFO_LENGTH_MISMATCH; if (length < dir_info_size( info_class, 1 )) return io->u.Status = STATUS_INFO_LENGTH_MISMATCH;
if (!buffer) return io->u.Status = STATUS_ACCESS_VIOLATION;
break; break;
default: default:
FIXME( "Unsupported file info class %d\n", info_class ); FIXME( "Unsupported file info class %d\n", info_class );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment