SeSetSessionIdTokenWithLinked
INT64 __fastcall SeSetSessionIdTokenWithLinked(VOID *a1, UINT64 a2){
unsigned int v2;
void *v3;
BOOL v4;
int v5;
_ETHREAD *CurrentThread;
PADAPTER_OBJECT v7;
_DMA_OPERATIONS *DmaOperations;
void *Token;
_SEP_LOGON_SESSION_REFERENCES *ReturnSession;
_SEP_LOGON_SESSION_REFERENCES *v12;
_LUID LogonId;
VOID *TrustLevelSid;
UINT8 UseNewTrust;
PADAPTER_OBJECT DmaAdapter;
DmaAdapter = 0i64;
v2 = a2;
ReturnSession = 0i64;
v3 = 0i64;
v12 = 0i64;
v5 = SepReferenceTokenByHandle(
a1,
8ui64,
*((_BYTE *)KeGetCurrentThread() + 562),
(_TOKEN **)&DmaAdapter,
&UseNewTrust,
&TrustLevelSid);
if( v5 < 0 )
{
v7 = DmaAdapter;
}
else
{
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
--*((_WORD *)CurrentThread + 242);
v7 = DmaAdapter;
LOBYTE(v4) = 1;
ExAcquireResourceSharedLite(*(PERESOURCE *)&DmaAdapter[3].Version, v4);
if( BYTE4(v7[12].DmaOperations) )
{
v5 = -1073741525;
goto LABEL_13;
}
v5 = SepReferenceLogonSessionSilo(
(_LUID *)&v7[13].DmaOperations->PutDmaAdapter,
(_EJOB *)v7[13].DmaOperations->AllocateAdapterChannelEx,
&ReturnSession);
if( v5 >= 0 )
{
DmaOperations = v7[13].DmaOperations;
Token = ReturnSession->Token;
LogonId = (_LUID)DmaOperations->AllocateCommonBuffer;
if( LogonId )
{
v5 = SepReferenceLogonSessionSilo(&LogonId, (_EJOB *)DmaOperations->AllocateAdapterChannelEx, &v12);
if( v5 < 0 )
goto LABEL_13;
v3 = v12->Token;
}
if( !Token || (v5 = SeSetSessionIdToken(Token, v2), v5 >= 0) )
{
if( v3 )
v5 = SeSetSessionIdToken(v3, v2);
}
}
}
LABEL_13:
if( v7 )
{
ExReleaseResourceLite(*(PERESOURCE *)&v7[3].Version);
KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
HalPutDmaAdapter(DmaAdapter);
}
if( ReturnSession )
SepDeReferenceLogonSessionDirect(ReturnSession);
if( v12 )
SepDeReferenceLogonSessionDirect(v12);
return(unsigned int)v5;
}Referenced by:
No references.