MiInsertProcessVads

NTSTATUS __stdcall MiInsertProcessVads(_EPROCESS *CurrentProcess, _MMVAD_SHORT **a2){
  _MMVAD_SHORT *v2; 
  NTSTATUS v3; 
  ULONG_PTR v5; 
  _MMVAD_SHORT *NextVad; 
  NTSTATUS result; 

  v2 = *a2;
  v3 = 0;
  v5 = (unsigned int)CurrentProcess;
  if( *a2 )
  {
    while( 1 )
    {
      NextVad = v2->NextVad;
      result = MiInsertVadCharges(v2, v5);
      v3 = result;
      if( result < 0 )
        break;
      MiGetWsAndInsertVad(v2);
      v2 = NextVad;
      if( !NextVad )
        goto LABEL_4;
    }
    *a2 = v2;
  }
  else
  {
LABEL_4:
    *a2 = 0i64;
    return v3;
  }
  return result;
}

Referenced by:

MmInitializeHandBuiltProcess2
MmInitializeProcessAddressSpace