WbGetWarbirdEncryptionSegment

NTSTATUS __stdcall WbGetWarbirdEncryptionSegment(INT64 a1, INT64 a2, INT64 **a3){
  _ETHREAD *CurrentThread; 
  _EX_PUSH_LOCK *v7; 
  _BYTE *v8; 
  NTSTATUS v9; 
  volatile signed __int64 *v10; 
  int v12; 
  volatile signed __int64 *v13; 
  volatile signed __int64 *v14; 
  int v15; 
  volatile signed __int64 *v16; 

  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  v16 = 0i64;
  v14 = 0i64;
  --CurrentThread->Tcb.SpecialApcDisable;
  v7 = (_EX_PUSH_LOCK *)(a1 + 176);
  v8 = KeAbPreAcquire((VOID *)(a1 + 176), 0i64, 0i64);
  if( _InterlockedCompareExchange64(&v7->_bf_0, 17i64, 0i64) )
    ExfAcquirePushLockSharedEx(v7, v8, v7);
  if( v8 )
    v8[26] |= 1u;
  v9 = sub_1405D21B8(a1, a2, &v16, &v15);
  if( _InterlockedCompareExchange64(&v7->_bf_0, 0i64, 17i64) != 17 )
    ExfReleasePushLockShared(v7);
  KeAbPostRelease(v7);
  KiLeaveGuardedRegionUnsafe((__int64)KeGetCurrentThread());
  if( v9 == -1073741198 )
  {
    v12 = sub_1405D1CA0(a2, &v16);
    v10 = v16;
    v9 = v12;
    if( v12 < 0 )
      goto LABEL_11;
    v9 = WbAddWarbirdEncryptionSegment(a1, (INT64)v16, &v14);
    if( v9 < 0 )
      goto LABEL_11;
    v13 = v14;
    if( v14 )
    {
      sub_1405D2184(v10);
      v10 = v13;
    }
  }
  else
  {
    v10 = v16;
    if( v9 < 0 )
      goto LABEL_11;
  }
  if( a3 )
  {
    *a3 = (INT64 *)v10;
    v10 = 0i64;
  }
LABEL_11:
  sub_1405D2184(v10);
  sub_1405D2184(v14);
  return v9;
}

Referenced by:

WbGetInitializedEncryptionSegment