WinCE下SD卡格式化代码
来源:互联网 发布:淘宝app软件流程图 编辑:程序博客网 时间:2024/05/01 17:49
注意:需要用到微软的API库"Storeapi.lib"和“storemgr.lib”。
#include "stdafx.h"#include <windows.h>#include <commctrl.h>#include <Storemgr.h>#include <formatdisk.h>#include <fatutil.h>#include <Bootpart.h>//#include <diskio.h>//#include <pcireg.h>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;}
0 0
- WinCE下SD卡格式化代码
- WinCE下SD卡格式化代码
- WinCE下SD卡格式化代码
- WinCE下SD卡格式化代码
- wince 下读取SD卡ID代码
- WINCE下检测SD卡
- linux 下格式化 SD卡
- Ubuntu下格式化SD卡
- linux 下格式化 SD卡
- ubuntu下格式化sd卡
- ubuntu下格式化sd卡
- linux下格式化SD卡
- linux 下格式化SD卡
- WinCE 下的SD 卡结构
- WinCE下如何获取SD卡容量
- WinCE下SD卡驱动开发
- Wince下读取SD卡ID
- WinCE下SD卡驱动开发
- Scala学习笔记之面向对象
- 解决arraycollection赋值修改过程中,出现TypeError: Error #1009: Cannot access a property or method of a null obje
- 素数求和问题
- eclipse下将java工程变成web工程
- 嵌入式 Centos开机自动挂载windows中的ntfs磁盘
- WinCE下SD卡格式化代码
- 关于Python Profilers性能分析器
- Redis命令及对应jedis操作(String)
- js响应刷新页面或者关闭页面事件
- ThinkPHP将session保存在数据库中的方法
- 嵌入式 一年成为Emacs高手(像神一样使用编辑器)
- 关于现下WireLurker的手机MacBook检测方法总结
- 85后屌丝:213万拍下史玉柱3小时,两年混进马云朋友圈
- 自定义数字键盘