mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
- Fixed definition of assert macro.
- Fixed few DPRINTs to compile. - Handle OF_CREATE flag of OpenFile. svn path=/trunk/; revision=9492
This commit is contained in:
parent
f11893f56e
commit
5a22e5bcf0
3 changed files with 49 additions and 24 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: file.c,v 1.53 2004/03/18 18:29:18 weiden Exp $
|
/* $Id: file.c,v 1.54 2004/05/25 20:04:13 navaraf 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
|
||||||
|
@ -89,19 +89,22 @@ OpenFile(LPCSTR lpFileName,
|
||||||
RtlAnsiStringToUnicodeString (&FileNameU, &FileName, TRUE);
|
RtlAnsiStringToUnicodeString (&FileNameU, &FileName, TRUE);
|
||||||
else
|
else
|
||||||
RtlOemStringToUnicodeString (&FileNameU, &FileName, TRUE);
|
RtlOemStringToUnicodeString (&FileNameU, &FileName, TRUE);
|
||||||
|
|
||||||
Len = SearchPathW (NULL,
|
if ((uStyle & OF_CREATE) == 0)
|
||||||
FileNameU.Buffer,
|
|
||||||
NULL,
|
|
||||||
OFS_MAXPATHNAME,
|
|
||||||
PathNameW,
|
|
||||||
&FilePart);
|
|
||||||
|
|
||||||
RtlFreeUnicodeString(&FileNameU);
|
|
||||||
|
|
||||||
if (Len == 0 || Len > OFS_MAXPATHNAME)
|
|
||||||
{
|
{
|
||||||
return (HFILE)INVALID_HANDLE_VALUE;
|
Len = SearchPathW (NULL,
|
||||||
|
FileNameU.Buffer,
|
||||||
|
NULL,
|
||||||
|
OFS_MAXPATHNAME,
|
||||||
|
PathNameW,
|
||||||
|
&FilePart);
|
||||||
|
|
||||||
|
RtlFreeUnicodeString(&FileNameU);
|
||||||
|
|
||||||
|
if (Len == 0 || Len > OFS_MAXPATHNAME)
|
||||||
|
{
|
||||||
|
return (HFILE)INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName.Buffer = lpReOpenBuff->szPathName;
|
FileName.Buffer = lpReOpenBuff->szPathName;
|
||||||
|
@ -124,13 +127,6 @@ OpenFile(LPCSTR lpFileName,
|
||||||
return (HFILE)INVALID_HANDLE_VALUE;
|
return (HFILE)INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
|
|
||||||
ObjectAttributes.RootDirectory = NULL;
|
|
||||||
ObjectAttributes.ObjectName = &FileNameString;
|
|
||||||
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE| OBJ_INHERIT;
|
|
||||||
ObjectAttributes.SecurityDescriptor = NULL;
|
|
||||||
ObjectAttributes.SecurityQualityOfService = NULL;
|
|
||||||
|
|
||||||
// FILE_SHARE_READ
|
// FILE_SHARE_READ
|
||||||
// FILE_NO_INTERMEDIATE_BUFFERING
|
// FILE_NO_INTERMEDIATE_BUFFERING
|
||||||
|
|
||||||
|
@ -140,6 +136,35 @@ OpenFile(LPCSTR lpFileName,
|
||||||
return (HFILE)NULL;
|
return (HFILE)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((uStyle & OF_CREATE) == OF_CREATE)
|
||||||
|
{
|
||||||
|
DWORD Sharing;
|
||||||
|
switch (uStyle & 0x70)
|
||||||
|
{
|
||||||
|
case OF_SHARE_EXCLUSIVE: Sharing = 0; break;
|
||||||
|
case OF_SHARE_DENY_WRITE: Sharing = FILE_SHARE_READ; break;
|
||||||
|
case OF_SHARE_DENY_READ: Sharing = FILE_SHARE_WRITE; break;
|
||||||
|
case OF_SHARE_DENY_NONE:
|
||||||
|
case OF_SHARE_COMPAT:
|
||||||
|
default:
|
||||||
|
Sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||||
|
}
|
||||||
|
return (HFILE) CreateFileA (lpFileName,
|
||||||
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
Sharing,
|
||||||
|
NULL,
|
||||||
|
CREATE_ALWAYS,
|
||||||
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
|
||||||
|
ObjectAttributes.RootDirectory = NULL;
|
||||||
|
ObjectAttributes.ObjectName = &FileNameString;
|
||||||
|
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE| OBJ_INHERIT;
|
||||||
|
ObjectAttributes.SecurityDescriptor = NULL;
|
||||||
|
ObjectAttributes.SecurityQualityOfService = NULL;
|
||||||
|
|
||||||
errCode = NtOpenFile (&FileHandle,
|
errCode = NtOpenFile (&FileHandle,
|
||||||
GENERIC_READ|SYNCHRONIZE,
|
GENERIC_READ|SYNCHRONIZE,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#ifdef assert
|
#ifdef assert
|
||||||
#undef assert
|
#undef assert
|
||||||
#endif
|
#endif
|
||||||
#define assert(x) do { if(!x) RtlAssert(x, __FILE__,__LINE__, ""); } while(0);
|
#define assert(x) do { if(!x) RtlAssert("#x", __FILE__,__LINE__, ""); } while(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DPRINT1(args...) do { DbgPrint("(KERNEL32:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
#define DPRINT1(args...) do { DbgPrint("(KERNEL32:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: section.c,v 1.24 2004/02/08 10:42:15 jfilby Exp $
|
/* $Id: section.c,v 1.25 2004/05/25 20:04:14 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -66,7 +66,7 @@ CreateFileMappingA(HANDLE hFile,
|
||||||
FileStandardInformation);
|
FileStandardInformation);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Status 0x%08x obtaining FileStandardInformation for source\n", errCode);
|
DPRINT("Status 0x%08x obtaining FileStandardInformation for source\n", Status);
|
||||||
SetLastErrorByStatus(Status);
|
SetLastErrorByStatus(Status);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ CreateFileMappingW(HANDLE hFile,
|
||||||
FileStandardInformation);
|
FileStandardInformation);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Status 0x%08x obtaining FileStandardInformation for source\n", errCode);
|
DPRINT("Status 0x%08x obtaining FileStandardInformation for source\n", Status);
|
||||||
SetLastErrorByStatus(Status);
|
SetLastErrorByStatus(Status);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue