ASP: 如何获取我的硬盘的序列号?--------急!!!
如题.
我用了FSO好象只能得到标识磁盘卷标的十进制序列号
问题点数:50、回复次数:18Top
1 楼xarrow(HELLO WORLD)回复于 2004-12-04 18:55:06 得分 0
UPTop
2 楼sun94510451(中原)回复于 2004-12-04 18:58:34 得分 3
Access:
<%
dim conn
dim connstr
connstr="DBQ="+server.mappath("bus.asp")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>
sql2000:
<%
Dim conn
Dim connstr
connstr="driver={SQL server};server=localhost; uid=sa; pwd=; database=数据库名"
set conn = Server.CreateObject("ADODB.Connection")
conn.open connstr
%>Top
3 楼sun94510451(中原)回复于 2004-12-04 18:59:39 得分 3
不好意思发错了,upTop
4 楼pennyclz(一分钱)回复于 2004-12-04 18:59:40 得分 3
upTop
5 楼itcoo()回复于 2004-12-04 19:58:21 得分 20
Private Declare Function GetVolumeInformation& Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal pVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long)
Private Const MAX_FILENAME_LEN = 256
Private Const GETSERIALPASSWORD = "lxy"
Public Function DriveSerial(ByVal sDrv As String) As Long '得到硬盘的序列号
Dim RetVal As Long
Dim str As String * MAX_FILENAME_LEN
Dim str2 As String * MAX_FILENAME_LEN
Dim a As Long
Dim b As Long
Call GetVolumeInformation(sDrv & ":\", str, MAX_FILENAME_LEN, RetVal, a, b, str2, MAX_FILENAME_LEN)
DriveSerial = RetVal
End Function
Public Function GetApplySerial() As Long '根据c盘的序列号生成一个申请码
GetApplySerial = DriveSerial("c")
If GetApplySerial < 0 Then GetApplySerial = 0 - GetApplySerial
End Function
'根据申请码和密码表及密码得到序列号
Public Function getSerial(ByVal SRC As Long, ByVal PASSWORD As String) As String
Dim SourceString As String
Dim NewSRC As Long
For I = 0 To 30
If (SRC And 2 ^ I) = 2 ^ I Then
SourceString = SourceString + "1"
Else
SourceString = SourceString + "0"
End If
Next I
If SRC < 0 Then
SourceString = SourceString + "1"
Else
SourceString = SourceString + "0"
End If
Dim Table As String
'================================================================================
'参数Table是密码表,根据你的要求换成别的,不过长度要一致
'================================================================================
'注意:这里的密码表变动后,对应的注册号生成器的密码表也要完全一致才能生成正确的注册号
Table = "JSDJFKLUWRUOISDH;KSADJKLWQ;ABCDEFHIHL;KLADSDKJAGFWIHERQOWRLQH"
'================================================================================
Dim TableIndex As Integer
Dim Result As String
Dim MidWord As String
Dim MidWordValue As Byte
Dim ResultValue As Byte
For t = 1 To 1
For I = 1 To Len(SourceString)
MidWord = Mid(SourceString, I, 1)
MidWordValue = Asc(MidWord)
TableIndex = TableIndex + 1
If TableIndex > Len(Table) Then TableIndex = 1
ResultValue = Asc(Mid(Table, TableIndex, 1)) Mod MidWordValue
Result = Result + Hex(ResultValue)
Next I
SourceString = Result
Next t
Dim BitTORool As Integer
For t = 1 To Len(CStr(SRC))
BitTORool = SRC And 2 ^ t
For I = 1 To BitTORool
SourceString = Right(SourceString, 1) _
+ Left(SourceString, Len(SourceString) - 1)
Next I
Next t
If PASSWORD = GETSERIALPASSWORD Then
getSerial = SourceString
Else
getSerial = "你无权获得软件序列号"
End If
End Function
'验证序列号是否正确
Public Function IsSerial(ByVal Serial As String) As Boolean
If Serial = getSerial(GetApplySerial(), GETSERIALPASSWORD) Then
IsSerial = True
Else
IsSerial = False
End If
End Function
Public Function checkSerial()
Dim II As New INI
II.FileName = "D:\bak\JFManage\serial.ini" 'INI文件名
II.AppName = "SERIAL" 'INI小节名称
II.KeyName = "Serial" 'INI项目名
Serial = II.GetINI
If IsSerial(Serial) Then
checkSerial = "通过注册码检查"
Else
checkSerial = "没通过注册码检查,请在serial.ini文件中设置注册码"
II.KeyName = "ApplySerial" 'INI项目名
II.ValueStr = GetApplySerial()
II.WriteINI
End If
Set II = Nothing
End FunctionTop
6 楼xarrow(HELLO WORLD)回复于 2004-12-05 01:09:58 得分 0
TO: itcoo() ( ) 信誉:100
Private Declare Function GetVolumeInformation& Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal pVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long)
我不用VB做成DLL,我想知道单纯用ASP(VBScript/Javascript)能否做到取得硬盘序列号呢?Top
7 楼itcoo()回复于 2004-12-05 01:17:22 得分 3
kernel32.dll是32位动态链接库文件,属于内核级文件。
一般是能直接调用的.
如果单纯用ASP(VBScript/Javascript)是实现不了的.Top
8 楼CnEve(龙哥哥)回复于 2004-12-05 02:04:02 得分 3
我用了FSO好象只能得到标识磁盘卷标的十进制序列号
______________
那你需要什么样的?二进制:Hex()Top
9 楼DARKNESSFALL(DARKNESSFALL)回复于 2004-12-05 09:06:29 得分 3
upTop
10 楼xarrow(HELLO WORLD)回复于 2004-12-05 11:57:12 得分 0
TO: 回复人: CnEve(吟风.Fighting a za a za) ( ) 信誉:100 2004-12-05 02:04:00 得分: 0
我用了FSO好象只能得到标识磁盘卷标的十进制序列号
______________
那你需要什么样的?二进制:Hex()
______________________________________________________________
呵呵,是我没表达清楚,FSO得到的只是磁盘卷标的序列号,而我要的是硬盘的序列号,比如:
我的希捷硬盘的序列号是:STA3080...,是这个
Top
11 楼xarrow(HELLO WORLD)回复于 2004-12-05 14:40:46 得分 0
upTop
12 楼NewBody()回复于 2004-12-05 15:16:49 得分 3
你指的是硬盘标签上的吗?咨询过硬盘厂商吗,在硬盘内部是否存有这样的信息.Top
13 楼FEB15(张郎)回复于 2004-12-05 16:11:05 得分 3
DriveName = Left(Server.MapPath("/"),3)'磁盘当前分区盘符
Set FSO = CreateObject("Scripting.FileSystemObject")
Set A = FSO.GetDrive(FSO.GetDriveName(Fso.GetAbsolutePathName(DriveName)))
DriveInfo = A.SerialNumber'磁盘当前分区卷标Top
14 楼FEB15(张郎)回复于 2004-12-05 16:12:06 得分 3
硬盘出厂序列号,估计单靠ASP获取不了吧?Top
15 楼xarrow(HELLO WORLD)回复于 2004-12-05 19:56:50 得分 0
我知道,能用VB来掉系统API做到,不过因为不是自己的服务器,所以不太好办,看来是没有办法呀Top
16 楼52800195(torney)回复于 2004-12-05 20:15:25 得分 3
难哦~!
其他语言还可以Top
17 楼xarrow(HELLO WORLD)回复于 2004-12-05 20:39:47 得分 0
????其他语言还可以?PHP,JSP Or Others???Top
18 楼xarrow(HELLO WORLD)回复于 2004-12-05 20:40:13 得分 0
KAO,CSDN怎么结不了贴啊Top




