Presentation is loading. Please wait.

Presentation is loading. Please wait.

EMB315 Non-Volatile Object Store And Hive Based Registry Design For Windows CE Rick Austin Principle Engineer Intermec Corporation.

Similar presentations


Presentation on theme: "EMB315 Non-Volatile Object Store And Hive Based Registry Design For Windows CE Rick Austin Principle Engineer Intermec Corporation."— Presentation transcript:

1 EMB315 Non-Volatile Object Store And Hive Based Registry Design For Windows CE Rick Austin Principle Engineer Intermec Corporation

2

3 M anagement T ools C ommunications & M essaging Device Update Agent Software Update Services Live Communications Server Exchange Server Internet Security and Acceleration Server Speech Server Image Update L ocation S ervices M ultimedia MapPoint DirectX Windows Media Visual Studio 2005 D evelopment T ools MFC 8.0, ATL 8.0 Win32 N ative M anaged S erver S ide L ightweight R elational SQL Server 2005 Express EditionEDB D ata P rogramming M odel D evice B uilding T ools D evice B uilding T ools H ardware/ D rivers Windows XP DDK Windows Embedded Studio Platform Builder OEM/IHV Supplied BSP (ARM, SH4, MIPS) OEM Hardware and Standard Drivers Standard PC Hardware and Drivers SQL Server 2005SQL Server 2005 Mobile Edition ASP.NET Mobile ControlsASP.NET.NET Compact Framework.NET Framework Microsoft Operations Manager Systems Management Server

4 History RAM Registry SYSGEN_FSREGRAM Most Common Implementation in PDAs Content Loss on boot Save And Restore Methods require difficult code pReadRegistryFromOEMpWriteRegistryToOEM RAM Object store SYSGEN_FSRAMROM most common denominator for application development Object Store Volume is always mounted Object Store is the Root of the file system Content Loss on cold boot Object Store and Executable Memory Tradeoff FSRAMPERCENTSetSystemMemoryDivision() RAM Object store limited to 256 MB

5 Persistence Benefits Simplifies Cold Boot System startup Data and Configuration is permanent Install applications once Reduce Data Backup/Restore Requirement Eliminate Redundant Data storage Requirement Reduce Cold Boot Times No Limit On Object Store Size

6 Persistence Benefits Better Power Management Reduce/Remove Backup Battery needs Increase Battery run time Lower RAM requirements = Lower Power Easy to Implement Largely Transparent to current Apps Mainly Simple Registry Setup Required Lower Cost systems Flash is cheaper than RAM for Data Store

7 Boot Phase Definitions 0 = Prior to init of locale (wince.nls) 1 = After locale init (wince.nls) but before registry is functional 2 = After registry is functional

8 File System Fundamentals Autoload file systems HKLM\System\StorageManager\AutoLoad Do not need block drivers Don’t require Device.exe Loaded by Storage Manager Can Start in BootPhase 0 or 1 Can Load Synchronously or Asynchronously [HKLM\System\StorageManager\Autoload\ ] “BootPhase” = dword:0 “LoadFlags” = dword:0 ;Async (default) ;Sync = 1

9 File System Fundamentals Block Driver Based File Systems Loaded By Device.exe IClass indicates its managed by storage manager {A4E7EDDA-E575-4252-9D6B- 4195D48BB865} Specifies partition and File system drivers Must Start in Bootphase 1 HKLM\Drivers\Builtin\ HKLM\Drivers\Builtin\ “BootPhase” = dword:1 “BootPhase” = dword:1

10 Hive Fundamentals Hives are registry files stored on persistent file systems Boot Hive Changes made during boot are copied to system hive Default Hive / System Hive System Data (HKLM, HKCR, HKU) User Hive User Data (HKCU) Allows settings for different users at logon Only Deltas are stored

