本课视频示范了通过易语言支持库 、VB,CMD,汇编等方法获取CPU的序列号,从而转化为特征字。
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))
优酷土豆链接:511遇见易语言软件本地注册验证-2-取CPU特征字
优酷全部教程播单:http://i.youku.com/i/UNTU3NDYyODg0/playlists
交流群:521068947
本人QQ: 272586593