how to unpack resources.pak from google chrome?

I found resource.pak V5 has a new format:

struct header {
    // 5 is the latest version
    uint32_t version;
    // 0 = BINARY, 1 = UTF8, 2 = UTF16
    uint8_t encoding;
    // 3 bytes padding
    uint8_t padding[3];
    uint16_t resource_count;
    uint16_t alias_count;
};

Which is followed by resource_count resources, and alias_count aliases.

struct resource {
    uint16_t resource_id;
    uint32_t file_offset;
};
struct alias {
    uint16_t resource_id;
    uint16_t entry_index;
};

Where uint32_t = 4 bytes, uint16_t = 2 bytes, uint8_t = 1, all little endian integers.

The source is available at https://github.com/chromium/chromium/blob/master/ui/base/resource/data_pack.cc.


The chrome-pak-customizer (pointed out by MrU in the comments above) seems to work well to unpack Chrome's .pak files. If you're on Windows, you can download and unzip chrome-pak.7z from the releases page. Then drop the .pak file on the unpack.bat script to unpack it.

For other platforms, it looks like you'll need to build the tool from the source.


taken from https://groups.google.com/a/chromium.org/forum/?fromgroups=#!topic/chromium-dev/agGjTt4Dmcw

4 byte version number
4 byte number of resources
1 byte encoding

For each resource:
2 byte resource id
4 byte resource offset in file

There is an extra resource entry at the end with ID 0 giving the end of the last resource (which is essentially the length of the file)

This python module can unpack and repack files:
data_pack.py from grit-i18n