[KERNEL32]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 6 Mar 2011 10:28:50 +0000 (10:28 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 6 Mar 2011 10:28:50 +0000 (10:28 +0000)
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...

svn path=/trunk/; revision=50980

reactos/dll/win32/kernel32/file/file.c

index 0d5d251..1f9124b 100644 (file)
@@ -406,26 +406,26 @@ OpenFile(LPCSTR lpFileName,
  * @implemented
  */
 BOOL WINAPI
-FlushFileBuffers(HANDLE hFile)
+FlushFileBuffers(IN HANDLE hFile)
 {
-    NTSTATUS errCode;
+    NTSTATUS Status;
     IO_STATUS_BLOCK IoStatusBlock;
 
     hFile = TranslateStdHandle(hFile);
 
     if (IsConsoleHandle(hFile))
     {
-        return FALSE;
+        return FlushConsoleInputBuffer(hFile);
     }
 
-    errCode = NtFlushBuffersFile(hFile,
-                                 &IoStatusBlock);
-    if (!NT_SUCCESS(errCode))
+    Status = NtFlushBuffersFile(hFile,
+                                &IoStatusBlock);
+    if (!NT_SUCCESS(Status))
     {
-        SetLastErrorByStatus(errCode);
-        return(FALSE);
+        BaseSetLastNTError(Status);
+        return FALSE;
     }
-    return(TRUE);
+    return TRUE;
 }