wince 快速挂载SD卡及U盘
作者:Apollo5520
轉自:http://blog.chinaunix.net/uid-8087110-id-1989039.html
| [HKEY_LOCAL_MACHINE\System\StorageManager\FATFS] "MountFlags"=dword:0 ; "Flags"=dword:14 ; |
具體的控制是Flags項,這個分支定義的是整個FATFS的參數,如果想進行分類進行不同的定義,則需要修改相關注冊表分支,例如,想定義flash自動掃描則添加定義如下
| [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\FlashDrv\FATFS] "MountFlags"=dword:2 "Flags"=dword:10 ;在Profiles\FlashDrv添加FATFS分支定義falsh上FATFS文件系統的相關參數,其他的sd卡,U盤等也可分別進行定義 |
以上兩個分支可同時存在,進行詳細的的定義。
關于FATFS相關參賽的定義如下:(http://msdn.microsoft.com/en-us/library/ms885403.aspx)
Platform Builder for Microsoft Windows CE 5.0 FAT File System Registry SettingsThe file allocation table (FAT) file system retrieves driver specific settings from the registry.
The following table shows the registry settings for the FAT file system stored inHKEY_LOCAL_MACHINE\System\StorageManager\FATFS.
| BufferSize: REG_DWORD | Specifies the number of sector-sized buffers to use for streams. The default value is 64 for TFAT and 32 for FAT. |
| CacheSize: REG_DWORD | Indicates the size of the disk cache, in number of sectors. This value must be a power of 2 and at least 16 sectors. If set to zero, FATFS will determine the best cache size to use. For more information, see CacheSize registry subkey. |
| CodePage: REG_DWORD | Overrides CP_OEMCP in all character conversions. |
| Dll: REG_SZ | Specifies the name of the file system DLL. |
| EnableCache: REG_DWORD | Controls caching.
|
| EnableCacheWarm: REG_DWORD | Enables pre-warming of the cache. |
| Flags: REG_DWORD | Indicates FAT file system registry flags. For more information, see Flags registry subkey. |
| FormatTfat: REG_DWORD | Formats the volume as TFAT on auto-format or through IOCTL_DISK_FORMAT_VOLUME. |
| FriendlyName: REG_SZ | Specifies a friendly name for the file system. |
| MountLabel: REG_DWORD | Pulls the volume label and uses it as a mount point. |
| Paging: REG_DWORD | Controls paging.
|
| Util: REG_SZ | Specifies the DLL name of utility to do format and scan. |
Flags registry subkey
The following table shows the available values you can set for the Flags registry subkey; set Flags to a combination of these values.
| FATFS_UPDATE_ACCESS | 0x00000001 | Updates access times. |
| FATFS_DISABLE_LOG | 0x00000002 | Disables event logging. |
| FATFS_DISABLE_AUTOSCAN | 0x00000004 | Disables automatic calls to ScanVolume. |
| FATFS_VERIFY_WRITES | 0x00000008 | Verifies all writes. |
| FATFS_ENABLE_BACKUP_FAT | 0x00000010 | Adds a backup FAT to all formats. |
| FATFS_FORCE_WRITETHROUGH | 0x00000020 | Sets all files to WRITE_THROUGH, regardless of the parameters to CreateFile. |
| FATFS_DISABLE_AUTOFORMAT | 0x00000040 | Disables automatic formatting of unformatted volumes. |
| FATFS_WFWS_NOWRITETHRU | 0x00010000 | Disables write through on the WriteFileWithSeek function. Improves memory-mapped file performance. |
| FATFS_DISABLE_FORMAT | 0x00020000 | Disables format. |
| FATFS_TRANS_DATA | 0x00040000 | Transacts data on a write operation. |
| FATFS_TFAT_USECLUS1 | 0x00080000 | Uses the cluster 1 entry in the FAT table for a TFAT transaction. TFAT uses the NOF field of the boot sector by default. |
| FATFS_DISABLE_TFAT_REDIR | 0x00100000 | Disables the redirect of the root directory to another hidden directory for FAT12 or 16. |
| FATFS_TFAT_ALWAYS | 0x00200000 | Marks transaction status, even if only one sector in FAT is changed. |
| FATFS_FORCE_TFAT | 0x00400000 | Forces TFAT transactions even if the volume is not formatted as TFAT. |
CacheSize registry subkey
The CacheSize registry subkey is a hexadecimal number of sectors to cache. This has to be a power of two. The following table shows valid numbers for theCacheSize registry subkey.
| 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 |
Example
The following registry key example shows the location of the Flags andCacheSize registry subkey values.
Copy Code [HKEY_LOCAL_MACHINE\System\StorageManager\FATFS]"Flags": dword:00000024"CacheSize" = dword:400If CacheSize is set to zero, the cache size will be set automatically.
?
http://www.vckbase.com/document/viewdoc/?id=1267
對”Flags”值的描述如下(C:\WINCE500\PRIVATE\WINCEOS\COREOS\FSD\FATFS\fatfs.h):
| 標志 | 值 | 描述 |
| FATFS_UPDATE_ACCESS | 0x00000001 | 更新訪問時間 |
| FATFS_DISABLE_AUTOSCAN | 0x00000004 | 不能自動調用ScanVolume |
| FATFS_VERIFY_WRITES | 0x00000008 | 檢驗所有寫操作 |
| FATFS_ENABLE_BACKUP_FAT | 0x00000010 | 備份FAT表 |
| FATFS_FORCE_WRITETHROUGH | 0x00000020 | 讓系統可以直接將任何緩沖區中的數據寫到磁盤上,這樣系統將加快寫數據到磁盤的速度 |
| FATFS_DISABLE_AUTOFORMAT | 0x00000040 | 禁止自動格式化未格式化的分區 |
| FATFS_DISABLE_COMPCHECK | 0x00000080 | 禁止自動檢測壓縮分區 |
上面把FLAGS定義為 14,也就是備份FAT表、不自動掃描卷標。這樣8G的SD卡,3秒就可以出現盤符了。
| ? 原創文章,轉載請注明:轉載自 風雨無阻博客(http://Apollo5520.cublog.cn) 本文鏈接地址:http://blog.chinaunix.net/u3/105764/showart_2114352.html ? |
總結
以上是生活随笔為你收集整理的wince 快速挂载SD卡及U盘的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 平衡小车—编码器使用教程与测速原理
- 下一篇: magics24安装教程|magics中