赛迪网 >> 技术应用子站 >> ASP
软件注册码方面的应用和本地化的加密
作者: 来源:cfan 发布时间:2006.07.27
【Java专区】 【网络安全】 【网管专区】 【linux专区】 【数据库专区】 【进入论坛】 【IT博客】 
【Eclipse】  【PHP】  【DB2】  【Ajax】  【Struts】  【Spring】 

using System;


using System.IO;


using System.Runtime.InteropServices;


using System.Text;


using Microsoft.Win32;



namespace Wjb.ReadOrWriteIniAndReg


{


///


/// HardDiskVal 的摘要说明。


/// 读取指定盘符的硬盘序列号


/// 类库开发:吴剑冰


/// 时间:2003年10月20日


/// 功能:读取指定盘符的硬盘序列号


///


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();


}


}




3G:关注3G;阚凯力;宋俊德;曾剑秋
评论】 【推荐】 【 】 【打印】 【关闭
*姓  名: 更多资料 了解方案 认识厂商
*单位名称:
*联系电话:
*电子邮件:
    
◆ 相关文章
· 数据结构与算法(C#实现)系列---N叉树(一) 2005-02-06
· 加密与解密 2003-02-22
· 动态菜单 2004-11-14
· 从MP3中提取歌曲信息 2004-08-20
· net中交易处理的解决方案 2004-11-23