mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 04:13:31 +00:00
implemented CreateMemoryResourceNotification() and QueryMemoryResourceNotification(), but only the kernel32 part
svn path=/trunk/; revision=10958
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: makefile,v 1.84 2004/08/24 17:21:10 navaraf Exp $
|
||||
# $Id: makefile,v 1.85 2004/09/21 19:17:26 weiden Exp $
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
@@ -45,7 +45,7 @@ FILE_OBJECTS = file/file.o file/curdir.o file/lfile.o file/dir.o \
|
||||
file/cnotify.o file/hardlink.o file/bintype.o
|
||||
|
||||
MEM_OBJECTS = mem/global.o mem/heap.o mem/isbad.o mem/local.o \
|
||||
mem/procmem.o mem/section.o mem/virtual.o
|
||||
mem/procmem.o mem/resnotify.o mem/section.o mem/virtual.o
|
||||
|
||||
NLS_OBJECTS =
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
/* $Id: resnotify.c,v 1.1 2004/09/21 19:17:26 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/kernel32/mem/resnotify.c
|
||||
* PURPOSE: Memory Resource Notification
|
||||
* PROGRAMMER: Thomas Weidenmueller <[email protected]>
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <k32.h>
|
||||
|
||||
/* stolen from include/ntos/synch.h */
|
||||
#define EVENT_QUERY_STATE (1)
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
HANDLE
|
||||
STDCALL
|
||||
CreateMemoryResourceNotification(
|
||||
MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType
|
||||
)
|
||||
{
|
||||
UNICODE_STRING EventName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE hEvent;
|
||||
NTSTATUS Status;
|
||||
|
||||
switch(NotificationType)
|
||||
{
|
||||
case LowMemoryResourceNotification:
|
||||
RtlInitUnicodeString(&EventName, L"\\KernelObjects\\LowMemoryCondition");
|
||||
break;
|
||||
|
||||
case HighMemoryResourceNotification:
|
||||
RtlInitUnicodeString(&EventName, L"\\KernelObjects\\HighMemoryCondition");
|
||||
break;
|
||||
|
||||
default:
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
|
||||
ObjectAttributes.RootDirectory = hBaseDir;
|
||||
ObjectAttributes.ObjectName = &EventName;
|
||||
ObjectAttributes.Attributes = 0;
|
||||
ObjectAttributes.SecurityDescriptor = NULL;
|
||||
ObjectAttributes.SecurityQualityOfService = NULL;
|
||||
|
||||
Status = NtOpenEvent(&hEvent,
|
||||
EVENT_QUERY_STATE | SYNCHRONIZE,
|
||||
&ObjectAttributes);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return hEvent;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
QueryMemoryResourceNotification(
|
||||
HANDLE ResourceNotificationHandle,
|
||||
PBOOL ResourceState
|
||||
)
|
||||
{
|
||||
EVENT_BASIC_INFORMATION ebi;
|
||||
ULONG RetLen;
|
||||
NTSTATUS Status;
|
||||
|
||||
if(ResourceState != NULL)
|
||||
{
|
||||
Status = NtQueryEvent(ResourceNotificationHandle,
|
||||
EventBasicInformation,
|
||||
&ebi,
|
||||
sizeof(ebi),
|
||||
&RetLen);
|
||||
if(NT_SUCCESS(Status))
|
||||
{
|
||||
*ResourceState = ebi.EventState;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
SetLastErrorByStatus(Status);
|
||||
}
|
||||
else /* ResourceState == NULL */
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: stubs.c,v 1.83 2004/09/21 17:41:24 weiden Exp $
|
||||
/* $Id: stubs.c,v 1.84 2004/09/21 19:17:26 weiden Exp $
|
||||
*
|
||||
* KERNEL32.DLL stubs (unimplemented functions)
|
||||
* Remove from this file, if you implement them.
|
||||
@@ -662,19 +662,6 @@ CreateJobSet (
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
HANDLE
|
||||
STDCALL
|
||||
CreateMemoryResourceNotification(
|
||||
MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
@@ -1028,20 +1015,6 @@ QueryInformationJobObject(
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
QueryMemoryResourceNotification(
|
||||
HANDLE ResourceNotificationHandle,
|
||||
PBOOL ResourceState
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user