ReactOS 0.4.16-dev-295-g4aee028
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;
29
30 if (NotificationType > HighMemoryResourceNotification)
31 {
33 return NULL;
34 }
35
36 RtlInitUnicodeString(&EventName,
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}
LONG NTSTATUS
Definition: precomp.h:26
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
Status
Definition: gdiplustypes.h:25
#define EVENT_QUERY_STATE
Definition: security.c:53
static HANDLE hEvent
Definition: comm.c:54
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtOpenEvent(OUT PHANDLE EventHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: event.c:181
#define L(x)
Definition: ntvdm.h:50
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:167
_In_ WDF_SPECIAL_FILE_TYPE NotificationType
Definition: wdfdevice.h:1024

◆ QueryMemoryResourceNotification()

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

Definition at line 64 of file resntfy.c.

66{
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 TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
@ EventBasicInformation
Definition: extypes.h:357
NTSTATUS NTAPI NtQueryEvent(IN HANDLE EventHandle, IN EVENT_INFORMATION_CLASS EventInformationClass, OUT PVOID EventInformation, IN ULONG EventInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: event.c:313