关于格式化Wince 使用 FormatPartition FormatStore 为什么失败?

Tomaslee 2011-11-09 03:17:52
请教下 到底有什么差异?


// 2 FormatStore 删掉分区表,甚至是MBR也给删掉
// 3 FormatPartition 删除分区表
// 4 FormatVolume 删除某个分区


一些英文的资料也基本查到
1 OpenStore DismountStore FormatStore 失败
2 OpenPartition DismountPartition FormatPartition 失败
3 OpenPartition DismountPartition FormatVolume 成功

关于FormatVolume FormatPartition 源代码目录
D:\WINCE500\PRIVATE\WINCEOS\COREOS\STORAGE\DOSPART\part.cpp
helper.cpp

为什么 1 跟 2 失败 3能成功?


hStore = OpenStore(szStoreName);

#if 1// Formate store
DismountStore(hStore);

if(FormatStore(hStore)==TRUE)
{
RETAILMSG(1,(TEXT("FormatStore OK\r\n")));
Sleep(10);
}
else
{
wsprintf(szChar,TEXT("FormatStore is Failed. Error code is %d.\r\n"), GetLastError());
RETAILMSG(1,(TEXT("FormatStore Fail %d,\r\n"), GetLastError() ));
}
#endif

#if 1//Formate Partition
HANDLE hPartition = OpenPartition(hStore,szPartName);

DismountPartition(hPartition);

if(FormatPartition(hPartition)==TRUE)
{ RETAILMSG(1,(TEXT("FormatPartition OK\r\n")));
Sleep(10);
}
else
{
wsprintf(szChar,TEXT("FormatPartition is Failed. Error code is %d.\r\n"), GetLastError());
RETAILMSG(1,(TEXT("FormatPartition Fail %d\r\n"), GetLastError() ));
}
#endif



实际调试下来

FormatStore 失败
FormatPartition 失败

GetLastError()得到返回为 31


31 A device attached to the system is not functioning. ERROR_GEN_FAILURE









http://social.msdn.microsoft.com/Forums/en-US/winembplatdev/thread/015d61b3-6563-43b7-8770-4bed9e3c5244
...全文
110 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Tomaslee 2011-11-11
  • 打赏
  • 举报
回复
一些英文的资料也基本查到
1 OpenStore DismountStore FormatStore 失败
2 OpenPartition DismountPartition FormatPartition 失败
3 OpenPartition DismountPartition FormatVolume 成功

关于FormatVolume FormatPartition 源代码目录
D:\WINCE500\PRIVATE\WINCEOS\COREOS\STORAGE\DOSPART\part.cpp
helper.cpp

为什么 1 跟 2 失败 3能成功?
Tomaslee 2011-11-10
  • 打赏
  • 举报
回复
MSDN上也就如此说明啊

The following steps show the process for partitioning a storage volume:

Open the storage volume using OpenStore.
Dismount all file systems on the store, using DismountStore.
Format the store, using FormatStore.
Create the desired number of partitions on the store, using CreatePartition.
Tomaslee 2011-11-10
  • 打赏
  • 举报
回复
请教下格式化的顺序.
1 hStore = OpenStore(StoreName);
2 hPartition = OpenPartition( hStore, PartitionName );
3 DismountPartition(hPartition)

第4步 
    如果
    FormatPartition(hPartition)
    FormatStore(hStore)
    则返回失败

FormatVolume(hPartition, &diskinfo, &fo, NULL, NULL) 
则成功

为什么直接用
FormatPartition(hPartition)
    FormatStore(hStore)
会失败?

19,498

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