Extract files from Android ROM

I am doing this article to show you how to extract the last wallpaper from a RUU ROM from HTC. I will also show you how "emulate" a Linux environment with Cygwin (only for Windows).

Prep

First, I advise you to download Cygwin on the official website. The full installation (with compilers) takes a while.
Choose a near mirror, the packets to install (verify twice for GCC). It should be automatical.

Then, find a RUU (Rom Utility Upgrade) with the EXE format corresponding to the phone.
It will download from the HTC website with the serial number of the phone.

Getting the ROM

Launch the installation utility, when you get to a menu like :

Utility menu

Go to your %temp% directory (open up "Execute" with Win+R or enter this in the path of a file browser).
Look for a folder with lots of number in its name.
Then, for a ROM.zip (7-Zip should work fine).

Uncompressing the .img

Those are system image files. For the HTC Hero they should be with the YAFFS format.
To uncompress them, you'll need a tool called unyaffs (open-source and free).

On Linux, you would compile it easilly with gcc unyaffs

Compile on Windows with Cygwin

If Cygwin's installation finished correctly, launch Cygwin Bash Shell from start menu (or the .bat in install directory).

Type cd followed by the absolute directory where unyaff is.

Type

gcc unyaffs.c

An exe file should be generated.
Keep in mind, if you change your directory, to copy cyggcc_s.dll, cyggcc_s.dll and cygwin1.dll (you can find them in /bin folder of Cygwin's installation.

Reading the file

With Windows Command Prompt, cd on the .exe's directory (a.exe maybe).
Type

a.exe system.img

Folders should appear.
You will be able to find the wallpapers in /customize/ressource/ and bootscreen in /media/bootscreen/, etc.