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
This commit is contained in:
Alex Ionescu 2005-05-25 04:16:56 +00:00
parent c1c8137afa
commit b09db8ab65
13 changed files with 127 additions and 128 deletions

View file

@ -990,7 +990,7 @@ RtlUnicodeStringToAnsiString(
AnsiDest, AnsiDest,
UniSource, UniSource,
AllocateDestinationString, AllocateDestinationString,
NonPagedPool); PagedPool);
} }
@ -1073,7 +1073,7 @@ RtlOemStringToUnicodeString(
UniDest, UniDest,
OemSource, OemSource,
AllocateDestinationString, AllocateDestinationString,
NonPagedPool); PagedPool);
} }
@ -1157,7 +1157,7 @@ RtlUnicodeStringToOemString(
OemDest, OemDest,
UniSource, UniSource,
AllocateDestinationString, AllocateDestinationString,
NonPagedPool); PagedPool);
} }
@ -1304,7 +1304,7 @@ RtlOemStringToCountedUnicodeString(
UniDest, UniDest,
OemSource, OemSource,
AllocateDestinationString, AllocateDestinationString,
NonPagedPool); PagedPool);
} }
@ -1634,7 +1634,7 @@ RtlUnicodeStringToCountedOemString(
OemDest, OemDest,
UniSource, UniSource,
AllocateDestinationString, AllocateDestinationString,
NonPagedPool); PagedPool);
} }
/* /*
@ -1766,7 +1766,7 @@ RtlUpcaseUnicodeString(
UniDest, UniDest,
UniSource, UniSource,
AllocateDestinationString, AllocateDestinationString,
NonPagedPool); PagedPool);
} }
@ -1833,7 +1833,7 @@ RtlUpcaseUnicodeStringToAnsiString(
AnsiDest, AnsiDest,
UniSource, UniSource,
AllocateDestinationString, AllocateDestinationString,
NonPagedPool); PagedPool);
} }
/* /*
@ -1921,7 +1921,7 @@ RtlUpcaseUnicodeStringToCountedOemString(
OemDest, OemDest,
UniSource, UniSource,
AllocateDestinationString, AllocateDestinationString,
NonPagedPool); PagedPool);
} }
@ -2007,7 +2007,7 @@ RtlUpcaseUnicodeStringToOemString (
OemDest, OemDest,
UniSource, UniSource,
AllocateDestinationString, AllocateDestinationString,
NonPagedPool); PagedPool);
} }
@ -2287,7 +2287,7 @@ RtlCreateUnicodeString(
{ {
DPRINT("RtlCreateUnicodeString\n"); DPRINT("RtlCreateUnicodeString\n");
return RtlpCreateUnicodeString(UniDest, Source, NonPagedPool); return RtlpCreateUnicodeString(UniDest, Source, PagedPool);
} }
@ -2306,7 +2306,7 @@ RtlpCreateUnicodeString(
ULONG Length; ULONG Length;
Length = (wcslen (Source) + 1) * sizeof(WCHAR); Length = (wcslen (Source) + 1) * sizeof(WCHAR);
PoolType = PagedPool;
UniDest->Buffer = ExAllocatePoolWithTag(PoolType, Length, TAG_USTR); UniDest->Buffer = ExAllocatePoolWithTag(PoolType, Length, TAG_USTR);
if (UniDest->Buffer == NULL) if (UniDest->Buffer == NULL)
return FALSE; return FALSE;
@ -2363,7 +2363,7 @@ RtlDowncaseUnicodeString(
UniDest, UniDest,
UniSource, UniSource,
AllocateDestinationString, AllocateDestinationString,
NonPagedPool); PagedPool);
} }
@ -2473,7 +2473,7 @@ RtlAnsiStringToUnicodeString(
UniDest, UniDest,
AnsiSource, AnsiSource,
AllocateDestinationString, AllocateDestinationString,
NonPagedPool); PagedPool);
} }
@ -2664,7 +2664,7 @@ RtlDuplicateUnicodeString(
AddNull, AddNull,
SourceString, SourceString,
DestinationString, DestinationString,
NonPagedPool); PagedPool);
} }

View file

@ -356,9 +356,9 @@ CmInitializeRegistry(VOID)
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
RtlInitUnicodeString(&Name, L"Key"); RtlInitUnicodeString(&Name, L"Key");
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KEY_OBJECT); ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(KEY_OBJECT);
ObjectTypeInitializer.GenericMapping = CmiKeyMapping; ObjectTypeInitializer.GenericMapping = CmiKeyMapping;
ObjectTypeInitializer.PoolType = NonPagedPool; ObjectTypeInitializer.PoolType = PagedPool;
ObjectTypeInitializer.ValidAccessMask = KEY_ALL_ACCESS; ObjectTypeInitializer.ValidAccessMask = KEY_ALL_ACCESS;
ObjectTypeInitializer.UseDefaultObject = TRUE; ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.DeleteProcedure = CmiObjectDelete; ObjectTypeInitializer.DeleteProcedure = CmiObjectDelete;

View file

@ -21,7 +21,7 @@
VOID FASTCALL VOID FASTCALL
ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex) ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex)
{ {
ASSERT(FastMutex->Owner != KeGetCurrentThread()); //ASSERT(FastMutex->Owner != KeGetCurrentThread());
InterlockedIncrementUL(&FastMutex->Contention); InterlockedIncrementUL(&FastMutex->Contention);
while (InterlockedExchange(&FastMutex->Count, 0) == 0) while (InterlockedExchange(&FastMutex->Count, 0) == 0)
{ {
@ -41,7 +41,7 @@ ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex)
VOID FASTCALL VOID FASTCALL
ExReleaseFastMutexUnsafe(PFAST_MUTEX FastMutex) ExReleaseFastMutexUnsafe(PFAST_MUTEX FastMutex)
{ {
ASSERT(FastMutex->Owner == KeGetCurrentThread()); //ASSERT(FastMutex->Owner == KeGetCurrentThread());
FastMutex->Owner = NULL; FastMutex->Owner = NULL;
InterlockedExchange(&FastMutex->Count, 1); InterlockedExchange(&FastMutex->Count, 1);
if (FastMutex->Contention > 0) if (FastMutex->Contention > 0)

View file

@ -134,12 +134,12 @@
#define TAG_HDTB TAG('H', 'D', 'T', 'B') #define TAG_HDTB TAG('H', 'D', 'T', 'B')
/* formerly located in se/acl.c */ /* formerly located in se/acl.c */
#define TAG_ACL TAG('A', 'C', 'L', 'T') #define TAG_ACL TAG('S', 'e', 'A', 'c')
/* formerly located in se/semgr.c */
#define TAG_SXPT TAG('S', 'X', 'P', 'T')
/* formerly located in se/sid.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 */ #endif /* _NTOSKRNL_TAG_H */

View file

@ -321,8 +321,11 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
} }
if (PsGetCurrentProcess() == NULL) 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"); DbgPrint("No current process\n");
return(STATUS_UNSUCCESSFUL); //return(STATUS_UNSUCCESSFUL);
} }
/* /*

View file

@ -2123,8 +2123,8 @@ MmInitSectionImplementation(VOID)
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
RtlInitUnicodeString(&Name, L"Section"); RtlInitUnicodeString(&Name, L"Section");
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(SECTION_OBJECT); ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(SECTION_OBJECT);
ObjectTypeInitializer.PoolType = NonPagedPool; ObjectTypeInitializer.PoolType = PagedPool;
ObjectTypeInitializer.UseDefaultObject = TRUE; ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.GenericMapping = MmpSectionMapping; ObjectTypeInitializer.GenericMapping = MmpSectionMapping;
ObjectTypeInitializer.DeleteProcedure = MmpDeleteSection; ObjectTypeInitializer.DeleteProcedure = MmpDeleteSection;
@ -2499,7 +2499,7 @@ ExeFmtpAllocateSegments(IN ULONG NrSegments)
/* TODO: check for integer overflow */ /* TODO: check for integer overflow */
SizeOfSegments = sizeof(MM_SECTION_SEGMENT) * NrSegments; SizeOfSegments = sizeof(MM_SECTION_SEGMENT) * NrSegments;
Segments = ExAllocatePoolWithTag(NonPagedPool, Segments = ExAllocatePoolWithTag(PagedPool,
SizeOfSegments, SizeOfSegments,
TAG_MM_SECTION_SEGMENT); TAG_MM_SECTION_SEGMENT);

View file

@ -63,7 +63,7 @@ RtlpAllocateHandle(PRTL_HANDLE_TABLE HandleTable,
{ {
/* allocate handle array */ /* allocate handle array */
ArraySize = sizeof(RTL_HANDLE) * HandleTable->TableSize; ArraySize = sizeof(RTL_HANDLE) * HandleTable->TableSize;
ArrayPointer = ExAllocatePoolWithTag(NonPagedPool, ArrayPointer = ExAllocatePoolWithTag(PagedPool,
ArraySize, ArraySize,
TAG_HDTB); TAG_HDTB);
if (ArrayPointer == NULL) if (ArrayPointer == NULL)

View file

@ -36,7 +36,7 @@ SepInitDACLs(VOID)
(sizeof(ACE) + RtlLengthSid(SeWorldSid)) + (sizeof(ACE) + RtlLengthSid(SeWorldSid)) +
(sizeof(ACE) + RtlLengthSid(SeLocalSystemSid)); (sizeof(ACE) + RtlLengthSid(SeLocalSystemSid));
SePublicDefaultDacl = ExAllocatePoolWithTag(NonPagedPool, SePublicDefaultDacl = ExAllocatePoolWithTag(PagedPool,
AclLength, AclLength,
TAG_ACL); TAG_ACL);
if (SePublicDefaultDacl == NULL) if (SePublicDefaultDacl == NULL)
@ -64,7 +64,7 @@ SepInitDACLs(VOID)
(sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid)) + (sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid)) +
(sizeof(ACE) + RtlLengthSid(SeRestrictedCodeSid)); (sizeof(ACE) + RtlLengthSid(SeRestrictedCodeSid));
SePublicDefaultUnrestrictedDacl = ExAllocatePoolWithTag(NonPagedPool, SePublicDefaultUnrestrictedDacl = ExAllocatePoolWithTag(PagedPool,
AclLength, AclLength,
TAG_ACL); TAG_ACL);
if (SePublicDefaultUnrestrictedDacl == NULL) if (SePublicDefaultUnrestrictedDacl == NULL)
@ -100,7 +100,7 @@ SepInitDACLs(VOID)
(sizeof(ACE) + RtlLengthSid(SeLocalSystemSid)) + (sizeof(ACE) + RtlLengthSid(SeLocalSystemSid)) +
(sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid)); (sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid));
SePublicOpenDacl = ExAllocatePoolWithTag(NonPagedPool, SePublicOpenDacl = ExAllocatePoolWithTag(PagedPool,
AclLength, AclLength,
TAG_ACL); TAG_ACL);
if (SePublicOpenDacl == NULL) if (SePublicOpenDacl == NULL)
@ -132,7 +132,7 @@ SepInitDACLs(VOID)
(sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid)) + (sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid)) +
(sizeof(ACE) + RtlLengthSid(SeRestrictedCodeSid)); (sizeof(ACE) + RtlLengthSid(SeRestrictedCodeSid));
SePublicOpenUnrestrictedDacl = ExAllocatePoolWithTag(NonPagedPool, SePublicOpenUnrestrictedDacl = ExAllocatePoolWithTag(PagedPool,
AclLength, AclLength,
TAG_ACL); TAG_ACL);
if (SePublicOpenUnrestrictedDacl == NULL) if (SePublicOpenUnrestrictedDacl == NULL)
@ -167,7 +167,7 @@ SepInitDACLs(VOID)
(sizeof(ACE) + RtlLengthSid(SeLocalSystemSid)) + (sizeof(ACE) + RtlLengthSid(SeLocalSystemSid)) +
(sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid)); (sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid));
SeSystemDefaultDacl = ExAllocatePoolWithTag(NonPagedPool, SeSystemDefaultDacl = ExAllocatePoolWithTag(PagedPool,
AclLength, AclLength,
TAG_ACL); TAG_ACL);
if (SeSystemDefaultDacl == NULL) if (SeSystemDefaultDacl == NULL)
@ -192,7 +192,7 @@ SepInitDACLs(VOID)
(sizeof(ACE) + RtlLengthSid(SeWorldSid)) + (sizeof(ACE) + RtlLengthSid(SeWorldSid)) +
(sizeof(ACE) + RtlLengthSid(SeRestrictedCodeSid)); (sizeof(ACE) + RtlLengthSid(SeRestrictedCodeSid));
SeUnrestrictedDacl = ExAllocatePoolWithTag(NonPagedPool, SeUnrestrictedDacl = ExAllocatePoolWithTag(PagedPool,
AclLength, AclLength,
TAG_ACL); TAG_ACL);
if (SeUnrestrictedDacl == NULL) if (SeUnrestrictedDacl == NULL)

View file

