Skip to content

Commit

Permalink
Update readme for 0.4.1 (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
swismer committed Feb 6, 2024
1 parent f33f55c commit 8cc4251
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This fork of PECOFF4J is available on [Maven Central](https://search.maven.org/a
<dependency>
<groupId>com.kichik.pecoff4j</groupId>
<artifactId>pecoff4j</artifactId>
<version>0.3.1</version>
<version>0.4.1</version>
</dependency>
```

Expand All @@ -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
Expand All @@ -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<StringPair> pair :table.getStrings()){
for (List<StringPair> pair : table.getStrings()){
System.out.println(pair.getKey() + " = " + pair.getValue());
}
}
Expand All @@ -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.
3 changes: 0 additions & 3 deletions todo.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

- resource assembler needs to write out resource directory from scratch

- use cases
- winrun4j rcedit impl
- icon extractor
Expand Down

0 comments on commit 8cc4251

Please sign in to comment.