WinCE5.0 SMDK2410 BSP在GEC2410开发板上的移植(13)-HIVE注册表实现

之前我们已经实现了Multi-Bin,CE已经可以正常启动运行.但是我们修改的系统设置在重启后就又恢复成初始状态.那是因为我们的注册表是基于RAM的,要实现注册表永久保存就需要实现HIVE注册表.
我们把注册表保存在Nand flash的FAT分区中.
在注册表中,HIVE BOOT SECTION和END HIVE BOOT SECTION直接的注册表内存就保存在HIVE中.
1.添加HIVE组件
Hive-based Registry
2.修改注册表
之前讲Multi-Bin时,HIVE注册表已经实现了,和HIVE相关的注册表设置之前都已经提及了.我们要保存的注册表内容都在system.hv中.
; @CESYSGEN IF FILESYS_FSREGHIVE
; HIVE BOOT SECTION

[HKEY_LOCAL_MACHINE/init/BootVars]
   "SystemHive"="Documents and Settings//system.hv"
   "ProfileDir"="Documents and Settings"
   "Flags"=dword:3 ;等同于 "Start DevMgr"=dword:1,讲注册表保存到ROM中
   "RegistryFlags"=dword:1 ;自动刷新system.hv,每次修改设置就自动保存注册表
; END HIVE BOOT SECTION
; @CESYSGEN ENDIF FILESYS_FSREGHIVE

还有个重要的设置就是我们的存储介质,设置MountAsBootable说明注册表保存在该存储设备中,系统启动时就从这里读取注册表内容
[HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/MSFlash/FATFS]
    "MountAsROM"=dword:0
    "MountHidden"=dword:0   
    "MountAsBootable"=dword:1
    "Flags"=dword:00000014    ;FATFS_FORCE_WRITETHROUGH | FATFS_DISABLE_AUTOSCAN
    "EnableWriteBack"=dword:1
    "CheckForFormat"=dword:1 

完整注册表如下:(讲Multi-Bin已列举过)
; @CESYSGEN IF FILESYS_FSREGHIVE
; HIVE BOOT SECTION

; Valid Bits for Flags registry value
; If no flags are set, the hive will be stored in the object store.
;
; 0x00000001    Start storage manager in boot phase 1 for hive-based registry
; 0x00000002    Start device manager in boot phase 1 for hive-based registry
; 0x00000004    Start storage manager in boot phase 1 for registry in
;               external ROM (such as BINFS)
; 0x00000008    Start device manager in boot phase 1 for registry in
;               external ROM (such as BINFS)

[HKEY_LOCAL_MACHINE/init/BootVars]
   "SystemHive"="Documents and Settings//system.hv"
   "ProfileDir"="Documents and Settings"
   "Flags"=dword:3 ;equals to "Start DevMgr"=dword:1
   "RegistryFlags"=dword:1 ;auto flush system.hv
; END HIVE BOOT SECTION
; @CESYSGEN ENDIF FILESYS_FSREGHIVE

; HIVE BOOT SECTION
; @CESYSGEN IF CE_MODULES_SDNPCID

; Add BinFS to partition table
[HKEY_LOCAL_MACHINE/System/StorageManager/PartitionTable]
    "21"="BINFS"

; Default values for binfs.  These can be overridden per profile
[HKEY_LOCAL_MACHINE/System/StorageManager/BinFS]
    "FriendlyName"="BIN Filesystem"
    "Dll"="binfs.dll"
    "Paging"=dword:1
    "Folder"="BINFS" 

[HKEY_LOCAL_MACHINE/Drivers/BuiltIn/MSFlash]
        "Profile"="MSFlash"
        "IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"
        "Order"=dword:0
        "FriendlyName"="MSFLASH Driver"
        "Dll"="smflash.dll"
        "Prefix"="DSK"
        "Ioctl"=dword:4     
        "Flags"=dword:1000  
        "BootPhase"=dword:0

[HKEY_LOCAL_MACHINE/System/StorageManager/AutoLoad/MSFlash]
    "DriverPath"="Drivers//BuiltIn//MSFlash"
    ; LoadFlags 0x01 == load synchronously
    "LoadFlags"=dword:1
    "Order"=dword:0
    "BootPhase"=dword:0

; @CESYSGEN ENDIF CE_MODULES_SDNPCID
; END HIVE BOOT SECTION

; HIVE BOOT SECTION
; @CESYSGEN IF CE_MODULES_SDNPCID
[HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/MSFlash]
    "DefaultFileSystem"="BINFS"
    "PartitionDriver"="mspart.dll"
    "MountAsROM"=dword:1
    "MountHidden"=dword:1
    "Folder"="Flash  Disk"
    "Name"="FLASH Disk Block Device"
    "AutoMount"=dword:1 
    "AutoPart"=dword:1  
    "BootPhase"=dword:0
    "Flags"=dword:1000 
    "AutoFormat"=dword:1

; Keep FATFS from trying to shadow /Windows
[HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/MSFlash/FATFS]
    "MountAsROM"=dword:0
    "MountHidden"=dword:0
    "MountAsBootable"=dword:1
    "Flags"=dword:00000014    ;FATFS_FORCE_WRITETHROUGH | FATFS_DISABLE_AUTOSCAN
    "EnableWriteBack"=dword:1
    "CheckForFormat"=dword:1   

; @CESYSGEN ENDIF CE_MODULES_SDNPCID
; END HIVE BOOT SECTION

你可能感兴趣的:(manager,Flash,equals,dll,WinCE,disk)