@ -28,8 +28,8 @@ BOOLEAN INIT_FUNCTION
SepInitSDs(VOID) SepInitSDs(VOID)
{ {
/* Create PublicDefaultSd */ /* Create PublicDefaultSd */
SePublicDefaultSd = ExAllocatePool(NonPagedPool, SePublicDefaultSd = ExAllocatePoolWithTag(PagedPool,
sizeof(SECURITY_DESCRIPTOR)); sizeof(SECURITY_DESCRIPTOR), TAG_SD);
if (SePublicDefaultSd == NULL) if (SePublicDefaultSd == NULL)
return FALSE; return FALSE;
@ -41,8 +41,8 @@ SepInitSDs(VOID)
FALSE); FALSE);
/* Create PublicDefaultUnrestrictedSd */ /* Create PublicDefaultUnrestrictedSd */
SePublicDefaultUnrestrictedSd = ExAllocatePool(NonPagedPool, SePublicDefaultUnrestrictedSd = ExAllocatePoolWithTag(PagedPool,
sizeof(SECURITY_DESCRIPTOR)); sizeof(SECURITY_DESCRIPTOR), TAG_SD);
if (SePublicDefaultUnrestrictedSd == NULL) if (SePublicDefaultUnrestrictedSd == NULL)
return FALSE; return FALSE;
@ -54,8 +54,8 @@ SepInitSDs(VOID)
FALSE); FALSE);
/* Create PublicOpenSd */ /* Create PublicOpenSd */
SePublicOpenSd = ExAllocatePool(NonPagedPool, SePublicOpenSd = ExAllocatePoolWithTag(PagedPool,
sizeof(SECURITY_DESCRIPTOR)); sizeof(SECURITY_DESCRIPTOR), TAG_SD);
if (SePublicOpenSd == NULL) if (SePublicOpenSd == NULL)
return FALSE; return FALSE;
@ -67,8 +67,8 @@ SepInitSDs(VOID)
FALSE); FALSE);
/* Create PublicOpenUnrestrictedSd */ /* Create PublicOpenUnrestrictedSd */
SePublicOpenUnrestrictedSd = ExAllocatePool(NonPagedPool, SePublicOpenUnrestrictedSd = ExAllocatePoolWithTag(PagedPool,
sizeof(SECURITY_DESCRIPTOR)); sizeof(SECURITY_DESCRIPTOR), TAG_SD);
if (SePublicOpenUnrestrictedSd == NULL) if (SePublicOpenUnrestrictedSd == NULL)
return FALSE; return FALSE;
@ -80,8 +80,8 @@ SepInitSDs(VOID)
FALSE); FALSE);
/* Create SystemDefaultSd */ /* Create SystemDefaultSd */
SeSystemDefaultSd = ExAllocatePool(NonPagedPool, SeSystemDefaultSd = ExAllocatePoolWithTag(PagedPool,
sizeof(SECURITY_DESCRIPTOR)); sizeof(SECURITY_DESCRIPTOR), TAG_SD);
if (SeSystemDefaultSd == NULL) if (SeSystemDefaultSd == NULL)
return FALSE; return FALSE;
@ -93,8 +93,8 @@ SepInitSDs(VOID)
FALSE); FALSE);
/* Create UnrestrictedSd */ /* Create UnrestrictedSd */
SeUnrestrictedSd = ExAllocatePool(NonPagedPool, SeUnrestrictedSd = ExAllocatePoolWithTag(PagedPool,
sizeof(SECURITY_DESCRIPTOR)); sizeof(SECURITY_DESCRIPTOR), TAG_SD);
if (SeUnrestrictedSd == NULL) if (SeUnrestrictedSd == NULL)
return FALSE; return FALSE;

View file

@ -17,6 +17,7 @@
/* GLOBALS ******************************************************************/ /* GLOBALS ******************************************************************/
PSE_EXPORTS EXPORTED SeExports = NULL; PSE_EXPORTS EXPORTED SeExports = NULL;
SE_EXPORTS SepExports;
static ERESOURCE SepSubjectContextLock; static ERESOURCE SepSubjectContextLock;
@ -121,56 +122,51 @@ SeInitSRM(VOID)
static BOOLEAN INIT_FUNCTION static BOOLEAN INIT_FUNCTION
SepInitExports(VOID) SepInitExports(VOID)
{ {
SeExports = ExAllocatePoolWithTag(NonPagedPool, SepExports.SeCreateTokenPrivilege = SeCreateTokenPrivilege;
sizeof(SE_EXPORTS), SepExports.SeAssignPrimaryTokenPrivilege = SeAssignPrimaryTokenPrivilege;
TAG_SXPT); SepExports.SeLockMemoryPrivilege = SeLockMemoryPrivilege;
if (SeExports == NULL) SepExports.SeIncreaseQuotaPrivilege = SeIncreaseQuotaPrivilege;
return FALSE; 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; SepExports.SeNullSid = SeNullSid;
SeExports->SeAssignPrimaryTokenPrivilege = SeAssignPrimaryTokenPrivilege; SepExports.SeWorldSid = SeWorldSid;
SeExports->SeLockMemoryPrivilege = SeLockMemoryPrivilege; SepExports.SeLocalSid = SeLocalSid;
SeExports->SeIncreaseQuotaPrivilege = SeIncreaseQuotaPrivilege; SepExports.SeCreatorOwnerSid = SeCreatorOwnerSid;
SeExports->SeUnsolicitedInputPrivilege = SeUnsolicitedInputPrivilege; SepExports.SeCreatorGroupSid = SeCreatorGroupSid;
SeExports->SeTcbPrivilege = SeTcbPrivilege; SepExports.SeNtAuthoritySid = SeNtAuthoritySid;
SeExports->SeSecurityPrivilege = SeSecurityPrivilege; SepExports.SeDialupSid = SeDialupSid;
SeExports->SeTakeOwnershipPrivilege = SeTakeOwnershipPrivilege; SepExports.SeNetworkSid = SeNetworkSid;
SeExports->SeLoadDriverPrivilege = SeLoadDriverPrivilege; SepExports.SeBatchSid = SeBatchSid;
SeExports->SeCreatePagefilePrivilege = SeCreatePagefilePrivilege; SepExports.SeInteractiveSid = SeInteractiveSid;
SeExports->SeIncreaseBasePriorityPrivilege = SeIncreaseBasePriorityPrivilege; SepExports.SeLocalSystemSid = SeLocalSystemSid;
SeExports->SeSystemProfilePrivilege = SeSystemProfilePrivilege; SepExports.SeAliasAdminsSid = SeAliasAdminsSid;
SeExports->SeSystemtimePrivilege = SeSystemtimePrivilege; SepExports.SeAliasUsersSid = SeAliasUsersSid;
SeExports->SeProfileSingleProcessPrivilege = SeProfileSingleProcessPrivilege; SepExports.SeAliasGuestsSid = SeAliasGuestsSid;
SeExports->SeCreatePermanentPrivilege = SeCreatePermanentPrivilege; SepExports.SeAliasPowerUsersSid = SeAliasPowerUsersSid;
SeExports->SeBackupPrivilege = SeBackupPrivilege; SepExports.SeAliasAccountOpsSid = SeAliasAccountOpsSid;
SeExports->SeRestorePrivilege = SeRestorePrivilege; SepExports.SeAliasSystemOpsSid = SeAliasSystemOpsSid;
SeExports->SeShutdownPrivilege = SeShutdownPrivilege; SepExports.SeAliasPrintOpsSid = SeAliasPrintOpsSid;
SeExports->SeDebugPrivilege = SeDebugPrivilege; SepExports.SeAliasBackupOpsSid = SeAliasBackupOpsSid;
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;
SeExports = &SepExports;
return TRUE; return TRUE;
} }
@ -498,7 +494,7 @@ SeAssignSecurity(PSECURITY_DESCRIPTOR ParentDescriptor OPTIONAL,
DaclLength, DaclLength,
SaclLength); SaclLength);
Descriptor = ExAllocatePool(NonPagedPool, Descriptor = ExAllocatePool(PagedPool,
Length); Length);
RtlZeroMemory( Descriptor, Length ); RtlZeroMemory( Descriptor, Length );

View file

