ObLogSecurityDescriptor
NTSTATUS __stdcall ObLogSecurityDescriptor(
PVOID InputSecurityDescriptor,
PVOID *OutputSecurityDescriptor,
UINT64 RefBias){
unsigned __int64 v4;
char *v5;
char *v6;
unsigned __int64 v7;
_ETHREAD *CurrentThread;
CHAR *CacheEntry;
INT64 *v10;
volatile signed __int64 *v11;
signed __int64 v12;
unsigned int v14;
unsigned int v16;
v16 = RefBias;
v14 = RtlLengthSecurityDescriptor(InputSecurityDescriptor);
v4 = 0i64;
v5 = (char *)InputSecurityDescriptor;
v6 = (char *)InputSecurityDescriptor + (v14 & 0xFFFFFFF8);
if( InputSecurityDescriptor < v6 )
{
do
{
v7 = *(_QWORD *)v5 ^ v4;
v5 += 16;
v4 = __ROL8__(v7, 3);
}
while( v5 < v6 );
}
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
CacheEntry = 0i64;
v10 = &ObsSecurityDescriptorCache[2 * (unsigned __int8)v4];
--*((_WORD *)CurrentThread + 242);
LABEL_4:
v11 = v10 + 1;
ExAcquirePushLockSharedEx((UINT64)v10, 0i64);
while( 1 )
{
v12 = *v11;
if( *v11 )
break;
LABEL_9:
if( !CacheEntry )
{
if( _InterlockedCompareExchange64(v10, 0i64, 17i64) != 17 )
ExfReleasePushLockShared(v10);
KeAbPostRelease(v10);
KeLeaveCriticalRegionThread((__int64)CurrentThread);
CacheEntry = ObpCreateCacheEntry(InputSecurityDescriptor, v14, v4, v16);
if( !CacheEntry )
return -1073741670;
--*((_WORD *)CurrentThread + 242);
goto LABEL_4;
}
*(_QWORD *)CacheEntry = v12;
v11 = (volatile signed __int64 *)_InterlockedCompareExchange64(v11, (signed __int64)CacheEntry, v12);
if( (volatile signed __int64 *)v12 == v11 )
{
if( _InterlockedCompareExchange64(v10, 0i64, 17i64) != 17 )
ExfReleasePushLockShared(v10);
KeAbPostRelease(v10);
KeLeaveCriticalRegionThread((__int64)CurrentThread);
*OutputSecurityDescriptor = CacheEntry + 32;
return 0;
}
}
while( *(_QWORD *)(v12 + 16) != v4 )
{
if( *(_QWORD *)(v12 + 16) > v4 )
goto LABEL_9;
LABEL_8:
v11 = (volatile signed __int64 *)v12;
v12 = *(_QWORD *)v12;
if( !v12 )
goto LABEL_9;
}
if( *(_DWORD *)(v12 + 24) != v14 || memcmp(InputSecurityDescriptor, (PVOID)(v12 + 32), v14) )
goto LABEL_8;
if( _InterlockedExchangeAdd64((volatile signed __int64 *)(v12 + 8), v16) <= 0 )
__fastfail(0xEu);
if( _InterlockedCompareExchange64(v10, 0i64, 17i64) != 17 )
ExfReleasePushLockShared(v10);
KeAbPostRelease(v10);
KeLeaveCriticalRegionThread((__int64)CurrentThread);
*OutputSecurityDescriptor = (PVOID)(v12 + 32);
if( CacheEntry )
ExFreePoolWithTag(CacheEntry, 0x6353624Fu);
return 0;
}Referenced by:
EtwpAllocGuidEntry
EtwpInitializeLoggerSecurityDescriptor
EtwpUpdateLoggerSecurityDescriptor
ExpWnfCreateNameInstance
IopGetSetSecurityObject
IopSetDeviceSecurityDescriptor
ObAssignObjectSecurityDescriptor
ObSetSecurityDescriptorInfo
ObpInitObjectTypeSD
SeDefaultObjectMethod