ReactOS  0.4.14-dev-342-gdc047f9
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 INIT_FUNCTION NTSTATUS NTAPI ObpCreateKernelObjectsSD (OUT PSECURITY_DESCRIPTOR *SecurityDescriptor)
 
BOOLEAN INIT_FUNCTION NTAPI ObInit2 (VOID)
 
BOOLEAN INIT_FUNCTION 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 INIT_FUNCTION NTAPI ObInit2 ( VOID  )

Definition at line 135 of file obinit.c.

136 {
137  CCHAR i;
138  PKPRCB Prcb;
139  PGENERAL_LOOKASIDE CurrentList = NULL;
140 
141  /* Now allocate the per-processor lists */
142  for (i = 0; i < KeNumberProcessors; i++)
143  {
144  /* Get the PRCB for this CPU */
145  Prcb = KiProcessorBlock[(int)i];
146 
147  /* Set the OBJECT_CREATE_INFORMATION List */
149  CurrentList = ExAllocatePoolWithTag(NonPagedPool,
150  sizeof(GENERAL_LOOKASIDE),
151  'ICbO');
152  if (CurrentList)
153  {
154  /* Initialize it */
156  NonPagedPool,
158  'ICbO',
159  32,
161  }
162  else
163  {
164  /* No list, use the static buffer */
165  CurrentList = &ObpCreateInfoLookasideList;
166  }
167 
168  /* Link it */
169  Prcb->PPLookasideList[LookasideCreateInfoList].P = CurrentList;
170 
171  /* Set the captured UNICODE_STRING Object Name List */
173  CurrentList = ExAllocatePoolWithTag(NonPagedPool,
174  sizeof(GENERAL_LOOKASIDE),
175  'MNbO');
176  if (CurrentList)
177  {
178  /* Initialize it */
180  PagedPool,
181  248,
182  'MNbO',
183  16,
185  }
186  else
187  {
188  /* No list, use the static buffer */
189  CurrentList = &ObpNameBufferLookasideList;
190  }
191 
192  /* Link it */
193  Prcb->PPLookasideList[LookasideNameBufferList].P = CurrentList;
194  }
195 
196  return TRUE;
197 }
#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
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 LOOKASIDE_ALIGN _GENERAL_LOOKASIDE * PGENERAL_LOOKASIDE
GENERAL_LOOKASIDE ObpNameBufferLookasideList
Definition: oblife.c:26
smooth NULL
Definition: ftsmooth.c:416
INIT_FUNCTION 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:35
char CCHAR
Definition: typedefs.h:50
struct _GENERAL_LOOKASIDE * L
Definition: ketypes.h:760
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
struct _GENERAL_LOOKASIDE * P
Definition: ketypes.h:759
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
LIST_ENTRY ExSystemLookasideListHead
Definition: lookas.c:25
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by ObInitSystem().

◆ ObInitSystem()

BOOLEAN INIT_FUNCTION NTAPI ObInitSystem ( VOID  )

Definition at line 202 of file obinit.c.

