[Android General] Qui Peccavit:
Android Firmware ROM and Custom Recovery Icons on Windows PCs

.​

ANDROID FILE EXTENSIONS

Custom Icons for Android ROMs, Recoveries and APKs on the PC​

Most manufacturers' firmware ROMs, as well as custom recoveries and flash files developed by the community, come in the form of packed archives, and Android Package Kits (APK) are compressed packages, too. Spotting them on computers or in directories with a lot of .7z, .rar or .zip files becomes a lot easier if Android or iOS files are indicated by other than the default icons for archive file extensions.

Unfortunately, Windows cannot handle double file extensions à la .ext1.ext2, which means that only the part of a file name after the last dot will be interpreted as the file type extension. This makes it impossible to distinguish, for example, between .tar.md5 and .md5 -- the configuration specified for .md5 will prevail. Consequently, in case you work with a lot of .md5 (.tar, .tgz, etc.) files that are not firmware ROMs for mobile phones, you may not want to do this, but if files for cellphones are the only files with these extensions on your system, identifying them with a special icon can avoid mixing up files at the time of flashing.

First of all, you will obviously need a couple suitable icons. One way to obtain them consists in downloading pictures , erasing the background (making it transparent) and converting them to .ico format, but doing a search for «Android Robot icon» or «iOS icon» saves you the legwork. I chose the same icon for original stock ROMs (.tar.md5) and customised files (.tar), only giving the latter a slightly more orange tint in a graphics software. In theory, modified firmware could be MD5-hashed, too, for example with Cygwin, Mkh Mourad's tar-Tool (for SAMSUNG) or the TAR-MD5 Packager, but most custom developers do not do that cosmetic extra step, so the distinction .tar.md5 versus .tar works quite well in practice. The icon for Android software (.apk) should be different; the little green robot suits the purpose perfectly.

Although stock ROMs or custom recoveries are flashed to mobile phones with each manufacturer's respective flashing software, it does not make sense to configure the firmware's file extension to be opened with those tools when being double-clicked, simply because they would not be loaded into the correct slots when the software opens. WinRAR, on the other hand, is able to open all file extensions such as .tar.md5/.tar or .tgz and can also extract .apk files. Therefore, we will associate the firmware file types with WinRAR or a similar archive decompression program. In the example below, we will speak of SAMSUNG's «Odin» firmware flashing software and .tar.md5/.tar files — simply replace them with your brand's equivalents.

Before we begin, copy the chosen icon files into a directory on your hard drive, such as %windir%\System32\ (C:\Windows\System32 by default) and then launch the Windows Registry Editor by holding [Windows]+[R] and entering RegEdit.

Specifying new File Type Extensions

In the Windows Registry Editor ...

Navigate to the HKEY_CLASSES_ROOT key (in the Windows Registry, keys are what looks like folders in the left hand pane of Windows Explorer).

Right-Click on HKEY_CLASSES_ROOT > New > Key and write the desired new file extension with a dot in front, for instance .md5.

In the pane on the right side, right-click (Default) to modify the file extension's program identifier. Do not use any spaces, only alphanumerical characters, eg. md5_Checksum or SamsungPhoneFirmware as the program ID.

In case an installed application can open the new file type, you may want to search the registry for the path to the respective executable and use that as the program ID. For instance, .tar.md5 files are flashed onto SAMSUNG mobile phones with SAMSUNG's «Odin» software. Search the Registry for Odin or Odin3.exe and use the key in the left-hand pane as the program ID for your file extension. In this example, Odin3.exe is registered under HKEY_CLASSES_ROOT\Applications\Odin3.exe, i.e. the key name in the left pane is Applications\Odin3.exe. Consequently, the value of the (Default) key above would be Applications\Odin3.exe.

Be aware that obviously, changing the default icon under the opening program's header will change the icon for all file types that are opened by the same software; if only the new file type's icon is desired to be different, do not link to «Odin» directly, but create a new program ID as suggested above and proceed with the following steps.

You just added the file extension .md5 and created a new (Default) program ID SamsungPhoneFirmware for it. Now right-click into an empty area in the right pane and create a new string Content Type. Double-click it and enter a description for the file type, for example Checksum Hash or Official Stock ROM.

In case there is none yet, create another string PerceivedType, right-click it and enter compressed.

Navigate back up to the HKEY_CLASSES_ROOT branch in the left hand pane.

Right-click HKEY_CLASSES_ROOT and create a new Key with the program ID chosen as (Default) for the new file extension, in our example SamsungPhoneFirmware.

Obviously, if you chose the program ID of the software with which the new file type is being processed (instead of creating a new default program ID), you search for the existing Applications\Odin3.exe instead of trying to create another key of that name.

In the right side pane of SamsungPhoneFirmware, double click on (Default) and enter a description to your liking; this time, spaces are allowed, eg. Checksum Verification, Samsung Phone Firmware or Original Stock Firmware.

Right-click into an empty area in the right pane to create a new DWORD called BrowserFlags. Right-click it and modify its hexadecimal value to 8.

Add another DWORD called EditFlags with a hexadecimal value of 0 (zero).

Right-click SamsungPhoneFirmware on the left side to add a new key with the name DefaultIcon.

In the right-hand pane of DefaultIcon, double-click on (Default) and enter the path to the icon file for the new extension, eg. %windir%\System32\AndroidStock.ico,0 (which usually means C:\Windows\System32\AndroidStock.ico,0).

Right-click the SamsungPhoneFirmware key on the left side and add a new key Shell to it.

Add a new key to Shell that is called open.

