mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 23:45:42 +00:00
set correct last error
svn path=/trunk/; revision=11966
This commit is contained in:
parent
dd196f60cb
commit
7a214c6c4b
1 changed files with 20 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: create.c,v 1.41 2004/11/29 17:31:21 gdalsnes Exp $
|
/* $Id: create.c,v 1.42 2004/12/06 14:24:51 gdalsnes Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -271,11 +271,25 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName,
|
||||||
RtlFreeUnicodeString(&NtPathU);
|
RtlFreeUnicodeString(&NtPathU);
|
||||||
|
|
||||||
/* error */
|
/* error */
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastErrorByStatus (Status);
|
/* In the case file creation was rejected due to CREATE_NEW flag
|
||||||
return INVALID_HANDLE_VALUE;
|
* was specified and file with that name already exists, correct
|
||||||
}
|
* last error is ERROR_FILE_EXISTS and not ERROR_ALREADY_EXISTS.
|
||||||
|
* Note: RtlNtStatusToDosError is not the subject to blame here.
|
||||||
|
*/
|
||||||
|
if (Status == STATUS_OBJECT_NAME_COLLISION &&
|
||||||
|
dwCreationDisposition == FILE_CREATE)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_FILE_EXISTS );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetLastErrorByStatus (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
return INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
create with OPEN_ALWAYS (FILE_OPEN_IF) returns info = FILE_OPENED or FILE_CREATED
|
create with OPEN_ALWAYS (FILE_OPEN_IF) returns info = FILE_OPENED or FILE_CREATED
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue