ReactOS 0.4.15-dev-7931-gfd331f1
Context.c File Reference
#include "fltmgr.h"
#include "fltmgrint.h"
#include <debug.h>
Include dependency graph for Context.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static BOOLEAN IsContextTypeValid (_In_ FLT_CONTEXT_TYPE ContextType)
 
static NTSTATUS SetupContextHeader (_In_ PFLT_FILTER Filter, _In_ PCFLT_CONTEXT_REGISTRATION ContextPtr, _Out_ PALLOCATE_CONTEXT_HEADER ContextHeader)
 
NTSTATUS FltpRegisterContexts (_In_ PFLT_FILTER Filter, _In_ const FLT_CONTEXT_REGISTRATION *Context)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file Context.c.

Function Documentation

◆ FltpRegisterContexts()

NTSTATUS FltpRegisterContexts ( _In_ PFLT_FILTER  Filter,
_In_ const FLT_CONTEXT_REGISTRATION Context 
)

Definition at line 43 of file Context.c.

45{
47 PALLOCATE_CONTEXT_HEADER ContextHeader, Prev;
49 ULONG BufferSize = 0;
50 USHORT i;
52
53 /* Loop through all entries in the context registration array */
54 ContextPtr = Context;
55 while (ContextPtr)
56 {
57 /* Bail if we found the terminator */
58 if (ContextPtr->ContextType == FLT_CONTEXT_END)
59 break;
60
61 /* Make sure we have a valid context */
62 if (IsContextTypeValid(ContextPtr->ContextType))
63 {
64 /* Each context is backed by a crtl struct. Reserve space for it */
66 }
67
68 /* Move to the next entry */
69 ContextPtr++;
70 }
71
72 /* Bail if we found no valid registration requests */
73 if (BufferSize == 0)
74 {
75 return STATUS_SUCCESS;
76 }
77
78 /* Allocate the pool that'll hold the context crtl structs */
81
83
84 /* Setup our loop data */
85 ContextHeader = Buffer;
86 Prev = NULL;
88
89 for (i = 0; i < MAX_CONTEXT_TYPES; i++)
90 {
92 while (ContextPtr)
93 {
94 /* We don't support variable sized contents yet */
96
97 /* Bail if we found the terminator */
98 if (ContextPtr->ContextType == FLT_CONTEXT_END)
99 break;
100
101 /* Size and pooltag are only checked when ContextAllocateCallback is null */
102 if (ContextPtr->ContextAllocateCallback == FALSE && ContextPtr->PoolTag == FALSE)
103 {
105 goto Quit;
106 }
107
108 /* Make sure we have a valid context */
109 if (IsContextTypeValid(ContextPtr->ContextType))
110 {
111 Status = SetupContextHeader(Filter, ContextPtr, ContextHeader);
112 if (NT_SUCCESS(Status))
113 {
114 if (Prev)
115 {
116 Prev->Next = ContextHeader;
117 }
118
119 Filter->SupportedContexts[i] = ContextHeader;
120 }
121 }
122
123 Prev = ContextHeader;
124
125 /* Move to the next entry */
126 ContextPtr++;
127 }
128 }
129
130Quit:
131 if (NT_SUCCESS(Status))
132 {
134 }
135 else
136 {
138 //FIXME: Cleanup anything that SetupContextHeader may have allocated
139 }
140
141 return Status;
142}
static NTSTATUS SetupContextHeader(_In_ PFLT_FILTER Filter, _In_ PCFLT_CONTEXT_REGISTRATION ContextPtr, _Out_ PALLOCATE_CONTEXT_HEADER ContextHeader)
Definition: Context.c:167
static BOOLEAN IsContextTypeValid(_In_ FLT_CONTEXT_TYPE ContextType)
Definition: Context.c:149
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
struct _FLT_CONTEXT_REGISTRATION * PFLT_CONTEXT_REGISTRATION
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1801
#define FLT_CONTEXT_END
Definition: fltkernel.h:444
#define FLT_VARIABLE_SIZED_CONTEXTS
Definition: fltkernel.h:513
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49
#define FM_TAG_CONTEXT_REGISTA
Definition: fltmgr.h:22
#define MAX_CONTEXT_TYPES
Definition: fltmgrint.h:5
struct _STREAM_LIST_CTRL STREAM_LIST_CTRL
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define STATUS_FLT_INVALID_CONTEXT_REGISTRATION
Definition: ntstatus.h:1444
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _ALLOCATE_CONTEXT_HEADER * Next
Definition: fltmgrint.h:38
PFLT_CONTEXT_ALLOCATE_CALLBACK ContextAllocateCallback
Definition: fltkernel.h:521
FLT_CONTEXT_TYPE ContextType
Definition: fltkernel.h:516
PALLOCATE_CONTEXT_HEADER SupportedContexts[MAX_CONTEXT_TYPES]
Definition: fltmgrint.h:112
PALLOCATE_CONTEXT_HEADER SupportedContextsListHead
Definition: fltmgrint.h:111
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254

Referenced by FltRegisterFilter().

◆ IsContextTypeValid()

static BOOLEAN IsContextTypeValid ( _In_ FLT_CONTEXT_TYPE  ContextType)
static

Definition at line 149 of file Context.c.

150{
151 switch (ContextType)
152 {
155 case FLT_FILE_CONTEXT:
159 return TRUE;
160 }
161
162 return FALSE;
163}
#define TRUE
Definition: types.h:120
#define FLT_TRANSACTION_CONTEXT
Definition: fltkernel.h:443
#define FLT_STREAMHANDLE_CONTEXT
Definition: fltkernel.h:442
#define FLT_VOLUME_CONTEXT
Definition: fltkernel.h:438
#define FLT_FILE_CONTEXT
Definition: fltkernel.h:440
#define FLT_STREAM_CONTEXT
Definition: fltkernel.h:441
#define FLT_INSTANCE_CONTEXT
Definition: fltkernel.h:439
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE ContextType
Definition: fltkernel.h:1443

Referenced by FltpRegisterContexts().

◆ SetupContextHeader()

static NTSTATUS SetupContextHeader ( _In_ PFLT_FILTER  Filter,
_In_ PCFLT_CONTEXT_REGISTRATION  ContextPtr,
_Out_ PALLOCATE_CONTEXT_HEADER  ContextHeader 
)
static

Definition at line 167 of file Context.c.

170{
171 return 0;
172}

Referenced by FltpRegisterContexts().