MmGetSessionIdEx

NTSTATUS __stdcall MmGetSessionIdEx(_EPROCESS *Process){
  _MM_SESSION_SPACE *Session; 

  Session = Process->Session;
  if( !Session || (Process->Flags3 & 0x1000) != 0 )
    return -1;
  else
    return *((_DWORD *)Session + 2);
}

Referenced by:

AlpcpPortQueryServerSessionInfo
CcAmILowPriorityWriter
CcApplyLowIoPriorityToThread
CcBoostLowPriorityWorkerThread
CcChangeBackingFileObject
CcPinFileData
CcSetDirtyInMask
CcSetDirtyPinnedData
CcUnpinFileDataEx
CmFcpInitializeChangeSubscription
CmpCheckOpenAccessOnKeyBody
CmpDoParseKey
DbgkpSendErrorMessage
EmpParseInfDatabase
EmpQueueRuleUpdateState
EmpRuleUpdateWorkerThread
EtwTracePool
EtwpBufferingModeCompressionFlush
EtwpBuildProcessEvent
EtwpCompressPendingBuffers
EtwpCompressionProc
EtwpDisableCompression
EtwpEventWriteFull
EtwpFreeCompression
EtwpSetCompressionSettings
ExAcquireAutoExpandPushLockShared
ExAcquireCacheAwarePushLockSharedEx
ExAcquireFastMutex
ExAcquireFastMutexUnsafe
ExAcquirePushLockExclusiveEx
ExAcquirePushLockSharedEx
ExDisableHandleTracing
ExFreeHeapPool
ExGetSessionPoolTagInformation
ExGetWakeTimerList
ExQueryHandleExceptionsPermanency
ExReleaseCacheAwarePushLockSharedEx
ExReleasePushLockEx
ExReleasePushLockExclusiveEx
ExShareAddressSpaceWithDevice
ExSvmBeginDeviceReset
ExSvmFinalizeDeviceReset
ExTryAcquirePushLockExclusiveEx
ExTryAcquirePushLockSharedEx
ExpDeleteTimer
ExpRemoveTagForBigPages
ExpSaAllocatorAllocate
ExpSaAllocatorFree
ExpSaPageGroupAllocateMemory
ExpSaPageGroupDescriptorAllocate
ExpSaPageGroupDescriptorFree
ExpSaPageGroupFreeMemory
ExpSetTimerObject
ExpSvmDereferenceDevice
ExpWorkerInitialization
FlushLookUpTableBucket
FsRtlAcquireEofLock
FsRtlCheckOplockEx2
FsRtlReleaseEofLock
HalpIommuBlockDevice
HalpIommuUnblockDevice
HalpLeaveDmaDomain
InsertEventEntryInLookUpTable
IoGetRequestorSessionId
IoRaiseHardError
IommuBeginDeviceReset
IommuFinalizeDeviceReset
IopCheckSessionDeviceAccess
IopProcessIoTracking
IopReleaseFileObjectLock
KeAbCrossThreadDelete
KeAbPostRelease
KeAbPreAcquire
KeReleaseMutant
KeRemoveSystemServiceTable
KiAbFindWakeupLockEntry
KiForceSymbolReferences
KiLockExtendedServiceTable
KsepShimDbChanged
MI_UNLOCK_RELOCATIONS_EXCLUSIVE
MiAddViewsForSection
MiCfgMarkValidEntries
MiClearPartitionPageBitMap
MiCommitPageTableRangesForVad
MiContractWsSwapPageFileWorker
MiCreatePrototypePtes
MiCreateSectionCommon
MiCreateSectionForDriver
MiDecommitHardwareEnclavePages
MiDeletePartialCloneVads
MiDeletePartialVad
MiDeletePartitionResources
MiDeleteVad
MiDereferenceExtendInfo
MiExpandPtes
MiFaultGetFileExtents
MiFillMapFileInfo
MiFinishVadDeletion
MiFreeUnusedPfnPages
MiGetImageProtoProtection
MiGetProtoPteAddress
MiGetSessionIdForVa
MiImageProtoChargedCommit
MiIncrementAweMapCount
MiInitializeMirroring
MiInitializePagedPoolEvents
MiInsertInSystemSpace
MiLockAddressSpaceToo
MiMakePerSessionProtoPte
MiMapImageInSystemSpace
MiMapSystemImage
MiMapViewOfImageSection
MiMarkSystemVaAllocated
MiObtainSessionVa
MiObtainSystemCacheView
MiOpenHotPatchFile
MiPfPrepareReadList
MiProcessTransitionHeatBatch
MiQueryAddressState
MiReleaseSessionVa
MiRelocateImage
MiRelocateImageAgain
MiRemoveFromSystemSpace
MiRemovePlaceholderVad
MiTrimUnusedPageFileRegionsWorker
MiTryLockVad
MiUnlockAndDereferenceVad
MiUnlockDriverMappings
MiUnlockDynamicMemoryExclusive
MiUnlockDynamicMemoryNestedParentExclusive
MiUnlockLoaderEntry
MiUnlockPartitionSystemThreads
MiUnlockVad
MiUpControlAreaRefs
MmIsSessionExecutionValid
MmIsSessionInCurrentServerSilo
MmOutSwapVirtualAddresses
MmOutSwapWorkingSet
NormalizationList__Unlock
NtCancelTimer
NtSetSystemInformation
NtSetThreadExecutionState
PfFileInfoNotify
PfLockExclusiveRelease
PfLockSharedTryAcquire
PfTSetTraceWorkerPriority
PfpLogApplicationEvent
PfpPrivSourceEnum
PfpQueryGpuUtilization
PnpInitializeNotifyEntry
PopCreateUserPowerRequest
PopDiagTracePowerRequestCreate
PopDirectedDripsDiagTraceNotifyDevices
PopDirectedDripsNotifyResiliencyCompletionWorker
PopFxBuildDirectedDripsCandidateDeviceList
PopFxBuildDripsBlockingDeviceList
PopFxClearDirectedDripsCandidateDeviceList
PopFxInsertAcpiDevice
PopFxPrepareDevicesForShutdown
PopFxRegisterPluginEx
PopFxRemoveAcpiDevice
PopFxRemoveDevice
PopPepPlatformStateRegistered
PopPepRemoveDevice
PsAdjustBasicEnclaveThreadList
PsGetProcessEnclaveModuleInfo
PsGetProcessSessionId
PsGetProcessSessionIdEx
PsLoadVsmEnclaveData
PsQueryCpuQuotaInformation
PspAllocateProcess
PspChangeProcessExecutionState
PspSetProcessTimerDelayForWin32
PspStorageEmptyArrayNonReadonly
PspUnlockAffinityUpdateExclusive
PspUnlockProcessExclusive
PspUnlockProcessExclusiveUnsafe
PspUnlockProcessListExclusive
PspUnlockQuotaExpansion
PspUnlockQuotaListExclusive
PspUnlockThreadSecurityExclusive
PspUnlockWorkingSetChangeExclusiveUnsafe
RtlInsertDynamicFunctionTable
RtlRemoveDynamicFunctionTable
RtlpCSparseBitmapUnlock
RtlpHpAcquireReleaseLockExclusive
RtlpHpFixedVsAllocate
RtlpHpFixedVsFree
RtlpHpHeapExtendContext
RtlpHpLargeAlloc
RtlpHpLargeFree
RtlpHpLfhBucketAddSubsegment
RtlpHpLfhBucketGetSubsegment
RtlpHpLfhBucketUpdateAffinityMapping
RtlpHpLfhSlotAllocate
RtlpHpLfhSubsegmentDecommitPages
RtlpHpLfhSubsegmentFreeBlock
RtlpHpLfhSubsegmentIncBlockCounts
RtlpHpReleaseQueuedLockExclusive
RtlpHpSegContextCompact
RtlpHpSegMgrCommitComplete
RtlpHpSegMgrCommitInitiate
RtlpHpSegMgrVaCtxAlloc
RtlpHpSegMgrVaCtxFree
RtlpHpSegMgrVaCtxInsert
RtlpHpSegPageRangeAllocate
RtlpHpSegPageRangeCoalesce
RtlpHpSegPageRangeShrink
RtlpHpVaMgrAlloc
RtlpHpVaMgrCtxFree
RtlpHpVsChunkSplit
RtlpHpVsSubsegmentCommitPages
SMKM_STORE::SmStCleanup
SMKM_STORE::SmStHelperSendCommand
SMKM_STORE::SmStWorker
SMKM_STORE_MGR::SmFeAddInitiate
SMKM_STORE_MGR::SmFeEmpty
SMKM_STORE_MGR::SmFeEvictComplete
SMKM_STORE_MGR::SmFeEvictInitiate
SMKM_STORE_MGR::SmFeSetEvictFailed
SMKM_STORE_MGR::SmFeStoreDelete
SMKM_STORE_MGR::SmFeStoreEvictKeys
SSHSupportReleasePushLockExclusive
ST_STORE::StDmPageRemove
ST_STORE::StDmpSinglePageAdd
SeExchangePrimaryToken
SeRegisterObjectTypeMandatoryPolicy
SepDeleteSessionLowboxEntries
SmFirstTimeInit
SmKmVirtualLockContextIncreaseWsMin
SmKmVirtualLockCtxMemoryUnlocked
SmpKeyedStoreEntryGet
SmpKeyedStoreSetVaRanges
SshpSetCollectionActive
StLockTryAcquireExclusive
UNLOCK_ADDRESS_SPACE
UNLOCK_ADDRESS_SPACE_UNORDERED
UNLOCK_PAGE_TABLE_COMMITMENT
ViAvlNodeInitializeSessionId
WheaInitialize