賽迪網 >> 技術應用子站 >> 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