转:WinCE 注册表platform.reg详解

注册表文件是WinCE中非常重要的文件,所有驱动程序的配置信息都保存在注册表中,系统启动的时候,会根据系统注册表中的信息,加载builtin驱动程序。还会根据注册表信息对flash或者SD卡等加载分区驱动和文件系统驱动。
WinCE中的注册表是在平台bulid的时候根据几个注册表文件生成reginit.ini文件,这个文件是最终系统镜像的注册表文件。这是在bulid过程最后makeing的阶段完成的。Reginit.in文件是从几个.reg文件中生成的,只要有platform.reg,common.reg,wceshell.reg,IE.reg,project.reg等文件。
一、HIVE 注册表功能
[HKEY_LOCAL_MACHINE/init/BootVars]
  "SystemHive"="Documents and Settings//System.hv"
   "ProfileDir"="Documents and Settings"
   "DefaultUser"="default"
   "Start DevMgr"=dword:1
   "Flags"=dword:3
   "RegistryFlags"=dword:1
 
说明:
SystemHiv
系统HIVE文件的保存路径与文件名
 
ProfileDir
         用户配置文件保存路径
 
DefaultUser
         默认加载的用户HIVE文件
 
Start DevMgr
         启动时加载设备管理器
 
Flags
         这个值替代Start DevMgr,可以在包括Start DevMgr的功能前提下提供更精确的控制
Flag bit setting Description
0x00000001
Starts Storage Manager in phase one of startup for hive-based registry
(为了实现HIVE,启动时加载存储管理器)
0x00000002
Starts Device Manager in phase one of startup for hive-based registry
(为了实现HIVE,启动时加载设备管理器)
0x00000004
Starts Storage Manager in phase one of startup for registry in external ROM, such as BINFS
(为了注册扩展ROM例如BINFS,在启动时加载存储管理器)
0x00000008
Starts Device Manager in phase one of startup for registry in external ROM, such as BINFS
(为了注册扩展ROM例如BINFS,在启动时加载设备管理器)
 
RegistryFlags
         在调用RegCloseKey函数时自动调用RegFlushKey函数,用于自动保存注册表
 
 
设备管理器会加载 HKEY_LOCAL_MACHINE/Drivers/BuiltIn 下的所有设备驱动
 
 
 
二、存储管理
[HKEY_LOCAL_MACHINE/System/StorageManager/Profiles]
   "AutoMount"=dword:1
   "AutoPart"=dword:0
   "AutoFormat"=dword:0
   "MountFlags"=dword:0
   "DefaultFileSystem"="FATFS"
   "PartitionDriver"="mspart.dll"
   "Folder"="Mounted Volume"
 
 
[HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/SMFLASH]
    "DefaultFileSystem"="BINFS"
    "AutoPart"=dword:1
    "AutoMount"=dword:1
    "PartitionDriver"="mspart.dll"
    "Name"="Microsoft Flash Disk"
    "Folder"="ResidentFlash"
    "BootPhase"=dword:0
    "AutoFormat"=dword:1
 
[HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/HDProfile]
   "Name"="IDE Hard Disk Drive"
   "Folder"="Hard Disk"
   "AutoMount"=dword:1
   "DefaultFileSystem"="EXFAT"
   "PartitionDriver"="mspart.dll"
 
[HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/HDProfile/FATFS] FATFS部分的定义
   "EnableCacheWarm"=dword:0
 
[HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/HDProfile/PartitionTable]
   "07"="" (该值表示对于NTFS类型的分区,不加强任何文件系统)
 
[HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/SDMMC]
   "Name"="SD MMC device"
   "Folder"="SD Card"
 
该分支可以的定义如下
Flag Description
"AutoFormat" 是否自动格式化(1-是,0-否)
"AutoMount" 是否自动挂载(1-是,0-否)
"AutoPart" 是否自动分区(1-是,0-否)
"DefaultFileSystem" 对于未知的分区表ID,默认识别为的分区类型,例如BINFS
"Folder" 挂载目录名
"MountFlags" 从Win CE 5.0开始废除. 用于标识分区挂载方式.
"Name" STOREINFO (Storage Manager) 结构体的. szStoreName成员变量值
"PartitionDriver" 默认加载的分区驱动
 
 
三、文件系统
1、Autoload 设置
 [HKEY_LOCAL_MACHINE/System/StorageManager/Autoload/Relfsd]
    "Dll"="relfsd.dll"
    "Paging"=dword:1
    "LoadFlags"= dword:1
Value: type Description
LoadFlags: REG_DWORD
控制如何加载文件系统.
1 –同步加载文件系统. 需要在启动的0或1阶段自动加载
2 –在另一个线程异步加载. 只支持在启动的2阶段,(默认值)
BootPhase: REG_DWORD
控制在核实加载文件系统.
0 – 在本地初始化之前加载.
1 -在本地初始化之后加载, 在注册表功能加载完成之前.
2 – 在注册表功能加载完成之后.
Dll: REG_SZ 制定 FSD DLL 文件
Order: REG_DWORD 指定加载顺序,值越小越先加载.
2、文件系统设置
[HKEY_LOCAL_MACHINE/System/StorageManager/FATFS];总定义
    "FriendlyName"="TFAT FileSystem"
    "Flags"=dword:00000014
    "Dll"="exfat.dll"
"CacheSize"=dword:0
 
[HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/SMFLASH/FATFS];详细定义
    "Flags"=dword:14
"FormatTfat"=dword:1
“MountAsBootable”= dword:1
"CheckForFormat"=dword:1
 
 
Registry value: Type Description
BufferSize: REG_DWORD
缓冲区大小.
默认值 64 for TFAT  32 for FAT.
CacheSize: REG_DWORD 磁盘缓存大小以扇区为单位. 设置为0则自动使用最佳缓存.
CodePage: REG_DWORD Overrides CP_OEMCP in all character conversions.
Dll: REG_SZ DLL文件名.
EnableCache: REG_DWORD
是否启用缓存
0 – 禁用   1 – 启用
EnableCacheWarm: REG_DWORD Enables pre-warming of the cache.
Flags: REG_DWORD 详见下表.
FormatTfat: REG_DWORD 格式化为TFAT
FriendlyName: REG_SZ Specifies a friendly name for the file system.
MountLabel: REG_DWORD 卷标名
Paging: REG_DWORD 分页 0-禁用 1-启用.
Util: REG_SZ Specifies the DLL name of utility to do format and scan
 
CheckForFormat
         对于Flash Media Drivers(FMD)来说,设置这个标志位,则会调用IOCTL_HAL_QUERY_FORMAT_PARTITION这个ioctl
 
 
Flag Description
"MountFlags" 从Win CE 5.0开始废除
"MountHidden" 隐藏挂载. 1 – 启用. 替代 "MountFlags"=dword:1
"MountAsBootable"
是否包含注册表. 第一个挂载的分区存储HIVE注册表. 1 – 启用
替代 "MountFlags"=dword:2
"MountAsRoot" 是否挂载为根文件系统. 1 – 启用. 替代 "MountFlags"=dword:4
"MountAsROM" 是否挂载为扩展ROM文件系统. 1 – 启用. 替代 "MountFlags"=dword:10
"MountSystem" 所有文件和目录作为系统文件. 1 – 启用. 替代 "MountFlags"=dword:20
"MountPermanent" 此卷不能卸载. 1 – 启用. 替代 "MountFlags"=dword:40
"MountAsNetwork"
指定这个卷标接收所有的 UNC paths. 1 – 启用.
替代 "MountFlags"=dword:80
 
Flags
 
Flag Value Description
FATFS_UPDATE_ACCESS 0x00000001 更新访问时间.
FATFS_DISABLE_LOG 0x00000002 禁用事件日志.
FATFS_DISABLE_AUTOSCAN 0x00000004 禁用自动扫描.
FATFS_VERIFY_WRITES 0x00000008 写校验.
FATFS_ENABLE_BACKUP_FAT 0x00000010 备份FAT表.
FATFS_FORCE_WRITETHROUGH 0x00000020 让系统可以直接将任何缓冲区中的数据写到磁盘上,这样系统将加快写数据到磁盘的速度.
FATFS_DISABLE_AUTOFORMAT 0x00000040 禁止自动格式化未格式化的分区.
FATFS_WFWS_NOWRITETHRU 0x00010000 Disables write through on theWriteFileWithSeek function. Improves memory-mapped file performance.
FATFS_DISABLE_FORMAT 0x00020000 禁止格式化.
FATFS_TRANS_DATA 0x00040000 写操作同时传输数据.
 
CacheSize
Registry entry Number of sectors Cache in kilobytes (KB)
2 2 1
4 4 2
8 8 4
10 16 8
20 16 32
40 64 32
80 128 64
100 256 128
200 512 256
400 1024 512
800 2048 1024
1000 4096 2048
 
 
 
添加HIVE 注册表支持
 
1、  添加hive-based registry catalog 组件
2、  添加
[HKEY_LOCAL_MACHINE/init/BootVars]
   "SystemHive"="Documents and Settings//System.hv"
   "ProfileDir"="Documents and Settings"
   "DefaultUser"="default"
   "Start DevMgr"=dword:1
   "Flags"=dword:3
   "RegistryFlags"=dword:1
 
3、  在 each driver that is loaded during the first phase of startup
[HKEY_LOCAL_MACHINE/Drivers/ 相关项下添加(表示此驱动程序只加载一次)
 "Flags"=dword:1000
 
4、
 [HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/<ProfileName>/<FileSystemName>]
下添加
"MountAsBootable"=dword:1

posted on 2017-04-25 10:48  humbird  阅读(1281)  评论(0编辑  收藏  举报

导航