獲取硬體標識

2021-08-02 08:46:46 字數 1106 閱讀 8604

通過wmi獲取網絡卡mac位址、硬碟序列號、主機板序列號、cpu id、bios序列號

delphi通過wmi獲取系統資訊

uses activex, comobj;

function getwmiproperty(wmitype, wmiproperty: string): string;

varwmi, objs, obj: olevariant;

enum: ienumvariant;

c: cardinal;

begin

wmi:= createoleobject('wbemscripting.swbemlocator');

objs := wmi.connectserver('.','root/cimv2').execquery('select * from win32_' + wmitype);

enum := ienumvariant(iunknown(objs._newenum));

enum.reset;

enum.next(1, obj, c);

obj := obj.properties_.item(wmiproperty, 0).value;

result := obj;

end;

// 獲取硬碟序列號

showmessage(getwmiproperty('diskdrive', 'pnpdeviceid'));

// 獲取biso序列號

showmessage(getwmiproperty('bios', 'serialnumber'));

// 獲取網絡卡mac位址

showmessage(getwmiproperty('networkadapter', 'macaddress'));

// 獲取網絡卡序列號

showmessage(getwmiproperty('networkadapter', 'pnpdeviceid'));

// 獲取cpu序列號

showmessage(getwmiproperty('processor', 'processorid'));

也可以用同樣的方法獲得任意感興趣的系統資訊,比如正在執行的程序、賬戶資訊等等。

更多wmi的資訊參考:

獲取裝置唯一標識

原文據說首發在 人人都是產品經理 ios蘋果系統,可用於識別唯一裝置的標識不多,如下圖。綜合起來,蘋果系統生成裝置id的識別符號順序應該是idfa idfv udid,即先獲取idfa,獲取不到在獲取idfv,獲取不到idfv時,再獲取udid,然後使用相關演算法生成乙個裝置id。蘋果.png 安卓...

c 獲取硬體資訊

using system using system.runtime.interopservices using system.management namespace hardware 取cpu編號 public string getcpuid return strcpuid catch end m...

c 獲取硬體資訊

using system using system.runtime.interopservices using system.management namespace hardware 取cpu編號 public string getcpuid return strcpuid catch end m...