windowsCE镜像文件结构

Formats:
struct BinFile{
    BYTE signature[7];     // = { 'B', '0', '0', '0', 'F', 'F', '\a' }
    DWORD   ImageStart
    DWORD   ImageLength
    Record  ImageRecords[RecordNum]
  };


struct Record{
    DWORD address;
    DWORD length;
    DWORD chksum;
  };
在文件的最开端,会放置一个BinFile结构,imageStart和ImageLength分别对应镜像展开后在内存中存放的首地址和长度。该结构中的RecordNum为不确定的,通常在最后一个记录之后增加一个address和Chksum都为0的纪录表示结束,而这个表示结束的结构中的Length则标示其实际入口点。

Image
Offset   -----------
  0x00    | ImageStart   
             |
             |
  0x40    | Rom Signature { 0x43454345 }
  0x44    | Pointer to the ROMHDR for this Region
             |
             |
  0x???? | ROMHDR{
             | };
             |

Chain file

struct _XIPCHAIN_ENTRY {
    LPVOID  pvAddr;                 // address of the XIP
    DWORD   dwLength;               // the size of the XIP
    DWORD   dwMaxLength;            // the biggest it can grow to
    USHORT  usOrder;                // where to put into ROMChain_t
    USHORT  usFlags;                // flags/status of XIP
    DWORD   dwVersion;              // version info
    CHAR    szName[XIP_NAMELEN];    // Name of XIP, typically the bin file's name, w/o .bin
    DWORD   dwAlgoFlags;            // algorithm to use for signature verification
    DWORD   dwKeyLen;               // length of key in byPublicKey
    BYTE    byPublicKey[596];       // public key data
  };

  Offset   --------------------------
  0x00    | DWORD Count;
  0x04    | XIPCHAIN_ENTRY[1]{
             | };
             | XIPCHAIN_ENTRY[2]{
             | };
             | ...

posted @ 2004-11-11 17:44 nasiry 阅读(...) 评论(...) 编辑 收藏