Process Hacker
secedit.h
Go to the documentation of this file.
1 #ifndef _PH_SECEDIT_H
2 #define _PH_SECEDIT_H
3 
4 // secedit
5 
6 typedef struct _PH_ACCESS_ENTRY
7 {
8  PWSTR Name;
9  ACCESS_MASK Access;
10  BOOLEAN General;
11  BOOLEAN Specific;
12  PWSTR ShortName;
14 
16 HPROPSHEETPAGE
17 NTAPI
19  _In_ PWSTR ObjectName,
20  _In_ PPH_GET_OBJECT_SECURITY GetObjectSecurity,
21  _In_ PPH_SET_OBJECT_SECURITY SetObjectSecurity,
22  _In_opt_ PVOID Context,
23  _In_ PPH_ACCESS_ENTRY AccessEntries,
24  _In_ ULONG NumberOfAccessEntries
25  );
26 
28 VOID
29 NTAPI
31  _In_ HWND hWnd,
32  _In_ PWSTR ObjectName,
33  _In_ PPH_GET_OBJECT_SECURITY GetObjectSecurity,
34  _In_ PPH_SET_OBJECT_SECURITY SetObjectSecurity,
35  _In_opt_ PVOID Context,
36  _In_ PPH_ACCESS_ENTRY AccessEntries,
37  _In_ ULONG NumberOfAccessEntries
38  );
39 
41 {
43  PWSTR ObjectType;
44  PVOID Context;
46 
47 FORCEINLINE ACCESS_MASK PhGetAccessForGetSecurity(
48  _In_ SECURITY_INFORMATION SecurityInformation
49  )
50 {
51  ACCESS_MASK access = 0;
52 
53  if (
54  (SecurityInformation & OWNER_SECURITY_INFORMATION) ||
55  (SecurityInformation & GROUP_SECURITY_INFORMATION) ||
56  (SecurityInformation & DACL_SECURITY_INFORMATION)
57  )
58  {
59  access |= READ_CONTROL;
60  }
61 
62  if (SecurityInformation & SACL_SECURITY_INFORMATION)
63  {
64  access |= ACCESS_SYSTEM_SECURITY;
65  }
66 
67  return access;
68 }
69 
70 FORCEINLINE ACCESS_MASK PhGetAccessForSetSecurity(
71  _In_ SECURITY_INFORMATION SecurityInformation
72  )
73 {
74  ACCESS_MASK access = 0;
75 
76  if (
77  (SecurityInformation & OWNER_SECURITY_INFORMATION) ||
78  (SecurityInformation & GROUP_SECURITY_INFORMATION)
79  )
80  {
81  access |= WRITE_OWNER;
82  }
83 
84  if (SecurityInformation & DACL_SECURITY_INFORMATION)
85  {
86  access |= WRITE_DAC;
87  }
88 
89  if (SecurityInformation & SACL_SECURITY_INFORMATION)
90  {
91  access |= ACCESS_SYSTEM_SECURITY;
92  }
93 
94  return access;
95 }
96 
98 _Callback_ NTSTATUS
99 NTAPI
101  _Out_ PSECURITY_DESCRIPTOR *SecurityDescriptor,
102  _In_ SECURITY_INFORMATION SecurityInformation,
103  _In_opt_ PVOID Context
104  );
105 
106 PHLIBAPI
107 _Callback_ NTSTATUS
108 NTAPI
110  _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
111  _In_ SECURITY_INFORMATION SecurityInformation,
112  _In_opt_ PVOID Context
113  );
114 
115 PHLIBAPI
116 NTSTATUS
117 NTAPI
119  _In_ HANDLE Handle,
120  _In_ ULONG ObjectType,
121  _In_ SECURITY_INFORMATION SecurityInformation,
122  _Out_ PSECURITY_DESCRIPTOR *SecurityDescriptor
123  );
124 
125 PHLIBAPI
126 NTSTATUS
127 NTAPI
129  _In_ HANDLE Handle,
130  _In_ ULONG ObjectType,
131  _In_ SECURITY_INFORMATION SecurityInformation,
132  _In_ PSECURITY_DESCRIPTOR SecurityDescriptor
133  );
134 
135 // secdata
136 
137 PHLIBAPI
138 BOOLEAN
139 NTAPI
141  _In_ PWSTR Type,
142  _Out_ PPH_ACCESS_ENTRY *AccessEntries,
143  _Out_ PULONG NumberOfAccessEntries
144  );
145 
146 PHLIBAPI
148 NTAPI
150  _In_ ACCESS_MASK Access,
151  _In_ PPH_ACCESS_ENTRY AccessEntries,
152  _In_ ULONG NumberOfAccessEntries
153  );
154 
155 #endif