mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:12:56 +00:00
Split CreateFileMapping flags before passing them on to NtCreateSection
svn path=/trunk/; revision=7091
This commit is contained in:
parent
8ca785b781
commit
d4d929e12c
1 changed files with 20 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: section.c,v 1.20 2003/07/10 18:50:51 chorns Exp $
|
/* $Id: section.c,v 1.21 2003/12/16 21:32:18 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -16,6 +16,9 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
#define MASK_PAGE_FLAGS (PAGE_READONLY | PAGE_READWRITE | PAGE_WRITECOPY)
|
||||||
|
#define MASK_SEC_FLAGS (SEC_COMMIT | SEC_IMAGE | SEC_NOCACHE | SEC_RESERVE)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -35,6 +38,12 @@ CreateFileMappingA(HANDLE hFile,
|
||||||
UNICODE_STRING UnicodeName;
|
UNICODE_STRING UnicodeName;
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
||||||
|
|
||||||
|
if ((flProtect & (MASK_PAGE_FLAGS | MASK_SEC_FLAGS)) != flProtect)
|
||||||
|
{
|
||||||
|
DPRINT1("Invalid flProtect 0x%08x\n", flProtect);
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (lpFileMappingAttributes)
|
if (lpFileMappingAttributes)
|
||||||
{
|
{
|
||||||
SecurityDescriptor = lpFileMappingAttributes->lpSecurityDescriptor;
|
SecurityDescriptor = lpFileMappingAttributes->lpSecurityDescriptor;
|
||||||
|
@ -60,8 +69,8 @@ CreateFileMappingA(HANDLE hFile,
|
||||||
SECTION_ALL_ACCESS,
|
SECTION_ALL_ACCESS,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
&MaximumSize,
|
&MaximumSize,
|
||||||
flProtect,
|
flProtect & MASK_PAGE_FLAGS,
|
||||||
0,
|
flProtect & MASK_SEC_FLAGS,
|
||||||
hFile==INVALID_HANDLE_VALUE ? NULL : hFile);
|
hFile==INVALID_HANDLE_VALUE ? NULL : hFile);
|
||||||
RtlFreeUnicodeString(&UnicodeName);
|
RtlFreeUnicodeString(&UnicodeName);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -92,6 +101,12 @@ CreateFileMappingW(HANDLE hFile,
|
||||||
UNICODE_STRING UnicodeName;
|
UNICODE_STRING UnicodeName;
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
||||||
|
|
||||||
|
if ((flProtect & (MASK_PAGE_FLAGS | MASK_SEC_FLAGS)) != flProtect)
|
||||||
|
{
|
||||||
|
DPRINT1("Invalid flProtect 0x%08x\n", flProtect);
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (lpFileMappingAttributes)
|
if (lpFileMappingAttributes)
|
||||||
{
|
{
|
||||||
SecurityDescriptor = lpFileMappingAttributes->lpSecurityDescriptor;
|
SecurityDescriptor = lpFileMappingAttributes->lpSecurityDescriptor;
|
||||||
|
@ -122,8 +137,8 @@ CreateFileMappingW(HANDLE hFile,
|
||||||
SECTION_ALL_ACCESS,
|
SECTION_ALL_ACCESS,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
MaximumSizePointer,
|
MaximumSizePointer,
|
||||||
flProtect,
|
flProtect & MASK_PAGE_FLAGS,
|
||||||
0,
|
flProtect & MASK_SEC_FLAGS,
|
||||||
hFile==INVALID_HANDLE_VALUE ? NULL : hFile);
|
hFile==INVALID_HANDLE_VALUE ? NULL : hFile);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue