ReactOS 0.4.15-dev-7704-gc07eb9f
session.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
#include <mm/ARM3/miarm.h>
Include dependency graph for session.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define MODULE_INVOLVED_IN_ARM3
 

Functions

VOID NTAPI MiInitializeSessionWsSupport (VOID)
 
BOOLEAN NTAPI MmIsSessionAddress (IN PVOID Address)
 
LCID NTAPI MmGetSessionLocaleId (VOID)
 
 _IRQL_requires_max_ (APC_LEVEL)
 
VOID NTAPI MiInitializeSessionIds (VOID)
 
VOID NTAPI MiSessionLeader (IN PEPROCESS Process)
 
ULONG NTAPI MmGetSessionId (IN PEPROCESS Process)
 
ULONG NTAPI MmGetSessionIdEx (IN PEPROCESS Process)
 
VOID NTAPI MiReleaseProcessReferenceToSessionDataPage (IN PMM_SESSION_SPACE SessionGlobal)
 
VOID NTAPI MiDereferenceSessionFinal (VOID)
 
VOID NTAPI MiDereferenceSession (VOID)
 
VOID NTAPI MiSessionRemoveProcess (VOID)
 
VOID NTAPI MiSessionAddProcess (IN PEPROCESS NewProcess)
 
NTSTATUS NTAPI MiSessionInitializeWorkingSetList (VOID)
 
NTSTATUS NTAPI MiSessionCreateInternal (OUT PULONG SessionId)
 
NTSTATUS NTAPI MmSessionCreate (OUT PULONG SessionId)
 
NTSTATUS NTAPI MmSessionDelete (IN ULONG SessionId)
 
VOID NTAPI MmQuitNextSession (_Inout_ PVOID SessionEntry)
 
PVOID NTAPI MmGetSessionById (_In_ ULONG SessionId)
 

Variables

PMM_SESSION_SPACE MmSessionSpace
 
PFN_NUMBER MiSessionDataPages
 
PFN_NUMBER MiSessionTagPages
 
PFN_NUMBER MiSessionTagSizePages
 
PFN_NUMBER MiSessionBigPoolPages
 
PFN_NUMBER MiSessionCreateCharge
 
KGUARDED_MUTEX MiSessionIdMutex
 
LONG MmSessionDataPages
 
PRTL_BITMAP MiSessionIdBitmap
 
volatile LONG MiSessionLeaderExists
 
LIST_ENTRY MiSessionWsList
 
LIST_ENTRY MmWorkingSetExpansionHead
 
KSPIN_LOCK MmExpansionLock
 
PETHREAD MiExpansionLockOwner
 

Macro Definition Documentation

◆ MODULE_INVOLVED_IN_ARM3

#define MODULE_INVOLVED_IN_ARM3

Definition at line 16 of file session.c.

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file session.c.

Function Documentation

◆ _IRQL_requires_max_()

_IRQL_requires_max_ ( APC_LEVEL  )

Definition at line 89 of file session.c.

94{
95 PEPROCESS CurrentProcess;
96 PAGED_CODE();
97
98 /* Get the current process and check if it is in a session */
99 CurrentProcess = PsGetCurrentProcess();
100 if ((CurrentProcess->Vm.Flags.SessionLeader == 0) &&
101 (CurrentProcess->Session != NULL))
102 {
103 /* Set the session locale Id */
104 ((PMM_SESSION_SPACE)CurrentProcess->Session)->LocaleId = LocaleId;
105 }
106 else
107 {
108 /* Set the default locale */
110 }
111}
#define PAGED_CODE()
#define NULL
Definition: types.h:112
struct _MM_SESSION_SPACE * PMM_SESSION_SPACE
LCID PsDefaultThreadLocaleId
Definition: locale.c:24
PVOID Session
Definition: pstypes.h:1325
MMSUPPORT Vm
Definition: pstypes.h:1356
ULONG SessionLeader
Definition: mmtypes.h:907
MMSUPPORT_FLAGS Flags
Definition: mmtypes.h:933
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING _In_ PCUNICODE_STRING _In_ LCID LocaleId
Definition: wdfpdo.h:437
#define PsGetCurrentProcess
Definition: psfuncs.h:17

◆ MiDereferenceSession()

VOID NTAPI MiDereferenceSession ( VOID  )

Definition at line 339 of file session.c.

340{
341 PMM_SESSION_SPACE SessionGlobal;
343 ULONG ReferenceCount, SessionId;
344
345 /* Sanity checks */
346 ASSERT(PsGetCurrentProcess()->ProcessInSession ||
348 (PsGetCurrentProcess()->Vm.Flags.SessionLeader == 1) &&
350
351 /* The session bit must be set */
354
355 /* Get the current process */
357
358 /* Decrement the process count */
360
361 /* Decrement the reference count and check if was the last reference */
363 if (ReferenceCount == 0)
364 {
365 /* No more references left, kill the session completely */
367 return;
368 }
369
370 /* Check if this is the session leader */
371 if (Process->Vm.Flags.SessionLeader)
372 {
373 /* Get the global session address before we kill the session mapping */
374 SessionGlobal = MmSessionSpace->GlobalVirtualAddress;
375
376 /* Delete all session PDEs and flush the TB */
377 //RtlZeroMemory(MiAddressToPde(MmSessionBase),
378 // BYTES_TO_PAGES(MmSessionSize) * sizeof(MMPDE));
380
381 /* Clean up the references here. */
382 ASSERT(Process->Session == NULL);
384 }
385
386 /* Reset the current process' session flag */
388}
#define InterlockedDecrement
Definition: armddk.h:52
#define FALSE
Definition: types.h:117
ULONG SessionId
Definition: dllmain.c:28
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
#define PSF_PROCESS_IN_SESSION_BIT
Definition: pstypes.h:288
#define ASSERT(a)
Definition: mode.c:44
VOID NTAPI KeFlushEntireTb(IN BOOLEAN Invalid, IN BOOLEAN AllProcessors)
Definition: cpu.c:617
VOID NTAPI MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE SessionGlobal)
Definition: session.c:209
PMM_SESSION_SPACE MmSessionSpace
Definition: session.c:21
VOID NTAPI MiDereferenceSessionFinal(VOID)
Definition: session.c:273
PRTL_BITMAP MiSessionIdBitmap
Definition: session.c:26
ULONG SessionId
Definition: miarm.h:477
LONG ResidentProcessCount
Definition: miarm.h:487
struct _MM_SESSION_SPACE * GlobalVirtualAddress
Definition: miarm.h:470
MM_SESSION_SPACE_FLAGS Flags
Definition: miarm.h:475
union _MM_SESSION_SPACE::@1828 u
LONG ReferenceCount
Definition: miarm.h:471
uint32_t ULONG
Definition: typedefs.h:59
#define RtlCheckBit(BMH, BP)
Definition: rtlfuncs.h:3152
#define RtlInterlockedClearBits(Flags, Flag)
Definition: rtlfuncs.h:3440

