MiRevertRelocations

VOID __stdcall MiRevertRelocations(INT64 a1, _CONTROL_AREA *a2, UINT64 a3){
  _SUBSECTION *v3; 
  unsigned int v4; 
  unsigned int v5; 
  char *v8; 
  char *v9; 
  _MI_PER_SESSION_PROTOS *SubsectionDriverProtos; 
  unsigned int v11; 
  unsigned int v12; 
  UINT64 Direction; 

  v3 = (_SUBSECTION *)&a2[1];
  v4 = 0;
  v5 = a3;
  v8 = (char *)(*((_QWORD *)a2->u2.SeImageStub->DynamicRelocations + 6)
              - *((_QWORD *)a2->u2.SeImageStub->DynamicRelocations + 5));
  while( v3 )
  {
    v9 = v8;
    SubsectionDriverProtos = MiGetSubsectionDriverProtos(v3);
    if( SubsectionDriverProtos )
      v9 = &v8[(unsigned __int64)((char *)a2->Segment->ExtendInfo
                                - (char *)SubsectionDriverProtos->SessionProtoNode.Children[0])];
    v12 = v5 - v4;
    if( v11 <= v5 - v4 )
      v12 = v11;
    if( v12 )
    {
      do
      {
        LODWORD(Direction) = 3;
        MiPerformFixups((VOID *)(a1 + (v4 << 12)), a2, v4, (UINT64)v9, 0i64, Direction);
        if( ++v4 >= v5 )
          return;
      }
      while( --v12 );
    }
    v4 += v3->_bf_34 & 0x3FFFFFFF;
    if( v4 >= v5 )
      return;
    v3 = v3->NextSubsection;
  }
}

Referenced by:

MiValidateSectionCreate