11 Hive Fundamentals The kernel starts Filesys.exe Filesys loads the Boot Hive from the ROM Image Filesys may start Device.exe to gain access to system hive Device.exe starts block drivers based on the boot registry The boot file system is initialized based on registry keys Filesys loads and mounts system registry The Kernel initializes using the system registry The Kernel signals Filesys Filesys.exe starts applications (Launch Keys) Device.exe is loaded if not already loaded Filesys.exe signals BootPhase2 event Device.exe then re-enumerates, starting drivers

12 Hive Fundamentals [HKLM\init\BootVars] "SystemHive"=" ” "Start DevMgr"=dword: "Start DevMgr"=dword: ;0 = don’t start ;0 = don’t start ; 1 = Start ; 1 = Start “Default User”=“ ” “ProfileDir”= “ProfileDir”= “Flags” = dword:3 ;Bit 0 = start storage manager ;Bit 1 = start device manager “RegistryFlags”=dword: “RegistryFlags”=dword: ;1 = enables aggressive flushing ;0 = default behavior

13 Hive Implementation Select Catalog Components Hive Based Registry support (SYSGEN_FSREGHIVE) Storage Manager Components SYSGEN_STOREMGR FAT (SYSGEN_FATFS) ? TFAT (SYSGEN_TFAT) ? Partition Driver (SYSGEN_MSPART) ? Components required depends on boot device See Examples

14 Hive Implementation Define Registry Hive Boot Sections Define the drivers and other system components required to start the system and access the boot media. Wrap all boot hive registry entries in the following comments ;Hive Boot Section ;End Hive Boot Section Common.reg has default definitions

15 Hive Implementation Prevent device.exe from loading drivers twice [HKLM\Builtin\drivers\...]“Flags”=dword:1000 Analyze the File system components required to load the device used to store the hives Does it need partitioning or format? Beware of drivers that use IsAPIReady() Enable Additional Debug Zones [HKCU\Pegasus\Zones] "FileSys" = dword:20 "FileSys" = dword:20

16 Hive Implementation Indicate System Registry Location [HKLM\System\StorageManager\Profiles\ \ ] "MountFlags"=dword:2or“MountAsBootable”=dword:1

17 Hive Implementation Implement Registry Flushing Suspend/Resume/PowerDown Flushing is automatic if power aware (more later) Do one or more of the following Enable Aggressive Flushing [HKLM\init\BootVars]“RegistryFlags"=dword:1 RegFlushKey() during power down Enable Lazy Flushing Environment Variable at build time PRJ_ENABLE_REGFLUSH_THREAD

18 Persistent Object Store Select the Catalog Components Select ROM-Only File System from Catalog (SYSGEN_FSROMONLY) Select Storage Manager Components from Catalog SYSGEN_STOREMGR FAT (SYSGEN_FATFS) ? FAT (SYSGEN_TFAT) ? Partition Driver (SYSGEN_MSPART) ?

19 Persistent Object Store Mount Root File System [HKLM\System\StorageManager\Profiles\ ] “MountAsRoot” = dword:1

20 Persistent Object Store Update FSRAMPERCENT in Config.bib Defaults to 0x80808080 if not set Set FSRAMPERCENT to >= 32KB Still need some RAM for Object Store Operations Recycle Bin Copy Operations Manage Stack and Memory Heap Compress and Expand Files *pOEMCalcFSPages()

21 Exploring A Persistent System

22 iPSM Example ; This registry setting indicates the PSM contains the registry and sets PSM ; to load in the first boot phase with the boot registry. [HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\PSM] "Dll"="PSMFSD.dll" "Dll"="PSMFSD.dll" "Paging"=dword:1 "Paging"=dword:1 "LoadFlags"=dword:1 "LoadFlags"=dword:1 "MountFlags"=dword:2 "MountFlags"=dword:2 "Flags"=dword:1000 "Flags"=dword:1000 "MountAsRoot"=dword:1;makes psm the root of the file system "MountAsRoot"=dword:1;makes psm the root of the file system "MountAsBootable"=dword:1 ;specifies the drive contains the system hive. "MountAsBootable"=dword:1 ;specifies the drive contains the system hive. "BootPhase"=dword:1 ;NLS support needed "BootPhase"=dword:1 ;NLS support needed ; The following key loads the PSMLock dll to support power management issue with PSM [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\PSMLock] "Prefix"="PSL" "Prefix"="PSL" "Dll"="PSMLock.Dll" "Dll"="PSMLock.Dll" "IClass"=multi_sz:"{8DD679CE-8AB4-43c8-A14A-EA4963FAA715}" "IClass"=multi_sz:"{8DD679CE-8AB4-43c8-A14A-EA4963FAA715}"

23 iPSM Example ; This registry key specifies the name of the PSM folder. [HKEY_LOCAL_MACHINE\Drivers\Builtin\FlshDrv] "FolderName"="Flash File Store“ "FolderName"="Flash File Store“[HKEY_LOCAL_MACHINE\System\StorageManager] "Dll"="fsdmgr.dll“ "Dll"="fsdmgr.dll“ ; This flag tells the device manager to load fsdmgr in the first boot phase ; with the boot registry, and not to load it a second time in the second ; boot phase with the system registry "Flags"=dword:1000 "Flags"=dword:1000[HKEY_LOCAL_MACHINE\System\Platform] "RegPath" = "\\Flash File Store" "RegPath" = "\\Flash File Store"[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\PSM] "MountAsRoot"=dword:1;makes PSM the root of the file system "MountAsRoot"=dword:1;makes PSM the root of the file system "MountAsBootable"=dword:1 ;specifies PSM contains the system hive. "MountAsBootable"=dword:1 ;specifies PSM contains the system hive. "BootPhase"=dword:1 ; NLS support is required "BootPhase"=dword:1 ; NLS support is required

24 DOC Example [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\TrueFFS] "Index"=dword:1 "Index"=dword:1 "Dll"="TrueFFS.dll" "Dll"="TrueFFS.dll" "Prefix"="DSK" "Prefix"="DSK" "Order"=dword:1 "Order"=dword:1 "Ioctl"=dword:4 "Ioctl"=dword:4 "AutoFormat"=dword:1 ; test for format to boot "AutoFormat"=dword:1 ; test for format to boot "DocAccessType"=dword:10 "DocAccessType"=dword:10 "WindowBase"=dword:0c000000 "WindowBase"=dword:0c000000 "IClass"="{A4E7EDDA-E575-4252-9D6B-4195D48BB865}“ "IClass"="{A4E7EDDA-E575-4252-9D6B-4195D48BB865}“ "Flags"=dword:1000 ;avoid loading the driver twice "Flags"=dword:1000 ;avoid loading the driver twice "BootPhase"=dword:1 ;NLS support required "BootPhase"=dword:1 ;NLS support required

25 DOC Example [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\TRUEFFS_DOC] "Name"="DiskOnChip M-Systems" "Name"="DiskOnChip M-Systems" "Folder"="DiskOnChip" "Folder"="DiskOnChip" "AutoFormat"=dword:1 ;auto format if needed "AutoFormat"=dword:1 ;auto format if needed "AutoPart"=dword:1 ;auto partition if needed "AutoPart"=dword:1 ;auto partition if needed[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\TRUEFFS_DOC] "DefaultFileSystem"="FATFS" "DefaultFileSystem"="FATFS" "AutoMount"=dword:1;mount any partition automatically "AutoMount"=dword:1;mount any partition automatically "MountAsRoot"=dword:1;makes trueffs the root of the file system "MountAsRoot"=dword:1;makes trueffs the root of the file system "MountAsBootable"=dword:1;specifies that Trueffs contains the system hive. "MountAsBootable"=dword:1;specifies that Trueffs contains the system hive. "BootPhase"=dword:1;NLS required "BootPhase"=dword:1;NLS required[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\TRUEFFS_DOC\FATFS] “MountAsBootable"=dword:1 ;FATFS is mounted as bootable “MountAsBootable"=dword:1 ;FATFS is mounted as bootable "MountAsRoot"=dword:1 ;FATFS contains the system hive "MountAsRoot"=dword:1 ;FATFS contains the system hive

