mirror of
https://github.com/reactos/reactos.git
synced 2025-06-26 17:09:44 +00:00
minor fixes
svn path=/trunk/; revision=11415
This commit is contained in:
parent
6003c5cb06
commit
cb1bf2ae32
2 changed files with 47 additions and 32 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: resnotify.c,v 1.1 2004/09/21 19:17:26 weiden Exp $
|
/* $Id: resnotify.c,v 1.2 2004/10/24 12:55:19 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -45,12 +45,11 @@ CreateMemoryResourceNotification(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
ObjectAttributes.RootDirectory = hBaseDir;
|
&EventName,
|
||||||
ObjectAttributes.ObjectName = &EventName;
|
0,
|
||||||
ObjectAttributes.Attributes = 0;
|
hBaseDir,
|
||||||
ObjectAttributes.SecurityDescriptor = NULL;
|
NULL);
|
||||||
ObjectAttributes.SecurityQualityOfService = NULL;
|
|
||||||
|
|
||||||
Status = NtOpenEvent(&hEvent,
|
Status = NtOpenEvent(&hEvent,
|
||||||
EVENT_QUERY_STATE | SYNCHRONIZE,
|
EVENT_QUERY_STATE | SYNCHRONIZE,
|
||||||
|
@ -76,7 +75,6 @@ QueryMemoryResourceNotification(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EVENT_BASIC_INFORMATION ebi;
|
EVENT_BASIC_INFORMATION ebi;
|
||||||
ULONG RetLen;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
if(ResourceState != NULL)
|
if(ResourceState != NULL)
|
||||||
|
@ -85,7 +83,7 @@ QueryMemoryResourceNotification(
|
||||||
EventBasicInformation,
|
EventBasicInformation,
|
||||||
&ebi,
|
&ebi,
|
||||||
sizeof(ebi),
|
sizeof(ebi),
|
||||||
&RetLen);
|
NULL);
|
||||||
if(NT_SUCCESS(Status))
|
if(NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
*ResourceState = ebi.EventState;
|
*ResourceState = ebi.EventState;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: section.c,v 1.26 2004/08/28 22:16:27 navaraf Exp $
|
/* $Id: section.c,v 1.27 2004/10/24 12:55:19 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -64,24 +64,34 @@ CreateFileMappingA(HANDLE hFile,
|
||||||
MaximumSize.u.HighPart = dwMaximumSizeHigh;
|
MaximumSize.u.HighPart = dwMaximumSizeHigh;
|
||||||
MaximumSizePointer = &MaximumSize;
|
MaximumSizePointer = &MaximumSize;
|
||||||
}
|
}
|
||||||
RtlInitAnsiString(&AnsiName,
|
|
||||||
(LPSTR)lpName);
|
if (lpName != NULL)
|
||||||
RtlAnsiStringToUnicodeString(&UnicodeName,
|
{
|
||||||
&AnsiName,
|
RtlInitAnsiString(&AnsiName,
|
||||||
TRUE);
|
(LPSTR)lpName);
|
||||||
|
RtlAnsiStringToUnicodeString(&UnicodeName,
|
||||||
|
&AnsiName,
|
||||||
|
TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&UnicodeName,
|
(lpName ? &UnicodeName : NULL),
|
||||||
0,
|
0,
|
||||||
hBaseDir,
|
hBaseDir,
|
||||||
SecurityDescriptor);
|
SecurityDescriptor);
|
||||||
|
|
||||||
Status = NtCreateSection(&SectionHandle,
|
Status = NtCreateSection(&SectionHandle,
|
||||||
SECTION_ALL_ACCESS,
|
SECTION_ALL_ACCESS,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
MaximumSizePointer,
|
MaximumSizePointer,
|
||||||
flProtect & MASK_PAGE_FLAGS,
|
flProtect & MASK_PAGE_FLAGS,
|
||||||
flProtect & MASK_SEC_FLAGS,
|
flProtect & MASK_SEC_FLAGS,
|
||||||
hFile==INVALID_HANDLE_VALUE ? NULL : hFile);
|
((hFile != INVALID_HANDLE_VALUE) ? hFile : NULL));
|
||||||
RtlFreeUnicodeString(&UnicodeName);
|
if (lpName != NULL)
|
||||||
|
{
|
||||||
|
RtlFreeUnicodeString(&UnicodeName);
|
||||||
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastErrorByStatus(Status);
|
SetLastErrorByStatus(Status);
|
||||||
|
@ -135,20 +145,26 @@ CreateFileMappingW(HANDLE hFile,
|
||||||
MaximumSize.u.HighPart = dwMaximumSizeHigh;
|
MaximumSize.u.HighPart = dwMaximumSizeHigh;
|
||||||
MaximumSizePointer = &MaximumSize;
|
MaximumSizePointer = &MaximumSize;
|
||||||
}
|
}
|
||||||
RtlInitUnicodeString(&UnicodeName,
|
|
||||||
lpName);
|
if (lpName != NULL)
|
||||||
|
{
|
||||||
|
RtlInitUnicodeString(&UnicodeName,
|
||||||
|
lpName);
|
||||||
|
}
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&UnicodeName,
|
(lpName ? &UnicodeName : NULL),
|
||||||
0,
|
0,
|
||||||
hBaseDir,
|
hBaseDir,
|
||||||
SecurityDescriptor);
|
SecurityDescriptor);
|
||||||
|
|
||||||
Status = NtCreateSection(&SectionHandle,
|
Status = NtCreateSection(&SectionHandle,
|
||||||
SECTION_ALL_ACCESS,
|
SECTION_ALL_ACCESS,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
MaximumSizePointer,
|
MaximumSizePointer,
|
||||||
flProtect & MASK_PAGE_FLAGS,
|
flProtect & MASK_PAGE_FLAGS,
|
||||||
flProtect & MASK_SEC_FLAGS,
|
flProtect & MASK_SEC_FLAGS,
|
||||||
hFile==INVALID_HANDLE_VALUE ? NULL : hFile);
|
((hFile != INVALID_HANDLE_VALUE) ? hFile : NULL));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastErrorByStatus(Status);
|
SetLastErrorByStatus(Status);
|
||||||
|
@ -271,11 +287,10 @@ OpenFileMappingA(DWORD dwDesiredAccess,
|
||||||
ANSI_STRING AnsiName;
|
ANSI_STRING AnsiName;
|
||||||
UNICODE_STRING UnicodeName;
|
UNICODE_STRING UnicodeName;
|
||||||
|
|
||||||
ULONG Attributes = 0;
|
if (lpName == NULL)
|
||||||
|
|
||||||
if (bInheritHandle)
|
|
||||||
{
|
{
|
||||||
Attributes = OBJ_INHERIT;
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlInitAnsiString(&AnsiName,
|
RtlInitAnsiString(&AnsiName,
|
||||||
|
@ -286,7 +301,7 @@ OpenFileMappingA(DWORD dwDesiredAccess,
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&UnicodeName,
|
&UnicodeName,
|
||||||
Attributes,
|
(bInheritHandle ? OBJ_INHERIT : 0),
|
||||||
hBaseDir,
|
hBaseDir,
|
||||||
NULL);
|
NULL);
|
||||||
Status = NtOpenSection(&SectionHandle,
|
Status = NtOpenSection(&SectionHandle,
|
||||||
|
@ -298,6 +313,7 @@ OpenFileMappingA(DWORD dwDesiredAccess,
|
||||||
SetLastErrorByStatus (Status);
|
SetLastErrorByStatus (Status);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SectionHandle;
|
return SectionHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,18 +330,18 @@ OpenFileMappingW(DWORD dwDesiredAccess,
|
||||||
HANDLE SectionHandle;
|
HANDLE SectionHandle;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING UnicodeName;
|
UNICODE_STRING UnicodeName;
|
||||||
ULONG Attributes = 0;
|
|
||||||
|
|
||||||
if (bInheritHandle)
|
if (lpName == NULL)
|
||||||
{
|
{
|
||||||
Attributes = OBJ_INHERIT;
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlInitUnicodeString(&UnicodeName,
|
RtlInitUnicodeString(&UnicodeName,
|
||||||
lpName);
|
lpName);
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&UnicodeName,
|
&UnicodeName,
|
||||||
Attributes,
|
(bInheritHandle ? OBJ_INHERIT : 0),
|
||||||
hBaseDir,
|
hBaseDir,
|
||||||
NULL);
|
NULL);
|
||||||
Status = ZwOpenSection(&SectionHandle,
|
Status = ZwOpenSection(&SectionHandle,
|
||||||
|
@ -336,6 +352,7 @@ OpenFileMappingW(DWORD dwDesiredAccess,
|
||||||
SetLastErrorByStatus(Status);
|
SetLastErrorByStatus(Status);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SectionHandle;
|
return SectionHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue