Commit in reactos/lib/kernel32 on MAIN
makefile+2-21.84 -> 1.85
misc/stubs.c+1-281.83 -> 1.84
mem/resnotify.c+105added 1.1
+108-30
1 added + 2 modified, total 3 files
implemented CreateMemoryResourceNotification() and QueryMemoryResourceNotification(), but only the kernel32 part

reactos/lib/kernel32
makefile 1.84 -> 1.85
diff -u -r1.84 -r1.85
--- makefile	24 Aug 2004 17:21:10 -0000	1.84
+++ makefile	21 Sep 2004 19:17:26 -0000	1.85
@@ -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/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 =
 

reactos/lib/kernel32/misc
stubs.c 1.83 -> 1.84
diff -u -r1.83 -r1.84
--- stubs.c	21 Sep 2004 17:41:24 -0000	1.83
+++ stubs.c	21 Sep 2004 19:17:26 -0000	1.84
@@ -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.
@@ -665,19 +665,6 @@
 /*
  * @unimplemented
  */
-HANDLE
-STDCALL
-CreateMemoryResourceNotification(
-    MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType
-    )
-{
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
 BOOL
 STDCALL
 DeactivateActCtx(
@@ -1031,20 +1018,6 @@
 /*
  * @unimplemented
  */
-BOOL
-STDCALL
-QueryMemoryResourceNotification(
-     HANDLE ResourceNotificationHandle,
-    PBOOL  ResourceState
-    )
-{
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
 DWORD
 STDCALL
 QueueUserAPC(

reactos/lib/kernel32/mem
resnotify.c added at 1.1
diff -N resnotify.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ resnotify.c	21 Sep 2004 19:17:26 -0000	1.1
@@ -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 <w3seek@reactos.com>
+ */
+
+/* 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 */
CVSspam 0.2.8