HalpAcquireSecondaryIcEntryExclusive

INT64 __fastcall HalpAcquireSecondaryIcEntryExclusive(volatile INT32 *a1, BYTE *a2){
  unsigned __int64 v4; 
  INT64 result; 
  _InterlockedIncrement(a1 + 29);
  while( 1 )
  {
    KeWaitForSingleObject((PVOID)(a1 + 30), Executive, 0, 0, 0i64);
    v4 = (unsigned __int8)HalpAcquireHighLevelLock(&SecondaryIcListSpinLock);
    result = (unsigned int)_InterlockedCompareExchange(a1 + 28, 2, 1);
    if( (_DWORD)result == 1 )
      break;
    KxReleaseSpinLock(&SecondaryIcListSpinLock);
    __writecr8(v4);
  }
  _InterlockedDecrement(a1 + 29);
  *a2 = v4;
  return result;
}

Referenced by:

HalpDeleteSecondaryIcEntry