public static int Compare(PESection x, PESection y) { if (!x.Name.Contains("$") && !y.Name.Contains("$")) { // COFF file ordinal is used as tie-breaker return(COFFTool.Compare(x.SourceCoff, y.SourceCoff)); } // Always give preference to sections with no $ else if (!x.Name.Contains("$") && y.Name.Contains("$")) { return(-1); } else if (x.Name.Contains("$") && !y.Name.Contains("$")) { return(1); } // If both have a $ grouping, order by $ suffix. else // (x.Name.Contains("$") && y.Name.Contains("$")) { string xdollar = x.Name.Substring(x.Name.IndexOf('$') + 1); string ydollar = y.Name.Substring(x.Name.IndexOf('$') + 1); int cmp = String.Compare(xdollar, ydollar); // COFF file ordinal is used as tie-breaker if (cmp == 0) { return(COFFTool.Compare(x.SourceCoff, y.SourceCoff)); } else { return(cmp); } } }
public PESection(COFFTool coff, IMAGE_SECTION_HEADER header) { this.sourceCoff = coff; this.header = header; this.relocations = null; }
public static int Compare(COFFTool x, COFFTool y) { return(x.Ordinal.CompareTo(y.Ordinal)); }
public static int Compare(COFFTool x, COFFTool y) { return x.Ordinal.CompareTo(y.Ordinal); }