511遇见易语言软件注册本地验证-2-取CPU序列号特征字

511遇见

VB GetTrait

Function GetTrait(P)
Dim WMI,Obj
    Select Case P
    Case "BIOS"
    Set WMI =GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_BIOS")
    For Each Obj in WMI
    GetTrait = Obj.Name
    Exit For
    Next
    Case "磁盘序列号"
    Set WMI =GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_PhysicalMedia")
    For Each Obj in WMI
    GetTrait = Obj.SerialNumber
    Exit For
    Next
    Case "CPUID"
    Set WMI =GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_Processor")
    For Each Obj in WMI
    GetTrait = Obj.ProcessorId
    Exit For
    Next
    Case "声卡"
    Set WMI =GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_SoundDevice")
    For Each Obj in WMI
    GetTrait = Obj.Caption
    Exit For
    Next
    Case "显卡"
    Set WMI =GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_VideoController")
    For Each Obj in WMI
    GetTrait = Obj.Caption
    Exit For
    Next
    Case "MAC"
    Set WMI =GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_NetworkAdapterConfiguration")
    For Each Obj in WMI
        If Obj.IPEnabled=True Then
           GetTrait = Obj.MacAddress
           Exit For
        End If
    Next
    End Select
End Function

汇编

.版本 2
 
.子程序 CPU_取序列号_汇编, 文本型, 公开, 系统使用汇编方式获取CPUID
.局部变量 s1, 整数型, , , -4
.局部变量 s2, 整数型, , , -8
 
置入代码 ({ 184, 1, 0, 0, 0 })  ' mov eax,01h
置入代码 ({ 49, 201 })  ' xor ecx,ecx
置入代码 ({ 49, 210 })  ' xor edx,edx
置入代码 ({ 15, 162 })  ' cpuid
置入代码 ({ 137, 85, 252 })  ' mov dword [ebp-4],edx
置入代码 ({ 137, 69, 248 })  ' mov dword [ebp-8],eax
返回 (取八位十六进制 (s1) + 取八位十六进制 (s2))


发布日期:

所属分类: 编程



没有相关文章!