From b09db8ab65f7eb79a5e33461bbdb331f4064d0ab Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Wed, 25 May 2005 04:16:56 +0000 Subject: [PATCH] Nonpaged Pool Liberation Day: Allow PagedPool to be used earlier, allow fast mutex to be used earlier on debug builds. Allocate all Se stuff from PagedPool, set the right object types to use paged pool, allocate all strings from paged pool, allocate PE sections from paged pool, and a bunch of other things which should, imo, be in paged pool. If anyone has any contradicting proof, let me know...until then, enjoy ~4-6MB more NonPagedPool svn path=/trunk/; revision=15492 --- reactos/lib/rtl/unicode.c | 28 ++++---- reactos/ntoskrnl/cm/registry.c | 4 +- reactos/ntoskrnl/ex/fmutex.c | 4 +- reactos/ntoskrnl/ex/init.c | 4 +- reactos/ntoskrnl/include/internal/tag.h | 10 +-- reactos/ntoskrnl/mm/mm.c | 5 +- reactos/ntoskrnl/mm/section.c | 6 +- reactos/ntoskrnl/rtl/handle.c | 2 +- reactos/ntoskrnl/se/acl.c | 12 ++-- reactos/ntoskrnl/se/sd.c | 24 +++---- reactos/ntoskrnl/se/semgr.c | 94 ++++++++++++------------- reactos/ntoskrnl/se/sid.c | 52 +++++++------- reactos/ntoskrnl/se/token.c | 10 +-- 13 files changed, 127 insertions(+), 128 deletions(-) diff --git a/reactos/lib/rtl/unicode.c b/reactos/lib/rtl/unicode.c index 8a772040616..79aa1d8af9c 100644 --- a/reactos/lib/rtl/unicode.c +++ b/reactos/lib/rtl/unicode.c @@ -990,7 +990,7 @@ RtlUnicodeStringToAnsiString( AnsiDest, UniSource, AllocateDestinationString, - NonPagedPool); + PagedPool); } @@ -1073,7 +1073,7 @@ RtlOemStringToUnicodeString( UniDest, OemSource, AllocateDestinationString, - NonPagedPool); + PagedPool); } @@ -1157,7 +1157,7 @@ RtlUnicodeStringToOemString( OemDest, UniSource, AllocateDestinationString, - NonPagedPool); + PagedPool); } @@ -1304,7 +1304,7 @@ RtlOemStringToCountedUnicodeString( UniDest, OemSource, AllocateDestinationString, - NonPagedPool); + PagedPool); } @@ -1634,7 +1634,7 @@ RtlUnicodeStringToCountedOemString( OemDest, UniSource, AllocateDestinationString, - NonPagedPool); + PagedPool); } /* @@ -1766,7 +1766,7 @@ RtlUpcaseUnicodeString( UniDest, UniSource, AllocateDestinationString, - NonPagedPool); + PagedPool); } @@ -1833,7 +1833,7 @@ RtlUpcaseUnicodeStringToAnsiString( AnsiDest, UniSource, AllocateDestinationString, - NonPagedPool); + PagedPool); } /* @@ -1921,7 +1921,7 @@ RtlUpcaseUnicodeStringToCountedOemString( OemDest, UniSource, AllocateDestinationString, - NonPagedPool); + PagedPool); } @@ -2007,7 +2007,7 @@ RtlUpcaseUnicodeStringToOemString ( OemDest, UniSource, AllocateDestinationString, - NonPagedPool); + PagedPool); } @@ -2287,7 +2287,7 @@ RtlCreateUnicodeString( { DPRINT("RtlCreateUnicodeString\n"); - return RtlpCreateUnicodeString(UniDest, Source, NonPagedPool); + return RtlpCreateUnicodeString(UniDest, Source, PagedPool); } @@ -2306,7 +2306,7 @@ RtlpCreateUnicodeString( ULONG Length; Length = (wcslen (Source) + 1) * sizeof(WCHAR); - + PoolType = PagedPool; UniDest->Buffer = ExAllocatePoolWithTag(PoolType, Length, TAG_USTR); if (UniDest->Buffer == NULL) return FALSE; @@ -2363,7 +2363,7 @@ RtlDowncaseUnicodeString( UniDest, UniSource, AllocateDestinationString, - NonPagedPool); + PagedPool); } @@ -2473,7 +2473,7 @@ RtlAnsiStringToUnicodeString( UniDest, AnsiSource, AllocateDestinationString, - NonPagedPool); + PagedPool); } @@ -2664,7 +2664,7 @@ RtlDuplicateUnicodeString( AddNull, SourceString, DestinationString, - NonPagedPool); + PagedPool); } diff --git a/reactos/ntoskrnl/cm/registry.c b/reactos/ntoskrnl/cm/registry.c index ebc3aee846a..621963a756a 100644 --- a/reactos/ntoskrnl/cm/registry.c +++ b/reactos/ntoskrnl/cm/registry.c @@ -356,9 +356,9 @@ CmInitializeRegistry(VOID) RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); RtlInitUnicodeString(&Name, L"Key"); ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); - ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KEY_OBJECT); + ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(KEY_OBJECT); ObjectTypeInitializer.GenericMapping = CmiKeyMapping; - ObjectTypeInitializer.PoolType = NonPagedPool; + ObjectTypeInitializer.PoolType = PagedPool; ObjectTypeInitializer.ValidAccessMask = KEY_ALL_ACCESS; ObjectTypeInitializer.UseDefaultObject = TRUE; ObjectTypeInitializer.DeleteProcedure = CmiObjectDelete; diff --git a/reactos/ntoskrnl/ex/fmutex.c b/reactos/ntoskrnl/ex/fmutex.c index 9f905d793c8..8fd4e057481 100644 --- a/reactos/ntoskrnl/ex/fmutex.c +++ b/reactos/ntoskrnl/ex/fmutex.c @@ -21,7 +21,7 @@ VOID FASTCALL ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex) { - ASSERT(FastMutex->Owner != KeGetCurrentThread()); + //ASSERT(FastMutex->Owner != KeGetCurrentThread()); InterlockedIncrementUL(&FastMutex->Contention); while (InterlockedExchange(&FastMutex->Count, 0) == 0) { @@ -41,7 +41,7 @@ ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex) VOID FASTCALL ExReleaseFastMutexUnsafe(PFAST_MUTEX FastMutex) { - ASSERT(FastMutex->Owner == KeGetCurrentThread()); + //ASSERT(FastMutex->Owner == KeGetCurrentThread()); FastMutex->Owner = NULL; InterlockedExchange(&FastMutex->Count, 1); if (FastMutex->Contention > 0) diff --git a/reactos/ntoskrnl/ex/init.c b/reactos/ntoskrnl/ex/init.c index 08aae21d139..f58d0187124 100644 --- a/reactos/ntoskrnl/ex/init.c +++ b/reactos/ntoskrnl/ex/init.c @@ -481,10 +481,10 @@ ExpInitializeExecutive(VOID) /* Set 1 CPU for now, we'll increment this later */ KeNumberProcessors = 1; - + /* Initalize the Process Manager */ PiInitProcessManager(); - + /* Break into the Debugger if requested */ if (KdPollBreakIn()) DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C); diff --git a/reactos/ntoskrnl/include/internal/tag.h b/reactos/ntoskrnl/include/internal/tag.h index a0b0583ac1e..4ea0cd0c9f5 100644 --- a/reactos/ntoskrnl/include/internal/tag.h +++ b/reactos/ntoskrnl/include/internal/tag.h @@ -134,12 +134,12 @@ #define TAG_HDTB TAG('H', 'D', 'T', 'B') /* formerly located in se/acl.c */ -#define TAG_ACL TAG('A', 'C', 'L', 'T') - -/* formerly located in se/semgr.c */ -#define TAG_SXPT TAG('S', 'X', 'P', 'T') +#define TAG_ACL TAG('S', 'e', 'A', 'c') /* formerly located in se/sid.c */ -#define TAG_SID TAG('S', 'I', 'D', 'T') +#define TAG_SID TAG('S', 'e', 'S', 'i') + +/* formerly located in se/sd.c */ +#define TAG_SD TAG('S', 'e', 'S', 'd') #endif /* _NTOSKRNL_TAG_H */ diff --git a/reactos/ntoskrnl/mm/mm.c b/reactos/ntoskrnl/mm/mm.c index eafada883d2..0bd5e39cdc5 100644 --- a/reactos/ntoskrnl/mm/mm.c +++ b/reactos/ntoskrnl/mm/mm.c @@ -321,8 +321,11 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode, } if (PsGetCurrentProcess() == NULL) { + /* Allow this! It lets us page alloc much earlier! It won't be needed + * after my init patch anyways + */ DbgPrint("No current process\n"); - return(STATUS_UNSUCCESSFUL); + //return(STATUS_UNSUCCESSFUL); } /* diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 0182e92a3ca..2997d649026 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -2123,8 +2123,8 @@ MmInitSectionImplementation(VOID) RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); RtlInitUnicodeString(&Name, L"Section"); ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); - ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(SECTION_OBJECT); - ObjectTypeInitializer.PoolType = NonPagedPool; + ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(SECTION_OBJECT); + ObjectTypeInitializer.PoolType = PagedPool; ObjectTypeInitializer.UseDefaultObject = TRUE; ObjectTypeInitializer.GenericMapping = MmpSectionMapping; ObjectTypeInitializer.DeleteProcedure = MmpDeleteSection; @@ -2499,7 +2499,7 @@ ExeFmtpAllocateSegments(IN ULONG NrSegments) /* TODO: check for integer overflow */ SizeOfSegments = sizeof(MM_SECTION_SEGMENT) * NrSegments; - Segments = ExAllocatePoolWithTag(NonPagedPool, + Segments = ExAllocatePoolWithTag(PagedPool, SizeOfSegments, TAG_MM_SECTION_SEGMENT); diff --git a/reactos/ntoskrnl/rtl/handle.c b/reactos/ntoskrnl/rtl/handle.c index d7adfd56a6a..90a1befe941 100644 --- a/reactos/ntoskrnl/rtl/handle.c +++ b/reactos/ntoskrnl/rtl/handle.c @@ -63,7 +63,7 @@ RtlpAllocateHandle(PRTL_HANDLE_TABLE HandleTable, { /* allocate handle array */ ArraySize = sizeof(RTL_HANDLE) * HandleTable->TableSize; - ArrayPointer = ExAllocatePoolWithTag(NonPagedPool, + ArrayPointer = ExAllocatePoolWithTag(PagedPool, ArraySize, TAG_HDTB); if (ArrayPointer == NULL) diff --git a/reactos/ntoskrnl/se/acl.c b/reactos/ntoskrnl/se/acl.c index 3ad94a742ac..ad725253abf 100644 --- a/reactos/ntoskrnl/se/acl.c +++ b/reactos/ntoskrnl/se/acl.c @@ -36,7 +36,7 @@ SepInitDACLs(VOID) (sizeof(ACE) + RtlLengthSid(SeWorldSid)) + (sizeof(ACE) + RtlLengthSid(SeLocalSystemSid)); - SePublicDefaultDacl = ExAllocatePoolWithTag(NonPagedPool, + SePublicDefaultDacl = ExAllocatePoolWithTag(PagedPool, AclLength, TAG_ACL); if (SePublicDefaultDacl == NULL) @@ -64,7 +64,7 @@ SepInitDACLs(VOID) (sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid)) + (sizeof(ACE) + RtlLengthSid(SeRestrictedCodeSid)); - SePublicDefaultUnrestrictedDacl = ExAllocatePoolWithTag(NonPagedPool, + SePublicDefaultUnrestrictedDacl = ExAllocatePoolWithTag(PagedPool, AclLength, TAG_ACL); if (SePublicDefaultUnrestrictedDacl == NULL) @@ -100,7 +100,7 @@ SepInitDACLs(VOID) (sizeof(ACE) + RtlLengthSid(SeLocalSystemSid)) + (sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid)); - SePublicOpenDacl = ExAllocatePoolWithTag(NonPagedPool, + SePublicOpenDacl = ExAllocatePoolWithTag(PagedPool, AclLength, TAG_ACL); if (SePublicOpenDacl == NULL) @@ -132,7 +132,7 @@ SepInitDACLs(VOID) (sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid)) + (sizeof(ACE) + RtlLengthSid(SeRestrictedCodeSid)); - SePublicOpenUnrestrictedDacl = ExAllocatePoolWithTag(NonPagedPool, + SePublicOpenUnrestrictedDacl = ExAllocatePoolWithTag(PagedPool, AclLength, TAG_ACL); if (SePublicOpenUnrestrictedDacl == NULL) @@ -167,7 +167,7 @@ SepInitDACLs(VOID) (sizeof(ACE) + RtlLengthSid(SeLocalSystemSid)) + (sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid)); - SeSystemDefaultDacl = ExAllocatePoolWithTag(NonPagedPool, + SeSystemDefaultDacl = ExAllocatePoolWithTag(PagedPool, AclLength, TAG_ACL); if (SeSystemDefaultDacl == NULL) @@ -192,7 +192,7 @@ SepInitDACLs(VOID) (sizeof(ACE) + RtlLengthSid(SeWorldSid)) + (sizeof(ACE) + RtlLengthSid(SeRestrictedCodeSid)); - SeUnrestrictedDacl = ExAllocatePoolWithTag(NonPagedPool, + SeUnrestrictedDacl = ExAllocatePoolWithTag(PagedPool, AclLength, TAG_ACL); if (SeUnrestrictedDacl == NULL) diff --git a/reactos/ntoskrnl/se/sd.c b/reactos/ntoskrnl/se/sd.c index 5a933bc7b7c..404744ab21e 100644 --- a/reactos/ntoskrnl/se/sd.c +++ b/reactos/ntoskrnl/se/sd.c @@ -28,8 +28,8 @@ BOOLEAN INIT_FUNCTION SepInitSDs(VOID) { /* Create PublicDefaultSd */ - SePublicDefaultSd = ExAllocatePool(NonPagedPool, - sizeof(SECURITY_DESCRIPTOR)); + SePublicDefaultSd = ExAllocatePoolWithTag(PagedPool, + sizeof(SECURITY_DESCRIPTOR), TAG_SD); if (SePublicDefaultSd == NULL) return FALSE; @@ -41,8 +41,8 @@ SepInitSDs(VOID) FALSE); /* Create PublicDefaultUnrestrictedSd */ - SePublicDefaultUnrestrictedSd = ExAllocatePool(NonPagedPool, - sizeof(SECURITY_DESCRIPTOR)); + SePublicDefaultUnrestrictedSd = ExAllocatePoolWithTag(PagedPool, + sizeof(SECURITY_DESCRIPTOR), TAG_SD); if (SePublicDefaultUnrestrictedSd == NULL) return FALSE; @@ -54,8 +54,8 @@ SepInitSDs(VOID) FALSE); /* Create PublicOpenSd */ - SePublicOpenSd = ExAllocatePool(NonPagedPool, - sizeof(SECURITY_DESCRIPTOR)); + SePublicOpenSd = ExAllocatePoolWithTag(PagedPool, + sizeof(SECURITY_DESCRIPTOR), TAG_SD); if (SePublicOpenSd == NULL) return FALSE; @@ -67,8 +67,8 @@ SepInitSDs(VOID) FALSE); /* Create PublicOpenUnrestrictedSd */ - SePublicOpenUnrestrictedSd = ExAllocatePool(NonPagedPool, - sizeof(SECURITY_DESCRIPTOR)); + SePublicOpenUnrestrictedSd = ExAllocatePoolWithTag(PagedPool, + sizeof(SECURITY_DESCRIPTOR), TAG_SD); if (SePublicOpenUnrestrictedSd == NULL) return FALSE; @@ -80,8 +80,8 @@ SepInitSDs(VOID) FALSE); /* Create SystemDefaultSd */ - SeSystemDefaultSd = ExAllocatePool(NonPagedPool, - sizeof(SECURITY_DESCRIPTOR)); + SeSystemDefaultSd = ExAllocatePoolWithTag(PagedPool, + sizeof(SECURITY_DESCRIPTOR), TAG_SD); if (SeSystemDefaultSd == NULL) return FALSE; @@ -93,8 +93,8 @@ SepInitSDs(VOID) FALSE); /* Create UnrestrictedSd */ - SeUnrestrictedSd = ExAllocatePool(NonPagedPool, - sizeof(SECURITY_DESCRIPTOR)); + SeUnrestrictedSd = ExAllocatePoolWithTag(PagedPool, + sizeof(SECURITY_DESCRIPTOR), TAG_SD); if (SeUnrestrictedSd == NULL) return FALSE; diff --git a/reactos/ntoskrnl/se/semgr.c b/reactos/ntoskrnl/se/semgr.c index e32f211f8d9..f58be6a8232 100644 --- a/reactos/ntoskrnl/se/semgr.c +++ b/reactos/ntoskrnl/se/semgr.c @@ -17,6 +17,7 @@ /* GLOBALS ******************************************************************/ PSE_EXPORTS EXPORTED SeExports = NULL; +SE_EXPORTS SepExports; static ERESOURCE SepSubjectContextLock; @@ -121,56 +122,51 @@ SeInitSRM(VOID) static BOOLEAN INIT_FUNCTION SepInitExports(VOID) { - SeExports = ExAllocatePoolWithTag(NonPagedPool, - sizeof(SE_EXPORTS), - TAG_SXPT); - if (SeExports == NULL) - return FALSE; + SepExports.SeCreateTokenPrivilege = SeCreateTokenPrivilege; + SepExports.SeAssignPrimaryTokenPrivilege = SeAssignPrimaryTokenPrivilege; + SepExports.SeLockMemoryPrivilege = SeLockMemoryPrivilege; + SepExports.SeIncreaseQuotaPrivilege = SeIncreaseQuotaPrivilege; + SepExports.SeUnsolicitedInputPrivilege = SeUnsolicitedInputPrivilege; + SepExports.SeTcbPrivilege = SeTcbPrivilege; + SepExports.SeSecurityPrivilege = SeSecurityPrivilege; + SepExports.SeTakeOwnershipPrivilege = SeTakeOwnershipPrivilege; + SepExports.SeLoadDriverPrivilege = SeLoadDriverPrivilege; + SepExports.SeCreatePagefilePrivilege = SeCreatePagefilePrivilege; + SepExports.SeIncreaseBasePriorityPrivilege = SeIncreaseBasePriorityPrivilege; + SepExports.SeSystemProfilePrivilege = SeSystemProfilePrivilege; + SepExports.SeSystemtimePrivilege = SeSystemtimePrivilege; + SepExports.SeProfileSingleProcessPrivilege = SeProfileSingleProcessPrivilege; + SepExports.SeCreatePermanentPrivilege = SeCreatePermanentPrivilege; + SepExports.SeBackupPrivilege = SeBackupPrivilege; + SepExports.SeRestorePrivilege = SeRestorePrivilege; + SepExports.SeShutdownPrivilege = SeShutdownPrivilege; + SepExports.SeDebugPrivilege = SeDebugPrivilege; + SepExports.SeAuditPrivilege = SeAuditPrivilege; + SepExports.SeSystemEnvironmentPrivilege = SeSystemEnvironmentPrivilege; + SepExports.SeChangeNotifyPrivilege = SeChangeNotifyPrivilege; + SepExports.SeRemoteShutdownPrivilege = SeRemoteShutdownPrivilege; - SeExports->SeCreateTokenPrivilege = SeCreateTokenPrivilege; - SeExports->SeAssignPrimaryTokenPrivilege = SeAssignPrimaryTokenPrivilege; - SeExports->SeLockMemoryPrivilege = SeLockMemoryPrivilege; - SeExports->SeIncreaseQuotaPrivilege = SeIncreaseQuotaPrivilege; - SeExports->SeUnsolicitedInputPrivilege = SeUnsolicitedInputPrivilege; - SeExports->SeTcbPrivilege = SeTcbPrivilege; - SeExports->SeSecurityPrivilege = SeSecurityPrivilege; - SeExports->SeTakeOwnershipPrivilege = SeTakeOwnershipPrivilege; - SeExports->SeLoadDriverPrivilege = SeLoadDriverPrivilege; - SeExports->SeCreatePagefilePrivilege = SeCreatePagefilePrivilege; - SeExports->SeIncreaseBasePriorityPrivilege = SeIncreaseBasePriorityPrivilege; - SeExports->SeSystemProfilePrivilege = SeSystemProfilePrivilege; - SeExports->SeSystemtimePrivilege = SeSystemtimePrivilege; - SeExports->SeProfileSingleProcessPrivilege = SeProfileSingleProcessPrivilege; - SeExports->SeCreatePermanentPrivilege = SeCreatePermanentPrivilege; - SeExports->SeBackupPrivilege = SeBackupPrivilege; - SeExports->SeRestorePrivilege = SeRestorePrivilege; - SeExports->SeShutdownPrivilege = SeShutdownPrivilege; - SeExports->SeDebugPrivilege = SeDebugPrivilege; - SeExports->SeAuditPrivilege = SeAuditPrivilege; - SeExports->SeSystemEnvironmentPrivilege = SeSystemEnvironmentPrivilege; - SeExports->SeChangeNotifyPrivilege = SeChangeNotifyPrivilege; - SeExports->SeRemoteShutdownPrivilege = SeRemoteShutdownPrivilege; - - SeExports->SeNullSid = SeNullSid; - SeExports->SeWorldSid = SeWorldSid; - SeExports->SeLocalSid = SeLocalSid; - SeExports->SeCreatorOwnerSid = SeCreatorOwnerSid; - SeExports->SeCreatorGroupSid = SeCreatorGroupSid; - SeExports->SeNtAuthoritySid = SeNtAuthoritySid; - SeExports->SeDialupSid = SeDialupSid; - SeExports->SeNetworkSid = SeNetworkSid; - SeExports->SeBatchSid = SeBatchSid; - SeExports->SeInteractiveSid = SeInteractiveSid; - SeExports->SeLocalSystemSid = SeLocalSystemSid; - SeExports->SeAliasAdminsSid = SeAliasAdminsSid; - SeExports->SeAliasUsersSid = SeAliasUsersSid; - SeExports->SeAliasGuestsSid = SeAliasGuestsSid; - SeExports->SeAliasPowerUsersSid = SeAliasPowerUsersSid; - SeExports->SeAliasAccountOpsSid = SeAliasAccountOpsSid; - SeExports->SeAliasSystemOpsSid = SeAliasSystemOpsSid; - SeExports->SeAliasPrintOpsSid = SeAliasPrintOpsSid; - SeExports->SeAliasBackupOpsSid = SeAliasBackupOpsSid; + SepExports.SeNullSid = SeNullSid; + SepExports.SeWorldSid = SeWorldSid; + SepExports.SeLocalSid = SeLocalSid; + SepExports.SeCreatorOwnerSid = SeCreatorOwnerSid; + SepExports.SeCreatorGroupSid = SeCreatorGroupSid; + SepExports.SeNtAuthoritySid = SeNtAuthoritySid; + SepExports.SeDialupSid = SeDialupSid; + SepExports.SeNetworkSid = SeNetworkSid; + SepExports.SeBatchSid = SeBatchSid; + SepExports.SeInteractiveSid = SeInteractiveSid; + SepExports.SeLocalSystemSid = SeLocalSystemSid; + SepExports.SeAliasAdminsSid = SeAliasAdminsSid; + SepExports.SeAliasUsersSid = SeAliasUsersSid; + SepExports.SeAliasGuestsSid = SeAliasGuestsSid; + SepExports.SeAliasPowerUsersSid = SeAliasPowerUsersSid; + SepExports.SeAliasAccountOpsSid = SeAliasAccountOpsSid; + SepExports.SeAliasSystemOpsSid = SeAliasSystemOpsSid; + SepExports.SeAliasPrintOpsSid = SeAliasPrintOpsSid; + SepExports.SeAliasBackupOpsSid = SeAliasBackupOpsSid; + SeExports = &SepExports; return TRUE; } @@ -498,7 +494,7 @@ SeAssignSecurity(PSECURITY_DESCRIPTOR ParentDescriptor OPTIONAL, DaclLength, SaclLength); - Descriptor = ExAllocatePool(NonPagedPool, + Descriptor = ExAllocatePool(PagedPool, Length); RtlZeroMemory( Descriptor, Length ); diff --git a/reactos/ntoskrnl/se/sid.c b/reactos/ntoskrnl/se/sid.c index be327852699..00b9656c4a1 100644 --- a/reactos/ntoskrnl/se/sid.c +++ b/reactos/ntoskrnl/se/sid.c @@ -67,7 +67,7 @@ SepInitSecurityIDs(VOID) SidLength2 = RtlLengthRequiredSid(2); /* create NullSid */ - SeNullSid = ExAllocatePoolWithTag(NonPagedPool, + SeNullSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeNullSid == NULL) @@ -81,7 +81,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_NULL_RID; /* create WorldSid */ - SeWorldSid = ExAllocatePoolWithTag(NonPagedPool, + SeWorldSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeWorldSid == NULL) @@ -95,7 +95,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_WORLD_RID; /* create LocalSid */ - SeLocalSid = ExAllocatePoolWithTag(NonPagedPool, + SeLocalSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeLocalSid == NULL) @@ -109,7 +109,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_LOCAL_RID; /* create CreatorOwnerSid */ - SeCreatorOwnerSid = ExAllocatePoolWithTag(NonPagedPool, + SeCreatorOwnerSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeCreatorOwnerSid == NULL) @@ -123,7 +123,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_CREATOR_OWNER_RID; /* create CreatorGroupSid */ - SeCreatorGroupSid = ExAllocatePoolWithTag(NonPagedPool, + SeCreatorGroupSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeCreatorGroupSid == NULL) @@ -137,7 +137,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_CREATOR_GROUP_RID; /* create CreatorOwnerServerSid */ - SeCreatorOwnerServerSid = ExAllocatePoolWithTag(NonPagedPool, + SeCreatorOwnerServerSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeCreatorOwnerServerSid == NULL) @@ -151,7 +151,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_CREATOR_OWNER_SERVER_RID; /* create CreatorGroupServerSid */ - SeCreatorGroupServerSid = ExAllocatePoolWithTag(NonPagedPool, + SeCreatorGroupServerSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeCreatorGroupServerSid == NULL) @@ -166,7 +166,7 @@ SepInitSecurityIDs(VOID) /* create NtAuthoritySid */ - SeNtAuthoritySid = ExAllocatePoolWithTag(NonPagedPool, + SeNtAuthoritySid = ExAllocatePoolWithTag(PagedPool, SidLength0, TAG_SID); if (SeNtAuthoritySid == NULL) @@ -177,7 +177,7 @@ SepInitSecurityIDs(VOID) 0); /* create DialupSid */ - SeDialupSid = ExAllocatePoolWithTag(NonPagedPool, + SeDialupSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeDialupSid == NULL) @@ -191,7 +191,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_DIALUP_RID; /* create NetworkSid */ - SeNetworkSid = ExAllocatePoolWithTag(NonPagedPool, + SeNetworkSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeNetworkSid == NULL) @@ -205,7 +205,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_NETWORK_RID; /* create BatchSid */ - SeBatchSid = ExAllocatePoolWithTag(NonPagedPool, + SeBatchSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeBatchSid == NULL) @@ -219,7 +219,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_BATCH_RID; /* create InteractiveSid */ - SeInteractiveSid = ExAllocatePoolWithTag(NonPagedPool, + SeInteractiveSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeInteractiveSid == NULL) @@ -233,7 +233,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_INTERACTIVE_RID; /* create ServiceSid */ - SeServiceSid = ExAllocatePoolWithTag(NonPagedPool, + SeServiceSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeServiceSid == NULL) @@ -247,7 +247,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_SERVICE_RID; /* create AnonymousLogonSid */ - SeAnonymousLogonSid = ExAllocatePoolWithTag(NonPagedPool, + SeAnonymousLogonSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeAnonymousLogonSid == NULL) @@ -261,7 +261,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_ANONYMOUS_LOGON_RID; /* create PrincipalSelfSid */ - SePrincipalSelfSid = ExAllocatePoolWithTag(NonPagedPool, + SePrincipalSelfSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SePrincipalSelfSid == NULL) @@ -275,7 +275,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_PRINCIPAL_SELF_RID; /* create LocalSystemSid */ - SeLocalSystemSid = ExAllocatePoolWithTag(NonPagedPool, + SeLocalSystemSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeLocalSystemSid == NULL) @@ -289,7 +289,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_LOCAL_SYSTEM_RID; /* create AuthenticatedUserSid */ - SeAuthenticatedUserSid = ExAllocatePoolWithTag(NonPagedPool, + SeAuthenticatedUserSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeAuthenticatedUserSid == NULL) @@ -303,7 +303,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_AUTHENTICATED_USER_RID; /* create RestrictedCodeSid */ - SeRestrictedCodeSid = ExAllocatePoolWithTag(NonPagedPool, + SeRestrictedCodeSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID); if (SeRestrictedCodeSid == NULL) @@ -317,7 +317,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = SECURITY_RESTRICTED_CODE_RID; /* create AliasAdminsSid */ - SeAliasAdminsSid = ExAllocatePoolWithTag(NonPagedPool, + SeAliasAdminsSid = ExAllocatePoolWithTag(PagedPool, SidLength2, TAG_SID); if (SeAliasAdminsSid == NULL) @@ -335,7 +335,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = DOMAIN_ALIAS_RID_ADMINS; /* create AliasUsersSid */ - SeAliasUsersSid = ExAllocatePoolWithTag(NonPagedPool, + SeAliasUsersSid = ExAllocatePoolWithTag(PagedPool, SidLength2, TAG_SID); if (SeAliasUsersSid == NULL) @@ -353,7 +353,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = DOMAIN_ALIAS_RID_USERS; /* create AliasGuestsSid */ - SeAliasGuestsSid = ExAllocatePoolWithTag(NonPagedPool, + SeAliasGuestsSid = ExAllocatePoolWithTag(PagedPool, SidLength2, TAG_SID); if (SeAliasGuestsSid == NULL) @@ -371,7 +371,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = DOMAIN_ALIAS_RID_GUESTS; /* create AliasPowerUsersSid */ - SeAliasPowerUsersSid = ExAllocatePoolWithTag(NonPagedPool, + SeAliasPowerUsersSid = ExAllocatePoolWithTag(PagedPool, SidLength2, TAG_SID); if (SeAliasPowerUsersSid == NULL) @@ -389,7 +389,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = DOMAIN_ALIAS_RID_POWER_USERS; /* create AliasAccountOpsSid */ - SeAliasAccountOpsSid = ExAllocatePoolWithTag(NonPagedPool, + SeAliasAccountOpsSid = ExAllocatePoolWithTag(PagedPool, SidLength2, TAG_SID); if (SeAliasAccountOpsSid == NULL) @@ -407,7 +407,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = DOMAIN_ALIAS_RID_ACCOUNT_OPS; /* create AliasSystemOpsSid */ - SeAliasSystemOpsSid = ExAllocatePoolWithTag(NonPagedPool, + SeAliasSystemOpsSid = ExAllocatePoolWithTag(PagedPool, SidLength2, TAG_SID); if (SeAliasSystemOpsSid == NULL) @@ -425,7 +425,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = DOMAIN_ALIAS_RID_SYSTEM_OPS; /* create AliasPrintOpsSid */ - SeAliasPrintOpsSid = ExAllocatePoolWithTag(NonPagedPool, + SeAliasPrintOpsSid = ExAllocatePoolWithTag(PagedPool, SidLength2, TAG_SID); if (SeAliasPrintOpsSid == NULL) @@ -443,7 +443,7 @@ SepInitSecurityIDs(VOID) *SubAuthority = DOMAIN_ALIAS_RID_PRINT_OPS; /* create AliasBackupOpsSid */ - SeAliasBackupOpsSid = ExAllocatePoolWithTag(NonPagedPool, + SeAliasBackupOpsSid = ExAllocatePoolWithTag(PagedPool, SidLength2, TAG_SID); if (SeAliasBackupOpsSid == NULL) diff --git a/reactos/ntoskrnl/se/token.c b/reactos/ntoskrnl/se/token.c index 944a0e147bc..9dce60c2c41 100644 --- a/reactos/ntoskrnl/se/token.c +++ b/reactos/ntoskrnl/se/token.c @@ -571,9 +571,9 @@ SepInitializeTokenImplementation(VOID) RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); RtlInitUnicodeString(&Name, L"Token"); ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); - ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(TOKEN); + ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(TOKEN); ObjectTypeInitializer.GenericMapping = SepTokenMapping; - ObjectTypeInitializer.PoolType = NonPagedPool; + ObjectTypeInitializer.PoolType = PagedPool; ObjectTypeInitializer.ValidAccessMask = TOKEN_ALL_ACCESS; ObjectTypeInitializer.UseDefaultObject = TRUE; ObjectTypeInitializer.DeleteProcedure = SepDeleteToken; @@ -1853,7 +1853,7 @@ SepCreateSystemProcessToken(VOID) uSize += uAdminsLength; AccessToken->UserAndGroups = - (PSID_AND_ATTRIBUTES)ExAllocatePoolWithTag(NonPagedPool, + (PSID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool, uSize, TAG('T', 'O', 'K', 'u')); SidArea = &AccessToken->UserAndGroups[AccessToken->UserAndGroupCount]; @@ -1885,7 +1885,7 @@ SepCreateSystemProcessToken(VOID) uSize = AccessToken->PrivilegeCount * sizeof(LUID_AND_ATTRIBUTES); AccessToken->Privileges = - (PLUID_AND_ATTRIBUTES)ExAllocatePoolWithTag(NonPagedPool, + (PLUID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool, uSize, TAG('T', 'O', 'K', 'p')); @@ -1964,7 +1964,7 @@ SepCreateSystemProcessToken(VOID) uSize += sizeof(ACE) + uAdminsLength; uSize = (uSize & (~3)) + 8; AccessToken->DefaultDacl = - (PACL) ExAllocatePoolWithTag(NonPagedPool, + (PACL) ExAllocatePoolWithTag(PagedPool, uSize, TAG('T', 'O', 'K', 'd')); Status = RtlCreateAcl(AccessToken->DefaultDacl, uSize, ACL_REVISION);