diff --git a/README.md b/README.md index a969a4e..6db815c 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ This fork of PECOFF4J is available on [Maven Central](https://search.maven.org/a com.kichik.pecoff4j pecoff4j - 0.3.1 + 0.4.1 ``` @@ -36,6 +36,11 @@ Sources are licensed under [Common Public License v1.0](http://www.eclipse.org/l The project was forked to implement version string parsing for a [StackOverflow question](http://stackoverflow.com/questions/23845480/how-to-get-windows-file-details/23848792). +Recently, support for modifying the resource directory has been added (e.g. adding or removing icons). See +the [ResourceDirectoryTest](https://github.com/kichik/pecoff4j/blob/master/src/test/java/com/kichik/pecoff4j/ResourceDirectoryTest.java) +for some basic examples. Use the `rebuild` method to re-calculate the internal structures prior to creating the binary +using the `write` method. + ### Example ```java @@ -60,13 +65,13 @@ public class Main { ResourceDirectory rd = pe.getImageData().getResourceTable(); ResourceEntry[] entries = ResourceHelper.findResources(rd, ResourceType.VERSION_INFO); - for (int i = 0; i < entries.length; i++) { - byte[] data = entries[i].getData(); + for (ResourceEntry entry : entries) { + byte[] data = entry.getData(); VersionInfo version = VersionInfo.read(new DataReader(data)); StringFileInfo strings = version.getStringFileInfo(); StringTable table = strings.getTables().get(0); - for (List pair :table.getStrings()){ + for (List pair : table.getStrings()){ System.out.println(pair.getKey() + " = " + pair.getValue()); } } @@ -88,7 +93,3 @@ OriginalFilename = NOTEPAD.EXE ProductName = Microsoft® Windows® Operating System ProductVersion = 6.1.7600.16385 ``` - -## Other Forks - -[jonnyzzz/PE](https://github.com/jonnyzzz/PE) has even more features and probably got much more love than this fork. diff --git a/todo.txt b/todo.txt index 965a0b7..5d77686 100644 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,3 @@ - -- resource assembler needs to write out resource directory from scratch - - use cases - winrun4j rcedit impl - icon extractor