[ros-diffs] [pschweitzer] 50980: [KERNEL32] FlushFileBuffers: - In spite of what MSDN pretends, it appears that FlushFileBuffers flushes console input buffer when it's called with a console handle. Then, do it...

pschweitzer at svn.reactos.org pschweitzer at svn.reactos.org
Sun Mar 6 10:28:50 UTC 2011


Author: pschweitzer
Date: Sun Mar  6 10:28:50 2011
New Revision: 50980

URL: http://svn.reactos.org/svn/reactos?rev=50980&view=rev
Log:
[KERNEL32]
FlushFileBuffers:
- In spite of what MSDN pretends, it appears that FlushFileBuffers flushes console input buffer when it's called with a console handle. Then, do it here as well.
- Get rid of SetLastErrorByStatus here...

Modified:
    trunk/reactos/dll/win32/kernel32/file/file.c

Modified: trunk/reactos/dll/win32/kernel32/file/file.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/file.c?rev=50980&r1=50979&r2=50980&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/file/file.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/file/file.c [iso-8859-1] Sun Mar  6 10:28:50 2011
@@ -406,26 +406,26 @@
  * @implemented
  */
 BOOL WINAPI
-FlushFileBuffers(HANDLE hFile)
-{
-    NTSTATUS errCode;
+FlushFileBuffers(IN HANDLE hFile)
+{
+    NTSTATUS Status;
     IO_STATUS_BLOCK IoStatusBlock;
 
     hFile = TranslateStdHandle(hFile);
 
     if (IsConsoleHandle(hFile))
     {
+        return FlushConsoleInputBuffer(hFile);
+    }
+
+    Status = NtFlushBuffersFile(hFile,
+                                &IoStatusBlock);
+    if (!NT_SUCCESS(Status))
+    {
+        BaseSetLastNTError(Status);
         return FALSE;
     }
-
-    errCode = NtFlushBuffersFile(hFile,
-                                 &IoStatusBlock);
-    if (!NT_SUCCESS(errCode))
-    {
-        SetLastErrorByStatus(errCode);
-        return(FALSE);
-    }
-    return(TRUE);
+    return TRUE;
 }
 
 




More information about the Ros-diffs mailing list