Working with resources using xres
To extract resources from a binary file, say HaikuDepot
, into a resources file HaikuDepot.rsrc
, run the xres
command like this:
~> xres -o HaikuDepot.rsrc HaikuDepotIf the binary file contains resources, the output file will be created (or overwritten if it already exists). Otherwise, the output file will be neither created nor touched (if already exists). To list the resources of a binary or resources file, use the
-l
switch like this:
~> xres -l HaikuDepot HaikuDepot resources: type ID size name ------ ----------- ----------- -------------------- 'MIMS' 1 35 BEOS:APP_SIG 'CSTR' 1 46 SYS:NAME 'APPF' 1 4 BEOS:APP_FLAGS 'MSGG' 1 134 BEOS:FILE_TYPES 'VICN' 101 1283 BEOS:ICON 'VICN' 501 54 star 'VICN' 502 119 thumbs up 'VICN' 503 119 thumbs down 'VICN' 504 71 installed 'APPV' 1 680 BEOS:APP_VERSION(You can also use the
listres
command to list the resources of a file.)
To add resources from a resources file to a binary file, we can again use the -o
switch:
~> xres -o HaikuDepot HaikuDepot.rsrcThere is no direct way to test whether a binary file contains resources because when listing or extracting resources, both
xres
and listres
will return the status code 0 either way. However, you can indirectly test it using xres
as demonstrated in the example below.
The following shell script is a good example of how to use xres
to back up and restore resources of a binary file. This is necessary because the strip --strip-debug
command will remove debugging symbols and the resources section.