using System;
using System.ComponentModel;
using System.Collections;
using System.Diagnostics;
using System.Security.Cryptography;
using System.Management;
using System.Runtime.InteropServices;namespace DE.WebUI
{
/// <summary>
/// Component1 的摘要说明。
/// </summary>
public class Component1 : System.ComponentModel.Component
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Component1(System.ComponentModel.IContainer container)
{
///
/// Windows.Forms 类撰写设计器支持所必需的
///
container.Add(this);
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} [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
); public static string GetVolOf(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("x");
} public Component1()
{
///
/// Windows.Forms 类撰写设计器支持所必需的
///
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary> 
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}