MiLockControlAreaSectionExtend

NTSTATUS __stdcall MiLockControlAreaSectionExtend(PVOID BugCheckParameter2){
  __int64 v1; 
  _ETHREAD *CurrentThread; 
  __int64 v3; 
  volatile LONG *v5; 
  void *v6; 
  KIRQL v7; 
  __int64 **v8; 
  unsigned __int64 v9; 
  __int64 v10; 
  NTSTATUS result; 
  void *v12; 
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  v3 = v1;
  if( *(_DWORD *)(v1 + 8) == 16 )
    --*((_WORD *)CurrentThread + 243);
  else
    --*((_WORD *)CurrentThread + 242);
  v5 = (volatile LONG *)((char *)BugCheckParameter2 + 72);
  while( 1 )
  {
    v6 = 0i64;
    v7 = ExAcquireSpinLockExclusive(v5);
    v8 = (__int64 **)*((_QWORD *)BugCheckParameter2 + 10);
    v9 = v7;
    if( v8 )
    {
      do
      {
        if( (*(_DWORD *)(v3 + 8) & (_DWORD)v8[1]) != 0 )
          break;
        v8 = (__int64 **)*v8;
      }
      while( v8 );
      if( v8 )
      {
        LODWORD(v12) = KeAbPreAcquire(BugCheckParameter2, 0i64, 0i64);
        v6 = v12;
        if( v12 )
          KeAbPreWait(v12);
      }
    }
    *(_DWORD *)(v3 + 20) = 0;
    *(_QWORD *)(v3 + 32) = v3 + 24;
    *(_QWORD *)(v3 + 24) = v3 + 24;
    *(_WORD *)(v3 + 16) = 263;
    *(_BYTE *)(v3 + 18) = 6;
    *(_QWORD *)v3 = *((_QWORD *)BugCheckParameter2 + 10);
    *((_QWORD *)BugCheckParameter2 + 10) = v3;
    if( !v8 )
      break;
    ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)v5);
    __writecr8(v9);
    KeWaitForGate((PVOID)(v3 + 16), 18);
    if( v6 )
    {
      KeAbPreAcquire(BugCheckParameter2, v6, 0i64);
      KeAbPostReleaseEx(BugCheckParameter2, v6);
    }
  }
  LODWORD(v10) = KeAbPreAcquire(BugCheckParameter2, 0i64, 0i64);
  if( v10 )
    *(_BYTE *)(v10 + 26) |= 1u;
  ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)v5);
  result = KiIrqlFlags;
  __writecr8(v9);
  return result;
}

Referenced by:

MmExtendSection