xref: /reactos/modules/rostests/kmtests/ntos_se/se.h (revision 40462c92)
1 /*
2  * PROJECT:         ReactOS kernel-mode tests
3  * LICENSE:         LGPLv2.1+ - See COPYING.LIB in the top level directory
4  * PURPOSE:         Kernel-Mode Test Suite Se helper declarations
5  * PROGRAMMER:      Thomas Faber <thomas.faber@reactos.org>
6  */
7 
8 #ifndef _KMTEST_SE_H_
9 #define _KMTEST_SE_H_
10 
11 /* FIXME: belongs in ntifs.h or something */
12 #define SEF_DACL_AUTO_INHERIT 1
13 #define SEF_SACL_AUTO_INHERIT 2
14 #define SEF_DEFAULT_DESCRIPTOR_FOR_OBJECT 4
15 #define SEF_AVOID_PRIVILEGE_CHECK 8
16 #define SEF_AVOID_OWNER_CHECK 16
17 #define SEF_DEFAULT_OWNER_FROM_PARENT 32
18 #define SEF_DEFAULT_GROUP_FROM_PARENT 64
19 #define SEF_MACL_NO_WRITE_UP 256
20 #define SEF_MACL_NO_READ_UP 512
21 #define SEF_MACL_NO_EXECUTE_UP 1024
22 #define SEF_AI_USE_EXTRA_PARAMS 2048
23 #define SEF_AVOID_OWNER_RESTRICTION 4096
24 #define SEF_MACL_VALID_FLAGS (SEF_MACL_NO_WRITE_UP | SEF_MACL_NO_READ_UP | SEF_MACL_NO_EXECUTE_UP)
25 
26 NTSTATUS
27 RtlxAddAuditAccessAceEx(
28     _Inout_ PACL Acl,
29     _In_ ULONG Revision,
30     _In_ ULONG Flags,
31     _In_ ACCESS_MASK AccessMask,
32     _In_ PSID Sid,
33     _In_ BOOLEAN Success,
34     _In_ BOOLEAN Failure);
35 
36 NTSTATUS
37 RtlxAddMandatoryLabelAceEx(
38     _Inout_ PACL Acl,
39     _In_ ULONG Revision,
40     _In_ ULONG Flags,
41     _In_ ACCESS_MASK AccessMask,
42     _In_ PSID Sid);
43 
44 #define NO_SIZE ((ULONG)-1)
45 
46 #define CheckSid(Sid, SidSize, ExpectedSid) CheckSid_(Sid, SidSize, ExpectedSid, __FILE__, __LINE__)
47 #define CheckSid_(Sid, SidSize, ExpectedSid, file, line) CheckSid__(Sid, SidSize, ExpectedSid, file ":" KMT_STRINGIZE(line))
48 VOID
49 CheckSid__(
50     _In_ PSID Sid,
51     _In_ ULONG SidSize,
52     _In_ PISID ExpectedSid,
53     _In_ PCSTR FileAndLine);
54 
55 VOID
56 VCheckAcl__(
57     _In_ PACL Acl,
58     _In_ ULONG AceCount,
59     _In_ PCSTR FileAndLine,
60     _In_ va_list Arguments);
61 
62 #define CheckAcl(Acl, AceCount, ...) CheckAcl_(Acl, AceCount, __FILE__, __LINE__, ##__VA_ARGS__)
63 #define CheckAcl_(Acl, AceCount, file, line, ...) CheckAcl__(Acl, AceCount, file ":" KMT_STRINGIZE(line), ##__VA_ARGS__)
64 VOID
65 CheckAcl__(
66     _In_ PACL Acl,
67     _In_ ULONG AceCount,
68     _In_ PCSTR FileAndLine,
69     ...);
70 
71 #endif /* !defined _KMTEST_SE_H_ */
72