Cluster size in .NET Compact Framework?

This forum post gives some ideas of someone else having this problem.

I haven't tried this myself, but you can try the CeGetVolumeInfo and check the dwBlockSize value. This looks like it could be the cluster size. If that doesn't work then it gets a little more involved.

Storage cards are normally formatted in the FAT format. You need to access the low level routines in CE to read at a disk level and read the FAT BPB it determine what type of FAT and what the cluster size is. Use Storage Manager functions FindFirstStore / FindNextStore to find the storage card you are after.

Then open the storage card using the CreateFile API. HANDLE hDisk(CreateFile(storeInfo. SzDeviceName, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL)); Then you need to read the FAT BPB which is on the first sector for super disks (which would be the normal case for Storage Card formatted devices) or it's in MBR format.

SG_REQ req; DWORD cb; req. Sr_start = 0; req. Sr_num_sec = 1; req.

Sr_num_sg = 1; req. Sr_status = 0; req. Sr_callback = 0; req.

Sr_sglist0. Sb_buf = sectorBuffer; req. Sr_sglist0.

Sb_len = storeInfo. DwBytesPerSector; DeviceIoControl(hDisk, DISK_IOCTL_READ, &req, sizeof(req), 0, 0, &cb, 0); Once you have the BPB you need to determine what fat format it is (FAT12/FAT16/FAT32) and then pull out the cluster size from it. How you do the above in C# is up to you.

I see in the storage manager reference it can go down to the partition level and you can query the partition type. That will tell you the FAT type so you don't need to figure it out.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions