Windows mobile 移动设备MAc地址

Windows mobile 移动设备MAc地址,windows-mobile,windows-ce,windows-mobile-6,Windows Mobile,Windows Ce,Windows Mobile 6,我有一个windows mobile项目。我想获取设备的MAC地址或号码,以确保我的软件安全。我的项目在Windows Ce和Windows Mobile 6中(两个项目)。如何从移动设备获取价值?(我问了同样的问题,但都是关于蓝牙MAC地址的,有些设备没有这个地址)调用API。它返回一个值,该值是设备适配器的所有信息的缓冲区。IP\u适配器\u INFO包含一个名为Address的成员,这是适配器的MAC地址。因为我花了很多时间找到VB.NET的方法来实现这一点,所以我将此发布给可能有用的任何

我有一个windows mobile项目。我想获取设备的MAC地址或号码,以确保我的软件安全。我的项目在Windows Ce和Windows Mobile 6中(两个项目)。如何从移动设备获取价值?(我问了同样的问题,但都是关于蓝牙MAC地址的,有些设备没有这个地址)

调用API。它返回一个值,该值是设备适配器的所有信息的缓冲区。
IP\u适配器\u INFO
包含一个名为
Address
的成员,这是适配器的MAC地址。

因为我花了很多时间找到VB.NET的方法来实现这一点,所以我将此发布给可能有用的任何人

<DllImport("iphlpapi.dll", SetLastError:=True)> _
Public Shared Function GetAdaptersInfo(ByVal info As Byte(), ByRef size As UInteger) As Integer
        End Function

        Public Shared Function GetMacAddress() As String
            Dim num As UInteger = 0UI
            GetAdaptersInfo(Nothing, num)
            Dim array As Byte() = New Byte(CInt(num) - 1) {}
            Dim adaptersInfo As Integer = GetAdaptersInfo(array, num)
            If adaptersInfo = 0 Then
                Dim macAddress As String = ""
                Dim macLength As Integer = BitConverter.ToInt32(array, 400)
                macAddress = BitConverter.ToString(array, 404, macLength)
                macAddress = macAddress.Replace("-", ":")

                Return macAddress
            Else
                Return ""
            End If
_
公共共享函数GetAdapterInfo(ByVal信息为Byte(),ByRef大小为UInteger)为整数
端函数
公共共享函数GetMacAddress()作为字符串
作为UInteger的Dim num=0UI
GetAdapterInfo(无,num)
作为字节()的Dim数组=新字节(CInt(num)-1{}
Dim AdapterInfo作为整数=GetAdapterInfo(数组,num)
如果AdapterInfo=0,则
Dim macAddress As String=“”
Dim macLength作为整数=位转换器.ToInt32(数组,400)
macAddress=BitConverter.ToString(数组,404,macLength)
macAddress=macAddress.Replace(“-”,“:”)
返回地址
其他的
返回“”
如果结束