在获得有关retrieving .MBR from a storage device的大量信息后,结论是使用P / Invoke来调用CreateFile
。
但是如何在C#中完成这项工作?请说明!非常感谢您的帮助!!!
答案 0 :(得分:19)
[DllImport("kernel32.dll", CharSet = CharSet.Auto,
CallingConvention = CallingConvention.StdCall,
SetLastError = true)]
public static extern SafeFileHandle CreateFile(
string lpFileName,
uint dwDesiredAccess,
uint dwShareMode,
IntPtr SecurityAttributes,
uint dwCreationDisposition,
uint dwFlagsAndAttributes,
IntPtr hTemplateFile
);