ReactOS  0.4.13-dev-249-gcba1a2f
resntfy.c File Reference
#include <k32.h>
#include <debug.h>
Include dependency graph for resntfy.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

HANDLE WINAPI CreateMemoryResourceNotification (IN MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType)
 
BOOL WINAPI QueryMemoryResourceNotification (IN HANDLE ResourceNotificationHandle, OUT PBOOL ResourceState)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file resntfy.c.

Function Documentation

◆ CreateMemoryResourceNotification()

HANDLE WINAPI CreateMemoryResourceNotification ( IN MEMORY_RESOURCE_NOTIFICATION_TYPE  NotificationType)

Definition at line 23 of file resntfy.c.

24 {
25  UNICODE_STRING EventName;
27  HANDLE hEvent;
29 
30  if (NotificationType > HighMemoryResourceNotification)
31  {
33  return NULL;
34  }
35 
36  RtlInitUnicodeString(&EventName,
37  NotificationType ?
38  L"\\KernelObjects\\HighMemoryCondition" :
39  L"\\KernelObjects\\LowMemoryCondition");
40 
42  &EventName,
43  0,
44  NULL,
45  NULL);
46 
50  if (!NT_SUCCESS(Status))
51  {
53  return NULL;
54  }
55 
56  return hEvent;
57 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
LONG NTSTATUS
Definition: precomp.h:26
#define EVENT_QUERY_STATE
Definition: security.c:53
static HANDLE hEvent
Definition: comm.c:54
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:409
static const WCHAR L[]
Definition: oid.c:1250
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSTATUS NTAPI NtOpenEvent(OUT PHANDLE EventHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: event.c:185
Status
Definition: gdiplustypes.h:24
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106

◆ QueryMemoryResourceNotification()

BOOL WINAPI QueryMemoryResourceNotification ( IN HANDLE  ResourceNotificationHandle,
OUT PBOOL  ResourceState 
)

Definition at line 64 of file resntfy.c.

66 {
67  EVENT_BASIC_INFORMATION EventInfo;
69 
70  if ((ResourceNotificationHandle) &&
71  (ResourceNotificationHandle != INVALID_HANDLE_VALUE) &&
72  (ResourceState))
73  {
74  Status = NtQueryEvent(ResourceNotificationHandle,
76  &EventInfo,
77  sizeof(EventInfo),
78  NULL);
79  if (NT_SUCCESS(Status))
80  {
81  *ResourceState = (EventInfo.EventState == 1);
82  return TRUE;
83  }
84 
86  }
87  else
88  {
90  }
91 
92  return FALSE;
93 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI NtQueryEvent(IN HANDLE EventHandle, IN EVENT_INFORMATION_CLASS EventInformationClass, OUT PVOID EventInformation, IN ULONG EventInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: event.c:317
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:409
Status
Definition: gdiplustypes.h:24