WinCE下如何獲取SD卡容量

2021-05-05 17:42:47 字數 939 閱讀 1884

參考下面**

void getstorageinfo()

cstring tmp;

tmp.format(l"di_bytes_per_sect=%d di_total_sectors =%d total captal=%d/r/n",inbuf.di_bytes_per_sect,inbuf.di_total_sectors,di_total_sectors*di_bytes_per_sect );

::messagebox ( null, tmp, l"error", 0);

closehandle(h_nfd);        

}======================================

補充:#include "winioctl.h"

#include "diskio.h"

m_devinfo裡面就會有sector總數和sector大小,進而算出總容量,這個是基於檔案系統層的獲得容量,並非實際物理容量

其中的dsk1:需要被替換成你的sd儲存裝置被載入的號碼,一般為dsk2:

也可以通過列舉hkey_local_machine/drivers/active下的鍵值,來獲得sd的dsk號碼,比如

[hkey_local_machine/drivers/active/49]

"hnd"=dword:005adc00

"name"="dsk2:"

"key"="/drivers//sdcard//clientdrivers//class//sdmemory_class"

"busparent"=dword:0059a2a0

"inte***cetype"=dword:00000000

"busname"="sdcard_0_0_0"

"clientinfo"=dword:005a5080

這裡的dsk2:就是你要傳遞的引數了

wince下SD卡驅動開發

如圖所示 最下面的是你的h w部分,其中sd host controller是你的sd硬體控制器部分,你寫驅動需要這部分的spec。接著上面的sd host controller driver就是你需要實現的部分了,直接和你的控制器打交道。而bus層則是位於host和client之間的一層,主要用來...

wince裝置上獲取sd卡的id號

最近工作上的乙個小需求,獲得sd卡上的需求號 typedef struct storage identification storage identification,pstorage identification pstorage identification pstoreinfo unsigne...

2440從sd卡啟動wince

有關sd卡驅動和fat fs的實現用了3個檔案來實現。sdboot.c為sd的驅動 可理解為pdd 層,主要實現一些對sd控制器的配置以及一些基本sd命令的實現和對sd卡的操作。sdmmc.c實現了從sd卡讀取nk並跳到記憶體去執行的 基本可以理解為sd驅動的mdd層 sdfat.c檔案就是實現fa...