[KERNEL32_VISTA] Import GetFileInformationByHandleEx() from Wine Staging 1.7.55....
[reactos.git] / reactos / dll / win32 / kernel32_vista / GetFileInformationByHandleEx.c
1
2 #include "k32_vista.h"
3
4 #include <ndk/rtlfuncs.h>
5 #include <ndk/iofuncs.h>
6
7 /* Taken from Wine kernel32/file.c */
8
9 /***********************************************************************
10 * GetFileInformationByHandleEx (KERNEL32.@)
11 */
12 BOOL WINAPI GetFileInformationByHandleEx( HANDLE handle, FILE_INFO_BY_HANDLE_CLASS class,
13 LPVOID info, DWORD size )
14 {
15 NTSTATUS status;
16 IO_STATUS_BLOCK io;
17
18 switch (class)
19 {
20 case FileStreamInfo:
21 case FileCompressionInfo:
22 case FileAttributeTagInfo:
23 case FileRemoteProtocolInfo:
24 case FileFullDirectoryInfo:
25 case FileFullDirectoryRestartInfo:
26 case FileStorageInfo:
27 case FileAlignmentInfo:
28 case FileIdInfo:
29 case FileIdExtdDirectoryInfo:
30 case FileIdExtdDirectoryRestartInfo:
31 //FIXME( "%p, %u, %p, %u\n", handle, class, info, size );
32 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
33 return FALSE;
34
35 case FileBasicInfo:
36 status = NtQueryInformationFile( handle, &io, info, size, FileBasicInformation );
37 break;
38
39 case FileStandardInfo:
40 status = NtQueryInformationFile( handle, &io, info, size, FileStandardInformation );
41 break;
42
43 case FileNameInfo:
44 status = NtQueryInformationFile( handle, &io, info, size, FileNameInformation );
45 break;
46
47 case FileIdBothDirectoryRestartInfo:
48 case FileIdBothDirectoryInfo:
49 status = NtQueryDirectoryFile( handle, NULL, NULL, NULL, &io, info, size,
50 FileIdBothDirectoryInformation, FALSE, NULL,
51 (class == FileIdBothDirectoryRestartInfo) );
52 break;
53
54 case FileRenameInfo:
55 case FileDispositionInfo:
56 case FileAllocationInfo:
57 case FileIoPriorityHintInfo:
58 case FileEndOfFileInfo:
59 default:
60 SetLastError( ERROR_INVALID_PARAMETER );
61 return FALSE;
62 }
63
64 if (status != STATUS_SUCCESS)
65 {
66 SetLastError( RtlNtStatusToDosError( status ) );
67 return FALSE;
68 }
69 return TRUE;
70 }