FsRtlFastCheckLockForWrite

VOID __fastcall FsRtlFastCheckLockForWrite(
        _FILE_LOCK *FileLock,
        _LARGE_INTEGER *StartingByte,
        _LARGE_INTEGER *Length,
        UINT64 Key,
        VOID *FileObject,
        VOID *ProcessId){
  LARGE_INTEGER *LockInformation; 
  LONGLONG QuadPart; 
  LARGE_INTEGER v8; 
  UINT64 *p_QuadPart; 
  LARGE_INTEGER v10; 
  unsigned __int8 v11; 
  unsigned __int64 v12; 
  VOID *v13; 
  VOID *v14; 
  __int64 v15; 
  bool v16; 
  unsigned int v17; 
  LARGE_INTEGER v18; 
  LARGE_INTEGER v19; 
  INT64 v20; 
  LODWORD(v20) = Key;
  LockInformation = (LARGE_INTEGER *)FileLock->LockInformation;
  if( LockInformation && (LockInformation[4].QuadPart || LockInformation[5].QuadPart) )
  {
    QuadPart = Length->QuadPart;
    if( Length->QuadPart )
    {
      v8 = *StartingByte;
      p_QuadPart = (UINT64 *)&LockInformation[3].QuadPart;
      v18 = v8;
      v10.QuadPart = v8.QuadPart + QuadPart - 1;
      v19 = v10;
      KeAcquireSpinLockRaiseToDpc((UINT64 *)&LockInformation[3].QuadPart, (UINT64)StartingByte);
      v12 = v11;
      if( v10.QuadPart < (unsigned __int64)LockInformation->QuadPart )
      {
LABEL_5:
        KxReleaseSpinLock((UINT64 *)&LockInformation[3].QuadPart);
LABEL_6:
        __writecr8(v12);
        return;
      }
      v13 = FileObject;
      v14 = ProcessId;
      v15 = *((_QWORD *)FileObject + 15);
      if( v15 )
      {
        v16 = v8.QuadPart < *(_QWORD *)v15;
        v17 = v20;
        if( !v16
          && v10.QuadPart <= *(_QWORD *)(v15 + 40)
          && *(_DWORD *)(v15 + 20) == (_DWORD)v20
          && *(VOID **)(v15 + 32) == ProcessId
          && *(_BYTE *)(v15 + 16) )
        {
          goto LABEL_5;
        }
      }
      else
      {
        v17 = v20;
      }
      if( FsRtlCheckNoSharedConflict((INT64)&LockInformation[3], &v18, &v19) )
        FsRtlCheckNoExclusiveConflict((INT64)p_QuadPart, &v18, &v19, v17, (INT64)v13, (INT64)v14);
      KxReleaseSpinLock(p_QuadPart);
      goto LABEL_6;
    }
  }
}

Referenced by:

FsRtlCheckLockForWriteAccess