ReactOS  0.4.15-dev-1397-g19779b3
obinit.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for obinit.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID NTAPI PsInitializeQuotaSystem (VOID)
 
static NTSTATUS NTAPI ObpCreateKernelObjectsSD (OUT PSECURITY_DESCRIPTOR *SecurityDescriptor)
 
BOOLEAN NTAPI ObInit2 (VOID)
 
BOOLEAN NTAPI ObInitSystem (VOID)
 

Variables

GENERIC_MAPPING ObpTypeMapping
 
GENERIC_MAPPING ObpDirectoryMapping
 
GENERIC_MAPPING ObpSymbolicLinkMapping
 
PDEVICE_MAP ObSystemDeviceMap = NULL
 
ULONG ObpTraceLevel = 0
 
ULONG ObpInitializationPhase
 
ULONG ObpObjectSecurityMode = 0
 
ULONG ObpProtectionMode = 0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file obinit.c.

Function Documentation

◆ ObInit2()

BOOLEAN NTAPI ObInit2 ( VOID  )

Definition at line 136 of file obinit.c.

137 {
138  CCHAR i;
139  PKPRCB Prcb;
140  PGENERAL_LOOKASIDE CurrentList = NULL;
141 
142  /* Now allocate the per-processor lists */
143  for (i = 0; i < KeNumberProcessors; i++)
144  {
145  /* Get the PRCB for this CPU */
146  Prcb = KiProcessorBlock[(int)i];
147 
148  /* Set the OBJECT_CREATE_INFORMATION List */
150  CurrentList = ExAllocatePoolWithTag(NonPagedPool,
151  sizeof(GENERAL_LOOKASIDE),
152  'ICbO');
153  if (CurrentList)
154  {
155  /* Initialize it */
157  NonPagedPool,
159  'ICbO',
160  32,
162  }
163  else
164  {
165  /* No list, use the static buffer */
166  CurrentList = &ObpCreateInfoLookasideList;
167  }
168 
169  /* Link it */
170  Prcb->PPLookasideList[LookasideCreateInfoList].P = CurrentList;
171 
172  /* Set the captured UNICODE_STRING Object Name List */
174  CurrentList = ExAllocatePoolWithTag(NonPagedPool,
175  sizeof(GENERAL_LOOKASIDE),
176  'MNbO');
177  if (CurrentList)
178  {
179  /* Initialize it */
181  PagedPool,
182  248,
183  'MNbO',
184  16,
186  }
187  else
188  {
189  /* No list, use the static buffer */
190  CurrentList = &ObpNameBufferLookasideList;
191  }
192 
193  /* Link it */
194  Prcb->PPLookasideList[LookasideNameBufferList].P = CurrentList;
195  }
196 
197  return TRUE;
198 }
#define TRUE
Definition: types.h:120
GENERAL_LOOKASIDE ObpCreateInfoLookasideList
Definition: oblife.c:26
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE GENERAL_LOOKASIDE
PP_LOOKASIDE_LIST PPLookasideList[16]
Definition: ketypes.h:624
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE * PGENERAL_LOOKASIDE
GENERAL_LOOKASIDE ObpNameBufferLookasideList
Definition: oblife.c:26
VOID NTAPI ExInitializeSystemLookasideList(IN PGENERAL_LOOKASIDE List, IN POOL_TYPE Type, IN ULONG Size, IN ULONG Tag, IN USHORT MaximumDepth, IN PLIST_ENTRY ListHead)
Definition: lookas.c:31
char CCHAR
Definition: typedefs.h:51
struct _GENERAL_LOOKASIDE * L
Definition: ketypes.h:802
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
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
struct _GENERAL_LOOKASIDE * P
Definition: ketypes.h:801
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
#define NULL
Definition: types.h:112
LIST_ENTRY ExSystemLookasideListHead
Definition: lookas.c:21
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by ObInitSystem().

◆ ObInitSystem()

BOOLEAN NTAPI ObInitSystem ( VOID  )

Definition at line 203 of file obinit.c.

