简体   繁体   English

编辑FAT驱动器的原始数据

[英]Editing raw data of a FAT drive

I am trying to edit the raw data of a FAT drive (I think I found a solution for NTFS, but didn't work for FAT. I don't have anything with FAT, just all my devices are using it) with C# (the result should be a drive in a different format - my own format). 我正在尝试使用C#编辑FAT驱动器的原始数据(我想我找到了适用于NTFS的解决方案,但不适用于FAT。我对FAT没有任何帮助,只是我的所有设备都在使用它)结果应该是采用其他格式的驱动器-我自己的格式)。 I was able to read the raw data (was nice seeing the FAT from inside) from it using CreateFile and opening a stream using the IntPtr I got, but couldn't write to it. 我能够使用CreateFile从中读取原始数据(很高兴从内部看到FAT),并使用获得的IntPtr打开流,但是无法写入。 I tried several computers, USB flash drives, SD cards, floppy disks - nothing. 我尝试了几台计算机,USB闪存驱动器,SD卡,软盘-什么都没有。 If it isn't possible with C#, I can do it with another language and later call the function using DLLImport. 如果C#无法实现,则可以使用另一种语言来实现,然后再使用DLLImport调用该函数。 Thanks. 谢谢。

If you edit/modify the drive on the sector level it could be no longer be fully compatible. 如果在扇区级别编辑/修改驱动器,则可能不再完全兼容。

The standard way is to make a big file to fill al the space and then operate on those sectors. 标准方法是制作一个大文件来填充所有空间,然后在这些扇区上进行操作。

Since your goal is space FAT is actually not efficient. 由于您的目标是空间,FAT实际上效率不高。 If you control both ends ( read/write) you can just cange sector 0 so that is is not recogninzed as an existing file system and then you can wirte your own sectors. 如果您控制两端(读/写),则可以取消扇区0,这样就不会将其识别为现有文件系统,然后可以编写自己的扇区。 Windows would nag you at insertion that the drive is not formatted. Windows会在插入时提醒您未格式化驱动器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM