NBHImageTool -build|-dump param1 param2 param3
What is NBHImageTool?
NBHImageTool is a command line application to handle dumping and re-creation of .NBH files, which are data containers designed by HTC to be read by their SPL. The .nbh file contains a number of data partitions identified by their ItemID. NBHImageTool uses just a small subset of libnb, which is a library designed to handle Windows Mobile firmware images, and is in development. New! Support for WP7 unsigned NBH dumping and rebuilding
How do I use NBHImageTool?
Included in the archive are 2 batch files which demonstrate the usage of NBHImageTool, one will dump the .nbh to its .nb components, and an xml configuration file which defines the parameters to rebuild it. The other will build an .nbh from its .nb components and an .xml. Note that ImageHash.exe and TEST.pvk must be in the same folder as libnb.dll or it will fail to sign the output NBH. These files are not required if your output NBH is not signed.
What is the output from NBHImageTool?
It will generate an RUU_Unsigned.nbh and an RUU_Signed.nbh. The RUU_Signed.nbh is signed with the TEST.pvk certificate contained in the archive, and the RUU_Unsigned.nbh is unsigned.
What are the .nb files generated with unknown in the name?
These are some binary data that i'm not sure about. If you know what they are (and optionally how to manipulate them) let me know!
What can I change in the xml configuration and still obtain a valid .nbh to flash to my device?
Defaults for the following parameters are all generated by the dump function. <NBHFile> The Signed attribute tells NBHImageTool if it should sign your output .NBH with TEST.pvk. The ModelID attribute must match your device ModelID. An asterisk (*) can be used to match any character. The CID attribute must match your device CID if you are running the stock bootloader. If you are running HardSPL the CID can be any value. The Version attribute can be any value. The Language attribute can be any value. The DataChunkSize attribute should match the original dumped value from your .NBH. This value defines the maximum size of data to be allocated inbetween signature chunks written by ImageHash.exe. <Item> The IncludedInNBH attribute determines if the program should look for this item in the input folder. The remaining attributes will be skipped if this is not set to 1. The ItemID attribute defines the Item's type. 0x400 defines an os.nb, which contains most of the relevant Windows Mobile files. This is the only ItemID which defaults to be included in the final NBH. ItemID and FileName will only be read if IncludedInNBH is set to 1. The FileName attribute defines the filename for NBHImageTool to grab from the input directory (param1). ItemID and FileName will only be read if IncludedInNBH is set to 1.
RUU_Signed.nbh and RUU_Unsigned.nbh are both generated in the output folder. You could change "TEST.pvk" in the .\tools folder to a .pvk of your choosing to sign the resulting .nbh with that certificate. Or you could use the RUU_Unsigned.nbh raw image to be processed in some other way (signed using a 3rd party tool, etc.)
What are the "unknown" .nb files generated by NBHImageTool?
These are data partitions that unknown to me! If you know what one is, please drop me a PM and let me know, I will update the library with this information.
What's this "param1", "param2" nonsense?
The parameters take different values, depending if you are running -dump or -build. The values are:
param1: Path to the .nbh to dump. This Path must end in the filename (eg. RUU_Signed.nbh)
param2: Path to the folder to extract to. This Path must end in a folder name (eg. C:\Kitchen\dumpfolder)
param3: Path to an .xml to create with configuration data to rebuild the .nbh. This path must end in an .xml file name (eg. C:\Kitchen\xml\raphael.xml)
param1: Path to the folder to take .nb files from to build resulting .nbh. This path must end in a folder name (eg. C:\Kitchen\dumpfolder)
param2: Path to the folder to build the .nbh files in. This path must end in a folder name (eg. C:\Kitchen\buildfolder)
param3: Path to an .xml to read with configuration data to rebuild the .nbh. This path must end in an .xml file name (eg. C:\Kitchen\xml\raphael.xml)
I've run into some bug with NBHImageTool, or found an .nbh that causes odd behavior!
Please drop me a PM to let me know, I will look into it ASAP!
I'm a programmer, and libnb sounds like a .dll I might be interested in.
Please contact me via PM! I'd like to support libnb.dll and all its functions for anyone interested in using it for their own program (not for commercial use)
This program is written in VS2010/C++ Native Code.
The Visual C++ 2010 (x86 or x64, depending which version you use) Runtime is required to run it.
Thanks to everyone who helped me to understand the .NBH format, the SPL, and what parameters it finds tasteful. Cmonex, Olipro, Bepe, and Ervius and many others!
v1.0: Initial release
v1.1: Fixed a bug when the last NBH Item is smaller than DataChunkSize resulting in a crash on dumping, changed help text and error output to reflect the need for ImageHash.exe and TEST.pvk in launch folder
v1.2: Optimizations, x64 version added, WP7 Unsigned NBH format now supported for dumping, new "Signed" variable added to XML. Path issues with imagehash.exe addressed (keep it and test.pvk in the same folder with libnb.dll)