204 {
207  OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
209  HANDLE Handle;
210  PKPRCB Prcb = KeGetCurrentPrcb();
211  PLIST_ENTRY ListHead, NextEntry;
213  POBJECT_HEADER_CREATOR_INFO CreatorInfo;
214  POBJECT_HEADER_NAME_INFO NameInfo;
215  PSECURITY_DESCRIPTOR KernelObjectsSD = NULL;
217 
218  /* Check if this is actually Phase 1 initialization */
219  if (ObpInitializationPhase != 0) goto ObPostPhase0;
220 
221  /* Initialize the OBJECT_CREATE_INFORMATION List */
223  NonPagedPool,
225  'ICbO',
226  32,
228 
229  /* Set the captured UNICODE_STRING Object Name List */
231  PagedPool,
232  248,
233  'MNbO',
234  16,
236 
237  /* Temporarily setup both pointers to the shared list */
242 
243  /* Initialize the security descriptor cache */
244  ObpInitSdCache();
245 
246  /* Initialize the Default Event */
248 
249  /* Initialize the Dos Device Map mutex */
251 
252  /* Setup default access for the system process */
253  PsGetCurrentProcess()->GrantedAccess = PROCESS_ALL_ACCESS;
254  PsGetCurrentThread()->GrantedAccess = THREAD_ALL_ACCESS;
255 
256  /* Setup the Object Reaper */
258 
259  /* Initialize default Quota block */
261 
262  /* Create kernel handle table */
263  PsGetCurrentProcess()->ObjectTable = ExCreateHandleTable(NULL);
264  ObpKernelHandleTable = PsGetCurrentProcess()->ObjectTable;
265 
266  /* Create the Type Type */
267  RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
268  RtlInitUnicodeString(&Name, L"Type");
269  ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
270  ObjectTypeInitializer.ValidAccessMask = OBJECT_TYPE_ALL_ACCESS;
271  ObjectTypeInitializer.UseDefaultObject = TRUE;
272  ObjectTypeInitializer.MaintainTypeList = TRUE;
273  ObjectTypeInitializer.PoolType = NonPagedPool;
274  ObjectTypeInitializer.GenericMapping = ObpTypeMapping;
275  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_TYPE);
276  ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
277  ObjectTypeInitializer.DeleteProcedure = ObpDeleteObjectType;
278  ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpTypeObjectType);
279 
280  /* Create the Directory Type */
281  RtlInitUnicodeString(&Name, L"Directory");
282  ObjectTypeInitializer.PoolType = PagedPool;
283  ObjectTypeInitializer.ValidAccessMask = DIRECTORY_ALL_ACCESS;
284  ObjectTypeInitializer.CaseInsensitive = TRUE;
285  ObjectTypeInitializer.MaintainTypeList = FALSE;
286  ObjectTypeInitializer.GenericMapping = ObpDirectoryMapping;
287  ObjectTypeInitializer.DeleteProcedure = NULL;
288  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_DIRECTORY);
289  ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpDirectoryObjectType);
290  ObpDirectoryObjectType->TypeInfo.ValidAccessMask &= ~SYNCHRONIZE;
291 
292  /* Create 'symbolic link' object type */
293  RtlInitUnicodeString(&Name, L"SymbolicLink");
294  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_SYMBOLIC_LINK);
295  ObjectTypeInitializer.GenericMapping = ObpSymbolicLinkMapping;
296  ObjectTypeInitializer.ValidAccessMask = SYMBOLIC_LINK_ALL_ACCESS;
297  ObjectTypeInitializer.ParseProcedure = ObpParseSymbolicLink;
298  ObjectTypeInitializer.DeleteProcedure = ObpDeleteSymbolicLink;
299  ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpSymbolicLinkObjectType);
300  ObpSymbolicLinkObjectType->TypeInfo.ValidAccessMask &= ~SYNCHRONIZE;
301 
302  /* Phase 0 initialization complete */
304  return TRUE;
305 
306 ObPostPhase0:
307 
308  /* Re-initialize lookaside lists */
309  ObInit2();
310 
311  /* Initialize Object Types directory attributes */
312  RtlInitUnicodeString(&Name, L"\\");
314  &Name,
316  NULL,
318 
319  /* Create the directory */
323  if (!NT_SUCCESS(Status)) return FALSE;
324 
325  /* Get a handle to it */
327  0,
329  KernelMode,
331  NULL);
332  if (!NT_SUCCESS(Status)) return FALSE;
333 
334  /* Close the extra handle */
335  Status = NtClose(Handle);
336  if (!NT_SUCCESS(Status)) return FALSE;
337 
338  /* Create a custom security descriptor for the KernelObjects directory */
339  Status = ObpCreateKernelObjectsSD(&KernelObjectsSD);
340  if (!NT_SUCCESS(Status))
341  return FALSE;
342 
343  /* Initialize the KernelObjects directory attributes */
344  RtlInitUnicodeString(&Name, L"\\KernelObjects");
346  &Name,
348  NULL,
349  KernelObjectsSD);
350 
351  /* Create the directory */
355  ExFreePoolWithTag(KernelObjectsSD, TAG_SD);
356  if (!NT_SUCCESS(Status)) return FALSE;
357 
358  /* Close the extra handle */
359  Status = NtClose(Handle);
360  if (!NT_SUCCESS(Status)) return FALSE;
361 
362  /* Initialize ObjectTypes directory attributes */
363  RtlInitUnicodeString(&Name, L"\\ObjectTypes");
365  &Name,
367  NULL,
368  NULL);
369 
370  /* Create the directory */
374  if (!NT_SUCCESS(Status)) return FALSE;
375 
376  /* Get a handle to it */
378  0,
380  KernelMode,
382  NULL);
383  if (!NT_SUCCESS(Status)) return FALSE;
384 
385  /* Close the extra handle */
386  Status = NtClose(Handle);
387  if (!NT_SUCCESS(Status)) return FALSE;
388 
389  /* Initialize lookup context */
391 
392  /* Lock it */
394 
395  /* Loop the object types */
396  ListHead = &ObpTypeObjectType->TypeList;
397  NextEntry = ListHead->Flink;
398  while (ListHead != NextEntry)
399  {
400  /* Get the creator info from the list */
401  CreatorInfo = CONTAINING_RECORD(NextEntry,
403  TypeList);
404 
405  /* Recover the header and the name header from the creator info */
406  Header = (POBJECT_HEADER)(CreatorInfo + 1);
408 
409  /* Make sure we have a name, and aren't inserted yet */
410  if ((NameInfo) && !(NameInfo->Directory))
411  {
412  /* Do the initial lookup to setup the context */
414  &NameInfo->Name,
416  FALSE,
417  &Context))
418  {
419  /* Insert this object type */
421  &Context,
422  Header);
423  }
424  }
425 
426  /* Move to the next entry */
427  NextEntry = NextEntry->Flink;
428  }
429 
430  /* Cleanup after lookup */
432 
433  /* Initialize DOS Devices Directory and related Symbolic Links */
435  if (!NT_SUCCESS(Status)) return FALSE;
436  return TRUE;
437 }
VOID NTAPI ObpDeleteSymbolicLink(IN PVOID ObjectBody)
#define OBJ_OPENLINK
Definition: winternl.h:230
POBJECT_DIRECTORY Directory
Definition: obtypes.h:432
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
NTSTATUS NTAPI ObCreateObjectType(IN PUNICODE_STRING TypeName, IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, IN PVOID Reserved, OUT POBJECT_TYPE *ObjectType)
Definition: oblife.c:1048
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1324
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
WORK_QUEUE_ITEM ObpReaperWorkItem
Definition: oblife.c:28
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1075
UNICODE_STRING Name
Definition: obtypes.h:433
GENERIC_MAPPING ObpDirectoryMapping
Definition: obinit.c:27
#define OBJECT_HEADER_TO_NAME_INFO(h)
Definition: obtypes.h:114
GENERAL_LOOKASIDE ObpCreateInfoLookasideList
Definition: oblife.c:26
ULONG ObpInitializationPhase
Definition: obinit.c:54
VOID NTAPI ObpDeleteObjectType(IN PVOID Object)
Definition: oblife.c:1329
static POBJECT_TYPE ObpDefaultObject
Definition: ObTypes.c:138
#define SYMBOLIC_LINK_ALL_ACCESS
Definition: nt_native.h:1267
GENERIC_MAPPING ObpTypeMapping
Definition: obinit.c:19
POBJECT_DIRECTORY ObpRootDirectoryObject
Definition: obname.c:19
PP_LOOKASIDE_LIST PPLookasideList[16]
Definition: ketypes.h:624
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
struct _OBJECT_HEADER * POBJECT_HEADER
#define FALSE
Definition: types.h:117
Definition: Header.h:8
GENERAL_LOOKASIDE ObpNameBufferLookasideList
Definition: oblife.c:26
struct NameRec_ * Name
Definition: cdprocs.h:459
#define PsGetCurrentProcess
Definition: psfuncs.h:17
VOID NTAPI ObpReapObject(IN PVOID Unused)
Definition: oblife.c:221
NTSTATUS NTAPI ObpCreateDosDevicesDirectory(VOID)
Definition: obname.c:177
PHANDLE_TABLE ObpKernelHandleTable
Definition: obhandle.c:20
#define TAG_SD
Definition: tag.h:176
VOID NTAPI ExInitializeSystemLookasideList(IN PGENERAL_LOOKASIDE List, IN POOL_TYPE Type, IN ULONG Size, IN ULONG Tag, IN USHORT MaximumDepth, IN PLIST_ENTRY ListHead)
Definition: lookas.c:31
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
OBJECT_TYPE
Definition: ntobjenum.h:23
BOOLEAN NTAPI ObpInsertEntryDirectory(IN POBJECT_DIRECTORY Parent, IN POBP_LOOKUP_CONTEXT Context, IN POBJECT_HEADER ObjectHeader)
Definition: obdir.c:45
Status
Definition: gdiplustypes.h:24
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define ObpDirectoryObjectType
Definition: ObTypes.c:123
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FORCEINLINE VOID ObpAcquireDirectoryLockExclusive(IN POBJECT_DIRECTORY Directory, IN POBP_LOOKUP_CONTEXT Context)
Definition: ob_x.h:190
OB_PARSE_METHOD ParseProcedure
Definition: obtypes.h:370
PHANDLE_TABLE NTAPI ExCreateHandleTable(IN PEPROCESS Process OPTIONAL)
Definition: handle.c:765
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
struct _GENERAL_LOOKASIDE * L
Definition: ketypes.h:802
static const WCHAR L[]
Definition: oid.c:1250
PVOID NTAPI ObpLookupEntryDirectory(IN POBJECT_DIRECTORY Directory, IN PUNICODE_STRING Name, IN ULONG Attributes, IN UCHAR SearchShadow, IN POBP_LOOKUP_CONTEXT Context)
Definition: obdir.c:158
#define OBJ_PERMANENT
Definition: winternl.h:226
Definition: typedefs.h:119
#define SYNCHRONIZE
Definition: nt_native.h:61
#define OBJECT_TYPE_ALL_ACCESS
Definition: nt_native.h:1248
NTSTATUS NTAPI ObpInitSdCache(VOID)
Definition: obsdcach.c:61
FORCEINLINE VOID ObpReleaseLookupContext(IN POBP_LOOKUP_CONTEXT Context)
Definition: ob_x.h:255
NTSTATUS NTAPI NtCreateDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: obdir.c:773
#define ObpSymbolicLinkObjectType
Definition: ObTypes.c:124
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:31
FORCEINLINE VOID ObpInitializeLookupContext(IN POBP_LOOKUP_CONTEXT Context)
Definition: ob_x.h:221
BOOLEAN NTAPI ObInit2(VOID)
Definition: obinit.c:136
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:358
struct _GENERAL_LOOKASIDE * P
Definition: ketypes.h:801
#define DIRECTORY_ALL_ACCESS
Definition: nt_native.h:1259
static NTSTATUS NTAPI ObpCreateKernelObjectsSD(OUT PSECURITY_DESCRIPTOR *SecurityDescriptor)
Definition: obinit.c:65
NTSTATUS NTAPI ObpParseSymbolicLink(IN PVOID ParsedObject, IN PVOID ObjectType, IN OUT PACCESS_STATE AccessState, IN KPROCESSOR_MODE AccessMode, IN ULONG Attributes, IN OUT PUNICODE_STRING FullPath, IN OUT PUNICODE_STRING RemainingName, IN OUT PVOID Context OPTIONAL, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL, OUT PVOID *NextObject)
Definition: oblink.c:431
#define NULL
Definition: types.h:112
GENERIC_MAPPING ObpSymbolicLinkMapping
Definition: obinit.c:38
VOID NTAPI PsInitializeQuotaSystem(VOID)
Definition: quota.c:100
static POBJECT_TYPE ObpTypeObjectType
Definition: ObTypes.c:122
_In_ HANDLE Handle
Definition: extypes.h:390
struct tagContext Context
Definition: acpixf.h:1034
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
KGUARDED_MUTEX ObpDeviceMapLock
Definition: oblife.c:24
LIST_ENTRY TypeList
Definition: obtypes.h:382
OB_DELETE_METHOD DeleteProcedure
Definition: obtypes.h:369
struct _OBJECT_SYMBOLIC_LINK OBJECT_SYMBOLIC_LINK
ULONG DefaultNonPagedPoolCharge
Definition: obtypes.h:365
LIST_ENTRY ExSystemLookasideListHead
Definition: lookas.c:21
PSECURITY_DESCRIPTOR SePublicDefaultUnrestrictedSd
Definition: sd.c:19
POBJECT_DIRECTORY ObpTypeDirectoryObject
Definition: obname.c:20
struct _OBJECT_DIRECTORY OBJECT_DIRECTORY

Referenced by ExpInitializeExecutive(), and Phase1InitializationDiscard().

◆ ObpCreateKernelObjectsSD()

static NTSTATUS NTAPI ObpCreateKernelObjectsSD ( OUT PSECURITY_DESCRIPTOR SecurityDescriptor)
static

Definition at line 65 of file obinit.c.

66 {
68  PACL Dacl;
69  ULONG AclSize, SdSize;
71 
72  AclSize = sizeof(ACL) +
73  sizeof(ACE) + RtlLengthSid(SeWorldSid) +
74  sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid) +
76 
77  SdSize = sizeof(SECURITY_DESCRIPTOR) + AclSize;
78 
79  /* Allocate the SD and ACL */
80  Sd = ExAllocatePoolWithTag(PagedPool, SdSize, TAG_SD);
81  if (Sd == NULL)
82  {
84  }
85 
86  /* Initialize the SD */
89  if (!NT_SUCCESS(Status))
90  goto done;
91 
92  Dacl = (PACL)((INT_PTR)Sd + sizeof(SECURITY_DESCRIPTOR));
93 
94  /* Initialize the DACL */
95  RtlCreateAcl(Dacl, AclSize, ACL_REVISION);
96 
97  /* Add the ACEs */
100  GENERIC_READ,
101  SeWorldSid);
102 
104  ACL_REVISION,
105  GENERIC_ALL,
107 
109  ACL_REVISION,
110  GENERIC_ALL,
112 
113  /* Attach the DACL to the SD */
115  TRUE,
116  Dacl,
117  FALSE);
118  if (!NT_SUCCESS(Status))
119  goto done;
120 
121  *SecurityDescriptor = Sd;
122 
123 done:
124  if (!NT_SUCCESS(Status))
125  {
126  if (Sd != NULL)
128  }
129 
130  return Status;
131 }
#define GENERIC_ALL
Definition: nt_native.h:92
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TRUE
Definition: types.h:120
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:182
struct _ACE ACE
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS NTAPI RtlCreateSecurityDescriptor(_Out_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ ULONG Revision)
int32_t INT_PTR
Definition: typedefs.h:64
NTSYSAPI NTSTATUS WINAPI RtlAddAccessAllowedAce(PACL, DWORD, DWORD, PSID)
NTSYSAPI NTSTATUS WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR, BOOLEAN, PACL, BOOLEAN)
NTSYSAPI NTSTATUS NTAPI RtlCreateAcl(PACL Acl, ULONG AclSize, ULONG AclRevision)
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
#define FALSE
Definition: types.h:117
struct _ACL ACL
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
Definition: sid.c:150
#define TAG_SD
Definition: tag.h:176
struct _ACL * PACL
Definition: security.c:104
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
Definition: rtlfuncs.h:1552
PSID SeAliasAdminsSid
Definition: sid.c:43
#define GENERIC_READ
Definition: compat.h:135
struct _SECURITY_DESCRIPTOR SECURITY_DESCRIPTOR
PSID SeWorldSid
Definition: sid.c:27
#define NULL
Definition: types.h:112
#define ACL_REVISION
Definition: setypes.h:39
PSID SeLocalSystemSid
Definition: sid.c:40
unsigned int ULONG
Definition: retypes.h:1
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
Definition: rtltypes.h:990

Referenced by ObInitSystem().

◆ PsInitializeQuotaSystem()

VOID NTAPI PsInitializeQuotaSystem ( VOID  )

Definition at line 100 of file quota.c.

101 {
105  PspDefaultQuotaBlock.QuotaEntry[2].Limit = (SIZE_T)-1; /* Page file */
106  PsGetCurrentProcess()->QuotaBlock = &PspDefaultQuotaBlock;
107 }
EPROCESS_QUOTA_ENTRY QuotaEntry[3]
Definition: pstypes.h:988
EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock
Definition: quota.c:17
#define PsGetCurrentProcess
Definition: psfuncs.h:17
ULONG_PTR SIZE_T
Definition: typedefs.h:80
SIZE_T Limit
Definition: pstypes.h:981
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by ObInitSystem().

Variable Documentation

◆ ObpDirectoryMapping

GENERIC_MAPPING ObpDirectoryMapping
Initial value:
=
{
}
#define STANDARD_RIGHTS_WRITE
Definition: nt_native.h:66
#define DIRECTORY_CREATE_OBJECT
Definition: nt_native.h:1256
#define STANDARD_RIGHTS_EXECUTE
Definition: nt_native.h:67
#define DIRECTORY_TRAVERSE
Definition: nt_native.h:1255
#define DIRECTORY_CREATE_SUBDIRECTORY
Definition: nt_native.h:1257
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65
#define DIRECTORY_ALL_ACCESS
Definition: nt_native.h:1259
#define DIRECTORY_QUERY
Definition: nt_native.h:1254

Definition at line 27 of file obinit.c.

Referenced by ObInitSystem().

◆ ObpInitializationPhase

ULONG ObpInitializationPhase

Definition at line 54 of file obinit.c.

Referenced by ObInitSystem().

◆ ObpObjectSecurityMode

ULONG ObpObjectSecurityMode = 0

Definition at line 56 of file obinit.c.

Referenced by QSI_DEF().

◆ ObpProtectionMode

ULONG ObpProtectionMode = 0

Definition at line 57 of file obinit.c.

Referenced by ObpCreateDosDevicesDirectory(), and ObpGetDosDevicesProtection().

◆ ObpSymbolicLinkMapping

GENERIC_MAPPING ObpSymbolicLinkMapping
Initial value:
=
{
}
#define STANDARD_RIGHTS_WRITE
Definition: nt_native.h:66
#define STANDARD_RIGHTS_EXECUTE
Definition: nt_native.h:67
#define SYMBOLIC_LINK_ALL_ACCESS
Definition: nt_native.h:1267
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65
#define SYMBOLIC_LINK_QUERY
Definition: nt_native.h:1265

Definition at line 38 of file obinit.c.

Referenced by ObInitSystem().

◆ ObpTraceLevel

ULONG ObpTraceLevel = 0

Definition at line 47 of file obinit.c.

◆ ObpTypeMapping

GENERIC_MAPPING ObpTypeMapping
Initial value:
=
{
0x000F0001
}
#define STANDARD_RIGHTS_WRITE
Definition: nt_native.h:66
#define STANDARD_RIGHTS_EXECUTE
Definition: nt_native.h:67
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65

Definition at line 19 of file obinit.c.

Referenced by ObInitSystem().

◆ ObSystemDeviceMap