@ -67,7 +67,7 @@ SepInitSecurityIDs(VOID)
SidLength2 = RtlLengthRequiredSid(2); SidLength2 = RtlLengthRequiredSid(2);
/* create NullSid */ /* create NullSid */
SeNullSid = ExAllocatePoolWithTag(NonPagedPool, SeNullSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeNullSid == NULL) if (SeNullSid == NULL)
@ -81,7 +81,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_NULL_RID; *SubAuthority = SECURITY_NULL_RID;
/* create WorldSid */ /* create WorldSid */
SeWorldSid = ExAllocatePoolWithTag(NonPagedPool, SeWorldSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeWorldSid == NULL) if (SeWorldSid == NULL)
@ -95,7 +95,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_WORLD_RID; *SubAuthority = SECURITY_WORLD_RID;
/* create LocalSid */ /* create LocalSid */
SeLocalSid = ExAllocatePoolWithTag(NonPagedPool, SeLocalSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeLocalSid == NULL) if (SeLocalSid == NULL)
@ -109,7 +109,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_LOCAL_RID; *SubAuthority = SECURITY_LOCAL_RID;
/* create CreatorOwnerSid */ /* create CreatorOwnerSid */
SeCreatorOwnerSid = ExAllocatePoolWithTag(NonPagedPool, SeCreatorOwnerSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeCreatorOwnerSid == NULL) if (SeCreatorOwnerSid == NULL)
@ -123,7 +123,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_CREATOR_OWNER_RID; *SubAuthority = SECURITY_CREATOR_OWNER_RID;
/* create CreatorGroupSid */ /* create CreatorGroupSid */
SeCreatorGroupSid = ExAllocatePoolWithTag(NonPagedPool, SeCreatorGroupSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeCreatorGroupSid == NULL) if (SeCreatorGroupSid == NULL)
@ -137,7 +137,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_CREATOR_GROUP_RID; *SubAuthority = SECURITY_CREATOR_GROUP_RID;
/* create CreatorOwnerServerSid */ /* create CreatorOwnerServerSid */
SeCreatorOwnerServerSid = ExAllocatePoolWithTag(NonPagedPool, SeCreatorOwnerServerSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeCreatorOwnerServerSid == NULL) if (SeCreatorOwnerServerSid == NULL)
@ -151,7 +151,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_CREATOR_OWNER_SERVER_RID; *SubAuthority = SECURITY_CREATOR_OWNER_SERVER_RID;
/* create CreatorGroupServerSid */ /* create CreatorGroupServerSid */
SeCreatorGroupServerSid = ExAllocatePoolWithTag(NonPagedPool, SeCreatorGroupServerSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeCreatorGroupServerSid == NULL) if (SeCreatorGroupServerSid == NULL)
@ -166,7 +166,7 @@ SepInitSecurityIDs(VOID)
/* create NtAuthoritySid */ /* create NtAuthoritySid */
SeNtAuthoritySid = ExAllocatePoolWithTag(NonPagedPool, SeNtAuthoritySid = ExAllocatePoolWithTag(PagedPool,
SidLength0, SidLength0,
TAG_SID); TAG_SID);
if (SeNtAuthoritySid == NULL) if (SeNtAuthoritySid == NULL)
@ -177,7 +177,7 @@ SepInitSecurityIDs(VOID)
0); 0);
/* create DialupSid */ /* create DialupSid */
SeDialupSid = ExAllocatePoolWithTag(NonPagedPool, SeDialupSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeDialupSid == NULL) if (SeDialupSid == NULL)
@ -191,7 +191,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_DIALUP_RID; *SubAuthority = SECURITY_DIALUP_RID;
/* create NetworkSid */ /* create NetworkSid */
SeNetworkSid = ExAllocatePoolWithTag(NonPagedPool, SeNetworkSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeNetworkSid == NULL) if (SeNetworkSid == NULL)
@ -205,7 +205,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_NETWORK_RID; *SubAuthority = SECURITY_NETWORK_RID;
/* create BatchSid */ /* create BatchSid */
SeBatchSid = ExAllocatePoolWithTag(NonPagedPool, SeBatchSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeBatchSid == NULL) if (SeBatchSid == NULL)
@ -219,7 +219,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_BATCH_RID; *SubAuthority = SECURITY_BATCH_RID;
/* create InteractiveSid */ /* create InteractiveSid */
SeInteractiveSid = ExAllocatePoolWithTag(NonPagedPool, SeInteractiveSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeInteractiveSid == NULL) if (SeInteractiveSid == NULL)
@ -233,7 +233,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_INTERACTIVE_RID; *SubAuthority = SECURITY_INTERACTIVE_RID;
/* create ServiceSid */ /* create ServiceSid */
SeServiceSid = ExAllocatePoolWithTag(NonPagedPool, SeServiceSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeServiceSid == NULL) if (SeServiceSid == NULL)
@ -247,7 +247,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_SERVICE_RID; *SubAuthority = SECURITY_SERVICE_RID;
/* create AnonymousLogonSid */ /* create AnonymousLogonSid */
SeAnonymousLogonSid = ExAllocatePoolWithTag(NonPagedPool, SeAnonymousLogonSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeAnonymousLogonSid == NULL) if (SeAnonymousLogonSid == NULL)
@ -261,7 +261,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_ANONYMOUS_LOGON_RID; *SubAuthority = SECURITY_ANONYMOUS_LOGON_RID;
/* create PrincipalSelfSid */ /* create PrincipalSelfSid */
SePrincipalSelfSid = ExAllocatePoolWithTag(NonPagedPool, SePrincipalSelfSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SePrincipalSelfSid == NULL) if (SePrincipalSelfSid == NULL)
@ -275,7 +275,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_PRINCIPAL_SELF_RID; *SubAuthority = SECURITY_PRINCIPAL_SELF_RID;
/* create LocalSystemSid */ /* create LocalSystemSid */
SeLocalSystemSid = ExAllocatePoolWithTag(NonPagedPool, SeLocalSystemSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeLocalSystemSid == NULL) if (SeLocalSystemSid == NULL)
@ -289,7 +289,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_LOCAL_SYSTEM_RID; *SubAuthority = SECURITY_LOCAL_SYSTEM_RID;
/* create AuthenticatedUserSid */ /* create AuthenticatedUserSid */
SeAuthenticatedUserSid = ExAllocatePoolWithTag(NonPagedPool, SeAuthenticatedUserSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeAuthenticatedUserSid == NULL) if (SeAuthenticatedUserSid == NULL)
@ -303,7 +303,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_AUTHENTICATED_USER_RID; *SubAuthority = SECURITY_AUTHENTICATED_USER_RID;
/* create RestrictedCodeSid */ /* create RestrictedCodeSid */
SeRestrictedCodeSid = ExAllocatePoolWithTag(NonPagedPool, SeRestrictedCodeSid = ExAllocatePoolWithTag(PagedPool,
SidLength1, SidLength1,
TAG_SID); TAG_SID);
if (SeRestrictedCodeSid == NULL) if (SeRestrictedCodeSid == NULL)
@ -317,7 +317,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = SECURITY_RESTRICTED_CODE_RID; *SubAuthority = SECURITY_RESTRICTED_CODE_RID;
/* create AliasAdminsSid */ /* create AliasAdminsSid */
SeAliasAdminsSid = ExAllocatePoolWithTag(NonPagedPool, SeAliasAdminsSid = ExAllocatePoolWithTag(PagedPool,
SidLength2, SidLength2,
TAG_SID); TAG_SID);
if (SeAliasAdminsSid == NULL) if (SeAliasAdminsSid == NULL)
@ -335,7 +335,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = DOMAIN_ALIAS_RID_ADMINS; *SubAuthority = DOMAIN_ALIAS_RID_ADMINS;
/* create AliasUsersSid */ /* create AliasUsersSid */
SeAliasUsersSid = ExAllocatePoolWithTag(NonPagedPool, SeAliasUsersSid = ExAllocatePoolWithTag(PagedPool,
SidLength2, SidLength2,
TAG_SID); TAG_SID);
if (SeAliasUsersSid == NULL) if (SeAliasUsersSid == NULL)
@ -353,7 +353,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = DOMAIN_ALIAS_RID_USERS; *SubAuthority = DOMAIN_ALIAS_RID_USERS;
/* create AliasGuestsSid */ /* create AliasGuestsSid */
SeAliasGuestsSid = ExAllocatePoolWithTag(NonPagedPool, SeAliasGuestsSid = ExAllocatePoolWithTag(PagedPool,
SidLength2, SidLength2,
TAG_SID); TAG_SID);
if (SeAliasGuestsSid == NULL) if (SeAliasGuestsSid == NULL)
@ -371,7 +371,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = DOMAIN_ALIAS_RID_GUESTS; *SubAuthority = DOMAIN_ALIAS_RID_GUESTS;
/* create AliasPowerUsersSid */ /* create AliasPowerUsersSid */
SeAliasPowerUsersSid = ExAllocatePoolWithTag(NonPagedPool, SeAliasPowerUsersSid = ExAllocatePoolWithTag(PagedPool,
SidLength2, SidLength2,
TAG_SID); TAG_SID);
if (SeAliasPowerUsersSid == NULL) if (SeAliasPowerUsersSid == NULL)
@ -389,7 +389,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = DOMAIN_ALIAS_RID_POWER_USERS; *SubAuthority = DOMAIN_ALIAS_RID_POWER_USERS;
/* create AliasAccountOpsSid */ /* create AliasAccountOpsSid */
SeAliasAccountOpsSid = ExAllocatePoolWithTag(NonPagedPool, SeAliasAccountOpsSid = ExAllocatePoolWithTag(PagedPool,
SidLength2, SidLength2,
TAG_SID); TAG_SID);
if (SeAliasAccountOpsSid == NULL) if (SeAliasAccountOpsSid == NULL)
@ -407,7 +407,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = DOMAIN_ALIAS_RID_ACCOUNT_OPS; *SubAuthority = DOMAIN_ALIAS_RID_ACCOUNT_OPS;
/* create AliasSystemOpsSid */ /* create AliasSystemOpsSid */
SeAliasSystemOpsSid = ExAllocatePoolWithTag(NonPagedPool, SeAliasSystemOpsSid = ExAllocatePoolWithTag(PagedPool,
SidLength2, SidLength2,
TAG_SID); TAG_SID);
if (SeAliasSystemOpsSid == NULL) if (SeAliasSystemOpsSid == NULL)
@ -425,7 +425,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = DOMAIN_ALIAS_RID_SYSTEM_OPS; *SubAuthority = DOMAIN_ALIAS_RID_SYSTEM_OPS;
/* create AliasPrintOpsSid */ /* create AliasPrintOpsSid */
SeAliasPrintOpsSid = ExAllocatePoolWithTag(NonPagedPool, SeAliasPrintOpsSid = ExAllocatePoolWithTag(PagedPool,
SidLength2, SidLength2,
TAG_SID); TAG_SID);
if (SeAliasPrintOpsSid == NULL) if (SeAliasPrintOpsSid == NULL)
@ -443,7 +443,7 @@ SepInitSecurityIDs(VOID)
*SubAuthority = DOMAIN_ALIAS_RID_PRINT_OPS; *SubAuthority = DOMAIN_ALIAS_RID_PRINT_OPS;
/* create AliasBackupOpsSid */ /* create AliasBackupOpsSid */
SeAliasBackupOpsSid = ExAllocatePoolWithTag(NonPagedPool, SeAliasBackupOpsSid = ExAllocatePoolWithTag(PagedPool,
SidLength2, SidLength2,
TAG_SID); TAG_SID);
if (SeAliasBackupOpsSid == NULL) if (SeAliasBackupOpsSid == NULL)

