About REG, DAT, BIB, and DB files
REG Files
Windows CE build 过程用到的REG Files 几乎和 windows 其他版本的REG Files 相似。最大的不同在于文件头的REG版本的标记被移走。这样就预防了意外的把windows CE REG file 写入你正开发的工作站的注册表,比如,双击REG file就可以很正常的把数据替换正在编写的文件。(我很难过,同时也很感谢第一个这么做并且认识到这个问题严重的家伙!)语法是易懂的。键名是建立在系统定义的键上,并且放在括号里。键的值来自于键名,数据类型,数据值等子键的赋值。
[HKEY_LOCAL_MACHINE/SOFTWARE/MegaSoft/KillerApp]
"Version"=dword:0400
"Build"=dword:0b3f
"Greeting"="Howdy!"
"Messages"=multi_sz:"Windows CE is Cool!","KillerApp is Super Cool!"
"AppData"=hex:01,00,02,00,03,00
在这个例子中,是一个MegaSoft software company的KillerApp新键的创建。下面的值是加在这个键上的。
Name |
Type |
Value |
Version |
REG_DWORD |
0x0400. DWORD value types are always in hex and therefore the "0x" prefix is not used. |
Build |
REG_DWORD |
0x0b3f |
Greeting |
REG_SZ |
"Howdy!" |
Messages |
REG_MULTI_SZ |
"Windows CE is Cool!/0KillerApp is Super Cool!/0/0" |
AppData |
REG_BINARY |
01,00,02,00,03,00 Hex is always assumed here as well. |
DAT files
DAT files是用来在系统冷启时,文件系统怎样初始化RAM file系统结构的。你可以在RAM system中建立一个完整的文件系统结构来满足应用程序和终端用户的需求。文件系统将会复制initobj.dat中所有的文件到它们在的文件夹里。谨记所有的ROM files都存在于/Windows/ folder,这样再把EXE and DLL files复制到DAT 文件的RAM-based文件夹是浪费资源。所以我们只需要在windows文件夹中建立EXE的快捷方式即可。
DAT文件的语法不太固定,但也不难。
root:-Directory("Program Files")
Directory("/Program Files"):-Directory("KillerApp")
Directory("/Program Files/KillerApp"):-File("KillerApp.lnk","/Windows/KillerApp.lnk")
这个例子在非文件系统的目录下创建了项目文件夹,在文件夹里,它创建了KillerApp,然后复制了KillerApp的快捷方式(.LNK file)到新创建的文件夹中。用户可以在Program Files/KillerApp下点击快捷方式来启动应用程序。
DB files
DB files为对象存储定义了RAM-based的数据库。语法是有的点模糊,但还是有资可寻。对于Platform Builder生成的系统,几乎很少用到数据库,但与ActiveSynch建立连接除外。例如:
; This is the database initialization file.
; format is as follows -
; Database : <db name> : <type in hex> : <num sort order> : <hex propid> : <hex flags> ....
; CEDB_SORT_DESCENDING 0x00000001
; CEDB_SORT_CASEINSENSITIVE 0x00000002
; CEDB_SORT_UNKNOWNFIRST 0x00000004
; CEDB_SORT_GENERICORDER 0x00000008
; A database specifier can be followed by any number of record specifiers
; Record :
; A record specifier can be followed by any number of field specifiers
; Field : <hex propid> : <value> [ either string or hex dword ]
; End (ends a matching database or a record context)
Database: "DB_notify_events" : 0 : 1 : 0001001F : 0
; 0001001F - PROPIDR_NAME
; 0002001F - PROPIDR_CMDLINE
; 00030013 - PROPIDR_EVENT
Record :
Field : 0001001F : "repllog.exe"
Field : 0002001F : "AppRunAtRs232Detect"
Field : 00030013 : 9
End
End Database
这个DB文件在RS232 event发生时,建立公告数据库用来运行RELLOG。这将方便ActiveSync的“热插拔”。
BIB files
ROMIMAGE uses Binary Image Builder (BIB) files to configure how it should configure the ROM. BIB files are just plain text files with keywords defining four different sections.
The modules section is identified with the keyword MODULES on a line of its own. In the modules section, executable modules are listed for code that will execute in place (XIP). The files section (keyword FILES) lists other files to place in the image (bitmaps, data files, HTML pages, and so on). It can also specify executable modules not intended for XIP. Rarely used diagnostic applications are a good candidate for that. The items in the files section are compressed by default to reduce the size.
The syntax is pretty straightforward for the entries of the modules and files sections:
<Target Name> <Whitespace> <Workstation path> <memory Section> <flags>
<Target Name> is the name of the file as it will appear in the ROM. <Workstation path> is the path ROMIMAGE will use to find the actual file (normally based on $(_FLATRELEASEDIR)). The memory section will be "NK" with few exceptions. (Boot loaders are a common exception).
The flags are summarized in the following table:
Flag |
Purpose |
C |
Compressed (default for files section) |
U |
Uncompressed (default for modules section) |
R |
Compress resources only |
H |
Hidden file |
S |
System file |
The remaining two sections of BIB files are normally placed in the Config.bib file (merged with the other BIB files in the makeimg phase to generate ce.bib). These are:
The memory section, which describes the memory layout for your system. It's syntax is as follows:
<name> <Virtual Address> <Size> <TYPE>
where TYPE is one of the following:
Value |
Description |
RAM |
Specifies a region of RAM available to running processes and the RAM-based Windows CE file system. The region must be contiguous. |
RAMIMAGE |
Specifies that the region should be treated like ROM. The kernel copies all writeable sections for an application into RAM and fixes the memory addresses prior to starting the application process. |
RESERVED |
Specifies that a region of RAM is reserved. Currently, Romimage.exe ignores this field, so it functions only as a comment. This memory might be a video frame buffer or a direct memory access (DMA) buffer. Do not overlap reserved regions with other memory regions. Windows CE .NET provides a means of allocating such buffers programmatically, so the use of reserved is now effectively obsolete. |
The config section specifies a number of miscellaneous settings, including the size and width of ROM if you are using the raw binary image format (ABX=ON).