Referenced by MiSessionRemoveProcess(), and MmSessionDelete().

◆ MiDereferenceSessionFinal()

VOID NTAPI MiDereferenceSessionFinal ( VOID  )

Definition at line 273 of file session.c.

274{
275 PMM_SESSION_SPACE SessionGlobal;
277
278 /* Get the pointer to the global session address */
279 SessionGlobal = MmSessionSpace->GlobalVirtualAddress;
280
281 /* Acquire the expansion lock */
283
284 /* Set delete pending flag, so that processes can no longer attach to this
285 session and the last process that detaches sets the AttachEvent */
286 ASSERT(SessionGlobal->u.Flags.DeletePending == 0);
287 SessionGlobal->u.Flags.DeletePending = 1;
288
289 /* Check if we have any attached processes */
290 if (SessionGlobal->AttachCount)
291 {
292 /* Initialize the event (it's not in use yet!) */
294
295 /* Release the expansion lock for the wait */
297
298 /* Wait for the event to be set due to the last process detach */
299 KeWaitForSingleObject(&SessionGlobal->AttachEvent, WrVirtualMemory, 0, 0, 0);
300
301 /* Reacquire the expansion lock */
303
304 /* Makes sure we still have the delete flag and no attached processes */
307 }
308
309 /* Check if the session is in the workingset expansion list */
310 if (SessionGlobal->Vm.WorkingSetExpansionLinks.Flink != NULL)
311 {
312 /* Remove the session from the list and zero the list entry */
314 SessionGlobal->Vm.WorkingSetExpansionLinks.Flink = 0;
315 }
316
317 /* Check if the session is in the workingset list */
318 if (SessionGlobal->WsListEntry.Flink)
319 {
320 /* Remove the session from the list and zero the list entry */
321 RemoveEntryList(&SessionGlobal->WsListEntry);
322 SessionGlobal->WsListEntry.Flink = NULL;
323 }
324
325 /* Release the expansion lock */
327
328 /* Check for a win32k unload routine */
329 if (SessionGlobal->Win32KDriverUnload)
330 {
331 /* Call it */
332 SessionGlobal->Win32KDriverUnload(NULL);
333 }
334}
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
FORCEINLINE KIRQL MiAcquireExpansionLock(VOID)
Definition: miarm.h:1531
FORCEINLINE VOID MiReleaseExpansionLock(KIRQL OldIrql)
Definition: miarm.h:1544
@ NotificationEvent
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY WorkingSetExpansionLinks
Definition: mmtypes.h:925
ULONG AttachCount
Definition: miarm.h:491
KEVENT AttachEvent
Definition: miarm.h:492
MMSUPPORT Vm
Definition: miarm.h:500
LIST_ENTRY WsListEntry
Definition: miarm.h:495
PDRIVER_UNLOAD Win32KDriverUnload
Definition: miarm.h:502
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
@ WrVirtualMemory
Definition: ketypes.h:433

Referenced by MiDereferenceSession().

◆ MiInitializeSessionIds()

VOID NTAPI MiInitializeSessionIds ( VOID  )

Definition at line 116 of file session.c.

117{
118 ULONG Size, BitmapSize;
119 PFN_NUMBER TotalPages;
120
121 /* Setup the total number of data pages needed for the structure */
125 TotalPages -= MiSessionDataPages;
126
127 /* Setup the number of pages needed for session pool tags */
131 ASSERT(MiSessionTagPages <= TotalPages);
133
134 /* Total pages needed for a session (FIXME: Probably different on PAE/x64) */
136
137 /* Initialize the lock */
139
140 /* Allocate the bitmap */
142 BitmapSize = ((Size + 31) / 32) * sizeof(ULONG);
144 sizeof(RTL_BITMAP) + BitmapSize,
145 TAG_MM);
147 {
148 /* Free all the bits */
151 Size);
153 }
154 else
155 {
156 /* Die if we couldn't allocate the bitmap */
157 KeBugCheckEx(INSTALL_MORE_MEMORY,
161 0x200);
162 }
163}
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
#define PagedPool
Definition: env_spec_w32.h:308
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:31
NTSYSAPI void WINAPI RtlInitializeBitMap(PRTL_BITMAP, PULONG, ULONG)
NTSYSAPI void WINAPI RtlClearAllBits(PRTL_BITMAP)
PFN_NUMBER MmLowestPhysicalPage
Definition: meminit.c:30
PFN_NUMBER MmHighestPhysicalPage
Definition: meminit.c:31
#define MI_SESSION_TAG_PAGES_MAXIMUM
Definition: miarm.h:248
#define MI_INITIAL_SESSION_IDS
Definition: miarm.h:207
#define MI_SESSION_DATA_PAGES_MAXIMUM
Definition: miarm.h:247
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
PFN_NUMBER MiSessionTagPages
Definition: session.c:22
PFN_NUMBER MiSessionCreateCharge
Definition: session.c:23
PFN_NUMBER MiSessionBigPoolPages
Definition: session.c:23
KGUARDED_MUTEX MiSessionIdMutex
Definition: session.c:24
PFN_NUMBER MiSessionTagSizePages
Definition: session.c:22
PFN_NUMBER MiSessionDataPages
Definition: session.c:22
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:108
ULONG PFN_NUMBER
Definition: ke.h:9
#define TAG_MM
Definition: tag.h:113
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define ROUND_TO_PAGES(Size)

