国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

C#應用:讀取指定盤符的硬盤序列號

2024-07-21 02:28:52
字體:
來源:轉載
供稿:網友

using system;
using system.io;
using system.runtime.interopservices;
using system.text;
using microsoft.win32;

namespace wjb.readorwriteiniandreg
{
/**////
/// 讀取指定盤符的硬盤序列號
///
public class harddiskval
{
[dllimport("kernel32.dll")]
private static extern int getvolumeinformation(
string lprootpathname,
string lpvolumenamebuffer,
int nvolumenamesize,
ref int lpvolumeserialnumber,
int lpmaximumcomponentlength,
int lpfilesystemflags,
string lpfilesystemnamebuffer,
int nfilesystemnamesize
);
/**////
/// 獲得盤符為drvid的硬盤序列號,缺省為c
///
///
///
public string hdval(string drvid)
{
const int max_filename_len = 256;
int retval = 0;
int a =0;
int b =0;
string str1 = null;
string str2 = null;

int i = getvolumeinformation(
drvid + @":/",
str1,
max_filename_len,
ref retval,
a,
b,
str2,
max_filename_len
);

return retval.tostring();
}
public string hdval()
{
const int max_filename_len = 256;
int retval = 0;
int a =0;
int b =0;
string str1 = null;
string str2 = null;

int i = getvolumeinformation(
"c://",
str1,
max_filename_len,
ref retval,
a,
b,
str2,
max_filename_len
);

return retval.tostring();
}
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 连山| 诸暨市| 会泽县| 石棉县| 涪陵区| 江门市| 瓦房店市| 文成县| 乌兰县| 抚松县| 冕宁县| 沾益县| 会理县| 阳西县| 彭山县| 南澳县| 衡南县| 金山区| 昌平区| 昌乐县| 宁化县| 巩义市| 伊通| 安图县| 昭通市| 奈曼旗| 三门县| 陆河县| 柳林县| 鄂托克前旗| 青海省| 西安市| 昆明市| 泰州市| 北宁市| 桂平市| 宜君县| 彝良县| 拉萨市| 台山市| 萍乡市|