[KERNEL32]
[reactos.git] / reactos / dll / win32 / kernel32 / client / file / copy.c
index 3eb763d..92c4555 100644 (file)
@@ -1,12 +1,12 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
- * FILE:            lib/kernel32/file/copy.c
+ * FILE:            dll/win32/kernel32/client/file/copy.c
  * PURPOSE:         Copying files
  * PROGRAMMER:      Ariadne (ariadne@xs4all.nl)
  * UPDATE HISTORY:
  *                  01/11/98 Created
- *                  07/02/99 Moved to seperate file
+ *                  07/02/99 Moved to separate file
  */
 
 /* INCLUDES ****************************************************************/
@@ -101,6 +101,13 @@ CopyLoop (
                                      RegionSize,
                                      NULL,
                                      NULL);
+                /* With sync read, 0 length + status success mean EOF:
+                 * https://msdn.microsoft.com/en-us/library/windows/desktop/aa365467(v=vs.85).aspx
+                 */
+                if (NT_SUCCESS(errCode) && IoStatusBlock.Information == 0)
+                {
+                    errCode = STATUS_END_OF_FILE;
+                }
                 if (NT_SUCCESS(errCode) && (NULL == pbCancel || ! *pbCancel))
                 {
                     errCode = NtWriteFile(FileHandleDest,