203 {
206  OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
208  HANDLE Handle;
209  PKPRCB Prcb = KeGetCurrentPrcb();
210  PLIST_ENTRY ListHead, NextEntry;
212  POBJECT_HEADER_CREATOR_INFO CreatorInfo;
213  POBJECT_HEADER_NAME_INFO NameInfo;
214  PSECURITY_DESCRIPTOR KernelObjectsSD = NULL;
216 
217  /* Check if this is actually Phase 1 initialization */
218  if (ObpInitializationPhase != 0) goto ObPostPhase0;
219 
220  /* Initialize the OBJECT_CREATE_INFORMATION List */
222  NonPagedPool,
224  'ICbO',
225  32,
227 
228  /* Set the captured UNICODE_STRING Object Name List */
230  PagedPool,
231  248,
232  'MNbO',
233  16,
235 
236  /* Temporarily setup both pointers to the shared list */
241 
242  /* Initialize the security descriptor cache */
243  ObpInitSdCache();
244 
245  /* Initialize the Default Event */
247 
248  /* Initialize the Dos Device Map mutex */
250 
251  /* Setup default access for the system process */
252  PsGetCurrentProcess()->GrantedAccess = PROCESS_ALL_ACCESS;
253  PsGetCurrentThread()->GrantedAccess = THREAD_ALL_ACCESS;
254 
255  /* Setup the Object Reaper */
257 
258  /* Initialize default Quota block */
260 
261  /* Create kernel handle table */
262  PsGetCurrentProcess()->ObjectTable = ExCreateHandleTable(NULL);
263  ObpKernelHandleTable = PsGetCurrentProcess()->ObjectTable;
264 
265  /* Create the Type Type */
266  RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
267  RtlInitUnicodeString(&Name, L"Type");
268  ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
269  ObjectTypeInitializer.ValidAccessMask = OBJECT_TYPE_ALL_ACCESS;
270  ObjectTypeInitializer.UseDefaultObject = TRUE;
271  ObjectTypeInitializer.MaintainTypeList = TRUE;
272  ObjectTypeInitializer.PoolType = NonPagedPool;
273  ObjectTypeInitializer.GenericMapping = ObpTypeMapping;
274  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_TYPE);
275  ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
276  ObjectTypeInitializer.DeleteProcedure = ObpDeleteObjectType;
277  ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpTypeObjectType);
278 
279  /* Create the Directory Type */
280  RtlInitUnicodeString(&Name, L"Directory");
281  ObjectTypeInitializer.PoolType = PagedPool;
282  ObjectTypeInitializer.ValidAccessMask = DIRECTORY_ALL_ACCESS;
283  ObjectTypeInitializer.CaseInsensitive = TRUE;
284  ObjectTypeInitializer.MaintainTypeList = FALSE;
285  ObjectTypeInitializer.GenericMapping = ObpDirectoryMapping;
286  ObjectTypeInitializer.DeleteProcedure = NULL;
287  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_DIRECTORY);
288  ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpDirectoryObjectType);
289  ObpDirectoryObjectType->TypeInfo.ValidAccessMask &= ~SYNCHRONIZE;
290 
291  /* Create 'symbolic link' object type */
292  RtlInitUnicodeString(&Name, L"SymbolicLink");
293  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_SYMBOLIC_LINK);
294  ObjectTypeInitializer.GenericMapping = ObpSymbolicLinkMapping;
295  ObjectTypeInitializer.ValidAccessMask = SYMBOLIC_LINK_ALL_ACCESS;
296  ObjectTypeInitializer.ParseProcedure = ObpParseSymbolicLink;
297  ObjectTypeInitializer.DeleteProcedure = ObpDeleteSymbolicLink;
298  ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpSymbolicLinkObjectType);
299  ObpSymbolicLinkObjectType->TypeInfo.ValidAccessMask &= ~SYNCHRONIZE;
300 
301  /* Phase 0 initialization complete */
303  return TRUE;
304 
305 ObPostPhase0:
306 
307  /* Re-initialize lookaside lists */
308  ObInit2();
309 
310  /* Initialize Object Types directory attributes */
311  RtlInitUnicodeString(&Name, L"\\");
313  &Name,
315  NULL,
317 
318  /* Create the directory */
322  if (!NT_SUCCESS(Status)) return FALSE;
323 
324  /* Get a handle to it */
326  0,
328  KernelMode,
330  NULL);
331  if (!NT_SUCCESS(Status)) return FALSE;
332 
333  /* Close the extra handle */
334  Status = NtClose(Handle);
335  if (!NT_SUCCESS(Status)) return FALSE;
336 
337  /* Create a custom security descriptor for the KernelObjects directory */
338  Status = ObpCreateKernelObjectsSD(&KernelObjectsSD);
339  if (!NT_SUCCESS(Status))
340  return FALSE;
341 
342  /* Initialize the KernelObjects directory attributes */
343  RtlInitUnicodeString(&Name, L"\\KernelObjects");
345  &Name,
347  NULL,
348  KernelObjectsSD);
349 
350  /* Create the directory */
354  ExFreePoolWithTag(KernelObjectsSD, TAG_SD);
355  if (!NT_SUCCESS(Status)) return FALSE;
356 
357  /* Close the extra handle */
358  Status = NtClose(Handle);
359  if (!NT_SUCCESS(Status)) return FALSE;
360 
361  /* Initialize ObjectTypes directory attributes */
362  RtlInitUnicodeString(&Name, L"\\ObjectTypes");
364  &Name,
366  NULL,
367  NULL);
368 
369  /* Create the directory */
373  if (!NT_SUCCESS(Status)) return FALSE;
374 
375  /* Get a handle to it */
377  0,
379  KernelMode,
381  NULL);
382  if (!NT_SUCCESS(Status)) return FALSE;
383 
384  /* Close the extra handle */
385  Status = NtClose(Handle);
386  if (!NT_SUCCESS(Status)) return FALSE;
387 
388  /* Initialize lookup context */
390 
391  /* Lock it */
393 
394  /* Loop the object types */
395  ListHead = &ObpTypeObjectType->TypeList;
396  NextEntry = ListHead->Flink;
397  while (ListHead != NextEntry)
398  {
399  /* Get the creator info from the list */
400  CreatorInfo = CONTAINING_RECORD(NextEntry,
402  TypeList);
403 
404  /* Recover the header and the name header from the creator info */
405  Header = (POBJECT_HEADER)(CreatorInfo + 1);
407 
408  /* Make sure we have a name, and aren't inserted yet */
409  if ((NameInfo) && !(NameInfo->Directory))
410  {
411  /* Do the initial lookup to setup the context */
413  &NameInfo->Name,
415  FALSE,
416  &Context))
417  {
418  /* Insert this object type */
420  &Context,
421  Header);
422  }
423  }
424 
425  /* Move to the next entry */
426  NextEntry = NextEntry->Flink;
427  }
428 
429  /* Cleanup after lookup */
431 
432  /* Initialize DOS Devices Directory and related Symbolic Links */
434  if (!NT_SUCCESS(Status)) return FALSE;
435  return TRUE;
436 }
VOID NTAPI ObpDeleteSymbolicLink(IN PVOID ObjectBody)
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 TRUE
Definition: types.h:120
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1324
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
WORK_QUEUE_ITEM ObpReaperWorkItem
Definition: oblife.c:28
static INIT_FUNCTION NTSTATUS NTAPI ObpCreateKernelObjectsSD(OUT PSECURITY_DESCRIPTOR *SecurityDescriptor)
Definition: obinit.c:64
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1062
UNICODE_STRING Name
Definition: obtypes.h:433
GENERIC_MAPPING ObpDirectoryMapping
Definition: obinit.c:27
INIT_FUNCTION NTSTATUS NTAPI ObpInitSdCache(VOID)
Definition: obsdcach.c:61
#define OBJ_OPENLINK
Definition: winternl.h:230
#define OBJECT_HEADER_TO_NAME_INFO(h)
Definition: obtypes.h:114
#define OBJ_PERMANENT
Definition: winternl.h:226
GENERAL_LOOKASIDE ObpCreateInfoLookasideList
Definition: oblife.c:26
ULONG ObpInitializationPhase
Definition: obinit.c:53
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
Definition: Header.h:8
GENERAL_LOOKASIDE ObpNameBufferLookasideList
Definition: oblife.c:26
struct NameRec_ * Name
Definition: cdprocs.h:464
#define PsGetCurrentProcess
Definition: psfuncs.h:17
VOID NTAPI ObpReapObject(IN PVOID Unused)
Definition: oblife.c:221
smooth NULL
Definition: ftsmooth.c:416
PHANDLE_TABLE ObpKernelHandleTable
Definition: obhandle.c:20
#define TAG_SD
Definition: tag.h:176
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
INIT_FUNCTION 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:35
BOOLEAN NTAPI ObpInsertEntryDirectory(IN POBJECT_DIRECTORY Parent, IN POBP_LOOKUP_CONTEXT Context, IN POBJECT_HEADER ObjectHeader)
Definition: obdir.c:45
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
_In_ HANDLE Handle
Definition: extypes.h:390
#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
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
struct _GENERAL_LOOKASIDE * L
Definition: ketypes.h:760
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
BOOLEAN INIT_FUNCTION NTAPI ObInit2(VOID)
Definition: obinit.c:135
Definition: typedefs.h:117
#define SYNCHRONIZE
Definition: nt_native.h:61
#define OBJECT_TYPE_ALL_ACCESS
Definition: nt_native.h:1248
Status
Definition: gdiplustypes.h:24
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
#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:759
#define DIRECTORY_ALL_ACCESS
Definition: nt_native.h:1259
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
GENERIC_MAPPING ObpSymbolicLinkMapping
Definition: obinit.c:38
VOID NTAPI PsInitializeQuotaSystem(VOID)
Definition: quota.c:100
INIT_FUNCTION NTSTATUS NTAPI ObpCreateDosDevicesDirectory(VOID)
Definition: obname.c:177
static POBJECT_TYPE ObpTypeObjectType
Definition: ObTypes.c:122
struct tagContext Context
Definition: acpixf.h:1030
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#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:25
PSECURITY_DESCRIPTOR SePublicDefaultUnrestrictedSd
Definition: sd.c:23
POBJECT_DIRECTORY ObpTypeDirectoryObject
Definition: obname.c:20
struct _OBJECT_DIRECTORY OBJECT_DIRECTORY

Referenced by ExpInitializeExecutive(), and Phase1InitializationDiscard().

◆ ObpCreateKernelObjectsSD()

static INIT_FUNCTION NTSTATUS NTAPI ObpCreateKernelObjectsSD ( OUT PSECURITY_DESCRIPTOR SecurityDescriptor)
static

Definition at line 64 of file obinit.c.

65 {
67  PACL Dacl;
68  ULONG AclSize, SdSize;
70 
71  AclSize = sizeof(ACL) +
72  sizeof(ACE) + RtlLengthSid(SeWorldSid) +
73  sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid) +
75 
76  SdSize = sizeof(SECURITY_DESCRIPTOR) + AclSize;
77 
78  /* Allocate the SD and ACL */
79  Sd = ExAllocatePoolWithTag(PagedPool, SdSize, TAG_SD);
80  if (Sd == NULL)
81  {
83  }
84 
85  /* Initialize the SD */
88  if (!NT_SUCCESS(Status))
89  goto done;
90 
91  Dacl = (PACL)((INT_PTR)Sd + sizeof(SECURITY_DESCRIPTOR));
92 
93  /* Initialize the DACL */
94  RtlCreateAcl(Dacl, AclSize, ACL_REVISION);
95 
96  /* Add the ACEs */
100  SeWorldSid);
101 
103  ACL_REVISION,
104  GENERIC_ALL,
106 
108  ACL_REVISION,
109  GENERIC_ALL,
111 
112  /* Attach the DACL to the SD */
114  TRUE,
115  Dacl,
116  FALSE);
117  if (!NT_SUCCESS(Status))
118  goto done;
119 
120  *SecurityDescriptor = Sd;
121 
122 done:
123  if (!NT_SUCCESS(Status))
124  {
125  if (Sd != NULL)
127  }
128 
129  return Status;
130 }
#define GENERIC_ALL
Definition: nt_native.h:92
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_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:62
NTSYSAPI NTSTATUS WINAPI RtlAddAccessAllowedAce(PACL, DWORD, DWORD, PSID)
NTSYSAPI NTSTATUS NTAPI RtlCreateAcl(PACL Acl, ULONG AclSize, ULONG AclRevision)
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
struct _ACL ACL
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR, BOOLEAN, PACL, BOOLEAN)
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
#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:1553
PSID SeAliasAdminsSid
Definition: sid.c:47
#define GENERIC_READ
Definition: compat.h:124
struct _SECURITY_DESCRIPTOR SECURITY_DESCRIPTOR
PSID SeWorldSid
Definition: sid.c:31
Status
Definition: gdiplustypes.h:24
#define ACL_REVISION
Definition: setypes.h:39
PSID SeLocalSystemSid
Definition: sid.c:44
unsigned int ULONG
Definition: retypes.h:1
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
Definition: rtltypes.h:988

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:977
EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock
Definition: quota.c:17
#define PsGetCurrentProcess
Definition: psfuncs.h:17
ULONG_PTR SIZE_T
Definition: typedefs.h:78
SIZE_T Limit
Definition: pstypes.h:970
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261

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 53 of file obinit.c.

Referenced by ObInitSystem().

◆ ObpObjectSecurityMode

ULONG ObpObjectSecurityMode = 0

Definition at line 55 of file obinit.c.

Referenced by QSI_DEF().

◆ ObpProtectionMode

ULONG ObpProtectionMode = 0

Definition at line 56 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