硬盘号:[System.Runtime.InteropServices.DllImport("kernel32.dll" , EntryPoint="GetVolumeInformationA")]
private extern static int GetVolumeInformation( string lpRootPathName , string lpVolumeNameBuffer , int nVolumeNameSize , ref int lpVolumeSerialNumber ,int lpMaximumComponentLength , int lpFileSystemFlags ,string lpFileSystemNameBuffer , int nFileSystemNameSize );

public static string GetDriveVolumeSerialNumber(string Drive)
{
int VolumeSerialNumber = 0;

GetVolumeInformation(Drive + ":\\", "", 255, ref VolumeSerialNumber, 0, 0, "", 255);     

return VolumeSerialNumber.ToString( "X" ).Insert( 4 , "-" );
}

解决方案 »

  1.   

    http://www.csdn.net/cnshare/soft/4/4806.shtm
      

  2.   

    行动很快嘛.
    谢谢两位,非常感谢.下面是技术讨论:To:lkal4587(舟遥遥风飘飘)
    你不觉的GetVolumeInformationA得出来得东西,每次硬盘格式化就变了吗?To: yarshray(saga jion),你得那个东西正是我要的,那个软件带了一个dll,并且他的功能比我相信的还多.但是,要注册啊,到不是100RMB很贵,主要是我想看看code,知道一下原理.能给我讲讲嘛?其他的大侠们也帮帮忙了,有了答案都沾光啊.再次感谢.
      

  3.   

    直说吧,大家也省省时间. 就要code或者是可行的思路.现成的东西,不太放心.
      

  4.   

    看看这篇,是利用API DeviceIoControl来实现的.可惜是C++的,好在有代码.http://www.5xsoft.com/data/200106/0121573701.htm
      

  5.   

    还有一篇,不过看起来这两片好相似啊,但是这篇有关演示软件,我试验过了,好用.http://www.winsim.com/diskid32/diskid32.html
      

  6.   

    TheAres(班门斧):
    vxd,nt结构不能用吧?SharpPlusPlus (C#佳佳):
    你发信到[email protected]吧 :)
      

  7.   

    To: TheAres(班门斧) 哈,版主也来了,谢谢.我下载了那个软件,的确管用,我是2k的机器.
    To: CForce() 
    演示代码管用,我的email是: [email protected]. 请查收你的email,如果有代码,就太感谢了.本打算结贴,但是代码是c++,我还要化些力气去改.分给你们记在账上了.改完了就来给你们加分.改不好,还要麻烦几位啊.谢谢了.
      

  8.   

    To CForce() :
    >vxd,nt结构不能用吧?
    对头,但是在Nt下不是vxd. How does DiskId32 work ? Windows 95 / 98 / ME: Uses a VXD for talking directly to the IDE hard drives 
    Windows NT / 2000 / XP (administrator rights): Uses PhysicalDrive interface 
    Windows NT / 2000 / XP (user rights only): Uses the SCSI back door to access the IDE hard drives To:SharpPlusPlus(C#佳佳)
    改好了能不能把代码贴上来?
      

  9.   

    没有改出来,惭愧.
    主要是那么多的struct在传递的时候不知道改如何传.
    还是那位行行好,来那我的400分吧.
    我先另开一个帖子,以表示我的诚意.To:  CForce() 
    给那发邮件了,请回答.
      

  10.   

    老兄啊,省点吧,不要改了
    Source code for ide21201.vxd (built using Windows 2K/ME DDK ) ide21201.asm 
    ide21201.def 
    makevxd.bat 
    用C#能行吗???/CRL的汇编能和Win32的汇编一样吗????
      

  11.   

    难道用C#调用DDK???SharpPlusPlus(C#佳佳),收邮件吧!