[讨论] wince 的fatutil.dll 有什么用?

Wince.Android   2013-12-17 17:08 楼主
fatutil.dll 这个看有些人实现多fat 分区会用到这个dll ,在SLC nandflash 上,我现在要做这个功能,但是行不通,这个fatutil.dll 什么用的?
如果对linux,Android,wince 等嵌入式底层有兴趣的,请加这个QQ群吧,群号:27100460

回复评论 (4)

似乎是格式化分区的

WinCE下SD卡格式化代码
如下代码经本人改写并验证成功。
注意:需要用到微软的API库"Storeapi.lib"和“storemgr.lib”。

#include "stdafx.h"
#include
#include
#include
#include
#include
#include
//#include
//#include

int wmain()
{
    STOREINFO StoreInfo = {0};
    PARTINFO PartInfo = {0};
    HANDLE hFirstStore,hStore,hPart;
    HINSTANCE hFatUtil = NULL;
    BOOL hDismount = FALSE;//, CPart,hPartition,
    BOOL hMount = FALSE;

    FORMAT_PARAMS fp = {0};
    FORMAT_OPTIONS pfo = {0};
    DWORD dwClusSize = 0;
    DWORD dwFatVersion = 16;

    typedef DWORD ( *PFN_MY_FORMATVOLUME)
        (HANDLE hVolume,PDISK_INFO pdi, PFORMAT_OPTIONS pfo, PFN_PROGRESS pfnProgress,PFN_MESSAGE pfnMessage);

    StoreInfo.cbSize = sizeof(StoreInfo);
    hFirstStore = FindFirstStore( &StoreInfo );

    if(!(hFirstStore ))
    {
        RETAILMSG(1, (TEXT("Error FindFirstStore\r\n")));

    }

    FindNextStore(hFirstStore,&StoreInfo);
    FindNextStore(hFirstStore,&StoreInfo);
    FindNextStore(hFirstStore,&StoreInfo);

    hFatUtil = LoadLibrary(L"fatutil.dll");

    PFN_MY_FORMATVOLUME pfnFormatVolume = NULL ;

    pfnFormatVolume = (PFN_MY_FORMATVOLUME)GetProcAddress(hFatUtil, TEXT( "FormatVolume"));
    if (!pfnFormatVolume )
    {
        RETAILMSG(1, (TEXT("Error pfnFormatVolumeEx\r\n")));
    }

    hStore = OpenStore(StoreInfo.szDeviceName);
    hPart = OpenPartition(hStore,L"Part00");

    hDismount = DismountPartition(hPart);
    if(!hDismount)
    {
        RETAILMSG(1, (TEXT("Error DismountStore\r\n")));
    }

    if(ERROR_SUCCESS != pfnFormatVolume(hPart, NULL, NULL, NULL, NULL))
    {
        RETAILMSG(1, (TEXT("Error pfnFormatVolumeEx\r\n")));
    }

    PartInfo.cbSize = (DWORD)StoreInfo.snBiggestPartCreatable;
    //PartInfo.szPartitionName = L"Part00";

    hDismount = CreatePartition(hStore, L"Part00", PartInfo.cbSize);
    if(!hDismount)
    {
        RETAILMSG(1, (TEXT("Error CreatePartitionEx\r\n")));
    }

    hMount = MountPartition(hPart);
    if(!( hMount ))
    {
        RETAILMSG(1, (TEXT("Error OpenStore\r\n")));
    }

return 0;
}

本文参考自http://bbs.driverdevelop.com/htm_data/48/0711/107241.html
如果对linux,Android,wince 等嵌入式底层有兴趣的,请加这个QQ群吧,群号:27100460
点赞  2013-12-17 17:10
[HKEY_LOCAL_MACHINE\System\StorageManager\FATFS]
    "FriendlyName"="FAT FileSystem"
    "Dll"="exfat.dll"
    "DisableAutoFormat"=dword:1
    "DisableAutoScan"=dword:1
    "Paging"=dword:1
    "EnableCache"=dword:1
    "CacheSize"=dword:0
    "Util"="fatutil.dll"
    "CacheDll"="diskcache.dll"

; @CESYSGEN IF CE_MODULES_CACHEFILT
[HKEY_LOCAL_MACHINE\System\StorageManager\FATFS\Filters\CacheFilt]
    "Dll"="cachefilt.dll"
    "LockIOBuffers"=dword:1
; @CESYSGEN ENDIF CE_MODULES_CACHEFILT

[HKEY_LOCAL_MACHINE\System\StorageManager\EXFAT]
    "FriendlyName"="exFAT FileSystem"
    "Dll"="exfat.dll"
    "DisableAutoFormat"=dword:1
    "DisableAutoScan"=dword:1
    "Paging"=dword:1
    "EnableCache"=dword:1
    "CacheSize"=dword:0
    "Util"="fatutil.dll"
    "CacheDll"="diskcache.dll"
    "FormatExfat"=dword:1

wince common.reg 里面 有这个使用方法,看来对我有用,下班先了。明天再来尝试一下。
如果对linux,Android,wince 等嵌入式底层有兴趣的,请加这个QQ群吧,群号:27100460
点赞  2013-12-17 17:17
如果对linux,Android,wince 等嵌入式底层有兴趣的,请加这个QQ群吧,群号:27100460
点赞  2013-12-17 17:22
; @CESYSGEN IF CE_MODULES_FATUTIL
   fatutil.dll     $(_FLATRELEASEDIR)\fatutil.dll              NK  SHQ
; @CESYSGEN ENDIF
确认这个是否打包进去了。
如果对linux,Android,wince 等嵌入式底层有兴趣的,请加这个QQ群吧,群号:27100460
点赞  2013-12-19 15:27
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复