(献上所有积分)C#如何获得硬盘操作系统部分的扇区位置

来源:百度知道 编辑:UC知道 时间:2024/07/12 14:05:54
请教高手,如何用C#实现获取硬盘操作系统(OS)所占的扇区位置,包括操作系统的起始扇区和结束扇区,以及扇区总数,当然这三者是可以计算的。
我用VC写过一个,用到DeviceIOControl和CreateFile,但是换成C#我不会,请大家帮忙写这段代码,最好不要先用C++写好再调DLL,最好直接用C#调用DeviceIOControl和CreateFile。
先谢过,我总共二十分,如果程序调试通过,我将献上所有积分!
楼下的楼下,你说的代码不是获取操作系统的代码啊,里面虽然涉及了DeviceIOControl和CreateFile的用法,但区别还是很大的啊!

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace DeviceIOControl
{
class Program
{
static void Main(string[] args)
{
//call print SIGNAL STRENGTH list
//
//
//{A5128180-8811-451C-BBBD-2BE2F69F65C9} denotes guid for my PCI wireless card.
//You can check guid for ur card in the system registry.
//HkEY_LOCAL_MACHINE\SYSTEM\CUrrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}
//
//{4D36E972-E325-11CE-BFC1-08002bE10318} specifies guid for 'Net' class.
//Under this key, all adapter guids are stored. You can explore the sub-nodes and specify a
//valid guid for your card
//
//OR
//HKEY_LOCAL_MACHINE\SOFTWARE\MIcrosoft\Windows Nt\CurrentVersion\NetworkCards
//
//
NDIS.MiniportDriver miniportDriver = new NDIS.MiniportDriver();
m