View file

@ -571,9 +571,9 @@ SepInitializeTokenImplementation(VOID)
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
RtlInitUnicodeString(&Name, L"Token"); RtlInitUnicodeString(&Name, L"Token");
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(TOKEN); ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(TOKEN);
ObjectTypeInitializer.GenericMapping = SepTokenMapping; ObjectTypeInitializer.GenericMapping = SepTokenMapping;
ObjectTypeInitializer.PoolType = NonPagedPool; ObjectTypeInitializer.PoolType = PagedPool;
ObjectTypeInitializer.ValidAccessMask = TOKEN_ALL_ACCESS; ObjectTypeInitializer.ValidAccessMask = TOKEN_ALL_ACCESS;
ObjectTypeInitializer.UseDefaultObject = TRUE; ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.DeleteProcedure = SepDeleteToken; ObjectTypeInitializer.DeleteProcedure = SepDeleteToken;
@ -1853,7 +1853,7 @@ SepCreateSystemProcessToken(VOID)
uSize += uAdminsLength; uSize += uAdminsLength;
AccessToken->UserAndGroups = AccessToken->UserAndGroups =
(PSID_AND_ATTRIBUTES)ExAllocatePoolWithTag(NonPagedPool, (PSID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool,
uSize, uSize,
TAG('T', 'O', 'K', 'u')); TAG('T', 'O', 'K', 'u'));
SidArea = &AccessToken->UserAndGroups[AccessToken->UserAndGroupCount]; SidArea = &AccessToken->UserAndGroups[AccessToken->UserAndGroupCount];
@ -1885,7 +1885,7 @@ SepCreateSystemProcessToken(VOID)
uSize = AccessToken->PrivilegeCount * sizeof(LUID_AND_ATTRIBUTES); uSize = AccessToken->PrivilegeCount * sizeof(LUID_AND_ATTRIBUTES);
AccessToken->Privileges = AccessToken->Privileges =
(PLUID_AND_ATTRIBUTES)ExAllocatePoolWithTag(NonPagedPool, (PLUID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool,
uSize, uSize,
TAG('T', 'O', 'K', 'p')); TAG('T', 'O', 'K', 'p'));
@ -1964,7 +1964,7 @@ SepCreateSystemProcessToken(VOID)
uSize += sizeof(ACE) + uAdminsLength; uSize += sizeof(ACE) + uAdminsLength;
uSize = (uSize & (~3)) + 8; uSize = (uSize & (~3)) + 8;
AccessToken->DefaultDacl = AccessToken->DefaultDacl =
(PACL) ExAllocatePoolWithTag(NonPagedPool, (PACL) ExAllocatePoolWithTag(PagedPool,
uSize, uSize,
TAG('T', 'O', 'K', 'd')); TAG('T', 'O', 'K', 'd'));
Status = RtlCreateAcl(AccessToken->DefaultDacl, uSize, ACL_REVISION); Status = RtlCreateAcl(AccessToken->DefaultDacl, uSize, ACL_REVISION);