diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/Coff.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/Coff.java index 21b47cdb6ff..b4872733945 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/Coff.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/Coff.java @@ -406,8 +406,10 @@ public class Coff { public String getName(byte[] table) { if (table.length > 0 && isLongName()) { ReadMemoryAccess memory = new ReadMemoryAccess(_n_name, true); - memory.getInt(); - int offset = memory.getInt(); + memory.getInt(); // pass over the first 4 bytes. + // The first for bytes of the string table represent the + // number of bytes in the string table. + int offset = memory.getInt() - 4; if (offset > 0) { for (int i = offset; i < table.length; i++) { if (table[i] == 0) { diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/PE.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/PE.java index 4a8f11c933d..4037a5104ea 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/PE.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/PE.java @@ -438,6 +438,14 @@ public class PE { return attrib; } + public static Attribute getAttributes(String file) throws IOException { + PE pe = new PE(file); + Attribute attrib = pe.getAttribute(); + pe.dispose(); + return attrib; + } + + public void dispose() throws IOException { if (rfile != null) { rfile.close();