26 Debug Example

27 Power Management Considerations Use SetSystemPowerState() allow power manager to properly flush file system on suspend/resume cycles Implement Graceful Shutdowns Software enabled cold and warm boots IClass {8DD679CE-8AB4-43c8-A14A-EA4963FAA715} indicates Power Managed Block Device Provide methods to protect against file system corruption TFAT Other software methods Hardware methods System recovery tools (ScanVolume())

28 Performance Considerations Performance will be slower than RAM based Object Store Consider the System Data Use NOR Flash Memory Fast Read Slower Write than NAND NAND Flash Memory Slower Read than Nor Faster Write than Nor RamDrive can be used to boost application performance Implement Proper File System Caching HKLM\SYSTEM\StorageManager\FATFS “EnableCache” = dword:1 “CacheSize” = dword:? FATFS_VERIFY_WRITES Flag ? FATSF_WRITETHROUGH Flag ? Implement Proper System Data Caching Tune File System Drivers for Performance

29 Application Considerations Rogue Applications can prevent boot Implement Clean/Safe Boot Format Media IOCTL_HAL_QUERY_FORMAT_PARTITON Restore Default (ROM) Hive IOCTL_HAL_GET_HIVE_CLEAN_FLAG Old Registry is deleted New Registry is created Reverts system to Factory Defaults Provide tools for diagnosis of failure Read Media from Bootstrap Diagnose Registry Diagnose File System

30 Application Considerations Registry Save and Restore functions exist RegSaveKey(HKEY_LOCAL_MACHINE,…)RegReplaceKey(HKEY_LOCAL_MACHINE,…)RegSaveKey(HKEY_CURRENT_USER,…)SetCurrentUser(NULL,…)CopyFile(CurrentUser,….) Use Persisted Keys for determining when to backup registry [HKEY_LOCAL_MACHINE]"RegPersisted"=dword:1[HKEY_CURRENT_USER]“RegPersisted”=dword:1

31 Questions?

32 While at MEDC 2005… Fill out an evaluation for this session Randomly selected instant WIN prizes! Randomly selected instant WIN prizes! Use real technology in a lab Instructor led Reef E/F & Breakers L Self-paced Reef B/C Self-paced Reef B/C Visit the Microsoft Product Pavilion in the Exhibit Hall Shorelines B in the Exhibit Hall Shorelines B

33 After The Conference… Develop Build InstallBuildJoin Install Enter Enter Join Full-featured trial versions of Windows CE and/or Windows XP Embedded Cool stuff & tell us about it: msdn.microsoft.com/embedded/community msdn.microsoft.com/embedded/community Windows Embedded Partner Program: www.mswep.com www.mswep.com Windows Mobile 5.0 Eval Kit including Visual Studio 2005 Beta 2 Mobile2Market Contest and win up to $25000: mobile2marketcontest.com mobile2marketcontest.com Microsoft Solutions Partner Program: partner.microsoft.com partner.microsoft.com

34 Tools & Resources msdn.microsoft.com/ embedded microsoft.public. windowsxp.embedded windowsce.platbuilder windowsce.platbuilder windowsce.embedded.vc windowsce.embedded.vc blogs.msdn.com/ mikehall Windows CE 5.0 Eval Kit Windows XP Embedded Eval Kit msdn.microsoft.com/ mobility microsoft.public. pocketpc.developer smartphone.developer dotnet.framework.compactframework blogs.msdn.com/ windowsmobile vsdteam netcfteam Windows Mobile 5.0 Eval Kit Websites Newsgroups Blogs Tools Build Develop

35 © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "EMB315 Non-Volatile Object Store And Hive Based Registry Design For Windows CE Rick Austin Principle Engineer Intermec Corporation."

Similar presentations


Ads by Google