|
我自己制作的一個(gè)注冊(cè)軟件,希望能給大家?guī)?lái)幫助 Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long ''此模塊的作用是檢測(cè)用程序所在機(jī)器C盤(pán)序列號(hào)并存入一個(gè)加密后的文本文件yibao.ini中, ''在每次運(yùn)行時(shí)檢測(cè)C盤(pán)序列號(hào)并與加密文本文件中的相應(yīng)值進(jìn)行比較如果不符提示用戶進(jìn)行注冊(cè) Public Reg_C As String Public Reg_Key As Long Public Jia_Mi_File As String Public Jia_Mi_Char As String Public Fso As New FileSystemObject Public Ctf As TextStream Public Function Jia_Mi_Txt() Reg_C = Abs(GetSerialNumber("c:\")) If Dir(App.Path & "\yibao.ini") = "" Then ''建立一個(gè)文本文件 Open App.Path & "\yibao.ini" For Output As #1 Print #1, "00000000" Close #1 End If Jia_Mi_File = App.Path & "\yibao.ini" Set Fso = CreateObject("Scripting.FileSystemObject") Set Ctf = Fso.OpenTextFile(Jia_Mi_File, 1) ''建立 TextStream 對(duì)象 CTF Jia_Mi_Char = "" Do While Ctf.AtEndOfStream <> True Jia_Mi_Char = Jia_Mi_Char & Chr(58 Xor Asc(Ctf.Read(1))) Loop Ctf.Close Set Ctf = Nothing If Jia_Mi_Char <> Int(Reg_C * 18 / 22 * 16 / 19) Then ''顯示注冊(cè)對(duì)話框 Dialog.Show 1 End If End Function ''Text2.Text = Len(Reg_C) Function GetSerialNumber(sroot As String) As Long Dim lserialnum As Long Dim r As Long Dim strlabel As String, strtype As String strlabel = String$(255, Chr$(0)) strtype = String$(255, Chr$(0)) r = GetVolumeInformation(sroot, strlabel, Len(strlabel), lserialnum, 0, 0, strtype, Len(strtype)) GetSerialNumber = lserialnum ''在 strLabel 中為磁盤(pán)卷標(biāo) ''在 strType 中為文件系統(tǒng)類型 End Function ''此部分為程序加密處理模塊,負(fù)責(zé)將C盤(pán)的卷標(biāo)讀并轉(zhuǎn)換成數(shù)字 ''對(duì)這串?dāng)?shù)字與58進(jìn)行異或處理,得到一個(gè)加密的字符串寫(xiě)入yibao.ini中 ''在每次運(yùn)行時(shí)與文檔中的加密后字符串進(jìn)行反解密比較,不成功提示用戶進(jìn)行注冊(cè) |
|
|