using System;
using System
using System
using System
using Microsoft
namespace Wjb
{
/**////
/// 讀取指定盤符的硬盤序列號
///
public class HardDiskVal
{
[DllImport(
private static extern int GetVolumeInformation(
string lpRootPathName
string lpVolumeNameBuffer
int nVolumeNameSize
ref int lpVolumeSerialNumber
int lpMaximumComponentLength
int lpFileSystemFlags
string lpFileSystemNameBuffer
int nFileSystemNameSize
);
/**////
/// 獲得盤符為drvID的硬盤序列號
///
///
///
public string HDVal(string drvID)
{
const int MAX_FILENAME_LEN =
int retVal =
int a =
int b =
string str
string str
int i = GetVolumeInformation(
drvID + @
str
MAX_FILENAME_LEN
ref retVal
a
b
str
MAX_FILENAME_LEN
);
return retVal
}
public string HDVal()
{
const int MAX_FILENAME_LEN =
int retVal =
int a =
int b =
string str
string str
int i = GetVolumeInformation(
str
MAX_FILENAME_LEN
ref retVal
a
b
str
MAX_FILENAME_LEN
);
return retVal
}
}
From:http://tw.wingwit.com/Article/program/net/201311/13904.html