[KERNEL32_VISTA] Import GetFileInformationByHandleEx() from Wine Staging 1.7.55....
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 17 Nov 2015 10:40:04 +0000 (10:40 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 17 Nov 2015 10:40:04 +0000 (10:40 +0000)
svn path=/trunk/; revision=69911

reactos/dll/win32/kernel32_vista/CMakeLists.txt
reactos/dll/win32/kernel32_vista/GetFileInformationByHandleEx.c [new file with mode: 0644]
reactos/dll/win32/kernel32_vista/kernel32_vista.spec

index 65cf814..57333ff 100644 (file)
@@ -7,6 +7,7 @@ spec2def(kernel32_vista.dll kernel32_vista.spec ADD_IMPORTLIB)
 
 list(APPEND SOURCE
     DllMain.c
+    GetFileInformationByHandleEx.c
     GetTickCount64.c
     InitOnceExecuteOnce.c
     ${CMAKE_CURRENT_BINARY_DIR}/kernel32_vista.def)
diff --git a/reactos/dll/win32/kernel32_vista/GetFileInformationByHandleEx.c b/reactos/dll/win32/kernel32_vista/GetFileInformationByHandleEx.c
new file mode 100644 (file)
index 0000000..e515d30
--- /dev/null
@@ -0,0 +1,70 @@
+
+#include "k32_vista.h"
+
+#include <ndk/rtlfuncs.h>
+#include <ndk/iofuncs.h>
+
+/* Taken from Wine kernel32/file.c */
+
+/***********************************************************************
+*             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 FileStreamInfo:
+    case FileCompressionInfo:
+    case FileAttributeTagInfo:
+    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 FileBasicInfo:
+        status = NtQueryInformationFile( handle, &io, info, size, FileBasicInformation );
+        break;
+
+    case FileStandardInfo:
+        status = NtQueryInformationFile( handle, &io, info, size, FileStandardInformation );
+        break;
+
+    case FileNameInfo:
+        status = NtQueryInformationFile( handle, &io, info, size, FileNameInformation );
+        break;
+
+    case FileIdBothDirectoryRestartInfo:
+    case FileIdBothDirectoryInfo:
+        status = NtQueryDirectoryFile( handle, NULL, NULL, NULL, &io, info, size,
+                                       FileIdBothDirectoryInformation, FALSE, NULL,
+                                       (class == FileIdBothDirectoryRestartInfo) );
+        break;
+
+    case FileRenameInfo:
+    case FileDispositionInfo:
+    case FileAllocationInfo:
+    case FileIoPriorityHintInfo:
+    case FileEndOfFileInfo:
+    default:
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return FALSE;
+    }
+
+    if (status != STATUS_SUCCESS)
+    {
+        SetLastError( RtlNtStatusToDosError( status ) );
+        return FALSE;
+    }
+    return TRUE;
+}
index 4594116..c046b0e 100644 (file)
@@ -1,3 +1,4 @@
 
-@ stdcall -ret64 GetTickCount64()
 @ stdcall InitOnceExecuteOnce(ptr ptr ptr ptr)
+@ stdcall GetFileInformationByHandleEx(long long ptr long)
+@ stdcall -ret64 GetTickCount64()