(c) 2003 XDA Developers
source: browse online
OsImageTool only works with ppc2002+ppc2003 roms for the xda1/wallaby,
have a look at nbftools
for information on how to flash other devices.
This tool is a replacement for XDARit, with less opportunity for the user
to damage their disks or devices.
When used interactively, you see 2 selection boxes, from which you
can either select a device or specify a file.
Devices can be a local sd card device, xda sd card device,
or xda ROM. The Sourcefile can be a .bin, .nb1, or nbf file,
the Destinationfile can be either a .nb1 or a .nbf file.
The program will check if the sdcard you are trying to write to
is large enough, not a harddisk, or too large, which may indicate
you are not writing to an sdcard. ( or maybe you are using this
software 2 years from now when 2+G cards will be common. )
This program will only create type 1 sd cards, which means you cannot
accidentally trash your bootloader with it.
Clicking 'COPY' will try to perform the action selected.
Clicking 'Cancel' will exit the program.
<source> and <destination> may both be one of
| ||-r <source>|
| ||-w <destination>|
| ||-a ||Be as automatic as possible|
| ||-f ||Do not check filesize|
| ||--register ||Install as .nb1 and .nbf handler|
when 'localsdcard' is selected with '-a' (auto) and more than 1 sdcard
is found, OsImageTool will allow the user to select the desired card.
- or a filename.
- HKCR\.nb1 = 'Flash OsImageFile'
- HKCR\.nbf = 'Flash OsImageFile'
- HKCR\Flash OsImageFile\shell\Open\command
= '"%apppath%" -a -r "%1" -w xdamemory'
- HKCR\Flash OsImageFile\shell\write to SD\command
= '"%apppath%" -a -r "%1" -w localsdcard'
- HKCU\Software\XDA Developers\OsImageTool
- 'Programme A Path' = '%apppath%'
- * this is where the subdirectory for nk.nbf is searched for.
- 'bootloader' = '%apppath\bootloader_v5_15.nb0'
- * the bootloader used to create an .nbf
- 'Programme A Command'= '%apppath%\start.bat'
- * the command used to execute Programme A
this batchfile may for instance call adaptrom.exe
to set things straight in the nbf.
this is a small utility dll used to access the xda memory and sdcard.
source can be found on http://www.xs4all.nl/~itsme/projects/xda/tools.html
this is the main executable.
this is a tool currently used to copy itsutils.dll to the device.
it will be replaced by a piece of code in the future.
You can download the source + exe distribution from
v1.00 : http://nah6.com/~itsme/download/oit_100.zip.
v1.01 : http://nah6.com/~itsme/download/oit_101.zip.
v1.05 : http://nah6.com/~itsme/download/oit_105.zip.
or browse the source
From the source + exe distribution
copy OsImageTool.exe and itsutils.dll to the "programme A" directory as created by unpacking
to a directory in your "Program Files" directory. Then run 'OsImageTool --register'.
currently OsImageTool depends on mfc71.dll, which can be downloaded from http://nah6.com/~itsme/download/mfc71.zip.
Currently things may go wrong if you unplug / replug devices while
OsImageTool is already running.
adaptrom notices that I have not yet calculated the checksum.
writing of 5.17 bootloader cards not supported
does not know how to handle data in the top 1M of the rom.
this is only an issue if you want to restore a saved rom, including
or in one case the first 2003 rom released had it's xipchain in that area,
but I suspect that to be an oversight by htc.
HOW TO BUILD
To build this you may need to change the IncludeDirectories and
LibraryDirectories settings in vc++, they currently point to paths
on my machine, which may not have the same disks as yours.
You need the pocketpc2002 sdk ( for the activesync or rapi libaries )
from microsoft, and the boost ( from http://www.boost.org/ ) headerfiles.
I am only using the header files from the boost distribution, no compilation
of boost nescesary.
SOURCE CODE DESCRIPTION
This is a very raw description of how the various classes
relate to each other.
I try to work with STL objects as much as possible, in most cases
a wrapper around the systemcalls is made for this.
- - can copy from OsImageReader to OsImageWriter
- 'OsImageReader' and 'OsImageWriter' use memory offsets
( 80040000 for start of nb1 )
- 'SdCardDevice' uses device offsets
- OsImageReader is subclassed by
- - SdOsImageReader
- * reads os images from a SdCardDevice
- - XDAOsImageReader
- * reads os image from device memory
- - FileOsImageReader, which is subclassed by:
- - BINOsImageReader
- * reads .xip and .bin files
- - LinearFileImageReader, which is subclassed by:
- - NB0ImageReader
- - NB1OsImageReader
- - NBFOsImageReader
- OsImageWriter is subclassed by
- - SdOsImageWriter
- * writes osimage to a SdCardDevice
- - XDAOsImageWriter
- * creates nbf, and calls Programme A
- - FileOsImageWriter which is subclassed by
- - LinearFileImageWriter which is subclassed by
- - NB1FileOsImageWriter
- - NBFFileOsImageWriter
- SdCardDevice is subclassed by
- - LocalSdCard [ local disk devices ]
- - RemoteSdCard [ sdcard in xda ]
- - a cleaner interface to get/set data in a combobox
- - reads/writes configuration to the registry
- - figures out what disks exist
- - closes itself when it goes out of scope.
- - easy interface to getting/setting registry values
[some research on how to relate drive letters to the device identification]
- - add target / source 'askme' to initially start with file selection
- - add tooltips to controls
- - why can I read way too much data from an sd card?
- - move all fileops to a class
- - split 'open' in 'open' and 'startimage'
- - split 'close' in 'close' and 'finishimage'
- - nbfwriter should not use 0x7fffffe0 as fileoffset, but needs 'out of band'
method to write header.
- - add option to only allow writing of sd cards which already contain a
- - 'OsImage' naming is not entirely correct, same objects are used
to read a bootloader.
- - maybe also add option to read bootloader from device, before
taking the bootloader.nb0 file.
- - recheck device configuration when starting write.
- - 'auto' may possibly be made more automatic.
- - I may need a 'message' or status message somewhere to describe what
the program is doing.
- - give messageboxes the dialog as parent.
- - dialog should disappear when in 'auto' mode
- - osimagetool currently does not support writing sd cards with data above 31M.
( the saved contacts area, or in 1 case the first alpha release of ce.net
this area contained the xip-chain )
- - 5.17 bootloader is not supported
- - replace calling of 'pput.exe' with copy-file-to-ce function
- - when selecting a file, the '.nb1' extension is not added.
usenet articles on lowlevel disk ioctls: