使用 .NET 进行 USB 驱动器编程 [英] USB drive programming with .NET

查看:37
本文介绍了使用 .NET 进行 USB 驱动器编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目,我需要访问 USB 驱动器的某些特定地址(例如扇区 0),并更改一些字节.我已经用 C# 完成了一些部分,包括用户界面、USB 驱动器检测等.谁能帮我提供一些链接,以便我可以使用 .NET 访问 USB 驱动器的特定地址?

I am working on a project where I need to access some specific addresses of a USB drive (e.g. sector 0), and change some bytes. I have done some parts with C# already that includes user interface, detection of USB drives etc. Can anybody help me providing some links so that I can access specific addresses of USB drives with .NET?

推荐答案

框架不支持这个.如果您尝试在设备上创建 FileStream,它将引发异常.您将不得不直接使用 Windows API 方法(p/invoke CreateFile、DeviceIoControl 等).请务必在此处阅读有关物理磁盘和卷的部分:http://msdn.microsoft.com/en-us/library/aa363858.aspx

The Framework doesn't support this. If you attempt to create a FileStream on a device it will throw an exception. You will have to use the Windows API methods directly (p/invoke CreateFile, DeviceIoControl, etc). Make sure you read the section on Physical Disks and Volumes here: http://msdn.microsoft.com/en-us/library/aa363858.aspx

这篇关于使用 .NET 进行 USB 驱动器编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