Add a new key to the open key that is called Command. You are now at HKEY_CLASSES_ROOT\SamsungPhoneFirmware\Shell\open\Command.

In the right pane of Command, right-click (Default) and modify its value by entering the path to the application with which you open your new file type, in our case "C:\Program Files\[Path to WinRAR]\WinRAR\WinRAR.exe" "%1"

The entries in the Windows Registry should look like this:

Computer
└─ HKEY_CLASSES_ROOT
⁞
├─ .md5 (Default) REG_SZ SamsungPhoneFirmware
│ Content Type REG_SZ Official Stock ROM
│ PerceivedType REG_SZ compressed
⁞
⁞
├─ SamsungPhoneFirmware (Default) REG_SZ Samsung Phone Firmware
│ │ BrowserFlags REG_DWORD 8
│ │ EditFlags REG_DWORD 0
│ │
│ ├─ Default Icon (Default) REG_SZ %windir%\System32\AndroidStock.ico,0
│ │
│ └─ Shell
│ └─ open
│ └─ Command (Default) REG_SZ "C:\Program Files\[[I]Path to WinRAR[/I]]\WinRAR\WinRAR.exe" "%1"
⁞
⁞

In most cases, this should be it. Some file types/extensions are a little bit different and special, however, such as .zip (as it is supported by Windows itself) or others that are assigned to applications that integrate themselves into the system. In case your icon is not displayed correctly even after double- and triple-checking that you did not mistype anything, spelled everything correctly and used the proper format for paths, etc., navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.md5 and create/modify the following entries there:

Computer
├─ [COLOR="Silver"]HKEY_CLASSES_ROOT[/COLOR]
├─ HKEY_CURRENT_USER
⁞ ⁞
⁞ ├─ Software
⁞ ⁞ ├─ Microsoft
⁞ ⁞ ⁞ ├─ Windows
⁞ ⁞ ⁞ ⁞ ├─ CurrentVersion
⁞ ⁞ ⁞ ⁞ ⁞ ├─ Explorer
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ├─ FileExts
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ├─ .md5 (Default) REG_SZ Firmware
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ├─ Default Icon (Default) REG_SZ %windir%\System32\AndroidStock.ico,0
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ├─ OpenWithList (Default) REG_SZ (value not set)
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ │ a REG_SZ WinRAR.exe
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ │ b REG_SZ Odin3.exe
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ │ MRUList REG_SZ ab
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ├─ OpenWithProgIDs (Default) REG_SZ (value not set)
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ │ SamsungPhoneFirmware REG_NONE (zero-length binary value) ⁽¹⁾
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ├─ UserChoice (Default) REG_SZ (value not set)
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ │ Hash REG_SZ OlB5ZAvhn4E= ⁽²⁾
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ └ ProgId REG_SZ SamsungPhoneFirmware
⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞ ⁞

⁽¹⁾ Unfortunately, Microsoft does not include REG_NONE as an option to create in the usual way. To work around that, find an existing file association within the same main branch that comes with a REG_NONE key under its OpenWithProgIDs branch. If the key you need to modify is under HKEY_CURRENT_USER\... (HKCU), look for another HKCU branch, if it is under HKEY_CLASSES_ROOT (HKCR), look for a similar HKCR key, and so on. In our case, let's look at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tar\OpenWithProgids (could also be .mp3 or whatever has a REG_NONE entry under HKCU). Right-click and Export that key as a Registry file. Edit the .reg file in Notepad to change the file extension to the one of your new file type and save it. Double-click the modified .reg file and confirm to add the information contained therein to the Windows Registry and then reopen the Registry Editor to verify the changes — voilà.

⁽²⁾ If not present, either calculate according to http://StackOverflow.com/questions/...crosoft-windows-currentversion-explorer-filee and http://Kolbi.cz/blog/2017/10/25/set...defeated-set-file-type-associations-per-user/ or do not create the Hash entry at all.

If creating the entries under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.md5 does not result in the icon being shown correctly, do the opposite: delete the entire .md5 key under HKCU\...\FileExts, reboot the PC and then everything should be all right.

Once the icon for original manufacturer firmware files is being displayed properly, modifying the .tar extension for modified ROMs or custom recoveries and creating an .apk extension for Android software is done in exactly the same manner.

Adding the new File Type to the Context Menu

In this particular case it does not make much sense, but for other file types, for instance when modifying the content of an extracted .apk package, you may want to add the new file type as one of the options when creating new files by right-clicking in Windows Explorer:

Navigate back to your file extension in the Registry, in our case HKEY_CLASSES_ROOT\.md5.

Right-click the .md5 key in the left pane to add a new key to it, which needs to be called ShellNew.

On the right side, right-click in an empty area to add a new String value called NullFile. Do not specify any value for Nullfile, leave it blank.

After the next reboot, files with the new file extension should appear with the proper icon, although most of the time, the changes will take effect immediately.

Remove the black «Shortcut» Arrow from Icons

If you prefer your icons without the little black «Shortcut» arrows, proceed as follows:

Create or download a blank, transparent icon.

Copy the transparent icon into %windir%\System32\, usually C:\Windows\System32\.

Launch the Windows Registry Editor by holding down [Windows]+[R] and entering RegEdit.

Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer and check whether there is already a key ('subdirectory') called Shell Icons under Explorer. If not, right-click on Explorer in the left pane and create a new key called Shell Icons. In the right-hand pane, click on an empty area to add/create a new String Value with the name 29. Right-click on 29 to modify its content and enter the path to the blank icon: %windir%\System32\Blank.ico or C:\Windows\System32\.

Delete the IconCache.db in C:\Users\[UserName]\AppData\Local, reboot the PC and then everything should look as expected.

.