Referenced by MmInitSystem().

◆ MiInitializeSessionWsSupport()

VOID NTAPI MiInitializeSessionWsSupport ( VOID  )

Definition at line 40 of file session.c.

41{
42 /* Initialize the list heads */
44}
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
LIST_ENTRY MiSessionWsList
Definition: session.c:29

Referenced by MmInitSystem().

◆ MiReleaseProcessReferenceToSessionDataPage()

VOID NTAPI MiReleaseProcessReferenceToSessionDataPage ( IN PMM_SESSION_SPACE  SessionGlobal)

Definition at line 209 of file session.c.

210{
212 PMMPTE PointerPte;
214 PMMPFN Pfn1;
216
217 /* Is there more than just this reference? If so, bail out */
218 if (InterlockedDecrement(&SessionGlobal->ProcessReferenceToSession)) return;
219
220 /* Get the session ID */
221 SessionId = SessionGlobal->SessionId;
222 DPRINT1("Last process in session %lu going down!!!\n", SessionId);
223
224 /* Free the session page tables */
225#ifndef _M_AMD64
226 ExFreePoolWithTag(SessionGlobal->PageTables, 'tHmM');
227#endif
228 ASSERT(!MI_IS_PHYSICAL_ADDRESS(SessionGlobal));
229
230 /* Capture the data page PFNs */
231 PointerPte = MiAddressToPte(SessionGlobal);
232 for (i = 0; i < MiSessionDataPages; i++)
233 {
234 PageFrameIndex[i] = PFN_FROM_PTE(PointerPte + i);
235 }
236
237 /* Release them */
239
240 /* Mark them as deleted */
241 for (i = 0; i < MiSessionDataPages; i++)
242 {
243 Pfn1 = MI_PFN_ELEMENT(PageFrameIndex[i]);
244 MI_SET_PFN_DELETED(Pfn1);
245 }
246
247 /* Loop every data page and drop a reference count */
248 OldIrql = MiAcquirePfnLock();
249 for (i = 0; i < MiSessionDataPages; i++)
250 {
251 /* Sanity check that the page is correct, then decrement it */
252 Pfn1 = MI_PFN_ELEMENT(PageFrameIndex[i]);
253 ASSERT(Pfn1->u2.ShareCount == 1);
254 ASSERT(Pfn1->u3.e2.ReferenceCount == 1);
255 MiDecrementShareCount(Pfn1, PageFrameIndex[i]);
256 }
257
258 /* Done playing with pages, release the lock */
259 MiReleasePfnLock(OldIrql);
260
261 /* Decrement the number of data pages */
263
264 /* Free this session ID from the session bitmap */
269}
#define DPRINT1
Definition: precomp.h:8
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
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
@ SystemPteSpace
Definition: miarm.h:403
FORCEINLINE BOOLEAN MI_IS_PHYSICAL_ADDRESS(IN PVOID Address)
Definition: miarm.h:945
#define MI_SET_PFN_DELETED(x)
Definition: miarm.h:194
VOID NTAPI MiReleaseSystemPtes(IN PMMPTE StartingPte, IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:264
VOID NTAPI MiDecrementShareCount(IN PMMPFN Pfn1, IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:1141
FORCEINLINE PMMPFN MI_PFN_ELEMENT(IN PFN_NUMBER Pfn)
Definition: miarm.h:1574
#define MiAddressToPte(x)
Definition: mmx86.c:19
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define PFN_FROM_PTE(v)
Definition: mm.h:92
LONG MmSessionDataPages
Definition: session.c:25
VOID NTAPI RtlClearBit(_In_ PRTL_BITMAP BitMapHeader, _In_ BITMAP_INDEX BitNumber)
Definition: bitmap.c:294
Definition: mm.h:374
union _MMPFN::@1790 u2
ULONG_PTR ShareCount
Definition: mm.h:390
union _MMPFN::@1791 u3
struct _MMPFN::@1791::@1797 e2

Referenced by MiDereferenceSession(), and MmDeleteProcessAddressSpace().

◆ MiSessionAddProcess()

VOID NTAPI MiSessionAddProcess ( IN PEPROCESS  NewProcess)

Definition at line 423 of file session.c.

424{
425 PMM_SESSION_SPACE SessionGlobal;
427
428 /* The current process must already be in a session */
430
431 /* Sanity check */
433
434 /* Get the global session */
435 SessionGlobal = MmSessionSpace->GlobalVirtualAddress;
436
437 /* Increment counters */
438 InterlockedIncrement((PLONG)&SessionGlobal->ReferenceCount);
441
442 /* Set the session pointer */
443 ASSERT(NewProcess->Session == NULL);
444 NewProcess->Session = SessionGlobal;
445
446 /* Acquire the expansion lock while touching the session */
448
449 /* Insert it into the process list */
450 InsertTailList(&SessionGlobal->ProcessList, &NewProcess->SessionProcessLinks);
451
452 /* Release the lock again */
454
455 /* Set the flag */
457}
#define InterlockedIncrement
Definition: armddk.h:53
#define TRUE
Definition: types.h:120
#define InsertTailList(ListHead, Entry)
BOOLEAN NTAPI MmIsAddressValid(IN PVOID VirtualAddress)
Definition: mmsup.c:174
#define PspSetProcessFlag(Process, Flag)
Definition: ps_x.h:33
LONG ProcessReferenceToSession
Definition: miarm.h:494
LIST_ENTRY ProcessList
Definition: miarm.h:478
int32_t * PLONG
Definition: typedefs.h:58
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by MmCreateProcessAddressSpace().

◆ MiSessionCreateInternal()

NTSTATUS NTAPI MiSessionCreateInternal ( OUT PULONG  SessionId)

Definition at line 599 of file session.c.

600{
602 ULONG NewFlags, Flags, i, Color;
603#if (_MI_PAGING_LEVELS < 3)
604 ULONG Size;
605#endif // (_MI_PAGING_LEVELS < 3)
606 PMMPDE PageTables = NULL;
608 PMMPTE PointerPte, SessionPte;
609 PMMPDE PointerPde;
610 PMM_SESSION_SPACE SessionGlobal;
615 PFN_NUMBER SessionPageDirIndex;
618
619 /* This should not exist yet */
621
622 /* Loop so we can set the session-is-creating flag */
623 Flags = Process->Flags;
624 while (TRUE)
625 {
626 /* Check if it's already set */
628 {
629 /* Bail out */
630 DPRINT1("Lost session race\n");
632 }
633
634 /* Now try to set it */
635 NewFlags = InterlockedCompareExchange((PLONG)&Process->Flags,
637 Flags);
638 if (NewFlags == Flags) break;
639
640 /* It changed, try again */
641 Flags = NewFlags;
642 }
643
644 /* Now we should own the flag */
646
647#if (_MI_PAGING_LEVELS < 3)
648 /*
649 * Session space covers everything from 0xA0000000 to 0xC0000000.
650 * Allocate enough page tables to describe the entire region
651 */
652 Size = (0x20000000 / PDE_MAPPED_VA) * sizeof(MMPTE);
653 PageTables = ExAllocatePoolWithTag(NonPagedPool, Size, 'tHmM');
654 ASSERT(PageTables != NULL);
655 RtlZeroMemory(PageTables, Size);
656#endif // (_MI_PAGING_LEVELS < 3)
657
658 /* Lock the session ID creation mutex */
660
661 /* Allocate a new Session ID */
663 if (*SessionId == 0xFFFFFFFF)
664 {
665 /* We ran out of session IDs, we should expand */
666 DPRINT1("Too many sessions created. Expansion not yet supported\n");
667#if (_MI_PAGING_LEVELS < 3)
668 ExFreePoolWithTag(PageTables, 'tHmM');
669#endif // (_MI_PAGING_LEVELS < 3)
670 return STATUS_NO_MEMORY;
671 }
672
673 /* Unlock the session ID creation mutex */
675
676 /* Reserve the global PTEs */
678 ASSERT(SessionPte != NULL);
679
680 /* Acquire the PFN lock while we set everything up */
681 OldIrql = MiAcquirePfnLock();
682
683 /* Loop the global PTEs */
685 for (i = 0; i < MiSessionDataPages; i++)
686 {
687 /* Get a zeroed colored zero page */
690 DataPage[i] = MiRemoveZeroPageSafe(Color);
691 if (!DataPage[i])
692 {
693 /* No zero pages, grab a free one */
694 DataPage[i] = MiRemoveAnyPage(Color);
695
696 /* Zero it outside the PFN lock */
697 MiReleasePfnLock(OldIrql);
698 MiZeroPhysicalPage(DataPage[i]);
699 OldIrql = MiAcquirePfnLock();
700 }
701
702 /* Fill the PTE out */
703 TempPte.u.Hard.PageFrameNumber = DataPage[i];
704 MI_WRITE_VALID_PTE(SessionPte + i, TempPte);
705 }
706
707 /* Set the pointer to global space */
708 SessionGlobal = MiPteToAddress(SessionPte);
709
710 /* Get a zeroed colored zero page */
713 SessionPageDirIndex = MiRemoveZeroPageSafe(Color);
714 if (!SessionPageDirIndex)
715 {
716 /* No zero pages, grab a free one */
717 SessionPageDirIndex = MiRemoveAnyPage(Color);
718
719 /* Zero it outside the PFN lock */
720 MiReleasePfnLock(OldIrql);
721 MiZeroPhysicalPage(SessionPageDirIndex);
722 OldIrql = MiAcquirePfnLock();
723 }
724
725 /* Fill the PTE out */
727 TempPde.u.Hard.PageFrameNumber = SessionPageDirIndex;
728
729 /* Setup, allocate, fill out the MmSessionSpace PTE */
730 PointerPde = MiAddressToPde(MmSessionSpace);
731 ASSERT(PointerPde->u.Long == 0);
732 MI_WRITE_VALID_PDE(PointerPde, TempPde);
733 MiInitializePfnForOtherProcess(SessionPageDirIndex,
734 PointerPde,
735 SessionPageDirIndex);
736 ASSERT(MI_PFN_ELEMENT(SessionPageDirIndex)->u1.WsIndex == 0);
737
738 /* Loop all the local PTEs for it */
740 PointerPte = MiAddressToPte(MmSessionSpace);
741 for (i = 0; i < MiSessionDataPages; i++)
742 {
743 /* And fill them out */
744 TempPte.u.Hard.PageFrameNumber = DataPage[i];
745 MiInitializePfnAndMakePteValid(DataPage[i], PointerPte + i, TempPte);
746 ASSERT(MI_PFN_ELEMENT(DataPage[i])->u1.WsIndex == 0);
747 }
748
749 /* Finally loop all of the session pool tag pages */
750 for (i = 0; i < MiSessionTagPages; i++)
751 {
752 /* Grab a zeroed colored page */
755 TagPage[i] = MiRemoveZeroPageSafe(Color);
756 if (!TagPage[i])
757 {
758 /* No zero pages, grab a free one */
759 TagPage[i] = MiRemoveAnyPage(Color);
760
761 /* Zero it outside the PFN lock */
762 MiReleasePfnLock(OldIrql);
763 MiZeroPhysicalPage(TagPage[i]);
764 OldIrql = MiAcquirePfnLock();
765 }
766
767 /* Fill the PTE out */
768 TempPte.u.Hard.PageFrameNumber = TagPage[i];
770 PointerPte + MiSessionDataPages + i,
771 TempPte);
772 }
773
774 /* PTEs have been setup, release the PFN lock */
775 MiReleasePfnLock(OldIrql);
776
777 /* Fill out the session space structure now */
778 MmSessionSpace->GlobalVirtualAddress = SessionGlobal;
784 MmSessionSpace->SessionPageDirectoryIndex = SessionPageDirIndex;
788#ifndef _M_AMD64
789 MmSessionSpace->PageTables = PageTables;
790 MmSessionSpace->PageTables[PointerPde - MiAddressToPde(MmSessionBase)] = *PointerPde;
791#endif
793
794 DPRINT1("Session %lu is ready to go: 0x%p 0x%p, %lx 0x%p\n",
795 *SessionId, MmSessionSpace, SessionGlobal, SessionPageDirIndex, PageTables);
796
797 /* Initialize session pool */
798 //Status = MiInitializeSessionPool();
801
802 /* Initialize system space */
803 Result = MiInitializeSystemSpaceMap(&SessionGlobal->Session);
804 ASSERT(Result == TRUE);
805
806 /* Initialize the process list, make sure the workign set list is empty */
807 ASSERT(SessionGlobal->WsListEntry.Flink == NULL);
808 ASSERT(SessionGlobal->WsListEntry.Blink == NULL);
809 InitializeListHead(&SessionGlobal->ProcessList);
810
811 /* We're done, clear the flag */
814
815 /* Insert the process into the session */
816 ASSERT(Process->Session == NULL);
817 ASSERT(SessionGlobal->ProcessReferenceToSession == 0);
818 SessionGlobal->ProcessReferenceToSession = 1;
819
820 /* We're done */
822 return STATUS_SUCCESS;
823}
unsigned char BOOLEAN
HARDWARE_PTE_ARMV6 TempPte
Definition: winldr.c:76
HARDWARE_PDE_ARMV6 TempPde
Definition: winldr.c:78
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define NonPagedPool
Definition: env_spec_w32.h:307
Status
Definition: gdiplustypes.h:25
GLdouble u1
Definition: glext.h:8308
#define PSF_SESSION_CREATION_UNDERWAY_BIT
Definition: pstypes.h:286
NTSYSAPI ULONG WINAPI RtlFindClearBitsAndSet(PRTL_BITMAP, ULONG, ULONG)
#define InterlockedCompareExchange
Definition: interlocked.h:104
#define MI_GET_NEXT_COLOR()
Definition: miarm.h:232
PFN_NUMBER NTAPI MiRemoveAnyPage(IN ULONG Color)
Definition: pfnlist.c:477
VOID NTAPI MiInitializePfnAndMakePteValid(IN PFN_NUMBER PageFrameIndex, IN PMMPTE PointerPte, IN MMPTE TempPte)
Definition: pfnlist.c:1041
VOID NTAPI MiInitializePfnForOtherProcess(IN PFN_NUMBER PageFrameIndex, IN PVOID PteAddress, IN PFN_NUMBER PteFrame)
Definition: pfnlist.c:1301
FORCEINLINE VOID MI_WRITE_VALID_PDE(IN PMMPDE PointerPde, IN MMPDE TempPde)
Definition: miarm.h:1018
PMMPTE NTAPI MiReserveSystemPtes(IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:246
BOOLEAN NTAPI MiInitializeSystemSpaceMap(IN PMMSESSION InputSession OPTIONAL)
Definition: section.c:222
FORCEINLINE VOID MI_WRITE_VALID_PTE(IN PMMPTE PointerPte, IN MMPTE TempPte)
Definition: miarm.h:959
FORCEINLINE PFN_NUMBER MiRemoveZeroPageSafe(IN ULONG Color)
Definition: miarm.h:2415
#define MiAddressToPde(x)
Definition: mmx86.c:20
VOID NTAPI MiZeroPhysicalPage(IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:122
LCID PsDefaultSystemLocaleId
Definition: locale.c:20
#define PDE_MAPPED_VA
Definition: mm.h:39
#define MiPteToAddress(_Pte)
Definition: mm.h:116
@ MI_USAGE_INIT_MEMORY
Definition: mm.h:345
#define MI_SET_USAGE(x)
Definition: mm.h:317
PVOID MmSessionBase
Definition: init.c:33
MMPTE ValidKernelPte
Definition: init.c:29
MMPTE ValidKernelPteLocal
Definition: init.c:33
MMPTE ValidKernelPdeLocal
Definition: init.c:32
#define STATUS_ALREADY_COMMITTED
Definition: ntstatus.h:270
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define PspClearProcessFlag(Process, Flag)
Definition: ps_x.h:35
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG PageFrameNumber
Definition: mmtypes.h:74
ULONG PageFrameNumber
Definition: mmtypes.h:109
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
ULONG WsIndex
Definition: mm.h:378
union _MMPTE::@2326 u
ULONG_PTR Long
Definition: mmtypes.h:215
ULONG LongFlags
Definition: miarm.h:474
PFN_NUMBER SessionPageDirectoryIndex
Definition: miarm.h:480
PMMPDE PageTables
Definition: miarm.h:507
MMSESSION Session
Definition: miarm.h:497
SIZE_T CommittedPages
Definition: miarm.h:482
SIZE_T NonPageablePages
Definition: miarm.h:481
LIST_ENTRY ImageList
Definition: miarm.h:489
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by MmSessionCreate().

◆ MiSessionInitializeWorkingSetList()

NTSTATUS NTAPI MiSessionInitializeWorkingSetList ( VOID  )

Definition at line 461 of file session.c.

462{
464 PMMPTE PointerPte;
465 PMMPDE PointerPde;
469 PFN_NUMBER PageFrameIndex;
470 PMM_SESSION_SPACE SessionGlobal;
471 BOOLEAN AllocatedPageTable;
472 PMMWSL WorkingSetList;
473
474 /* Get pointers to session global and the session working set list */
475 SessionGlobal = MmSessionSpace->GlobalVirtualAddress;
476 WorkingSetList = (PMMWSL)MiSessionSpaceWs;
477
478 /* Fill out the two pointers */
479 MmSessionSpace->Vm.VmWorkingSetList = WorkingSetList;
480 MmSessionSpace->Wsle = (PMMWSLE)((&WorkingSetList->VadBitMapHint) + 1);
481
482 /* Get the PDE for the working set, and check if it's already allocated */
483 PointerPde = MiAddressToPde(WorkingSetList);
484 if (PointerPde->u.Hard.Valid == 1)
485 {
486 /* Nope, we'll have to do it */
487#ifndef _M_ARM
488 ASSERT(PointerPde->u.Hard.Global == 0);
489#endif
490 AllocatedPageTable = FALSE;
491 }
492 else
493 {
494 /* Yep, that makes our job easier */
495 AllocatedPageTable = TRUE;
496 }
497
498 /* Get the PTE for the working set */
499 PointerPte = MiAddressToPte(WorkingSetList);
500
501 /* Initialize the working set lock, and lock the PFN database */
502 ExInitializePushLock(&SessionGlobal->Vm.WorkingSetMutex);
503 //MmLockPageableSectionByHandle(ExPageLockHandle);
504 OldIrql = MiAcquirePfnLock();
505
506 /* Check if we need a page table */
507 if (AllocatedPageTable != FALSE)
508 {
509 /* Get a zeroed colored zero page */
512 PageFrameIndex = MiRemoveZeroPageSafe(Color);
513 if (!PageFrameIndex)
514 {
515 /* No zero pages, grab a free one */
516 PageFrameIndex = MiRemoveAnyPage(Color);
517
518 /* Zero it outside the PFN lock */
519 MiReleasePfnLock(OldIrql);
520 MiZeroPhysicalPage(PageFrameIndex);
521 OldIrql = MiAcquirePfnLock();
522 }
523
524 /* Write a valid PDE for it */
526 TempPde.u.Hard.PageFrameNumber = PageFrameIndex;
527 MI_WRITE_VALID_PDE(PointerPde, TempPde);
528
529 /* Add this into the list */
530 Index = ((ULONG_PTR)WorkingSetList - (ULONG_PTR)MmSessionBase) >> 22;
531#ifndef _M_AMD64
533#endif
534 /* Initialize the page directory page, and now zero the working set list itself */
535 MiInitializePfnForOtherProcess(PageFrameIndex,
536 PointerPde,
538 KeZeroPages(PointerPte, PAGE_SIZE);
539 }
540
541 /* Get a zeroed colored zero page */
544 PageFrameIndex = MiRemoveZeroPageSafe(Color);
545 if (!PageFrameIndex)
546 {
547 /* No zero pages, grab a free one */
548 PageFrameIndex = MiRemoveAnyPage(Color);
549
550 /* Zero it outside the PFN lock */
551 MiReleasePfnLock(OldIrql);
552 MiZeroPhysicalPage(PageFrameIndex);
553 OldIrql = MiAcquirePfnLock();
554 }
555
556 /* Write a valid PTE for it */
559 TempPte.u.Hard.PageFrameNumber = PageFrameIndex;
560
561 /* Initialize the working set list page */
562 MiInitializePfnAndMakePteValid(PageFrameIndex, PointerPte, TempPte);
563
564 /* Now we can release the PFN database lock */
565 MiReleasePfnLock(OldIrql);
566
567 /* Fill out the working set structure */
571 WorkingSetList->LastEntry = 20;
572 WorkingSetList->HashTable = NULL;
573 WorkingSetList->HashTableSize = 0;
574 WorkingSetList->Wsle = MmSessionSpace->Wsle;
575
576 /* Acquire the expansion lock while touching the session */
578
579 /* Handle list insertions */
580 ASSERT(SessionGlobal->WsListEntry.Flink == NULL);
581 ASSERT(SessionGlobal->WsListEntry.Blink == NULL);
582 InsertTailList(&MiSessionWsList, &SessionGlobal->WsListEntry);
583
584 ASSERT(SessionGlobal->Vm.WorkingSetExpansionLinks.Flink == NULL);
585 ASSERT(SessionGlobal->Vm.WorkingSetExpansionLinks.Blink == NULL);
587 &SessionGlobal->Vm.WorkingSetExpansionLinks);
588
589 /* Release the lock again */
591
592 /* All done, return */
593 //MmUnlockPageableImageSection(ExPageLockHandle);
594 return STATUS_SUCCESS;
595}
#define ULONG_PTR
Definition: config.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define ExInitializePushLock
Definition: ex.h:1013
PVOID MiSessionSpaceWs
Definition: mminit.c:130
struct _MMWSL * PMMWSL
struct _MMWSLE * PMMWSLE
#define MI_MAKE_DIRTY_PAGE(x)
Definition: mm.h:98
VOID FASTCALL KeZeroPages(IN PVOID Address, IN ULONG Size)
Definition: cpu.c:56
LIST_ENTRY MmWorkingSetExpansionHead
Definition: session.c:30
ULONG64 Valid
Definition: mmtypes.h:150
ULONG64 Global
Definition: mmtypes.h:166
MMPTE_HARDWARE Hard
Definition: mmtypes.h:217
ULONG SessionSpace
Definition: mmtypes.h:905
PMMWSL VmWorkingSetList
Definition: mmtypes.h:943
EX_PUSH_LOCK WorkingSetMutex
Definition: mmtypes.h:961
ULONG MinimumWorkingSetSize
Definition: mmtypes.h:941
ULONG MaximumWorkingSetSize
Definition: mmtypes.h:942
PMMWSLE_HASH HashTable
Definition: mmtypes.h:878
ULONG LastEntry
Definition: mmtypes.h:873
ULONG VadBitMapHint
Definition: mmtypes.h:884
PMMWSLE Wsle
Definition: mmtypes.h:875
ULONG HashTableSize
Definition: mmtypes.h:879
PMMWSLE Wsle
Definition: miarm.h:501
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by MmSessionCreate().

◆ MiSessionLeader()

VOID NTAPI MiSessionLeader ( IN PEPROCESS  Process)

Definition at line 167 of file session.c.

168{
170
171 /* Set the flag while under the expansion lock */
173 Process->Vm.Flags.SessionLeader = TRUE;
175}

Referenced by MmSessionCreate().

◆ MiSessionRemoveProcess()

VOID NTAPI MiSessionRemoveProcess ( VOID  )

Definition at line 392 of file session.c.

393{
394 PEPROCESS CurrentProcess = PsGetCurrentProcess();
396
397 /* If the process isn't already in a session, or if it's the leader... */
398 if (!(CurrentProcess->Flags & PSF_PROCESS_IN_SESSION_BIT) ||
399 (CurrentProcess->Vm.Flags.SessionLeader))
400 {
401 /* Then there's nothing to do */
402 return;
403 }
404
405 /* Sanity check */
407
408 /* Acquire the expansion lock while touching the session */
410
411 /* Remove the process from the list */
412 RemoveEntryList(&CurrentProcess->SessionProcessLinks);
413
414 /* Release the lock again */
416
417 /* Dereference the session */
419}
VOID NTAPI MiDereferenceSession(VOID)
Definition: session.c:339
ULONG Flags
Definition: pstypes.h:1435
LIST_ENTRY SessionProcessLinks
Definition: pstypes.h:1274

Referenced by MmCleanProcessAddressSpace().

◆ MmGetSessionById()

PVOID NTAPI MmGetSessionById ( _In_ ULONG  SessionId)

Definition at line 1050 of file session.c.

1052{
1053 PLIST_ENTRY ListEntry;
1054 PMM_SESSION_SPACE Session;
1056 KIRQL OldIrql;
1057
1058 /* Acquire the expansion lock while touching the session */
1060
1061 /* Loop all entries in the session ws list */
1062 ListEntry = MiSessionWsList.Flink;
1063 while (ListEntry != &MiSessionWsList)
1064 {
1065 Session = CONTAINING_RECORD(ListEntry, MM_SESSION_SPACE, WsListEntry);
1066 ListEntry = ListEntry->Flink;
1067
1068 /* Check if this is the session we are looking for */
1069 if (Session->SessionId == SessionId)
1070 {
1071 /* Check if we also have a process in the process list */
1072 if (!IsListEmpty(&Session->ProcessList))
1073 {
1075 EPROCESS,
1076 SessionProcessLinks);
1077
1078 /* Reference the process */
1080 break;
1081 }
1082 }
1083 }
1084
1085 /* Release the lock again */
1087
1088 return Process;
1089}
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
Definition: typedefs.h:120
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define ObReferenceObject
Definition: obfuncs.h:204

Referenced by ExpWin32SessionCallout().

◆ MmGetSessionId()

ULONG NTAPI MmGetSessionId ( IN PEPROCESS  Process)

Definition at line 179 of file session.c.

180{
181 PMM_SESSION_SPACE SessionGlobal;
182
183 /* The session leader is always session zero */
184 if (Process->Vm.Flags.SessionLeader == 1) return 0;
185
186 /* Otherwise, get the session global, and read the session ID from it */
187 SessionGlobal = (PMM_SESSION_SPACE)Process->Session;
188 if (!SessionGlobal) return 0;
189 return SessionGlobal->SessionId;
190}
if(dx< 0)
Definition: linetemp.h:194

Referenced by IoGetRequestorSessionId(), MmCreatePeb(), PsGetCurrentProcessSessionId(), PsGetProcessSessionId(), PsGetThreadSessionId(), PspInitializeProcessSecurity(), and SeExchangePrimaryToken().

◆ MmGetSessionIdEx()

ULONG NTAPI MmGetSessionIdEx ( IN PEPROCESS  Process)

Definition at line 194 of file session.c.

195{
196 PMM_SESSION_SPACE SessionGlobal;
197
198 /* The session leader is always session zero */
199 if (Process->Vm.Flags.SessionLeader == 1) return 0;
200
201 /* Otherwise, get the session global, and read the session ID from it */
202 SessionGlobal = (PMM_SESSION_SPACE)Process->Session;
203 if (!SessionGlobal) return -1;
204 return SessionGlobal->SessionId;
205}

Referenced by PsGetProcessSessionIdEx().

◆ MmGetSessionLocaleId()

LCID NTAPI MmGetSessionLocaleId ( VOID  )

Definition at line 56 of file session.c.

57{
59 PAGED_CODE();
60
61 //
62 // Get the current process
63 //
65
66 //
67 // Check if it's NOT the Session Leader
68 //
69 if (!Process->Vm.Flags.SessionLeader)
70 {
71 //
72 // Make sure it has a valid Session
73 //
74 if (Process->Session)
75 {
76 //
77 // Get the Locale ID
78 //
79 return ((PMM_SESSION_SPACE)Process->Session)->LocaleId;
80 }
81 }
82
83 //
84 // Not a session leader, return the default
85 //
87}

Referenced by NtQueryDefaultLocale(), and PspUserThreadStartup().

◆ MmIsSessionAddress()

BOOLEAN NTAPI MmIsSessionAddress ( IN PVOID  Address)

Definition at line 48 of file session.c.

49{
50 /* Check if it is in range */
52}
#define MI_IS_SESSION_ADDRESS(Address)
Definition: miarm.h:171
static WCHAR Address[46]
Definition: ping.c:68

Referenced by KdpQueryMemory(), and MmDbgCopyMemory().

◆ MmQuitNextSession()

VOID NTAPI MmQuitNextSession ( _Inout_ PVOID  SessionEntry)

Definition at line 1030 of file session.c.

1032{
1033 PEPROCESS EntryProcess;
1034
1035 /* The parameter is the actual process! */
1036 EntryProcess = SessionEntry;
1037 ASSERT(EntryProcess != NULL);
1038
1039 /* Sanity checks */
1041 ASSERT(EntryProcess->Vm.Flags.SessionLeader == 0);
1042 ASSERT(EntryProcess->Session != NULL);
1043
1044 /* Get rid of the reference we took */
1045 ObDereferenceObject(EntryProcess);
1046}
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define ObDereferenceObject
Definition: obfuncs.h:203

Referenced by ExpWin32SessionCallout().

◆ MmSessionCreate()

NTSTATUS NTAPI MmSessionCreate ( OUT PULONG  SessionId)

Definition at line 827 of file session.c.

828{
830 ULONG SessionLeaderExists;
832
833 /* Fail if the process is already in a session */
835 {
836 DPRINT1("Process already in session\n");
838 }
839
840 /* Check if the process is already the session leader */
841 if (!Process->Vm.Flags.SessionLeader)
842 {
843 /* Atomically set it as the leader */
844 SessionLeaderExists = InterlockedCompareExchange(&MiSessionLeaderExists, 1, 0);
845 if (SessionLeaderExists)
846 {
847 DPRINT1("Session leader race\n");
849 }
850
851 /* Do the work required to upgrade him */
853 }
854
855 /* Create the session */
858 if (!NT_SUCCESS(Status))
859 {
861 return Status;
862 }
863
864 /* Set up the session working set */
866 if (!NT_SUCCESS(Status))
867 {
868 /* Fail */
869 //MiDereferenceSession();
870 ASSERT(FALSE);
872 return Status;
873 }
874
875 /* All done */
877
878 /* Set and assert the flags, and return */
882 return Status;
883}
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
NTSTATUS NTAPI MiSessionCreateInternal(OUT PULONG SessionId)
Definition: session.c:599
VOID NTAPI MiSessionLeader(IN PEPROCESS Process)
Definition: session.c:167
NTSTATUS NTAPI MiSessionInitializeWorkingSetList(VOID)
Definition: session.c:461
volatile LONG MiSessionLeaderExists
Definition: session.c:27
#define STATUS_INVALID_SYSTEM_SERVICE
Definition: ntstatus.h:265

Referenced by SSI_DEF().

◆ MmSessionDelete()

NTSTATUS NTAPI MmSessionDelete ( IN ULONG  SessionId)

Definition at line 887 of file session.c.

888{
890
891 /* Process must be in a session */
892 if (!(Process->Flags & PSF_PROCESS_IN_SESSION_BIT))
893 {
894 DPRINT1("Not in a session!\n");
896 }
897
898 /* It must be the session leader */
899 if (!Process->Vm.Flags.SessionLeader)
900 {
901 DPRINT1("Not a session leader!\n");
903 }
904
905 /* Remove one reference count */
909
910 /* All done */
911 return STATUS_SUCCESS;
912}
#define STATUS_UNABLE_TO_FREE_VM
Definition: ntstatus.h:263

Referenced by SSI_DEF().

Variable Documentation

◆ MiExpansionLockOwner

PETHREAD MiExpansionLockOwner

Definition at line 33 of file session.c.

Referenced by MiAcquireExpansionLock(), and MiReleaseExpansionLock().

◆ MiSessionBigPoolPages

PFN_NUMBER MiSessionBigPoolPages

Definition at line 23 of file session.c.

Referenced by MiInitializeSessionIds().

◆ MiSessionCreateCharge

PFN_NUMBER MiSessionCreateCharge

Definition at line 23 of file session.c.

Referenced by MiInitializeSessionIds(), and MiSessionCreateInternal().

◆ MiSessionDataPages

◆ MiSessionIdBitmap

◆ MiSessionIdMutex

◆ MiSessionLeaderExists

volatile LONG MiSessionLeaderExists

Definition at line 27 of file session.c.

Referenced by MmSessionCreate().

◆ MiSessionTagPages

PFN_NUMBER MiSessionTagPages

Definition at line 22 of file session.c.

Referenced by MiInitializeSessionIds(), and MiSessionCreateInternal().

◆ MiSessionTagSizePages

PFN_NUMBER MiSessionTagSizePages

Definition at line 22 of file session.c.

Referenced by MiInitializeSessionIds().

◆ MiSessionWsList

LIST_ENTRY MiSessionWsList

◆ MmExpansionLock

KSPIN_LOCK MmExpansionLock

◆ MmSessionDataPages

LONG MmSessionDataPages

◆ MmSessionSpace

◆ MmWorkingSetExpansionHead

LIST_ENTRY MmWorkingSetExpansionHead