asp调用自己写的DLL出错,高手指点,做在那里!

itfly itfly 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
dll内容:

Option Explicit
Private Const NO_ERROR = 0
Private Declare Function inet_addr Lib "wsock32.dll" _
(ByVal s As String) As Long
Private Declare Function SendARP Lib "iphlpapi.dll" _
(ByVal DestIP As Long, _
ByVal SrcIP As Long, _
pMacAddr As Long, _
PhyAddrLen As Long) As Long

Private Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" _
(dst As Any, _
src As Any, _
ByVal bcount As Long)

Public Function GetRemoteMACAddress(ByVal sRemoteIP As String) As String

Dim dwRemoteIP As Long
Dim pMacAddr As Long
Dim bpMacAddr() As Byte
Dim PhyAddrLen As Long
Dim cnt As Long
Dim tmp As String

dwRemoteIP = inet_addr(sRemoteIP)

If dwRemoteIP <> 0 Then

'set PhyAddrLen to 6
PhyAddrLen = 6

'retrieve the remote MAC address
If SendARP(dwRemoteIP, 0&, pMacAddr, PhyAddrLen) = NO_ERROR Then

If pMacAddr <> 0 And PhyAddrLen <> 0 Then

'returned value is a long pointer
'to the mac address, so copy data
'to a byte array
ReDim bpMacAddr(0 To PhyAddrLen - 1)
CopyMemory bpMacAddr(0), pMacAddr, ByVal PhyAddrLen

'loop through array to build string
For cnt = 0 To PhyAddrLen - 1

If bpMacAddr(cnt) = 0 Then
tmp = tmp & "00-"
Else
tmp = tmp & Hex$(bpMacAddr(cnt)) & "-"
End If

Next

'remove the trailing dash
'added above and return True
If Len(tmp) > 0 Then
GetRemoteMACAddress = Left$(tmp, Len(tmp) - 1)
Else
GetRemoteMACAddress = ""
End If

Else
GetRemoteMACAddress = ""
End If

Else
GetRemoteMACAddress = ""
End If 'SendARP

Else
GetRemoteMACAddress = ""
End If 'dwRemoteIP

End Function

asp代码:
<%
set thismac = server.CreateObject( "H_MAC.GetMAC")
response.write "当前网卡IP:" & Request.Servervariables("LOCAL_ADDR")
response.Write " 对应的MAC为:" & thismac.GetRemoteMACAddress(Request.Servervariables("LOCAL_ADDR"))
set S_MAC = nothing
%>
错误代码:
当前网卡IP:192.168.1.6
Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

/iisHelp/common/500-100.asp,行242

Microsoft VBScript 运行时错误 错误 '800a01fb'

出现一个意外错误: 'GetRemoteMACAddress'

/index.asp,行13


...全文
评论 1
收藏 已收藏
分享
返回顶部
itfly
VB基础类 7,788 成员 197,583 内容