关于格式化Wince 使用 FormatPartition FormatStore 为什么失败?
请教下 到底有什么差异?
// 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