Dmitry Gorbachev <hs26332@mail.cnt.ru>

- NtSetInformationFile() could be done before asynchronously called NtWriteFile is completed. Fix this by sending the synchronous flag.
- Check return status of the second NtSetInformationFile() call.
See issue #2071 for more details.

svn path=/trunk/; revision=29629
This commit is contained in:
Aleksey Bragin 2007-10-16 14:59:09 +00:00
parent 337bfc3217
commit 5cb248c027

View file

@ -204,7 +204,9 @@ SetupCopyFile(PWCHAR SourceFileName,
FILE_ATTRIBUTE_NORMAL, FILE_ATTRIBUTE_NORMAL,
0, 0,
FILE_OVERWRITE_IF, FILE_OVERWRITE_IF,
FILE_NO_INTERMEDIATE_BUFFERING | FILE_SEQUENTIAL_ONLY, FILE_NO_INTERMEDIATE_BUFFERING |
FILE_SEQUENTIAL_ONLY |
FILE_SYNCHRONOUS_IO_NONALERT,
NULL, NULL,
0); 0);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
@ -243,11 +245,17 @@ SetupCopyFile(PWCHAR SourceFileName,
} }
/* shorten the file back to it's real size after completing the write */ /* shorten the file back to it's real size after completing the write */
NtSetInformationFile(FileHandleDest, Status = NtSetInformationFile(FileHandleDest,
&IoStatusBlock, &IoStatusBlock,
&FileStandard.EndOfFile, &FileStandard.EndOfFile,
sizeof(FILE_END_OF_FILE_INFORMATION), sizeof(FILE_END_OF_FILE_INFORMATION),
FileEndOfFileInformation); FileEndOfFileInformation);
if(!NT_SUCCESS(Status))
{
DPRINT1("NtSetInformationFile failed: %x\n", Status);
}
closedest: closedest:
NtClose(FileHandleDest); NtClose(FileHandleDest);
unmapsrcsec: unmapsrcsec: