IopSetFileMemoryPartitionInformation

INT64 __fastcall IopSetFileMemoryPartitionInformation(FILE_OBJECT *FileObject, INT64 a2, UINT64 a3){
  NTSTATUS v5; 
  _OWORD *PoolWithTag; 
  _DWORD *v7; 
  NTSTATUS v8; 
  PVOID v9; 
  PVOID FoExt; 
  __m128i v12; 
  PVOID Object; 
  FoExt = 0i64;
  Object = 0i64;
  if( (unsigned int)a3 < 0x10 )
    return(unsigned int)-1073741811;
  v12 = *(__m128i *)a2;
  if( (unsigned __int8)_mm_cvtsi128_si32(_mm_srli_si128(v12, 8)) > 1u )
    return(unsigned int)-1073741811;
  v12.m128i_i8[8] = 0;
  if( v12.m128i_i32[2] )
  {
    return(unsigned int)-1073741811;
  }
  else
  {
    PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, 0x10ui64, 0x66506F49ui64);
    v7 = PoolWithTag;
    if( PoolWithTag )
    {
      *PoolWithTag = 0i64;
      v8 = PsReferencePartitionByHandle(*(VOID **)a2, 2ui64, 0, 0x66506F49ui64, &Object);
      v9 = Object;
      v5 = v8;
      if( v8 >= 0 )
      {
        ObfReferenceObjectWithTag(Object, 0x6F466F49u);
        PsDereferencePartition((INT64)v9);
        *(_QWORD *)v7 = v9;
        v7[2] ^= (v7[2] ^ *(unsigned __int8 *)(a2 + 8)) & 1;
        v5 = IopAllocateFileObjectExtension(FileObject, &FoExt);
        if( v5 >= 0 )
        {
          if( IopSetTypeSpecificFoExtension((_IOP_FILE_OBJECT_EXTENSION *)FoExt, FoExtTypeMemoryPartitionInfo, v7) >= 0 )
          {
            v7 = 0i64;
            v5 = 0;
          }
          else
          {
            v5 = -1073741791;
          }
        }
      }
      if( v7 )
      {
        if( *(_QWORD *)v7 )
          ObfDereferenceObjectWithTag(v9, 0x6F466F49ui64);
        ExFreePoolWithTag(v7, 0);
      }
    }
    else
    {
      return(unsigned int)-1073741670;
    }
  }
  return(unsigned int)v5;
}

Referenced by:

IoSetInformation
NtSetInformationFile