MiInsertSecureImageActivePatch

VOID __stdcall MiInsertSecureImageActivePatch(PRTL_BALANCED_NODE Node){
  __int64 *v1; 
  bool v3; 
  __int64 *v4; 
  int v5; 
  __int64 v6; 
  v1 = 0i64;
  v3 = 0;
LABEL_2:
  v4 = (__int64 *)MiSecureImageActivePatches;
  if( MiSecureImageActivePatches )
  {
    while( 1 )
    {
      v5 = MiCompareHotPatchNodes((INT64)Node, (INT64)v4);
      if( v5 <= 0 )
      {
        if( v5 >= 0 )
        {
          v1 = v4;
          RtlAvlRemoveNode((unsigned __int64 *)&MiSecureImageActivePatches, v4);
          goto LABEL_2;
        }
        v6 = *v4;
        if( !*v4 )
          break;
      }
      else
      {
        v6 = v4[1];
        if( !v6 )
        {
          v3 = 1;
          break;
        }
      }
      v4 = (__int64 *)v6;
    }
  }
  RtlAvlInsertNodeEx((unsigned __int64 *)&MiSecureImageActivePatches, (__int64)v4, v3, Node);
  if( v1 )
    ExFreePoolWithTag(v1, 0);
}

Referenced by:

MiLoadHotPatch