ReactOS 0.4.15-dev-5865-g640e228
objtype.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for objtype.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS SeCaptureObjectTypeList (_In_reads_opt_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList, _In_ ULONG ObjectTypeListLength, _In_ KPROCESSOR_MODE PreviousMode, _Out_ POBJECT_TYPE_LIST *CapturedObjectTypeList)
 Captures a list of object types.
 
VOID SeReleaseObjectTypeList (_In_ _Post_invalid_ POBJECT_TYPE_LIST CapturedObjectTypeList, _In_ KPROCESSOR_MODE PreviousMode)
 Releases a buffer list of object types.
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file objtype.c.

Function Documentation

◆ SeCaptureObjectTypeList()

NTSTATUS SeCaptureObjectTypeList ( _In_reads_opt_(ObjectTypeListLength) POBJECT_TYPE_LIST  ObjectTypeList,
_In_ ULONG  ObjectTypeListLength,
_In_ KPROCESSOR_MODE  PreviousMode,
_Out_ POBJECT_TYPE_LIST CapturedObjectTypeList 
)

Captures a list of object types.

Parameters
[in]ObjectTypeListAn existing list of object types.
[in]ObjectTypeListLengthThe length size of the list.
[in]PreviousModeProcessor access level mode.
[out]CapturedObjectTypeListThe captured list of object types.
Returns
Returns STATUS_SUCCESS if the list of object types has been captured successfully. STATUS_INVALID_PARAMETER is returned if the caller hasn't supplied a buffer list of object types. STATUS_INSUFFICIENT_RESOURCES is returned if pool memory allocation for the captured list has failed.

Definition at line 39 of file objtype.c.

44{
46
48 {
50 }
51
52 if (ObjectTypeListLength == 0)
53 {
54 *CapturedObjectTypeList = NULL;
55 return STATUS_SUCCESS;
56 }
57
58 if (ObjectTypeList == NULL)
59 {
61 }
62
63 /* Calculate the list size and check for integer overflow */
64 Size = ObjectTypeListLength * sizeof(OBJECT_TYPE_LIST);
65 if (Size == 0)
66 {
68 }
69
70 /* Allocate a new list */
71 *CapturedObjectTypeList = ExAllocatePoolWithTag(PagedPool, Size, TAG_SEPA);
72 if (*CapturedObjectTypeList == NULL)
73 {
75 }
76
78 {
79 ProbeForRead(ObjectTypeList, Size, sizeof(ULONG));
80 RtlCopyMemory(*CapturedObjectTypeList, ObjectTypeList, Size);
81 }
83 {
84 ExFreePoolWithTag(*CapturedObjectTypeList, TAG_SEPA);
85 *CapturedObjectTypeList = NULL;
87 }
89
90 return STATUS_SUCCESS;
91}
#define NULL
Definition: types.h:112
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define KernelMode
Definition: asm.h:34
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:162
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TAG_SEPA
Definition: tag.h:156
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
struct _OBJECT_TYPE_LIST OBJECT_TYPE_LIST

Referenced by SepAccessCheckAndAuditAlarm().

◆ SeReleaseObjectTypeList()

VOID SeReleaseObjectTypeList ( _In_ _Post_invalid_ POBJECT_TYPE_LIST  CapturedObjectTypeList,
_In_ KPROCESSOR_MODE  PreviousMode 
)

Releases a buffer list of object types.

Parameters
[in]CapturedObjectTypeListA list of object types to free.
[in]PreviousModeProcessor access level mode.
Returns
Nothing.

Definition at line 107 of file objtype.c.

110{
111 if ((PreviousMode != KernelMode) && (CapturedObjectTypeList != NULL))
112 ExFreePoolWithTag(CapturedObjectTypeList, TAG_SEPA);
113}

Referenced by SepAccessCheckAndAuditAlarm().